jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 1 | /* |
Harald Welte | 632e843 | 2017-09-05 18:12:14 +0200 | [diff] [blame] | 2 | * OsmoGGSN - Gateway GPRS Support Node |
jjako | 0fe0df0 | 2004-09-17 11:30:40 +0000 | [diff] [blame] | 3 | * Copyright (C) 2002, 2003, 2004 Mondru AB. |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 4 | * |
| 5 | * The contents of this file may be used under the terms of the GNU |
| 6 | * General Public License Version 2, provided that the above copyright |
| 7 | * notice and this permission notice is included in all copies or |
| 8 | * substantial portions of the software. |
| 9 | * |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #ifndef _GTPIE_H |
| 13 | #define _GTPIE_H |
| 14 | |
Harald Welte | 8376972 | 2017-10-13 15:57:48 +0200 | [diff] [blame] | 15 | #include <arpa/inet.h> |
| 16 | |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 17 | /* Macroes for conversion between host and network byte order */ |
| 18 | #define hton8(x) (x) |
| 19 | #define ntoh8(x) (x) |
| 20 | #define hton16(x) htons(x) |
| 21 | #define ntoh16(x) ntohs(x) |
| 22 | #define hton32(x) htonl(x) |
| 23 | #define ntoh32(x) ntohl(x) |
| 24 | |
jjako | 08d331d | 2003-10-13 20:33:30 +0000 | [diff] [blame] | 25 | #if BYTE_ORDER == LITTLE_ENDIAN |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 26 | static __inline uint64_t hton64(uint64_t q) |
jjako | 08d331d | 2003-10-13 20:33:30 +0000 | [diff] [blame] | 27 | { |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 28 | register uint32_t u, l; |
| 29 | u = q >> 32; |
| 30 | l = (uint32_t) q; |
jjako | 08d331d | 2003-10-13 20:33:30 +0000 | [diff] [blame] | 31 | |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 32 | return htonl(u) | ((uint64_t) htonl(l) << 32); |
jjako | 08d331d | 2003-10-13 20:33:30 +0000 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | #define ntoh64(_x) hton64(_x) |
| 36 | |
| 37 | #elif BYTE_ORDER == BIG_ENDIAN |
| 38 | |
| 39 | #define hton64(_x) (_x) |
| 40 | #define ntoh64(_x) hton64(_x) |
| 41 | |
| 42 | #else |
| 43 | #error "Please fix <machine/endian.h>" |
| 44 | #endif |
| 45 | |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 46 | #define GTPIE_SIZE 256 /* Max number of information elements */ |
| 47 | #define GTPIE_MAX 0xffff /* Max length of information elements */ |
| 48 | #define GTPIE_MAX_TV 28 /* Max length of type value pair */ |
| 49 | #define GTPIE_MAX_TLV 0xffff-3 /* Max length of TLV (GTP length is 16 bit) */ |
jjako | 08d331d | 2003-10-13 20:33:30 +0000 | [diff] [blame] | 50 | |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 51 | #define GTPIE_DEBUG 0 /* Print debug information */ |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 52 | |
Harald Welte | bc41c8d | 2017-10-09 10:15:04 +0800 | [diff] [blame] | 53 | /* GTP Information elements from 29.060 v11.8.0 7.7 Information Elements */ |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 54 | /* Also covers version 0. Note that version 0 6: QOS Profile was superceded * |
| 55 | * by 135: QOS Profile in version 1 */ |
| 56 | |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 57 | #define GTPIE_CAUSE 1 /* Cause 1 */ |
| 58 | #define GTPIE_IMSI 2 /* International Mobile Subscriber Identity 8 */ |
| 59 | #define GTPIE_RAI 3 /* Routing Area Identity (RAI) 8 */ |
| 60 | #define GTPIE_TLLI 4 /* Temporary Logical Link Identity (TLLI) 4 */ |
| 61 | #define GTPIE_P_TMSI 5 /* Packet TMSI (P-TMSI) 4 */ |
| 62 | #define GTPIE_QOS_PROFILE0 6 /* Quality of Service Profile GTP version 0 3 */ |
| 63 | /* 6-7 SPARE *//* 6 is QoS Profile vers 0 */ |
| 64 | #define GTPIE_REORDER 8 /* Reordering Required 1 */ |
| 65 | #define GTPIE_AUTH_TRIPLET 9 /* Authentication Triplet 28 */ |
| 66 | /* 10 SPARE */ |
| 67 | #define GTPIE_MAP_CAUSE 11 /* MAP Cause 1 */ |
| 68 | #define GTPIE_P_TMSI_S 12 /* P-TMSI Signature 3 */ |
| 69 | #define GTPIE_MS_VALIDATED 13 /* MS Validated 1 */ |
| 70 | #define GTPIE_RECOVERY 14 /* Recovery 1 */ |
| 71 | #define GTPIE_SELECTION_MODE 15 /* Selection Mode 1 */ |
| 72 | #define GTPIE_FL_DI 16 /* Flow Label Data I 2 */ |
| 73 | #define GTPIE_TEI_DI 16 /* Tunnel Endpoint Identifier Data I 4 */ |
| 74 | #define GTPIE_TEI_C 17 /* Tunnel Endpoint Identifier Control Plane 4 */ |
| 75 | #define GTPIE_FL_C 17 /* Flow Label Signalling 2 */ |
| 76 | #define GTPIE_TEI_DII 18 /* Tunnel Endpoint Identifier Data II 5 */ |
| 77 | #define GTPIE_TEARDOWN 19 /* Teardown Ind 1 */ |
| 78 | #define GTPIE_NSAPI 20 /* NSAPI 1 */ |
| 79 | #define GTPIE_RANAP_CAUSE 21 /* RANAP Cause 1 */ |
| 80 | #define GTPIE_RAB_CONTEXT 22 /* RAB Context 7 */ |
| 81 | #define GTPIE_RP_SMS 23 /* Radio Priority SMS 1 */ |
| 82 | #define GTPIE_RP 24 /* Radio Priority 1 */ |
| 83 | #define GTPIE_PFI 25 /* Packet Flow Id 2 */ |
| 84 | #define GTPIE_CHARGING_C 26 /* Charging Characteristics 2 */ |
| 85 | #define GTPIE_TRACE_REF 27 /* Trace Reference 2 */ |
| 86 | #define GTPIE_TRACE_TYPE 28 /* Trace Type 2 */ |
| 87 | #define GTPIE_MS_NOT_REACH 29 /* MS Not Reachable Reason 1 */ |
| 88 | /* 30-116 UNUSED */ |
Harald Welte | bc41c8d | 2017-10-09 10:15:04 +0800 | [diff] [blame] | 89 | /* 117-126 Reserved for the GPRS charging protocol (see GTP' in GSM 12.15 / 32.295) */ |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 90 | #define GTPIE_CHARGING_ID 127 /* Charging ID 4 */ |
| 91 | #define GTPIE_EUA 128 /* End User Address */ |
| 92 | #define GTPIE_MM_CONTEXT 129 /* MM Context */ |
| 93 | #define GTPIE_PDP_CONTEXT 130 /* PDP Context */ |
| 94 | #define GTPIE_APN 131 /* Access Point Name */ |
| 95 | #define GTPIE_PCO 132 /* Protocol Configuration Options */ |
| 96 | #define GTPIE_GSN_ADDR 133 /* GSN Address */ |
| 97 | #define GTPIE_MSISDN 134 /* MS International PSTN/ISDN Number */ |
| 98 | #define GTPIE_QOS_PROFILE 135 /* Quality of Service Profile */ |
| 99 | #define GTPIE_AUTH_QUINTUP 136 /* Authentication Quintuplet */ |
| 100 | #define GTPIE_TFT 137 /* Traffic Flow Template */ |
| 101 | #define GTPIE_TARGET_INF 138 /* Target Identification */ |
| 102 | #define GTPIE_UTRAN_TRANS 139 /* UTRAN Transparent Container */ |
| 103 | #define GTPIE_RAB_SETUP 140 /* RAB Setup Information */ |
| 104 | #define GTPIE_EXT_HEADER_T 141 /* Extension Header Type List */ |
| 105 | #define GTPIE_TRIGGER_ID 142 /* Trigger Id */ |
| 106 | #define GTPIE_OMC_ID 143 /* OMC Identity */ |
Harald Welte | bc41c8d | 2017-10-09 10:15:04 +0800 | [diff] [blame] | 107 | #define GTPIE_RAN_T_CONTAIN 144 /* RAN Transparent Container */ |
| 108 | #define GTPIE_PDP_CTX_PRIO 145 /* PDP Context Prioritization */ |
| 109 | #define GTPIE_ADDL_RAB_S_I 146 /* Additional RAB Setup Information */ |
| 110 | #define GTPIE_SGSN_NUMBER 147 /* SGSN Number */ |
Harald Welte | 89e1abc | 2017-10-08 07:50:20 +0800 | [diff] [blame] | 111 | #define GTPIE_COMMON_FLAGS 148 /* Common Flags */ |
Harald Welte | bc41c8d | 2017-10-09 10:15:04 +0800 | [diff] [blame] | 112 | #define GTPIE_APN_RESTR 149 /* APN Restriction */ |
| 113 | #define GTPIE_R_PRIO_LCS 150 /* Radio Priority LCS */ |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 114 | #define GTPIE_RAT_TYPE 151 /* Radio Access Technology Type */ |
| 115 | #define GTPIE_USER_LOC 152 /* User Location Information */ |
| 116 | #define GTPIE_MS_TZ 153 /* MS Time Zone */ |
| 117 | #define GTPIE_IMEI_SV 154 /* IMEI Software Version */ |
Harald Welte | bc41c8d | 2017-10-09 10:15:04 +0800 | [diff] [blame] | 118 | #define GTPIE_CML_CHG_I_CT 155 /* CAMEL Charging Information Container */ |
| 119 | #define GTPIE_MBMS_UE_CTX 156 /* MSMS UE Context */ |
| 120 | #define GTPIE_TMGI 157 /* Temporary Mobile Group Identity (TMGI) */ |
| 121 | #define GTPIE_RIM_ROUT_ADDR 158 /* RIM Routing Address */ |
| 122 | #define GTPIE_MBMS_PCO 159 /* MBMS Protocol Configuratin Options */ |
| 123 | #define GTPIE_MBMS_SA 160 /* MBMS Service Area */ |
| 124 | #define GTPIE_SRNC_PDCP_CTX 161 /* Source RNC PDCP Context Info */ |
| 125 | #define GTPIE_ADDL_TRACE 162 /* Additional Trace Info */ |
| 126 | #define GTPIE_HOP_CTR 163 /* Hop Counter */ |
| 127 | #define GTPIE_SEL_PLMN_ID 164 /* Selected PLMN ID */ |
| 128 | #define GTPIE_MBMS_SESS_ID 165 /* MBMS Session Identifier */ |
| 129 | #define GTPIE_MBMS_2_3G_IND 166 /* MBMS 2G/3G Indicator */ |
| 130 | #define GTPIE_ENH_NSAPI 167 /* Enhanced NSAPI */ |
| 131 | #define GTPIE_MBMS_SESS_DUR 168 /* MBMS Session Duration */ |
| 132 | #define GTPIE_A_MBMS_TRAC_I 169 /* Additional MBMS Trace Info */ |
| 133 | #define GTPIE_MBMS_S_REP_N 170 /* MBMS Session Repetition Number */ |
| 134 | #define GTPIE_MBMS_TTDT 171 /* MBMS Time To Data Transfer */ |
| 135 | #define GTPIE_PS_HO_REQ_CTX 172 /* PS Handover Request Context */ |
| 136 | #define GTPIE_BSS_CONTAINER 173 /* BSS Container */ |
| 137 | #define GTPIE_CELL_ID 174 /* Cell Identification */ |
| 138 | #define GTPIE_PDU_NUMBERS 175 /* PDU Numbers */ |
| 139 | #define GTPIE_BSSGP_CAUSE 176 /* BSSGP Cause */ |
| 140 | #define GTPIE_RQD_MBMS_BCAP 177 /* Required MBMS Bearer Capabilities */ |
| 141 | #define GTPIE_RIM_RA_DISCR 178 /* RIM Routing Address Discriminator */ |
| 142 | #define GTPIE_L_SETUP_PFCS 179 /* List of set-up PFCs */ |
| 143 | #define GTPIE_PS_HO_XID_PAR 180 /* PS Handover XID Parameters */ |
| 144 | #define GTPIE_MS_CHG_REP_A 181 /* MS Info Change Reporting Action */ |
| 145 | #define GTPIE_DIR_TUN_FLAGS 182 /* Direct Tunnel Flags */ |
| 146 | #define GTPIE_CORREL_ID 183 /* Correlation-ID */ |
BJovke | 03dbafb | 2016-09-15 13:41:41 +0200 | [diff] [blame] | 147 | #define GTPIE_BCM 184 /* Bearer control mode */ |
Harald Welte | bc41c8d | 2017-10-09 10:15:04 +0800 | [diff] [blame] | 148 | #define GTPIE_MBMS_FLOWI 185 /* MBMS Flow Identifier */ |
| 149 | #define GTPIE_MBMS_MC_DIST 186 /* MBMS IP Multicast Distribution */ |
| 150 | #define GTPIE_MBMS_DIST_ACK 187 /* MBMS Distribution Acknowledgement */ |
| 151 | #define GTPIE_R_IRAT_HO_INF 188 /* Reliable INTER RAT HANDOVER INFO */ |
| 152 | #define GTPIE_RFSP_IDX 189 /* RFSP Index */ |
| 153 | #define GTPIE_FQDN 190 /* FQDN */ |
| 154 | #define GTPIE_E_ALL_PRIO_1 191 /* Evolvd Allocation/Retention Priority I */ |
| 155 | #define GTPIE_E_ALL_PRIO_2 192 /* Evolvd Allocation/Retention Priority II */ |
| 156 | #define GTPIE_E_CMN_FLAGS 193 /* Extended Common Flags */ |
| 157 | #define GTPIE_U_CSG_INFO 194 /* User CSG Information (UCI) */ |
| 158 | #define GTPIE_CSG_I_REP_ACT 195 /* CSG Information Reporting Action */ |
| 159 | #define GTPIE_CSG_ID 196 /* CSG ID */ |
| 160 | #define GTPIE_CSG_MEMB_IND 197 /* CSG Membership Indication (CMI) */ |
| 161 | #define GTPIE_AMBR 198 /* Aggregate Maximum Bit Rate (AMBR) */ |
| 162 | #define GTPIE_UE_NET_CAPA 199 /* UE Network Capability */ |
| 163 | #define GTPIE_UE_AMBR 200 /* UE-AMBR */ |
| 164 | #define GTPIE_APN_AMBR_NS 201 /* APN-AMBR with NSAPI */ |
| 165 | #define GTPIE_GGSN_BACKOFF 202 /* GGSN Back-Off Time */ |
| 166 | #define GTPIE_S_PRIO_IND 203 /* Signalling Priority Indication */ |
| 167 | #define GTPIE_S_PRIO_IND_NS 204 /* Signalling Priority Indication with NSAPI */ |
| 168 | #define GTPIE_H_BR_16MBPS_F 205 /* Higher Bitrates than 16 Mbps flag */ |
| 169 | /* 206: Reserved */ |
| 170 | #define GTPIE_A_MMCTX_SRVCC 207 /* Additional MM context for SRVCC */ |
| 171 | #define GTPIE_A_FLAGS_SRVCC 208 /* Additional flags fro SRVC */ |
| 172 | #define GTPIE_STN_SR 209 /* STN-SR */ |
| 173 | #define GTPIE_C_MSISDN 210 /* C-MSISDN */ |
| 174 | #define GTPIE_E_RANAP_CAUSE 211 /* Extended RANAP Cause */ |
| 175 | #define GTPIE_ENODEB_ID 212 /* eNodeB ID */ |
| 176 | #define GTPIE_SEL_MODE_NS 213 /* Selection Mode with NSAPI */ |
| 177 | #define GTPIE_ULI_TIMESTAMP 214 /* ULI Timestamp */ |
| 178 | /* 215-238 Spare. For future use */ |
| 179 | /* 239-250 Reserved for the GPRS charging protocol (see GTP' in GSM 12.15 / 32.295) */ |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 180 | #define GTPIE_CHARGING_ADDR 251 /* Charging Gateway Address */ |
Harald Welte | bc41c8d | 2017-10-09 10:15:04 +0800 | [diff] [blame] | 181 | /* 252-254 Reserved for the GPRS charging protocol (see GTP' in GSM 12.15 / 32.295) */ |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 182 | #define GTPIE_PRIVATE 255 /* Private Extension */ |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 183 | |
| 184 | /* GTP information element structs in network order */ |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 185 | struct gtpie_ext { /* Extension header */ |
| 186 | uint8_t t; /* Type */ |
| 187 | uint8_t l; /* Length */ |
| 188 | uint8_t *p; /* Value */ |
| 189 | } __attribute__ ((packed)); |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 190 | |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 191 | struct gtpie_tlv { /* Type length value pair */ |
| 192 | uint8_t t; /* Type */ |
| 193 | uint16_t l; /* Length */ |
| 194 | uint8_t v[GTPIE_MAX_TLV]; /* Value */ |
| 195 | } __attribute__ ((packed)); |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 196 | |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 197 | struct gtpie_tv0 { /* 1 byte type value pair */ |
| 198 | uint8_t t; /* Type */ |
| 199 | uint8_t v[GTPIE_MAX_TV]; /* Pointer to value */ |
| 200 | } __attribute__ ((packed)); |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 201 | |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 202 | struct gtpie_tv1 { /* 1 byte type value pair */ |
| 203 | uint8_t t; /* Type */ |
| 204 | uint8_t v; /* Value */ |
| 205 | } __attribute__ ((packed)); |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 206 | |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 207 | struct gtpie_tv2 { /* 2 byte type value pair */ |
| 208 | uint8_t t; /* Type */ |
| 209 | uint16_t v; /* Value */ |
| 210 | } __attribute__ ((packed)); |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 211 | |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 212 | struct gtpie_tv4 { /* 4 byte type value pair */ |
| 213 | uint8_t t; /* Type */ |
| 214 | uint32_t v; /* Value */ |
| 215 | } __attribute__ ((packed)); |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 216 | |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 217 | struct gtpie_tv8 { /* 8 byte type value pair */ |
| 218 | uint8_t t; /* Type */ |
| 219 | uint64_t v; /* Value */ |
| 220 | } __attribute__ ((packed)); |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 221 | |
| 222 | union gtpie_member { |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 223 | uint8_t t; |
| 224 | struct gtpie_ext ext; |
| 225 | struct gtpie_tlv tlv; |
| 226 | struct gtpie_tv0 tv0; |
| 227 | struct gtpie_tv1 tv1; |
| 228 | struct gtpie_tv2 tv2; |
| 229 | struct gtpie_tv4 tv4; |
| 230 | struct gtpie_tv8 tv8; |
| 231 | } __attribute__ ((packed)); |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 232 | |
| 233 | /* |
| 234 | cause |
| 235 | imsi |
| 236 | rai |
| 237 | tlli |
| 238 | p_tmsi |
| 239 | qos_profile0 |
| 240 | reorder |
| 241 | auth |
| 242 | map_cause |
| 243 | p_tmsi_s |
| 244 | ms_validated |
| 245 | recovery |
| 246 | selection_mode |
| 247 | tei_di |
| 248 | tei_c |
| 249 | tei_dii |
| 250 | teardown |
| 251 | nsapi |
| 252 | ranap_cause |
| 253 | rab_context |
| 254 | rp_sms |
| 255 | rp |
| 256 | pfi |
| 257 | charging_c |
| 258 | trace_ref |
| 259 | trace_type |
| 260 | ms_not_reach |
| 261 | charging_id |
| 262 | eua |
| 263 | mm_context |
| 264 | pdp_context |
| 265 | apn |
| 266 | pco |
| 267 | gsn_addr |
| 268 | msisdn |
| 269 | qos_profile |
| 270 | auth |
| 271 | tft |
| 272 | target_inf |
| 273 | utran_trans |
| 274 | rab_setup |
| 275 | ext_header_t |
| 276 | trigger_id |
| 277 | omc_id |
| 278 | charging_addr |
| 279 | private |
| 280 | */ |
| 281 | |
| 282 | struct tlv1 { |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 283 | uint8_t type; |
| 284 | uint8_t length; |
| 285 | } __attribute__ ((packed)); |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 286 | |
| 287 | struct tlv2 { |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 288 | uint8_t type; |
| 289 | uint16_t length; |
| 290 | } __attribute__ ((packed)); |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 291 | |
Harald Welte | f54a1f4 | 2010-05-04 11:08:38 +0200 | [diff] [blame] | 292 | extern int gtpie_tlv(void *p, unsigned int *length, unsigned int size, |
Harald Welte | 02af9b3 | 2017-10-13 05:04:33 +0200 | [diff] [blame] | 293 | uint8_t t, int l, const void *v); |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 294 | extern int gtpie_tv0(void *p, unsigned int *length, unsigned int size, |
Harald Welte | 02af9b3 | 2017-10-13 05:04:33 +0200 | [diff] [blame] | 295 | uint8_t t, int l, const uint8_t * v); |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 296 | extern int gtpie_tv1(void *p, unsigned int *length, unsigned int size, |
| 297 | uint8_t t, uint8_t v); |
| 298 | extern int gtpie_tv2(void *p, unsigned int *length, unsigned int size, |
| 299 | uint8_t t, uint16_t v); |
| 300 | extern int gtpie_tv4(void *p, unsigned int *length, unsigned int size, |
| 301 | uint8_t t, uint32_t v); |
| 302 | extern int gtpie_tv8(void *p, unsigned int *length, unsigned int size, |
| 303 | uint8_t t, uint64_t v); |
| 304 | extern int gtpie_getie(union gtpie_member *ie[], int type, int instance); |
| 305 | extern int gtpie_exist(union gtpie_member *ie[], int type, int instance); |
| 306 | extern int gtpie_gettlv(union gtpie_member *ie[], int type, int instance, |
Harald Welte | f54a1f4 | 2010-05-04 11:08:38 +0200 | [diff] [blame] | 307 | unsigned int *length, void *dst, unsigned int size); |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 308 | extern int gtpie_gettv0(union gtpie_member *ie[], int type, int instance, |
Harald Welte | f54a1f4 | 2010-05-04 11:08:38 +0200 | [diff] [blame] | 309 | void *dst, unsigned int size); |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 310 | extern int gtpie_gettv1(union gtpie_member *ie[], int type, int instance, |
| 311 | uint8_t * dst); |
| 312 | extern int gtpie_gettv2(union gtpie_member *ie[], int type, int instance, |
| 313 | uint16_t * dst); |
| 314 | extern int gtpie_gettv4(union gtpie_member *ie[], int type, int instance, |
| 315 | uint32_t * dst); |
| 316 | extern int gtpie_gettv8(union gtpie_member *ie[], int type, int instance, |
| 317 | uint64_t * dst); |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 318 | |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 319 | extern int gtpie_decaps(union gtpie_member *ie[], int version, |
Harald Welte | a964027 | 2017-10-13 12:06:08 +0200 | [diff] [blame] | 320 | const void *pack, unsigned len); |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 321 | extern int gtpie_encaps(union gtpie_member *ie[], void *pack, unsigned *len); |
Harald Welte | f54a1f4 | 2010-05-04 11:08:38 +0200 | [diff] [blame] | 322 | extern int gtpie_encaps2(union gtpie_member ie[], unsigned int size, |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 323 | void *pack, unsigned *len); |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 324 | |
Harald Welte | bed35df | 2011-11-02 13:06:18 +0100 | [diff] [blame] | 325 | #endif /* !_GTPIE_H */ |