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"
14 #include "../rx/rx_kcommon.h"
17 osi_NetReceive(osi_socket asocket
, struct sockaddr_in
*addr
,
18 struct iovec
*dvec
, int nvecs
, int *alength
)
22 struct iovec iov
[RX_MAXIOVECS
];
23 struct mbuf
*nam
= NULL
;
25 int haveGlock
= ISAFS_GLOCK();
27 memset(&u
, 0, sizeof(u
));
28 memset(&iov
, 0, sizeof(iov
));
30 if (nvecs
> RX_MAXIOVECS
)
31 osi_Panic("osi_NetReceive: %d: too many iovecs\n", nvecs
);
33 for (i
= 0; i
< nvecs
; i
++)
39 u
.uio_resid
= *alength
;
40 u
.uio_segflg
= UIO_SYSSPACE
;
46 code
= soreceive(asocket
, (addr
? &nam
: NULL
), &u
, NULL
, NULL
, NULL
47 #if defined(AFS_OBSD45_ENV)
56 printf("rx code %d termState %d\n", code
, afs_termState
);
58 while (afs_termState
== AFSOP_STOP_RXEVENT
)
59 afs_osi_Sleep(&afs_termState
);
63 *alength
-= u
.uio_resid
;
65 memcpy(addr
, mtod(nam
, caddr_t
), nam
->m_len
);
72 extern int rxk_ListenerPid
;
74 osi_StopListener(void)
79 p
= pfind(rxk_ListenerPid
);
85 * rx_NetSend - send asize bytes at adata from asocket to host at addr.
89 osi_NetSend(osi_socket asocket
, struct sockaddr_in
*addr
, struct iovec
*dvec
,
90 int nvecs
, afs_int32 alength
, int istack
)
93 struct iovec iov
[RX_MAXIOVECS
];
96 int haveGlock
= ISAFS_GLOCK();
98 memset(&u
, 0, sizeof(u
));
99 memset(&iov
, 0, sizeof(iov
));
101 AFS_STATCNT(osi_NetSend
);
102 if (nvecs
> RX_MAXIOVECS
)
103 osi_Panic("osi_NetSend: %d: Too many iovecs.\n", nvecs
);
105 for (i
= 0; i
< nvecs
; i
++)
109 u
.uio_iovcnt
= nvecs
;
111 u
.uio_resid
= alength
;
112 u
.uio_segflg
= UIO_SYSSPACE
;
113 u
.uio_rw
= UIO_WRITE
;
116 nam
= m_get(M_DONTWAIT
, MT_SONAME
);
119 nam
->m_len
= addr
->sin_len
= sizeof(struct sockaddr_in
);
120 memcpy(mtod(nam
, caddr_t
), addr
, addr
->sin_len
);
124 code
= sosend(asocket
, nam
, &u
, NULL
, NULL
, 0);