1 .\" $FreeBSD: src/share/man/man4/natm.4,v 1.4.2.3 2001/08/17 13:08:38 ru Exp $
2 .\" $DragonFly: src/share/man/man4/natm.4,v 1.3 2006/04/02 08:42:30 swildner Exp $
9 .Nd Native Mode ATM protocol layer
15 ATM software comes with a
16 .Em native mode ATM protocol layer
17 which provides socket level access to AAL0 and AAL5 virtual circuits.
20 .Dv struct sockaddr_natm
21 to specify a virtual circuit:
22 .Bd -literal -offset indent
23 struct sockaddr_natm {
24 u_int8_t snatm_len; /* length */
25 u_int8_t snatm_family; /* AF_NATM */
26 char snatm_if[IFNAMSIZ]; /* interface name */
27 u_int16_t snatm_vci; /* vci */
28 u_int8_t snatm_vpi; /* vpi */
32 To create an AAL5 connection to a virtual circuit with VPI 0, VCI 201
33 one would use the following:
34 .Bd -literal -offset indent
35 struct sockaddr_natm snatm;
37 s = socket(AF_NATM, SOCK_STREAM, PROTO_NATMAAL5);
38 /* note: PROTO_NATMAAL0 is AAL0 */
39 if (s < 0) { perror("socket"); exit(1); }
40 bzero(&snatm, sizeof(snatm));
41 snatm.snatm_len = sizeof(snatm);
42 snatm.snatm_family = AF_NATM;
43 sprintf(snatm.snatm_if, "en0");
44 snatm.snatm_vci = 201;
46 r = connect(s, (struct sockaddr *)&snatm, sizeof(snatm));
47 if (r < 0) { perror("connect"); exit(1); }
48 /* s now connected to ATM! */
53 call simply creates an unconnected NATM socket. The
55 call associates an unconnected NATM socket with a
56 virtual circuit and tells the driver to enable that virtual circuit
57 for receiving data. After the
63 to the socket to perform ATM I/O.
64 .Sh Internal NATM operation
65 Internally, the NATM protocol layer keeps a list of all active virtual
66 circuits on the system in
68 This includes circuits currently being used for IP to prevent NATM and
69 IP from clashing over virtual circuit usage.
71 When a virtual circuit is enabled for receiving data, the NATM
72 protocol layer passes the address of the protocol control block down
73 to the driver as a receive
75 When inbound data arrives, the driver passes the data back with the
76 appropriate receive handle. The NATM layer uses this to avoid the
77 overhead of a protocol control block lookup. This allows us to take
78 advantage of the fact that ATM has already demultiplexed the data for
81 We are currently involved with a video server project and are using
82 this driver as part of it. We have a device we build called an MMX.
83 You can connect a video camera to an MMX and have it send you a stream
84 of AAL0 cells with the video output in it. Of course this stream
85 is pretty rapid (in fact, it is massive!), and the normal AAL0
86 handling of the driver is unable to handle it (you end up with a cell
87 per small mbuf trying to make it to the application ... it turns out
88 the socket layer can't keep up with that sort of data stream). To
89 solve this problem we have implemented a
91 mode which batches unprocessed AAL0 info from the card into larger
92 data chunks blocks. We can save this data to disk in real-time
93 without the socket layer freaking out. Unfortunately, the data has
94 RBD (receive buffer descriptors) and cells headers in it, and this has
95 to be filtered out after capture.
98 mode one does the following ioctl:
99 .Bd -literal -offset indent
100 int size = 4000; /* bytes */
101 ret = ioctl(s, SIOCRAWATM, (caddr_t)&size);
104 This tells the driver to batch AAL0 data into 4000 bytes chunks,
105 rather than the usual 48 bytes chunks. Admittedly this is somewhat
106 gross, but our current application requires it. In the future we
107 hope that video sources send data in nice large AAL5 frames.
109 The NATM protocol support is subject to change as
110 the ATM protocols develop. Users should not depend
111 on details of the current implementation, but rather
112 the services exported.
117 of Washington University implemented the NATM protocol layer
118 along with the EN ATM driver in 1996 for