2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afsconfig.h>
11 #include "../afs/param.h"
15 #include "../rx/rx_kcommon.h"
17 int osi_NetReceive(osi_socket asocket, struct sockaddr_in *addr, struct iovec *dvec,
18 int nvecs, int *alength)
22 struct iovec iov[RX_MAXIOVECS];
23 struct mbuf *nam = NULL;
25 int haveGlock = ISAFS_GLOCK();
27 if (nvecs > RX_MAXIOVECS)
28 osi_Panic("osi_NetReceive: %d: too many iovecs\n", nvecs);
30 for (i = 0 ; i < nvecs ; i++)
36 u.uio_resid = *alength;
37 u.uio_segflg = UIO_SYSSPACE;
43 code = soreceive(asocket, (addr ? &nam : NULL), &u, NULL, NULL, NULL);
49 printf("rx code %d termState %d\n", code, afs_termState);
51 while (afs_termState == AFSOP_STOP_RXEVENT)
52 afs_osi_Sleep(&afs_termState);
56 *alength -= u.uio_resid;
58 memcpy(addr, mtod(nam, caddr_t), nam->m_len);
65 extern int rxk_ListenerPid;
66 void osi_StopListener(void)
71 p = pfind(rxk_ListenerPid);
77 * rx_NetSend - send asize bytes at adata from asocket to host at addr.
80 int osi_NetSend(osi_socket asocket, struct sockaddr_in *addr,
81 struct iovec *dvec, int nvecs, afs_int32 alength, int istack)
84 struct iovec iov[RX_MAXIOVECS];
87 int haveGlock = ISAFS_GLOCK();
89 AFS_STATCNT(osi_NetSend);
90 if (nvecs > RX_MAXIOVECS)
91 osi_Panic("osi_NetSend: %d: Too many iovecs.\n", nvecs);
93 for (i = 0; i < nvecs; i++)
99 u.uio_resid = alength;
100 u.uio_segflg = UIO_SYSSPACE;
101 u.uio_rw = UIO_WRITE;
104 nam = m_get(M_DONTWAIT, MT_SONAME);
107 nam->m_len = addr->sin_len = sizeof(struct sockaddr_in);
108 memcpy(mtod(nam, caddr_t), addr, addr->sin_len);
112 code = sosend(asocket, nam, &u, NULL, NULL, 0);