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