1292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer/* atmsap.h - ATM Service Access Point addressing definitions */
2292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
3292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */
4292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
5292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
6292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#ifndef _LINUX_ATMSAP_H
7292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define _LINUX_ATMSAP_H
8292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
9292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#include <linux/atmapi.h>
10292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
11292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer/*
12292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer * BEGIN_xx and END_xx markers are used for automatic generation of
13292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer * documentation. Do not change them.
14292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer */
15292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
16292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
17292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer/*
18292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer * Layer 2 protocol identifiers
19292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer */
20292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
21292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer/* BEGIN_L2 */
22292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L2_NONE	0	/* L2 not specified */
23292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L2_ISO1745  0x01	/* Basic mode ISO 1745 */
24292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L2_Q291	0x02	/* ITU-T Q.291 (Rec. I.441) */
25292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L2_X25_LL	0x06	/* ITU-T X.25, link layer */
26292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L2_X25_ML	0x07	/* ITU-T X.25, multilink */
27292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L2_LAPB	0x08	/* Extended LAPB, half-duplex (Rec. T.71) */
28292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L2_HDLC_ARM	0x09	/* HDLC ARM (ISO/IEC 4335) */
29292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L2_HDLC_NRM	0x0a	/* HDLC NRM (ISO/IEC 4335) */
30292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L2_HDLC_ABM	0x0b	/* HDLC ABM (ISO/IEC 4335) */
31292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L2_ISO8802	0x0c	/* LAN LLC (ISO/IEC 8802/2) */
32292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L2_X75	0x0d	/* ITU-T X.75, SLP */
33292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L2_Q922	0x0e	/* ITU-T Q.922 */
34292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L2_USER	0x10	/* user-specified */
35292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L2_ISO7776	0x11	/* ISO 7776 DTE-DTE */
36292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer/* END_L2 */
37292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
38292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
39292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer/*
40292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer * Layer 3 protocol identifiers
41292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer */
42292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
43292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer/* BEGIN_L3 */
44292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L3_NONE	0	/* L3 not specified */
45292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L3_X25	0x06	/* ITU-T X.25, packet layer */
46292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L3_ISO8208	0x07	/* ISO/IEC 8208 */
47292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L3_X223	0x08	/* ITU-T X.223 | ISO/IEC 8878 */
48292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L3_ISO8473	0x09	/* ITU-T X.233 | ISO/IEC 8473 */
49292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L3_T70	0x0a	/* ITU-T T.70 minimum network layer */
50292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L3_TR9577	0x0b	/* ISO/IEC TR 9577 */
51292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L3_H310	0x0c	/* ITU-T Recommendation H.310 */
52292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L3_H321	0x0d	/* ITU-T Recommendation H.321 */
53292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_L3_USER	0x10	/* user-specified */
54292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer/* END_L3 */
55292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
56292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
57292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer/*
58292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer * High layer identifiers
59292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer */
60292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
61292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer/* BEGIN_HL */
62292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_HL_NONE	0	/* HL not specified */
63292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_HL_ISO	0x01	/* ISO */
64292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_HL_USER	0x02	/* user-specific */
65292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_HL_HLP	0x03	/* high layer profile - UNI 3.0 only */
66292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_HL_VENDOR	0x04	/* vendor-specific application identifier */
67292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer/* END_HL */
68292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
69292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
70292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer/*
71292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer * ITU-T coded mode of operation
72292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer */
73292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
74292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer/* BEGIN_IMD */
75292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_IMD_NONE	 0	/* mode not specified */
76292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_IMD_NORMAL	 1	/* normal mode of operation */
77292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_IMD_EXTENDED 2	/* extended mode of operation */
78292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer/* END_IMD */
79292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
80292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer/*
81292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer * H.310 code points
82292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer */
83292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
84292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_TT_NONE	0	/* terminal type not specified */
85292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_TT_RX	1	/* receive only */
86292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_TT_TX	2	/* send only */
87292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_TT_RXTX	3	/* receive and send */
88292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
89292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_MC_NONE	0	/* no multiplexing */
90292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_MC_TS	1	/* transport stream (TS) */
91292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_MC_TS_FEC	2	/* transport stream with forward error corr. */
92292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_MC_PS	3	/* program stream (PS) */
93292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_MC_PS_FEC	4	/* program stream with forward error corr. */
94292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_MC_H221	5	/* ITU-T Rec. H.221 */
95292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
96292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer/*
97292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer * SAP structures
98292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer */
99292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
100292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_MAX_HLI	8	/* maximum high-layer information length */
101292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
102292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
103292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouerstruct atm_blli {
104292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer    unsigned char l2_proto;	/* layer 2 protocol */
105292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer    union {
106292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	struct {
107292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	    unsigned char mode;	/* mode of operation (ATM_IMD_xxx), 0 if */
108292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer				/* absent */
109292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	    unsigned char window; /* window size (k), 1-127 (0 to omit) */
110292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	} itu;			/* ITU-T encoding */
111292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	unsigned char user;	/* user-specified l2 information */
112292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer    } l2;
113292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer    unsigned char l3_proto;	/* layer 3 protocol */
114292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer    union {
115292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	struct {
116292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	    unsigned char mode;	/* mode of operation (ATM_IMD_xxx), 0 if */
117292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer				/* absent */
118292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	    unsigned char def_size; /* default packet size (log2), 4-12 (0 to */
119292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer				    /* omit) */
120292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	    unsigned char window;/* packet window size, 1-127 (0 to omit) */
121292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	} itu;			/* ITU-T encoding */
122292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	unsigned char user;	/* user specified l3 information */
123292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	struct {		      /* if l3_proto = ATM_L3_H310 */
124292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	    unsigned char term_type;  /* terminal type */
125292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	    unsigned char fw_mpx_cap; /* forward multiplexing capability */
126292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer				      /* only if term_type != ATM_TT_NONE */
127292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	    unsigned char bw_mpx_cap; /* backward multiplexing capability */
128292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer				      /* only if term_type != ATM_TT_NONE */
129292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	} h310;
130292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	struct {		  /* if l3_proto = ATM_L3_TR9577 */
131292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	    unsigned char ipi;	  /* initial protocol id */
132292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	    unsigned char snap[5];/* IEEE 802.1 SNAP identifier */
133292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer				  /* (only if ipi == NLPID_IEEE802_1_SNAP) */
134292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	} tr9577;
135292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer    } l3;
136292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer} __ATM_API_ALIGN;
137292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
138292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
139292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouerstruct atm_bhli {
140292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer    unsigned char hl_type;	/* high layer information type */
141292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer    unsigned char hl_length;	/* length (only if hl_type == ATM_HL_USER || */
142292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer				/* hl_type == ATM_HL_ISO) */
143292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer    unsigned char hl_info[ATM_MAX_HLI];/* high layer information */
144292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer};
145292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
146292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
147292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#define ATM_MAX_BLLI	3		/* maximum number of BLLI elements */
148292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
149292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
150292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouerstruct atm_sap {
151292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	struct atm_bhli bhli;		/* local SAP, high-layer information */
152292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	struct atm_blli blli[ATM_MAX_BLLI] __ATM_API_ALIGN;
153292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer					/* local SAP, low-layer info */
154292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer};
155292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
156292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
157292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouerstatic __inline__ int blli_in_use(struct atm_blli blli)
158292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer{
159292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer	return blli.l2_proto || blli.l3_proto;
160292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer}
161292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer
162292f29b42c3444375b5ae7086484c99da7129d94Jesper Dangaard Brouer#endif
163