summaryrefslogtreecommitdiffstats
path: root/share/man/man4/natm.4
blob: 33bd2b19e8e27d09917fcd09edf66ae3ac99635d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
.\" $FreeBSD$
.\"
.Dd December 29, 1997
.Dt NATM 4
.Os
.Sh NAME
.Nm natm
.Nd Native Mode ATM protocol layer
.Sh DESCRIPTION
The
.Bx
ATM software comes with a
.Em native mode ATM protocol layer
which provides socket level access to AAL0 and AAL5 virtual circuits.
To enable this protocol layer, add
.Dl options NATM
to your kernel configuration file and re-make the kernel (do not forget
to do
.Dq make clean ) .
.Sh NATM API
The NATM layer uses a
.Vt 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); }
  bzero(&snatm, sizeof(snatm));
  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
The
.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
for receiving data.
After the
.Fn connect
call one can
.Fn read
or
.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
circuits on the system in
.Dv natm_pcbs .
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
to the driver as a receive
.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 CAVEATS
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 ,
.Xr fatm 4 ,
.Xr hatm 4 ,
.Xr natmip 4 ,
.Xr patm 4
.Sh AUTHORS
.An Chuck Cranor
of Washington University implemented the NATM protocol layer
along with the EN ATM driver in 1996 for
.Nx .
OpenPOWER on IntegriCloud