Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 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 1 2 3 4 5 6


atm.h
001: /* atm.h - general ATM declarations */
002:  
003: /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
004:  
005: 
006: /*
007:  * WARNING: User-space programs should not #include <linux/atm.h> directly.
008:  *          Instead, #include <atm.h>
009:  */
010: 
011: #ifndef _LINUX_ATM_H
012: #define _LINUX_ATM_H
013: 
014: /*
015:  * BEGIN_xx and END_xx markers are used for automatic generation of
016:  * documentation. Do not change them.
017:  */
018: 
019: 
020: #include <linux/atmapi.h>
021: #include <linux/atmsap.h>
022: #include <linux/atmioc.h>
023: #include <linux/types.h>
024: 
025: 
026: /* general ATM constants */
027: #define ATM_CELL_SIZE               53  /* ATM cell size incl. header */
028: #define ATM_CELL_PAYLOAD            48  /* ATM payload size */
029: #define ATM_AAL0_SDU                52  /* AAL0 SDU size */
030: #define ATM_MAX_AAL34_PDU        65535  /* maximum AAL3/4 PDU payload */
031: #define ATM_AAL5_TRAILER             8  /* AAL5 trailer size */
032: #define ATM_MAX_AAL5_PDU         65535  /* maximum AAL5 PDU payload */
033: #define ATM_MAX_CDV               9999  /* maximum (default) CDV */
034: #define ATM_NOT_RSV_VCI             32  /* first non-reserved VCI value */
035: 
036: #define ATM_MAX_VPI                255  /* maximum VPI at the UNI */
037: #define ATM_MAX_VPI_NNI           4096  /* maximum VPI at the NNI */
038: #define ATM_MAX_VCI              65535  /* maximum VCI */
039: 
040: 
041: /* "protcol" values for the socket system call */
042: #define ATM_NO_AAL      0               /* AAL not specified */
043: #define ATM_AAL0        13              /* "raw" ATM cells */
044: #define ATM_AAL1        1               /* AAL1 (CBR) */
045: #define ATM_AAL2        2               /* AAL2 (VBR) */
046: #define ATM_AAL34       3               /* AAL3/4 (data) */
047: #define ATM_AAL5        5               /* AAL5 (data) */
048: 
049: /*
050:  * socket option name coding functions
051:  *
052:  * Note that __SO_ENCODE and __SO_LEVEL are somewhat a hack since the
053:  * << 22 only reserves 9 bits for the level.  On some architectures
054:  * SOL_SOCKET is 0xFFFF, so that's a bit of a problem
055:  */
056: 
057: #define __SO_ENCODE(l,n,t)      ((((l) & 0x1FF) << 22) | ((n) << 16) | \
058:                                 sizeof(t))
059: #define __SO_LEVEL_MATCH(c,m)   (((c) >> 22) == ((m) & 0x1FF))
060: #define __SO_NUMBER(c)          (((c) >> 16) & 0x3f)
061: #define __SO_SIZE(c)            ((c) & 0x3fff)
062: 
063: /*
064:  * ATM layer
065:  */
066: 
067: #define SO_SETCLP       __SO_ENCODE(SOL_ATM,0,int)
068:                             /* set CLP bit value - TODO */
069: #define SO_CIRANGE      __SO_ENCODE(SOL_ATM,1,struct atm_cirange)
070:                             /* connection identifier range; socket must be
071:                                bound or connected */
072: #define SO_ATMQOS       __SO_ENCODE(SOL_ATM,2,struct atm_qos)
073:                             /* Quality of Service setting */
074: #define SO_ATMSAP       __SO_ENCODE(SOL_ATM,3,struct atm_sap)
075:                             /* Service Access Point */
076: #define SO_ATMPVC       __SO_ENCODE(SOL_ATM,4,struct sockaddr_atmpvc)
077:                             /* "PVC" address (also for SVCs); get only */
078: #define SO_MULTIPOINT   __SO_ENCODE(SOL_ATM, 5, int)
079:                             /* make this vc a p2mp */
080: 
081: 
082: /*
083:  * Note @@@: since the socket layers don't really distinguish the control and
084:  * the data plane but generally seems to be data plane-centric, any layer is
085:  * about equally wrong for the SAP. If you have a better idea about this,
086:  * please speak up ...
087:  */
088: 
089: 
090: /* ATM cell header (for AAL0) */
091: 
092: /* BEGIN_CH */
093: #define ATM_HDR_GFC_MASK        0xf0000000
094: #define ATM_HDR_GFC_SHIFT       28
095: #define ATM_HDR_VPI_MASK        0x0ff00000
096: #define ATM_HDR_VPI_SHIFT       20
097: #define ATM_HDR_VCI_MASK        0x000ffff0
098: #define ATM_HDR_VCI_SHIFT       4
099: #define ATM_HDR_PTI_MASK        0x0000000e
100: #define ATM_HDR_PTI_SHIFT       1
101: #define ATM_HDR_CLP             0x00000001
102: /* END_CH */
103: 
104: 
105: /* PTI codings */
106: 
107: /* BEGIN_PTI */
108: #define ATM_PTI_US0     0  /* user data cell, congestion not exp, SDU-type 0 */
109: #define ATM_PTI_US1     1  /* user data cell, congestion not exp, SDU-type 1 */
110: #define ATM_PTI_UCES0   2  /* user data cell, cong. experienced, SDU-type 0 */
111: #define ATM_PTI_UCES1   3  /* user data cell, cong. experienced, SDU-type 1 */
112: #define ATM_PTI_SEGF5   4  /* segment OAM F5 flow related cell */
113: #define ATM_PTI_E2EF5   5  /* end-to-end OAM F5 flow related cell */
114: #define ATM_PTI_RSV_RM  6  /* reserved for traffic control/resource mgmt */
115: #define ATM_PTI_RSV     7  /* reserved */
116: /* END_PTI */
117: 
118: 
119: /*
120:  * The following items should stay in linux/atm.h, which should be linked to
121:  * netatm/atm.h
122:  */
123: 
124: /* Traffic description */
125: 
126: #define ATM_NONE        0               /* no traffic */
127: #define ATM_UBR         1
128: #define ATM_CBR         2
129: #define ATM_VBR         3
130: #define ATM_ABR         4
131: #define ATM_ANYCLASS    5               /* compatible with everything */
132: 
133: #define ATM_MAX_PCR     -1              /* maximum available PCR */
134: 
135: struct atm_trafprm {
136:         unsigned char   traffic_class;  /* traffic class (ATM_UBR, ...) */
137:         int             max_pcr;        /* maximum PCR in cells per second */
138:         int             pcr;            /* desired PCR in cells per second */
139:         int             min_pcr;        /* minimum PCR in cells per second */
140:         int             max_cdv;        /* maximum CDV in microseconds */
141:         int             max_sdu;        /* maximum SDU in bytes */
142:         /* extra params for ABR */
143:         unsigned int    icr;            /* Initial Cell Rate (24-bit) */
144:         unsigned int    tbe;            /* Transient Buffer Exposure (24-bit) */ 
145:         unsigned int    frtt : 24;      /* Fixed Round Trip Time (24-bit) */
146:         unsigned int    rif  : 4;       /* Rate Increment Factor (4-bit) */
147:         unsigned int    rdf  : 4;       /* Rate Decrease Factor (4-bit) */
148:         unsigned int nrm_pres  :1;      /* nrm present bit */
149:         unsigned int trm_pres  :1;      /* rm present bit */
150:         unsigned int adtf_pres :1;      /* adtf present bit */
151:         unsigned int cdf_pres  :1;      /* cdf present bit*/
152:         unsigned int nrm       :3;      /* Max # of Cells for each forward RM cell (3-bit) */
153:         unsigned int trm       :3;      /* Time between forward RM cells (3-bit) */    
154:         unsigned int adtf      :10;     /* ACR Decrease Time Factor (10-bit) */
155:         unsigned int cdf       :3;      /* Cutoff Decrease Factor (3-bit) */
156:         unsigned int spare     :9;      /* spare bits */ 
157: };
158: 
159: struct atm_qos {
160:         struct atm_trafprm txtp;        /* parameters in TX direction */
161:         struct atm_trafprm rxtp __ATM_API_ALIGN;
162:                                         /* parameters in RX direction */
163:         unsigned char aal __ATM_API_ALIGN;
164: };
165: 
166: /* PVC addressing */
167: 
168: #define ATM_ITF_ANY     -1              /* "magic" PVC address values */
169: #define ATM_VPI_ANY     -1
170: #define ATM_VCI_ANY     -1
171: #define ATM_VPI_UNSPEC  -2
172: #define ATM_VCI_UNSPEC  -2
173: 
174: 
175: struct sockaddr_atmpvc {
176:         unsigned short  sap_family;     /* address family, AF_ATMPVC  */
177:         struct {                        /* PVC address */
178:                 short   itf;            /* ATM interface */
179:                 short   vpi;            /* VPI (only 8 bits at UNI) */
180:                 int     vci;            /* VCI (only 16 bits at UNI) */
181:         } sap_addr __ATM_API_ALIGN;     /* PVC address */
182: };
183: 
184: /* SVC addressing */
185: 
186: #define ATM_ESA_LEN     20              /* ATM End System Address length */
187: #define ATM_E164_LEN    12              /* maximum E.164 number length */
188: 
189: #define ATM_AFI_DCC     0x39            /* DCC ATM Format */
190: #define ATM_AFI_ICD     0x47            /* ICD ATM Format */
191: #define ATM_AFI_E164    0x45            /* E.164 ATM Format */
192: #define ATM_AFI_LOCAL   0x49            /* Local ATM Format */ 
193: 
194: #define ATM_AFI_DCC_GROUP       0xBD    /* DCC ATM Group Format */
195: #define ATM_AFI_ICD_GROUP       0xC5    /* ICD ATM Group Format */
196: #define ATM_AFI_E164_GROUP      0xC3    /* E.164 ATM Group Format */
197: #define ATM_AFI_LOCAL_GROUP     0xC7    /* Local ATM Group Format */
198: 
199: #define ATM_LIJ_NONE    0               /* no leaf-initiated join */
200: #define ATM_LIJ         1               /* request joining */
201: #define ATM_LIJ_RPJ     2               /* set to root-prompted join */
202: #define ATM_LIJ_NJ      3               /* set to network join */
203: 
204: 
205: struct sockaddr_atmsvc {
206:     unsigned short      sas_family;     /* address family, AF_ATMSVC */
207:     struct {                            /* SVC address */
208:         unsigned char   prv[ATM_ESA_LEN];/* private ATM address */
209:         char            pub[ATM_E164_LEN+1]; /* public address (E.164) */
210:                                         /* unused addresses must be bzero'ed */
211:         char            lij_type;       /* role in LIJ call; one of ATM_LIJ* */
212:         __u32   lij_id;         /* LIJ call identifier */
213:     } sas_addr __ATM_API_ALIGN;         /* SVC address */
214: };
215: 
216: 
217: static __inline__ int atmsvc_addr_in_use(struct sockaddr_atmsvc addr)
218: {
219:         return *addr.sas_addr.prv || *addr.sas_addr.pub;
220: }
221: 
222: 
223: static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr)
224: {
225:         return addr.sap_addr.itf || addr.sap_addr.vpi || addr.sap_addr.vci;
226: }
227: 
228: 
229: /*
230:  * Some stuff for linux/sockios.h
231:  */
232: 
233: struct atmif_sioc {
234:         int number;
235:         int length;
236:         void *arg;
237: };
238: 
239: 
240: typedef unsigned short atm_backend_t;
241: #endif
242: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/