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