P2P(4) BSD Programmer's Manual P2P(4)NAMEp2p - point-to-point synchronous serial interface encapsulation
SYNOPSISSYNOPSIS
#include <sys/types.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <net/if_p2p.h>
DESCRIPTION
The point-to-point subsystem provides the basis for support of several
different serial line encapsulation protocols for synchronous serial in-
terfaces.
Synchronous serial interfaces may be configured to support one of several
different encapsulation protocols. The desired protocol may be selected
by specifying the linktype parameter to ifconfig(8). To include the code
to support these protocols, specific options are required in the kernel
configuration file. These options are described in the man pages for
each protocol.
The supported encapsulation protocols include:
Cisco HDLC (linktype chdlc)
The Cisco HDLC serial line encapsulation protocol provides a method
for connecting two systems via a point-to-point connection. This
implementation is compatible with Cisco routers and supports the
IPv4 and IPv6 transport protocols. See cisco_hdlc(4) for more in-
formation.
Frame Relay (linktype fr)
The Frame Relay serial line encapsulation provides a method for con-
necting a system to a Frame Relay ``cloud''. This implementation on-
ly supports the IPv4 transport protocol. See fr(4) for more infor-
mation.
None (linktype none)
When an interface is configured with a linktype of ``none'' it is
available to programs for reading and writing of raw link level
packets. This can be used to facilitate the prototyping of new
point-to-point encapsulation protocols.
Point-to-Point Protocol (linktype ppp)
The PPP serial line encapsulation protocol provides a standardized
method for connecting two systems via a point-to-point connection.
The PPP protocol is implemented by a wide range of routers and sys-
tems. This implementation currently only supports the IPv4 trans-
port protocol. See ppp(4) and ppp(8) for more information.
The currently supported serial interface hardware includes:
ntwo
SDL Communications RISCom/N2 dual high-speed synchronous interface.
This interface is available in versions for both the ISA and PCI
buses. Versions are available with various combinations of V.35 in-
terfaces and integral T1 or 56K CSUs. See ntwo(4) for more informa-
tion.
rh SDL Communications RISCom/H2 dual high-speed synchronous interface.
See rh(4) for more information.
rn SDL Communications RISCcom/N1 high-speed synchronous interface. See
rn(4) for more information.
Several physical serial interfaces may be linked into a single logical
interface via a Parallel Interface facility to increase bandwidth. See
pif(4) for more information.
PROGRAMING INTERFACE
To manipulate a synchronous serial interface it is necessary to open a
raw link-level socket (see socket(2)). The domain must be set to
AF_LINK, and the type must be set to SOCK_RAW.
Changing the link-type
The link-type of a synchronous serial interface may be changed with the
SIOCSIFADDR ioctl(2). When creating the raw socket for this operation,
the protocol argument to socket(2) must be zero.
This ioctl takes an argument of type struct ifreq. The ifr_name field of
this structure specifies the interface to be changed. The ifr_addr field
should contain a struct sockaddr_dl (as defined in < net/sockaddr_dl.h>)
with the sdl_family field set to AF_LINK and the desired link type in the
sdl_type field. Link types are defined in <net/if_dl.h>.
All protocol addresses must be removed from the interface before changing
link types.
Modem control
Two socket options (see setsockopt(2)) may be used to manage modem con-
trol signals. Both of these operations require the protocol argument to
socket(2) to specify the interface index of the desired interface (see
if_nametoindex(3)).
The P2P_DTR socket option is used to set or clear the DTR signal on a
given interface. The optval argument of setsockopt should point to an
integer and the optlen argument should specify the length of an integer.
A value of zero will cause the synchronous serial interface to drop the
DTR signal, a non-zero value will cause the synchronous serial interface
to raise the DTR signal.
The P2P_DCD socket option is used to query the DCD signal on a given in-
terface. The optval argument of getsockopt should point to a data area
large enough and properly aligned for an integer data type. If the DCD
signal is on, the returned value will be non-zero, if the DCD signal is
off, the returned value will be zero.
STATE TRANSITIONS
When the state of an interface transitions from UP to DOWN the shutdown
routine for the currently selected protocol is invoked.
When link-type for an interface is changed, the detach routine for the
existing protocol is invoked, then the attach routine for the new proto-
col is invoked. If the attach of the new protocol fails, the attach rou-
tine for the previous protocol is invoked to restore the prior state of
the interface.
SEE ALSOcisco_hdlc(4), fr(4), inet(4), inet6(4), netintro(4), ntwo(4),
pif(4), rh(4), rn(4), ppp(4), ifconfig(8), ppp(8).
BSD/OS September 8, 1998 2