1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux << 2 /* atm.h - general ATM declarations */ 1 /* atm.h - general ATM declarations */ 3 2 4 /* Written 1995-2000 by Werner Almesberger, EP 3 /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ 5 4 6 5 7 /* 6 /* 8 * WARNING: User-space programs should not #in 7 * WARNING: User-space programs should not #include <linux/atm.h> directly. 9 * Instead, #include <atm.h> 8 * Instead, #include <atm.h> 10 */ 9 */ 11 10 12 #ifndef _UAPI_LINUX_ATM_H 11 #ifndef _UAPI_LINUX_ATM_H 13 #define _UAPI_LINUX_ATM_H 12 #define _UAPI_LINUX_ATM_H 14 13 15 /* 14 /* 16 * BEGIN_xx and END_xx markers are used for au 15 * BEGIN_xx and END_xx markers are used for automatic generation of 17 * documentation. Do not change them. 16 * documentation. Do not change them. 18 */ 17 */ 19 18 20 #include <linux/compiler.h> 19 #include <linux/compiler.h> 21 #include <linux/atmapi.h> 20 #include <linux/atmapi.h> 22 #include <linux/atmsap.h> 21 #include <linux/atmsap.h> 23 #include <linux/atmioc.h> 22 #include <linux/atmioc.h> 24 #include <linux/types.h> 23 #include <linux/types.h> 25 24 26 25 27 /* general ATM constants */ 26 /* general ATM constants */ 28 #define ATM_CELL_SIZE 53 /* ATM 27 #define ATM_CELL_SIZE 53 /* ATM cell size incl. header */ 29 #define ATM_CELL_PAYLOAD 48 /* ATM 28 #define ATM_CELL_PAYLOAD 48 /* ATM payload size */ 30 #define ATM_AAL0_SDU 52 /* AAL 29 #define ATM_AAL0_SDU 52 /* AAL0 SDU size */ 31 #define ATM_MAX_AAL34_PDU 65535 /* max 30 #define ATM_MAX_AAL34_PDU 65535 /* maximum AAL3/4 PDU payload */ 32 #define ATM_AAL5_TRAILER 8 /* AAL 31 #define ATM_AAL5_TRAILER 8 /* AAL5 trailer size */ 33 #define ATM_MAX_AAL5_PDU 65535 /* max 32 #define ATM_MAX_AAL5_PDU 65535 /* maximum AAL5 PDU payload */ 34 #define ATM_MAX_CDV 9999 /* max 33 #define ATM_MAX_CDV 9999 /* maximum (default) CDV */ 35 #define ATM_NOT_RSV_VCI 32 /* fir 34 #define ATM_NOT_RSV_VCI 32 /* first non-reserved VCI value */ 36 35 37 #define ATM_MAX_VPI 255 /* max 36 #define ATM_MAX_VPI 255 /* maximum VPI at the UNI */ 38 #define ATM_MAX_VPI_NNI 4096 /* max 37 #define ATM_MAX_VPI_NNI 4096 /* maximum VPI at the NNI */ 39 #define ATM_MAX_VCI 65535 /* max 38 #define ATM_MAX_VCI 65535 /* maximum VCI */ 40 39 41 40 42 /* "protcol" values for the socket system call 41 /* "protcol" values for the socket system call */ 43 #define ATM_NO_AAL 0 /* AAL 42 #define ATM_NO_AAL 0 /* AAL not specified */ 44 #define ATM_AAL0 13 /* "ra 43 #define ATM_AAL0 13 /* "raw" ATM cells */ 45 #define ATM_AAL1 1 /* AAL 44 #define ATM_AAL1 1 /* AAL1 (CBR) */ 46 #define ATM_AAL2 2 /* AAL 45 #define ATM_AAL2 2 /* AAL2 (VBR) */ 47 #define ATM_AAL34 3 /* AAL 46 #define ATM_AAL34 3 /* AAL3/4 (data) */ 48 #define ATM_AAL5 5 /* AAL 47 #define ATM_AAL5 5 /* AAL5 (data) */ 49 48 50 /* 49 /* 51 * socket option name coding functions 50 * socket option name coding functions 52 * 51 * 53 * Note that __SO_ENCODE and __SO_LEVEL are so 52 * Note that __SO_ENCODE and __SO_LEVEL are somewhat a hack since the 54 * << 22 only reserves 9 bits for the level. 53 * << 22 only reserves 9 bits for the level. On some architectures 55 * SOL_SOCKET is 0xFFFF, so that's a bit of a 54 * SOL_SOCKET is 0xFFFF, so that's a bit of a problem 56 */ 55 */ 57 56 58 #define __SO_ENCODE(l,n,t) ((((l) & 0x1FF 57 #define __SO_ENCODE(l,n,t) ((((l) & 0x1FF) << 22) | ((n) << 16) | \ 59 sizeof(t)) 58 sizeof(t)) 60 #define __SO_LEVEL_MATCH(c,m) (((c) >> 22) = 59 #define __SO_LEVEL_MATCH(c,m) (((c) >> 22) == ((m) & 0x1FF)) 61 #define __SO_NUMBER(c) (((c) >> 16) & 60 #define __SO_NUMBER(c) (((c) >> 16) & 0x3f) 62 #define __SO_SIZE(c) ((c) & 0x3fff) 61 #define __SO_SIZE(c) ((c) & 0x3fff) 63 62 64 /* 63 /* 65 * ATM layer 64 * ATM layer 66 */ 65 */ 67 66 68 #define SO_SETCLP __SO_ENCODE(SOL_ATM,0, 67 #define SO_SETCLP __SO_ENCODE(SOL_ATM,0,int) 69 /* set CLP bit val 68 /* set CLP bit value - TODO */ 70 #define SO_CIRANGE __SO_ENCODE(SOL_ATM,1, 69 #define SO_CIRANGE __SO_ENCODE(SOL_ATM,1,struct atm_cirange) 71 /* connection iden 70 /* connection identifier range; socket must be 72 bound or connec 71 bound or connected */ 73 #define SO_ATMQOS __SO_ENCODE(SOL_ATM,2, 72 #define SO_ATMQOS __SO_ENCODE(SOL_ATM,2,struct atm_qos) 74 /* Quality of Serv 73 /* Quality of Service setting */ 75 #define SO_ATMSAP __SO_ENCODE(SOL_ATM,3, 74 #define SO_ATMSAP __SO_ENCODE(SOL_ATM,3,struct atm_sap) 76 /* Service Access 75 /* Service Access Point */ 77 #define SO_ATMPVC __SO_ENCODE(SOL_ATM,4, 76 #define SO_ATMPVC __SO_ENCODE(SOL_ATM,4,struct sockaddr_atmpvc) 78 /* "PVC" address ( 77 /* "PVC" address (also for SVCs); get only */ 79 #define SO_MULTIPOINT __SO_ENCODE(SOL_ATM, 5 78 #define SO_MULTIPOINT __SO_ENCODE(SOL_ATM, 5, int) 80 /* make this vc a 79 /* make this vc a p2mp */ 81 80 82 81 83 /* 82 /* 84 * Note @@@: since the socket layers don't rea 83 * Note @@@: since the socket layers don't really distinguish the control and 85 * the data plane but generally seems to be da 84 * the data plane but generally seems to be data plane-centric, any layer is 86 * about equally wrong for the SAP. If you hav 85 * about equally wrong for the SAP. If you have a better idea about this, 87 * please speak up ... 86 * please speak up ... 88 */ 87 */ 89 88 90 89 91 /* ATM cell header (for AAL0) */ 90 /* ATM cell header (for AAL0) */ 92 91 93 /* BEGIN_CH */ 92 /* BEGIN_CH */ 94 #define ATM_HDR_GFC_MASK 0xf0000000 93 #define ATM_HDR_GFC_MASK 0xf0000000 95 #define ATM_HDR_GFC_SHIFT 28 94 #define ATM_HDR_GFC_SHIFT 28 96 #define ATM_HDR_VPI_MASK 0x0ff00000 95 #define ATM_HDR_VPI_MASK 0x0ff00000 97 #define ATM_HDR_VPI_SHIFT 20 96 #define ATM_HDR_VPI_SHIFT 20 98 #define ATM_HDR_VCI_MASK 0x000ffff0 97 #define ATM_HDR_VCI_MASK 0x000ffff0 99 #define ATM_HDR_VCI_SHIFT 4 98 #define ATM_HDR_VCI_SHIFT 4 100 #define ATM_HDR_PTI_MASK 0x0000000e 99 #define ATM_HDR_PTI_MASK 0x0000000e 101 #define ATM_HDR_PTI_SHIFT 1 100 #define ATM_HDR_PTI_SHIFT 1 102 #define ATM_HDR_CLP 0x00000001 101 #define ATM_HDR_CLP 0x00000001 103 /* END_CH */ 102 /* END_CH */ 104 103 105 104 106 /* PTI codings */ 105 /* PTI codings */ 107 106 108 /* BEGIN_PTI */ 107 /* BEGIN_PTI */ 109 #define ATM_PTI_US0 0 /* user data cell, 108 #define ATM_PTI_US0 0 /* user data cell, congestion not exp, SDU-type 0 */ 110 #define ATM_PTI_US1 1 /* user data cell, 109 #define ATM_PTI_US1 1 /* user data cell, congestion not exp, SDU-type 1 */ 111 #define ATM_PTI_UCES0 2 /* user data cell, 110 #define ATM_PTI_UCES0 2 /* user data cell, cong. experienced, SDU-type 0 */ 112 #define ATM_PTI_UCES1 3 /* user data cell, 111 #define ATM_PTI_UCES1 3 /* user data cell, cong. experienced, SDU-type 1 */ 113 #define ATM_PTI_SEGF5 4 /* segment OAM F5 f 112 #define ATM_PTI_SEGF5 4 /* segment OAM F5 flow related cell */ 114 #define ATM_PTI_E2EF5 5 /* end-to-end OAM F 113 #define ATM_PTI_E2EF5 5 /* end-to-end OAM F5 flow related cell */ 115 #define ATM_PTI_RSV_RM 6 /* reserved for tra 114 #define ATM_PTI_RSV_RM 6 /* reserved for traffic control/resource mgmt */ 116 #define ATM_PTI_RSV 7 /* reserved */ 115 #define ATM_PTI_RSV 7 /* reserved */ 117 /* END_PTI */ 116 /* END_PTI */ 118 117 119 118 120 /* 119 /* 121 * The following items should stay in linux/at 120 * The following items should stay in linux/atm.h, which should be linked to 122 * netatm/atm.h 121 * netatm/atm.h 123 */ 122 */ 124 123 125 /* Traffic description */ 124 /* Traffic description */ 126 125 127 #define ATM_NONE 0 /* no 126 #define ATM_NONE 0 /* no traffic */ 128 #define ATM_UBR 1 127 #define ATM_UBR 1 129 #define ATM_CBR 2 128 #define ATM_CBR 2 130 #define ATM_VBR 3 129 #define ATM_VBR 3 131 #define ATM_ABR 4 130 #define ATM_ABR 4 132 #define ATM_ANYCLASS 5 /* com 131 #define ATM_ANYCLASS 5 /* compatible with everything */ 133 132 134 #define ATM_MAX_PCR -1 /* max 133 #define ATM_MAX_PCR -1 /* maximum available PCR */ 135 134 136 struct atm_trafprm { 135 struct atm_trafprm { 137 unsigned char traffic_class; /* tra 136 unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */ 138 int max_pcr; /* max 137 int max_pcr; /* maximum PCR in cells per second */ 139 int pcr; /* des 138 int pcr; /* desired PCR in cells per second */ 140 int min_pcr; /* min 139 int min_pcr; /* minimum PCR in cells per second */ 141 int max_cdv; /* max 140 int max_cdv; /* maximum CDV in microseconds */ 142 int max_sdu; /* max 141 int max_sdu; /* maximum SDU in bytes */ 143 /* extra params for ABR */ 142 /* extra params for ABR */ 144 unsigned int icr; /* Ini 143 unsigned int icr; /* Initial Cell Rate (24-bit) */ 145 unsigned int tbe; /* Tra 144 unsigned int tbe; /* Transient Buffer Exposure (24-bit) */ 146 unsigned int frtt : 24; /* Fix 145 unsigned int frtt : 24; /* Fixed Round Trip Time (24-bit) */ 147 unsigned int rif : 4; /* Rat 146 unsigned int rif : 4; /* Rate Increment Factor (4-bit) */ 148 unsigned int rdf : 4; /* Rat 147 unsigned int rdf : 4; /* Rate Decrease Factor (4-bit) */ 149 unsigned int nrm_pres :1; /* nrm 148 unsigned int nrm_pres :1; /* nrm present bit */ 150 unsigned int trm_pres :1; /* rm 149 unsigned int trm_pres :1; /* rm present bit */ 151 unsigned int adtf_pres :1; /* adt 150 unsigned int adtf_pres :1; /* adtf present bit */ 152 unsigned int cdf_pres :1; /* cdf 151 unsigned int cdf_pres :1; /* cdf present bit*/ 153 unsigned int nrm :3; /* Max 152 unsigned int nrm :3; /* Max # of Cells for each forward RM cell (3-bit) */ 154 unsigned int trm :3; /* Tim 153 unsigned int trm :3; /* Time between forward RM cells (3-bit) */ 155 unsigned int adtf :10; /* ACR 154 unsigned int adtf :10; /* ACR Decrease Time Factor (10-bit) */ 156 unsigned int cdf :3; /* Cut 155 unsigned int cdf :3; /* Cutoff Decrease Factor (3-bit) */ 157 unsigned int spare :9; /* spa 156 unsigned int spare :9; /* spare bits */ 158 }; 157 }; 159 158 160 struct atm_qos { 159 struct atm_qos { 161 struct atm_trafprm txtp; /* par 160 struct atm_trafprm txtp; /* parameters in TX direction */ 162 struct atm_trafprm rxtp __ATM_API_ALIG 161 struct atm_trafprm rxtp __ATM_API_ALIGN; 163 /* par 162 /* parameters in RX direction */ 164 unsigned char aal __ATM_API_ALIGN; 163 unsigned char aal __ATM_API_ALIGN; 165 }; 164 }; 166 165 167 /* PVC addressing */ 166 /* PVC addressing */ 168 167 169 #define ATM_ITF_ANY -1 /* "ma 168 #define ATM_ITF_ANY -1 /* "magic" PVC address values */ 170 #define ATM_VPI_ANY -1 169 #define ATM_VPI_ANY -1 171 #define ATM_VCI_ANY -1 170 #define ATM_VCI_ANY -1 172 #define ATM_VPI_UNSPEC -2 171 #define ATM_VPI_UNSPEC -2 173 #define ATM_VCI_UNSPEC -2 172 #define ATM_VCI_UNSPEC -2 174 173 175 174 176 struct sockaddr_atmpvc { 175 struct sockaddr_atmpvc { 177 unsigned short sap_family; /* add 176 unsigned short sap_family; /* address family, AF_ATMPVC */ 178 struct { /* PVC 177 struct { /* PVC address */ 179 short itf; /* ATM 178 short itf; /* ATM interface */ 180 short vpi; /* VPI 179 short vpi; /* VPI (only 8 bits at UNI) */ 181 int vci; /* VCI 180 int vci; /* VCI (only 16 bits at UNI) */ 182 } sap_addr __ATM_API_ALIGN; /* PVC 181 } sap_addr __ATM_API_ALIGN; /* PVC address */ 183 }; 182 }; 184 183 185 /* SVC addressing */ 184 /* SVC addressing */ 186 185 187 #define ATM_ESA_LEN 20 /* ATM 186 #define ATM_ESA_LEN 20 /* ATM End System Address length */ 188 #define ATM_E164_LEN 12 /* max 187 #define ATM_E164_LEN 12 /* maximum E.164 number length */ 189 188 190 #define ATM_AFI_DCC 0x39 /* DCC 189 #define ATM_AFI_DCC 0x39 /* DCC ATM Format */ 191 #define ATM_AFI_ICD 0x47 /* ICD 190 #define ATM_AFI_ICD 0x47 /* ICD ATM Format */ 192 #define ATM_AFI_E164 0x45 /* E.1 191 #define ATM_AFI_E164 0x45 /* E.164 ATM Format */ 193 #define ATM_AFI_LOCAL 0x49 /* Loc 192 #define ATM_AFI_LOCAL 0x49 /* Local ATM Format */ 194 193 195 #define ATM_AFI_DCC_GROUP 0xBD /* DCC 194 #define ATM_AFI_DCC_GROUP 0xBD /* DCC ATM Group Format */ 196 #define ATM_AFI_ICD_GROUP 0xC5 /* ICD 195 #define ATM_AFI_ICD_GROUP 0xC5 /* ICD ATM Group Format */ 197 #define ATM_AFI_E164_GROUP 0xC3 /* E.1 196 #define ATM_AFI_E164_GROUP 0xC3 /* E.164 ATM Group Format */ 198 #define ATM_AFI_LOCAL_GROUP 0xC7 /* Loc 197 #define ATM_AFI_LOCAL_GROUP 0xC7 /* Local ATM Group Format */ 199 198 200 #define ATM_LIJ_NONE 0 /* no 199 #define ATM_LIJ_NONE 0 /* no leaf-initiated join */ 201 #define ATM_LIJ 1 /* req 200 #define ATM_LIJ 1 /* request joining */ 202 #define ATM_LIJ_RPJ 2 /* set 201 #define ATM_LIJ_RPJ 2 /* set to root-prompted join */ 203 #define ATM_LIJ_NJ 3 /* set 202 #define ATM_LIJ_NJ 3 /* set to network join */ 204 203 205 204 206 struct sockaddr_atmsvc { 205 struct sockaddr_atmsvc { 207 unsigned short sas_family; /* add 206 unsigned short sas_family; /* address family, AF_ATMSVC */ 208 struct { /* SVC 207 struct { /* SVC address */ 209 unsigned char prv[ATM_ESA_LEN];/* pr 208 unsigned char prv[ATM_ESA_LEN];/* private ATM address */ 210 char pub[ATM_E164_LEN+1]; / 209 char pub[ATM_E164_LEN+1]; /* public address (E.164) */ 211 /* unu 210 /* unused addresses must be bzero'ed */ 212 char lij_type; /* rol 211 char lij_type; /* role in LIJ call; one of ATM_LIJ* */ 213 __u32 lij_id; /* LIJ call id 212 __u32 lij_id; /* LIJ call identifier */ 214 } sas_addr __ATM_API_ALIGN; /* SVC 213 } sas_addr __ATM_API_ALIGN; /* SVC address */ 215 }; 214 }; 216 215 217 216 218 static __inline__ int atmsvc_addr_in_use(struc 217 static __inline__ int atmsvc_addr_in_use(struct sockaddr_atmsvc addr) 219 { 218 { 220 return *addr.sas_addr.prv || *addr.sas 219 return *addr.sas_addr.prv || *addr.sas_addr.pub; 221 } 220 } 222 221 223 222 224 static __inline__ int atmpvc_addr_in_use(struc 223 static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr) 225 { 224 { 226 return addr.sap_addr.itf || addr.sap_a 225 return addr.sap_addr.itf || addr.sap_addr.vpi || addr.sap_addr.vci; 227 } 226 } 228 227 229 228 230 /* 229 /* 231 * Some stuff for linux/sockios.h 230 * Some stuff for linux/sockios.h 232 */ 231 */ 233 232 234 struct atmif_sioc { 233 struct atmif_sioc { 235 int number; 234 int number; 236 int length; 235 int length; 237 void __user *arg; 236 void __user *arg; 238 }; 237 }; 239 238 240 239 241 typedef unsigned short atm_backend_t; 240 typedef unsigned short atm_backend_t; 242 #endif /* _UAPI_LINUX_ATM_H */ 241 #endif /* _UAPI_LINUX_ATM_H */ 243 242
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.