#ifdef AFS_HPUX110_ENV
#include "../h/tihdr.h"
#include <xti.h>
-#include "../afs/hpux_110.h"
#endif
#include "../afsint/afsint.h"
-afs_int32 rxi_Findcbi();
-extern struct interfaceAddr afs_cb_interface;
+#ifdef AFS_DARWIN60_ENV
+struct ifnet *rxi_FindIfnet(afs_uint32 addr, struct ifaddr **pifad);
+#else
+struct ifnet *rxi_FindIfnet(afs_uint32 addr, struct in_ifaddr **pifad);
+#endif
#ifndef RXK_LISTENER_ENV
-int (*rxk_GetPacketProc)(); /* set to packet allocation procedure */
-int (*rxk_PacketArrivalProc)();
+int (*rxk_PacketArrivalProc)(register struct rx_packet *ahandle,
+ register struct sockaddr_in *afrom, char *arock,
+ afs_int32 asize); /* set to packet allocation procedure */
+int (*rxk_GetPacketProc)(char **ahandle, int asize);
#endif
+extern struct interfaceAddr afs_cb_interface;
+
rxk_ports_t rxk_ports;
rxk_portRocks_t rxk_portRocks;
}
/* remove as port from the monitored list, port # is in network order */
-rxk_DelPort(aport)
-u_short aport; {
+int rxk_DelPort(u_short aport)
+{
register int i;
register unsigned short *tsp;
#if ! defined(AFS_SUN5_ENV) && ! defined(UKERNEL) && ! defined(RXK_LISTENER_ENV)
soclose((struct socket *)rxk_portRocks[i]);
#endif
- rxk_portRocks[i] = (char *)0;
+ rxk_portRocks[i] = NULL;
}
}
}
-osi_socket rxi_GetUDPSocket(port)
- u_short port;
+osi_socket rxi_GetUDPSocket(u_short port)
{
struct osi_socket *sockp;
sockp = (struct osi_socket *) rxk_NewSocket(port);
* defined only on success.
*/
-int
-osi_utoa(char *buf, size_t len, unsigned long val)
+int osi_utoa(char *buf, size_t len, unsigned long val)
{
long k; /* index of first byte of string value */
* argument to the native panic(), we construct a single string and hand
* that to osi_Panic().
*/
-void
-osi_AssertFailK(const char *expr, const char *file, int line)
+void osi_AssertFailK(const char *expr, const char *file, int line)
{
static const char msg0[] = "assertion failed: ";
static const char msg1[] = ", file: ";
#ifndef UKERNEL
/* This is the server process request loop. Kernel server
* processes never become listener threads */
-void rx_ServerProc()
+void rx_ServerProc(void)
{
int threadID;
#endif /* !UKERNEL */
#ifndef RXK_LISTENER_ENV
-static int MyPacketProc(ahandle, asize)
-int asize; /* this includes the Rx header */
-char **ahandle;
+/* asize includes the Rx header */
+static int MyPacketProc(char **ahandle, int asize)
{
register struct rx_packet *tp;
return 0;
}
-static int MyArrivalProc(ahandle, afrom, arock, asize)
-register struct rx_packet *ahandle;
-register struct sockaddr_in *afrom;
-char *arock;
-afs_int32 asize; {
+static int MyArrivalProc(register struct rx_packet *ahandle,
+ register struct sockaddr_in *afrom, char *arock,
+ afs_int32 asize)
+{
/* handle basic rx packet */
ahandle->length = asize - RX_HEADER_SIZE;
rxi_DecodePacketHeader(ahandle);
}
#endif /* !RXK_LISTENER_ENV */
-void
-rxi_StartListener() {
+void rxi_StartListener(void)
+{
/* if kernel, give name of appropriate procedures */
#ifndef RXK_LISTENER_ENV
rxk_GetPacketProc = MyPacketProc;
/* Called from rxi_FindPeer, when initializing a clear rx_peer structure,
to get interesting information. */
-void rxi_InitPeerParams(pp)
-register struct rx_peer *pp;
+void rxi_InitPeerParams(register struct rx_peer *pp)
{
#ifdef ADAPT_MTU
u_short rxmtu;
pp->ifMTU = RX_REMOTE_PACKET_SIZE;
}
#else /* AFS_USERSPACE_IP_ADDR */
+#ifdef AFS_DARWIN60_ENV
+ struct ifaddr *ifad = (struct ifaddr *) 0;
+#else
struct in_ifaddr *ifad = (struct in_ifaddr *) 0;
+#endif
struct ifnet *ifn;
/* At some time we need to iterate through rxi_FindIfnet() to find the
#define ADDRSPERSITE 16
static afs_uint32 myNetAddrs[ADDRSPERSITE];
static int myNetMTUs[ADDRSPERSITE];
-static int myNetFlags[ADDRSPERSITE];
static int numMyNetAddrs = 0;
#ifdef AFS_USERSPACE_IP_ADDR
-int rxi_GetcbiInfo()
+int rxi_GetcbiInfo(void)
{
int i, j, different = 0;
int rxmtu, maxmtu;
/* Returns the afs_cb_interface inxex which best matches address.
* If none is found, we return -1.
*/
-afs_int32 rxi_Findcbi(addr)
- afs_uint32 addr;
+afs_int32 rxi_Findcbi(afs_uint32 addr)
{
int j;
afs_uint32 myAddr, thisAddr, netMask, subnetMask;
}
}
- done:
return(rvalue);
}
#define IFADDR2SA(f) ((f)->ifa_addr)
#endif
-int rxi_GetIFInfo()
+int rxi_GetIFInfo(void)
{
int i = 0;
int different = 0;
}
return different;
}
-
+#ifdef AFS_DARWIN60_ENV
/* Returns ifnet which best matches address */
struct ifnet *
rxi_FindIfnet(addr, pifad)
afs_uint32 addr;
- struct in_ifaddr **pifad;
+ struct ifaddr **pifad;
+{
+ struct sockaddr_in s;
+
+ if (numMyNetAddrs == 0)
+ (void) rxi_GetIFInfo();
+
+ s.sin_family=AF_INET;
+ s.sin_addr.s_addr=addr;
+ *pifad=ifa_ifwithnet((struct sockaddr *)&s);
+ done:
+ return (*pifad ? (*pifad)->ifa_ifp : NULL );
+}
+#else
+/* Returns ifnet which best matches address */
+struct ifnet *rxi_FindIfnet(afs_uint32 addr, struct in_ifaddr **pifad)
{
afs_uint32 ppaddr;
int match_value = 0;
done:
return (*pifad ? (*pifad)->ia_ifp : NULL );
}
+#endif
#endif /* else AFS_USERSPACE_IP_ADDR */
#endif /* !SUN5 && !SGI62 */
myaddr.sin_family = AF_INET;
myaddr.sin_port = aport;
myaddr.sin_addr.s_addr = 0;
+#ifdef STRUCT_SOCKADDR_HAS_SA_LEN
+ myaddr.sin_len = sizeof(myaddr);
+#endif
#ifdef AFS_HPUX110_ENV
bindnam = allocb_wait((addrsize+SO_MSGOFFSET+1), BPRI_MED);
osi_Panic("osi_NewSocket: last attempt to reserve 32K failed!\n");
}
#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
- myaddr.sin_len = sizeof(myaddr);
#if defined(AFS_XBSD_ENV)
code = sobind(newSocket, (struct sockaddr *)&myaddr, curproc);
#else
/* free socket allocated by rxk_NewSocket */
-int rxk_FreeSocket(asocket)
- register struct socket *asocket;
+int rxk_FreeSocket(register struct socket *asocket)
{
AFS_STATCNT(osi_FreeSocket);
#if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL)
/*
* Run RX event daemon every second (5 times faster than rest of systems)
*/
-afs_rxevent_daemon()
+void afs_rxevent_daemon(void)
{
- int s, code;
struct clock temp;
SPLVAR;
#ifdef RX_ENABLE_LOCKS
AFS_GLOCK();
#endif /* RX_ENABLE_LOCKS */
- afs_osi_Wait(500, (char *)0, 0);
+ afs_osi_Wait(500, NULL, 0);
if (afs_termState == AFSOP_STOP_RXEVENT )
{
#ifdef RXK_LISTENER_ENV
#ifdef AFS_SUN5_ENV
/*
- * Run the listener as a kernel process.
+ * Run the listener as a kernel thread.
*/
void rxk_Listener(void)
{
extern id_t syscid;
void rxk_ListenerProc(void);
- if (newproc(rxk_ListenerProc, syscid, 59))
- osi_Panic("rxk_Listener: failed to fork listener process!\n");
+ if (thread_create(NULL, DEFAULTSTKSZ, rxk_ListenerProc,
+ 0, 0, &p0, TS_RUN, minclsyspri) == NULL)
+ osi_Panic("rxk_Listener: failed to start listener thread!\n");
}
void rxk_ListenerProc(void)
rxk_ListenerPid = current->pid;
#endif
#ifdef AFS_SUN5_ENV
- rxk_ListenerPid = curproc->p_pid;
+ rxk_ListenerPid = 1; /* No PID, just a flag that we're alive */
#endif /* AFS_SUN5_ENV */
-#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+#ifdef AFS_FBSD_ENV
+ rxk_ListenerPid = curproc->p_pid;
+#endif /* AFS_FBSD_ENV */
+#if defined(AFS_DARWIN_ENV)
rxk_ListenerPid = current_proc()->p_pid;
#endif
#if defined(RX_ENABLE_LOCKS) && !defined(AFS_SUN5_ENV)
}
if (!(code = rxk_ReadPacket(rx_socket, rxp, &host, &port))) {
AFS_RXGLOCK();
- rxp = rxi_ReceivePacket(rxp, rx_socket, host, port);
+ rxp = rxi_ReceivePacket(rxp, rx_socket, host, port, 0, 0);
AFS_RXGUNLOCK();
}
}