1999-08-28 23:23:38 +00:00
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
1998-07-29 05:41:20 +00:00
|
|
|
.Dd December 29, 1997
|
|
|
|
.Dt NATM 4
|
2000-11-17 15:40:57 +00:00
|
|
|
.Os
|
1998-07-29 05:41:20 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm natm
|
2001-04-18 15:54:10 +00:00
|
|
|
.Nd Native Mode ATM protocol layer
|
1998-07-29 05:41:20 +00:00
|
|
|
.Sh DESCRIPTION
|
2001-08-14 10:01:54 +00:00
|
|
|
The
|
|
|
|
.Bx
|
|
|
|
ATM software comes with a
|
2001-07-14 19:41:16 +00:00
|
|
|
.Em native mode ATM protocol layer
|
1998-07-29 05:41:20 +00:00
|
|
|
which provides socket level access to AAL0 and AAL5 virtual circuits.
|
2001-07-14 19:41:16 +00:00
|
|
|
To enable this protocol layer, add
|
1998-07-29 05:41:20 +00:00
|
|
|
.Dl options NATM
|
|
|
|
to your kernel configuration file and re-make the kernel (don't forget
|
2001-07-14 19:41:16 +00:00
|
|
|
to do
|
2001-08-10 17:35:21 +00:00
|
|
|
.Dq make clean ) .
|
1998-07-29 05:41:20 +00:00
|
|
|
.Sh NATM API
|
2001-07-14 19:41:16 +00:00
|
|
|
The NATM layer uses a
|
1998-07-29 05:41:20 +00:00
|
|
|
.Dv struct sockaddr_natm
|
|
|
|
to specify a virtual circuit:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
struct sockaddr_natm {
|
|
|
|
u_int8_t snatm_len; /* length */
|
|
|
|
u_int8_t snatm_family; /* AF_NATM */
|
|
|
|
char snatm_if[IFNAMSIZ]; /* interface name */
|
|
|
|
u_int16_t snatm_vci; /* vci */
|
|
|
|
u_int8_t snatm_vpi; /* vpi */
|
|
|
|
};
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
To create an AAL5 connection to a virtual circuit with VPI 0, VCI 201
|
|
|
|
one would use the following:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
struct sockaddr_natm snatm;
|
|
|
|
int s, r;
|
|
|
|
s = socket(AF_NATM, SOCK_STREAM, PROTO_NATMAAL5);
|
|
|
|
/* note: PROTO_NATMAAL0 is AAL0 */
|
|
|
|
if (s < 0) { perror("socket"); exit(1); }
|
1999-03-29 04:25:09 +00:00
|
|
|
bzero(&snatm, sizeof(snatm));
|
1998-07-29 05:41:20 +00:00
|
|
|
snatm.snatm_len = sizeof(snatm);
|
|
|
|
snatm.snatm_family = AF_NATM;
|
|
|
|
sprintf(snatm.snatm_if, "en0");
|
|
|
|
snatm.snatm_vci = 201;
|
|
|
|
snatm.snatm_vpi = 0;
|
|
|
|
r = connect(s, (struct sockaddr *)&snatm, sizeof(snatm));
|
|
|
|
if (r < 0) { perror("connect"); exit(1); }
|
|
|
|
/* s now connected to ATM! */
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2001-07-14 19:41:16 +00:00
|
|
|
The
|
1998-07-29 05:41:20 +00:00
|
|
|
.Fn socket
|
|
|
|
call simply creates an unconnected NATM socket. The
|
|
|
|
.Fn connect
|
|
|
|
call associates an unconnected NATM socket with a
|
|
|
|
virtual circuit and tells the driver to enable that virtual circuit
|
2001-07-14 19:41:16 +00:00
|
|
|
for receiving data. After the
|
1998-07-29 05:41:20 +00:00
|
|
|
.Fn connect
|
2001-07-14 19:41:16 +00:00
|
|
|
call one can
|
1998-07-29 05:41:20 +00:00
|
|
|
.Fn read
|
2001-07-14 19:41:16 +00:00
|
|
|
or
|
1998-07-29 05:41:20 +00:00
|
|
|
.Fn write
|
|
|
|
to the socket to perform ATM I/O.
|
|
|
|
.Sh Internal NATM operation
|
|
|
|
Internally, the NATM protocol layer keeps a list of all active virtual
|
2001-07-14 19:41:16 +00:00
|
|
|
circuits on the system in
|
|
|
|
.Dv natm_pcbs .
|
1998-07-29 05:41:20 +00:00
|
|
|
This includes circuits currently being used for IP to prevent NATM and
|
|
|
|
IP from clashing over virtual circuit usage.
|
|
|
|
.Pp
|
|
|
|
When a virtual circuit is enabled for receiving data, the NATM
|
|
|
|
protocol layer passes the address of the protocol control block down
|
2001-07-14 19:41:16 +00:00
|
|
|
to the driver as a receive
|
1998-07-29 05:41:20 +00:00
|
|
|
.Dq handle .
|
|
|
|
When inbound data arrives, the driver passes the data back with the
|
|
|
|
appropriate receive handle. The NATM layer uses this to avoid the
|
|
|
|
overhead of a protocol control block lookup. This allows us to take
|
|
|
|
advantage of the fact that ATM has already demultiplexed the data for
|
|
|
|
us.
|
|
|
|
.Sh CAVEAT
|
|
|
|
The NATM protocol support is subject to change as
|
|
|
|
the ATM protocols develop. Users should not depend
|
|
|
|
on details of the current implementation, but rather
|
|
|
|
the services exported.
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr en 4
|
|
|
|
.Sh AUTHORS
|
1999-08-15 10:48:36 +00:00
|
|
|
.An Chuck Cranor
|
|
|
|
of Washington University implemented the NATM protocol layer
|
|
|
|
along with the EN ATM driver in 1996 for
|
|
|
|
.Nx .
|