4.2BSD/usr/man/man4/pup.4p

.TH PUP 4P "7 July 1983"
.UC 4
.SH NAME
pup \- raw PUP socket interface
.SH SYNOPSIS
.B #include <sys/socket.h>
.br
.B #include <netpup/pup.h>
.PP
.B socket(AF_PUP, SOCK_RAW, PUPPROTO_BSP);
.SH DESCRIPTION
A raw pup socket provides PUP-I access to an
Ethernet network.  Users send packets using the 
.I sendto 
call, and receive packets with the
.IR recvfrom 
call.  All outgoing packets must have space present at
the front of the packet to allow the PUP header to be
filled in.  The header format is described in 
.IR pup (4F).
Likewise, packets received
by the user will have the PUP header on the front.  The
PUP header and legal values for the various fields
are defined in the include file
.RI < netpup/pup.h >.
.PP
The raw pup interface automatically installs the length
and source and destination addresses in the PUP header of all
outgoing packets; these need not be filled in by the user.
The only control bit that may be set in the 
.I tcontrol
field of outgoing packets is the \*(lqtrace\*(rq bit.
A checksum is calculated unless the sender sets the checksum
field to PUP_NOCKSUM.
.SH DIAGNOSTICS
A socket operation may fail and one of the following will be returned:
.TP 15
[EISCONN]
when trying to establish a connection on a socket which
already has one, or when trying to send a datagram with the destination
address specified and the socket is already connected;
.TP 15
[ENOTCONN]
when trying to send a datagram, but
no destination address is specified, and the socket hasn't been
connected;
.TP 15
[ENOBUFS]
when the system runs out of memory for
an internal data structure;
.TP 15
[EADDRNOTAVAIL]
when an attempt is made to create a 
socket with a network address for which no network interface
exists.
.PP
A 
.I sendto
operation may fail if one of the following is true:
.TP 15
[EINVAL]
Insufficient space was left by the user for the PUP header.
.TP 15
[EINVAL]
The
.I pup_type
field was 0 or the 
.I pup_tcontrol
field had a bit other than PUP_TRACE set.
.TP 15
[EMSGSIZE]
The message was not an even number of bytes, smaller than
MINPUPSIZ, or large than MAXPUPSIZ.
.TP 15
[ENETUNREACH]
The destination address was on a network which was not
directly reachable (the raw interface provides no routing support).
.SH SEE ALSO
send(2), recv(2), intro(4N), pup(4F)
.SH BUGS
The interface is untested against other PUP implementations.