/* raw_pup.c 4.7 82/03/10 */
#include "../h/protosw.h"
#include "../h/socketvar.h"
#include "../net/in_systm.h"
#include "../net/raw_cb.h"
* Raw PUP protocol interface.
* Encapsulate packet in PUP header which is supplied by the
* user. This is done to allow user to specify PUP identifier.
register struct rawcb
*rp
= sotorawcb(so
);
register struct pup_header
*pup
;
struct sockaddr_pup
*spup
;
* Verify user has supplied necessary space
* for the header and check parameters in it.
if ((m
->m_off
> MMAXOFF
|| m
->m_len
< sizeof(struct pup_header
)) &&
(m
= m_pullup(m
, sizeof(struct pup_header
))) == 0)
pup
= mtod(m
, struct pup_header
*);
if (pup
->pup_tcontrol
&& (pup
->pup_tcontrol
& ~PUP_TRACE
))
for (len
= 0, n
= m
; n
; n
= n
->m_next
)
spup
= (struct sockaddr_pup
*)&rp
->rcb_addr
;
pup
->pup_dport
= spup
->spup_addr
;
* Insure proper source address is included.
spup
= (struct sockaddr_pup
*)&(rp
->rcb_socket
->so_addr
);
pup
->pup_sport
= spup
->spup_addr
;
/* for now, assume user generates PUP checksum. */
ifp
= if_ifonnetof(&rp
->rcb_addr
);
ifp
= if_gatewayfor(&rp
->rcb_addr
);
return (enoutput((struct ifnet
*)rp
->rcb_pcb
, m
, PF_PUP
));