1.\" $FreeBSD: head/share/man/man4/natm.4 116735 2003-06-23 14:46:12Z harti $
| 1.\" $FreeBSD: head/share/man/man4/natm.4 117011 2003-06-28 23:53:39Z ru $
|
2.\" 3.Dd December 29, 1997 4.Dt NATM 4 5.Os 6.Sh NAME 7.Nm natm 8.Nd Native Mode ATM protocol layer 9.Sh DESCRIPTION 10The 11.Bx 12ATM software comes with a 13.Em native mode ATM protocol layer 14which provides socket level access to AAL0 and AAL5 virtual circuits. 15To enable this protocol layer, add 16.Dl options NATM 17to your kernel configuration file and re-make the kernel (don't forget 18to do 19.Dq make clean ) . 20.Sh NATM API 21The NATM layer uses a
| 2.\" 3.Dd December 29, 1997 4.Dt NATM 4 5.Os 6.Sh NAME 7.Nm natm 8.Nd Native Mode ATM protocol layer 9.Sh DESCRIPTION 10The 11.Bx 12ATM software comes with a 13.Em native mode ATM protocol layer 14which provides socket level access to AAL0 and AAL5 virtual circuits. 15To enable this protocol layer, add 16.Dl options NATM 17to your kernel configuration file and re-make the kernel (don't forget 18to do 19.Dq make clean ) . 20.Sh NATM API 21The NATM layer uses a
|
22.Dv struct sockaddr_natm
| 22.Vt struct sockaddr_natm
|
23to specify a virtual circuit: 24.Bd -literal -offset indent 25struct sockaddr_natm { 26 u_int8_t snatm_len; /* length */ 27 u_int8_t snatm_family; /* AF_NATM */ 28 char snatm_if[IFNAMSIZ]; /* interface name */ 29 u_int16_t snatm_vci; /* vci */ 30 u_int8_t snatm_vpi; /* vpi */ 31}; 32.Ed 33.Pp 34To create an AAL5 connection to a virtual circuit with VPI 0, VCI 201 35one would use the following: 36.Bd -literal -offset indent 37 struct sockaddr_natm snatm; 38 int s, r; 39 s = socket(AF_NATM, SOCK_STREAM, PROTO_NATMAAL5); 40 /* note: PROTO_NATMAAL0 is AAL0 */ 41 if (s < 0) { perror("socket"); exit(1); } 42 bzero(&snatm, sizeof(snatm)); 43 snatm.snatm_len = sizeof(snatm); 44 snatm.snatm_family = AF_NATM; 45 sprintf(snatm.snatm_if, "en0"); 46 snatm.snatm_vci = 201; 47 snatm.snatm_vpi = 0; 48 r = connect(s, (struct sockaddr *)&snatm, sizeof(snatm)); 49 if (r < 0) { perror("connect"); exit(1); } 50 /* s now connected to ATM! */ 51.Ed 52.Pp 53The 54.Fn socket
| 23to specify a virtual circuit: 24.Bd -literal -offset indent 25struct sockaddr_natm { 26 u_int8_t snatm_len; /* length */ 27 u_int8_t snatm_family; /* AF_NATM */ 28 char snatm_if[IFNAMSIZ]; /* interface name */ 29 u_int16_t snatm_vci; /* vci */ 30 u_int8_t snatm_vpi; /* vpi */ 31}; 32.Ed 33.Pp 34To create an AAL5 connection to a virtual circuit with VPI 0, VCI 201 35one would use the following: 36.Bd -literal -offset indent 37 struct sockaddr_natm snatm; 38 int s, r; 39 s = socket(AF_NATM, SOCK_STREAM, PROTO_NATMAAL5); 40 /* note: PROTO_NATMAAL0 is AAL0 */ 41 if (s < 0) { perror("socket"); exit(1); } 42 bzero(&snatm, sizeof(snatm)); 43 snatm.snatm_len = sizeof(snatm); 44 snatm.snatm_family = AF_NATM; 45 sprintf(snatm.snatm_if, "en0"); 46 snatm.snatm_vci = 201; 47 snatm.snatm_vpi = 0; 48 r = connect(s, (struct sockaddr *)&snatm, sizeof(snatm)); 49 if (r < 0) { perror("connect"); exit(1); } 50 /* s now connected to ATM! */ 51.Ed 52.Pp 53The 54.Fn socket
|
55call simply creates an unconnected NATM socket. The
| 55call simply creates an unconnected NATM socket. 56The
|
56.Fn connect 57call associates an unconnected NATM socket with a 58virtual circuit and tells the driver to enable that virtual circuit
| 57.Fn connect 58call associates an unconnected NATM socket with a 59virtual circuit and tells the driver to enable that virtual circuit
|
59for receiving data. After the
| 60for receiving data. 61After the
|
60.Fn connect 61call one can 62.Fn read 63or 64.Fn write 65to the socket to perform ATM I/O. 66.Sh Internal NATM operation 67Internally, the NATM protocol layer keeps a list of all active virtual 68circuits on the system in 69.Dv natm_pcbs . 70This includes circuits currently being used for IP to prevent NATM and 71IP from clashing over virtual circuit usage. 72.Pp 73When a virtual circuit is enabled for receiving data, the NATM 74protocol layer passes the address of the protocol control block down 75to the driver as a receive 76.Dq handle . 77When inbound data arrives, the driver passes the data back with the
| 62.Fn connect 63call one can 64.Fn read 65or 66.Fn write 67to the socket to perform ATM I/O. 68.Sh Internal NATM operation 69Internally, the NATM protocol layer keeps a list of all active virtual 70circuits on the system in 71.Dv natm_pcbs . 72This includes circuits currently being used for IP to prevent NATM and 73IP from clashing over virtual circuit usage. 74.Pp 75When a virtual circuit is enabled for receiving data, the NATM 76protocol layer passes the address of the protocol control block down 77to the driver as a receive 78.Dq handle . 79When inbound data arrives, the driver passes the data back with the
|
78appropriate receive handle. The NATM layer uses this to avoid the 79overhead of a protocol control block lookup. This allows us to take
| 80appropriate receive handle. 81The NATM layer uses this to avoid the 82overhead of a protocol control block lookup. 83This allows us to take
|
80advantage of the fact that ATM has already demultiplexed the data for 81us. 82.Sh CAVEAT 83The NATM protocol support is subject to change as
| 84advantage of the fact that ATM has already demultiplexed the data for 85us. 86.Sh CAVEAT 87The NATM protocol support is subject to change as
|
84the ATM protocols develop. Users should not depend 85on details of the current implementation, but rather
| 88the ATM protocols develop. 89Users should not depend on details of the current implementation, but rather
|
86the services exported. 87.Sh SEE ALSO 88.Xr en 4 ,
| 90the services exported. 91.Sh SEE ALSO 92.Xr en 4 ,
|
89.Xr hatm 4 ,
| |
90.Xr fatm 4 ,
| 93.Xr fatm 4 ,
|
| 94.Xr hatm 4 ,
|
91.Xr natmip 4 92.Sh AUTHORS 93.An Chuck Cranor 94of Washington University implemented the NATM protocol layer 95along with the EN ATM driver in 1996 for 96.Nx .
| 95.Xr natmip 4 96.Sh AUTHORS 97.An Chuck Cranor 98of Washington University implemented the NATM protocol layer 99along with the EN ATM driver in 1996 for 100.Nx .
|