diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1996-03-04 10:37:32 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1996-03-04 10:37:32 +0000 |
commit | 19b3595c2000294ed57cd7cb23e1d91ee553215d (patch) | |
tree | 404b337fc172b005d07d5f30eeeb873a270a9eac /sys/netiso/idrp_usrreq.c | |
parent | d4b3fca05966647ecd8191d973cdce74570844ca (diff) |
Initial commit of NetBSD 960217 netiso.
all the rest is the fixes to the import by Niklas.
Diffstat (limited to 'sys/netiso/idrp_usrreq.c')
-rw-r--r-- | sys/netiso/idrp_usrreq.c | 96 |
1 files changed, 62 insertions, 34 deletions
diff --git a/sys/netiso/idrp_usrreq.c b/sys/netiso/idrp_usrreq.c index 2dfe2bd99f3..c050d256de2 100644 --- a/sys/netiso/idrp_usrreq.c +++ b/sys/netiso/idrp_usrreq.c @@ -1,4 +1,5 @@ -/* $NetBSD: idrp_usrreq.c,v 1.4 1995/08/12 23:59:47 mycroft Exp $ */ +/* $OpenBSD: idrp_usrreq.c,v 1.2 1996/03/04 10:35:20 mickey Exp $ */ +/* $NetBSD: idrp_usrreq.c,v 1.5 1996/02/13 22:09:33 christos Exp $ */ /* * Copyright (c) 1992, 1993 @@ -54,11 +55,13 @@ #include <netiso/clnl.h> #include <netiso/iso_pcb.h> #include <netiso/iso_var.h> +#include <netiso/idrp_var.h> -void idrp_input(); -struct isopcb idrp_isop; -static struct sockaddr_iso idrp_addrs[2] = -{ { sizeof(idrp_addrs), AF_ISO, }, { sizeof(idrp_addrs[1]), AF_ISO, } }; +#include <machine/stdarg.h> + +struct isopcb idrp_isop; +static struct sockaddr_iso idrp_addrs[2] = +{{sizeof(idrp_addrs), AF_ISO,}, {sizeof(idrp_addrs[1]), AF_ISO,}}; /* * IDRP initialization @@ -82,58 +85,84 @@ idrp_init() * FUNCTION and ARGUMENTS: * Take a packet (m) from clnp, strip off the clnp header * and mke suitable for the idrp socket. - * No return value. + * No return value. */ void -idrp_input(m, src, dst) - register struct mbuf *m; - struct sockaddr_iso *src, *dst; +#if __STDC__ +idrp_input(struct mbuf *m, ...) +#else +idrp_input(m, va_alist) + struct mbuf *m; + va_dcl +#endif { + struct sockaddr_iso *src, *dst; + va_list ap; + + va_start(ap, m); + src = va_arg(ap, struct sockaddr_iso *); + dst = va_arg(ap, struct sockaddr_iso *); + va_end(ap); + if (idrp_isop.isop_socket == 0) { - bad: m_freem(m); +bad: m_freem(m); return; } bzero(idrp_addrs[0].siso_data, sizeof(idrp_addrs[0].siso_data)); - bcopy((caddr_t)&(src->siso_addr), (caddr_t)&idrp_addrs[0].siso_addr, - 1 + src->siso_nlen); + bcopy((caddr_t) & (src->siso_addr), (caddr_t) & idrp_addrs[0].siso_addr, + 1 + src->siso_nlen); bzero(idrp_addrs[1].siso_data, sizeof(idrp_addrs[1].siso_data)); - bcopy((caddr_t)&(dst->siso_addr), (caddr_t)&idrp_addrs[1].siso_addr, - 1 + dst->siso_nlen); + bcopy((caddr_t) & (dst->siso_addr), (caddr_t) & idrp_addrs[1].siso_addr, + 1 + dst->siso_nlen); if (sbappendaddr(&idrp_isop.isop_socket->so_rcv, - sisotosa(idrp_addrs), m, (struct mbuf *)0) == 0) + sisotosa(idrp_addrs), m, (struct mbuf *) 0) == 0) goto bad; sorwakeup(idrp_isop.isop_socket); } -idrp_output(m, addr) - struct mbuf *m, *addr; +int +#if __STDC__ +idrp_output(struct mbuf *m, ...) +#else +idrp_output(m, va_alist) + struct mbuf *m; + va_dcl +#endif { - register struct sockaddr_iso *siso = mtod(addr, struct sockaddr_iso *); - int s = splsoftnet(), i; - - bcopy((caddr_t)&(siso->siso_addr), - (caddr_t)&idrp_isop.isop_sfaddr.siso_addr, 1 + siso->siso_nlen); + struct mbuf *addr; + register struct sockaddr_iso *siso; + int s = splsoftnet(), i; + va_list ap; + va_start(ap, m); + addr = va_arg(ap, struct mbuf *); + va_end(ap); + siso = mtod(addr, struct sockaddr_iso *); + + bcopy((caddr_t) & (siso->siso_addr), + (caddr_t) & idrp_isop.isop_sfaddr.siso_addr, 1 + siso->siso_nlen); siso++; - bcopy((caddr_t)&(siso->siso_addr), - (caddr_t)&idrp_isop.isop_sladdr.siso_addr, 1 + siso->siso_nlen); + bcopy((caddr_t) & (siso->siso_addr), + (caddr_t) & idrp_isop.isop_sladdr.siso_addr, 1 + siso->siso_nlen); i = clnp_output(m, idrp_isop, m->m_pkthdr.len, 0); splx(s); return (i); } -u_long idrp_sendspace = 3072; /* really max datagram size */ -u_long idrp_recvspace = 40 * 1024; /* 40 1K datagrams */ +u_long idrp_sendspace = 3072; /* really max datagram size */ +u_long idrp_recvspace = 40 * 1024; /* 40 1K datagrams */ -/*ARGSUSED*/ +/* ARGSUSED */ +int idrp_usrreq(so, req, m, addr, control) - struct socket *so; - int req; - struct mbuf *m, *addr, *control; + struct socket *so; + int req; + struct mbuf *m, *addr, *control; { - int error = 0; + int error = 0; - /* Note: need to block idrp_input while changing - * the udp pcb queue and/or pcb addresses. + /* + * Note: need to block idrp_input while changing the udp pcb queue + * and/or pcb addresses. */ switch (req) { @@ -170,7 +199,6 @@ idrp_usrreq(so, req, m, addr, control) return (EOPNOTSUPP); /* do not free mbuf's */ } -release: if (control) { printf("idrp control data unexpectedly retained\n"); m_freem(control); |