Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1 | module DIAMETER_Templates { |
| 2 | |
| 3 | /* (C) 2019 by Harald Welte <laforge@gnumonks.org> |
| 4 | * All rights reserved. |
| 5 | * |
| 6 | * Released under the terms of GNU General Public License, Version 2 or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 10 | */ |
| 11 | |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 12 | import from General_Types all; |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 13 | import from DIAMETER_Types all; |
| 14 | import from Osmocom_Types all; |
Pau Espin Pedrol | 8fa2284 | 2022-05-20 14:47:55 +0200 | [diff] [blame] | 15 | import from Misc_Helpers all; |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 16 | |
| 17 | /* https://www.iana.org/assignments/aaa-parameters/aaa-parameters.xhtml#aaa-parameters-4 */ |
| 18 | type enumerated DIAMETER_Resultcode { |
| 19 | /* Informational */ |
| 20 | DIAMETER_MULTI_ROUND_AUTH (1001), |
| 21 | |
| 22 | /* Success */ |
| 23 | DIAMETER_SUCCESS (2001), |
| 24 | DIAMETER_LIMITED_SUCCESS (2002), |
| 25 | DIAMETER_FIRST_REGISTRATION (2003), |
| 26 | DIAMETER_SUBSEQUENT_REGISTRATION (2004), |
| 27 | DIAMETER_UNREGISTERED_SERVICE (2005), |
| 28 | DIAMETER_SUCCESS_SERVER_NAME_NOT_STORED (2006), |
| 29 | DIAMETER_SERVER_SELECTION (2007), |
| 30 | DIAMETER_SUCCESS_AUTH_SENT_SERVER_NOT_STORED (2008), |
| 31 | DIAMETER_SUCCESS_RELOCATE_HA (2009), |
| 32 | |
| 33 | /* Protocol Errors */ |
| 34 | DIAMETER_COMMAND_UNSUPPORTED (3001), |
| 35 | DIAMETER_UNABLE_TO_DELIVER (3002), |
| 36 | DIAMETER_REALM_NOT_SERVED (3003), |
| 37 | DIAMETER_TOO_BUSY (3004), |
| 38 | DIAMETER_LOOP_DETECTED (3005), |
| 39 | DIAMETER_REDIRECT_INDICATION (3006), |
| 40 | DIAMETER_APPLICATION_UNSUPPORTED (3007), |
| 41 | DIAMETER_INVALID_HDR_BITS (3008), |
| 42 | DIAMETER_INVALID_AVP_BITS (3009), |
| 43 | DIAMETER_UNKNOWN_PEER (3010), |
| 44 | DIAMETER_REALM_REDIRECT_INDICATION (3011), |
| 45 | |
| 46 | /* Transient Failures */ |
| 47 | DIAMETER_AUTHENTICATION_REJECTED (4001), |
| 48 | DIAMETER_OUT_OF_SPACE (4002), |
| 49 | ELECTION_LOST (4003), |
| 50 | DIAMETER_ERROR_MIP_REPLY_FAILURE (4005), |
| 51 | DIAMETER_ERROR_HA_NOT_AVAILABLE (4006), |
| 52 | DIAMETER_ERROR_BAD_KEY (4007), |
| 53 | DIAMETER_ERROR_MIP_FILTER_NOT_SUPPORTED (4008), |
| 54 | DIAMETER_END_USER_SERVICE_DENIED (4010), |
| 55 | DIAMETER_CREDIT_CONTROL_NOT_APPLICABLE (4011), |
| 56 | DIAMETER_CREDIT_LIMIT_REACHED (4012), |
| 57 | DIAMETER_USER_NAME_REQUIRED (4013), |
| 58 | RESOURCE_FAILURE (4014), |
| 59 | |
| 60 | DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE (4181), |
| 61 | DIAMETER_ERROR_CAMEL_SUBSCRIPTION_PRESENT (4882), |
| 62 | |
| 63 | /* Permanent Failure */ |
| 64 | DIAMETER_AVP_UNSUPPORTED (5001), |
| 65 | DIAMETER_UNKNOWN_SESSION_ID (5002), |
| 66 | DIAMETER_AUTHORIZATION_REJECTED (5003), |
| 67 | DIAMETER_INVALID_AVP_VALUE (5004), |
| 68 | DIAMETER_MISSING_AVP (5005), |
| 69 | DIAMETER_RESOURCES_EXCEEDED (5006), |
| 70 | DIAMETER_CONTRADICTING_AVPS (5007), |
| 71 | DIAMETER_AVP_NOT_ALLOWED (5008), |
| 72 | DIAMETER_AVP_OCCURS_TOO_MANY_TIMES (5009), |
| 73 | DIAMETER_NO_COMMON_APPLICATION (5010), |
| 74 | DIAMETER_UNSUPPORTED_VERSION (5011), |
| 75 | DIAMETER_UNABLE_TO_COMPLY (5012), |
| 76 | DIAMETER_INVALID_BIT_IN_HEADER (5013), |
| 77 | DIAMETER_INVALID_AVP_LENGTH (5014), |
| 78 | DIAMETER_INVALID_MESSAGE_LENGTH (5015), |
| 79 | DIAMETER_INVALID_AVP_BIT_COMBO (5016), |
| 80 | DIAMETER_NO_COMMON_SECURITY (5017), |
| 81 | DIAMETER_RADIUS_AVP_UNTRANSLATABLE (5018), |
| 82 | DIAMETER_ERROR_NO_FOREIGN_HA_SERVICE (5024), |
| 83 | DIAMETER_ERROR_END_TO_END_MIP_KEY_ENCRYPTION (5025), |
| 84 | DIAMETER_USER_UNKNOWN (5030), |
| 85 | DIAMETER_RATING_FAILED (5031), |
| 86 | DIAMETER_ERROR_USER_UNKNOWN (5032), |
| 87 | DIAMETER_ERROR_IDENTITIES_DONT_MATCH (5033), |
| 88 | DIAMETER_ERROR_IDENTITY_NOT_REGISTERED (5034), |
| 89 | DIAMETER_ERROR_ROAMING_NOT_ALLOWED (5035), |
| 90 | DIAMETER_ERROR_IDENTITY_ALREADY_REGISTERED (5036), |
| 91 | DIAMETER_ERROR_AUTH_SCHEME_NOT_SUPPORTED (5037), |
| 92 | DIAMETER_ERROR_IN_ASSIGNMENT_TYPE (5038), |
| 93 | DIAMETER_ERROR_TOO_MUCH_DATA (5039), |
| 94 | DIAMETER_ERROR_NOT_SUPPORTED_USER_DATA (5040), |
| 95 | DIAMETER_ERROR_MIP6_AUTH_MODE (5041), |
| 96 | UNKNOWN_BINDING_TEMPLATE_NAME (5042), |
| 97 | BINDING_FAILURE (5043), |
| 98 | MAX_BINDINGS_SET_FAILURE (5044), |
| 99 | MAXIMUM_BINDINGS_REACHED_FOR_ENDPOINT (5045), |
| 100 | SESSION_EXISTS (5046), |
| 101 | INSUFFICIENT_CLASSIFIERS (5047), |
| 102 | DIAMETER_ERROR_EAP_CODE_UNKNOWN (5048) |
| 103 | }; |
| 104 | |
Pau Espin Pedrol | 7aa4ad8 | 2023-08-28 18:24:24 +0200 | [diff] [blame] | 105 | /* 3GPP TS 29.272 section 7.4. Errors in Experimental-Result-Code */ |
| 106 | type enumerated DIAMETER_ExperimentalResultcode { |
| 107 | /* transient */ |
| 108 | DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE (4181), |
| 109 | DIAMETER_ERROR_CAMEL_SUBSCRIPTION_PRESENT (4182), |
| 110 | /* permanent */ |
| 111 | DIAMETER_ERROR_USER_UNKNOWN (5001), |
| 112 | DIAMETER_AUTHORIZATION_REJECTED (5003), |
| 113 | DIAMETER_ERROR_ROAMING_NOT_ALLOWED (5004), |
| 114 | DIAMETER_MISSING_AVP (5005), |
| 115 | DIAMETER_ERROR_UNKNOWN_EPS_SUBSCRIPTION (5420), |
| 116 | DIAMETER_ERROR_RAT_NOT_ALLOWED (5421), |
| 117 | DIAMETER_ERROR_EQUIPMENT_UNKNOWN (5422), |
| 118 | DIAMETER_ERROR_UNKOWN_SERVING_NODE (5423) |
| 119 | } |
| 120 | |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 121 | /* Gy : 3GPP TS 32.299 7.1.6, RFC4006 3.1 */ |
| 122 | const uint32_t c_DIAMETER_CREDIT_CONTROL_AID := 4; |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 123 | /* 3GPP TS 29.272 Section 7.1.8 */ |
Harald Welte | f9fb63e | 2020-04-26 18:07:19 +0200 | [diff] [blame] | 124 | const uint32_t c_DIAMETER_3GPP_Gx_AID := 16777238; |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 125 | const uint32_t c_DIAMETER_3GPP_S6_AID := 16777251; |
| 126 | const uint32_t c_DIAMETER_3GPP_S13_AID := 16777252; |
| 127 | const uint32_t c_DIAMETER_3GPP_S7_AID := 16777308; |
| 128 | |
Vadim Yanitskiy | 0e8f516 | 2021-12-15 05:00:32 +0300 | [diff] [blame] | 129 | const octetstring c_def_sess_id := char2oct("ttcn3.session"); |
| 130 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 131 | template (value) PDU_DIAMETER |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 132 | ts_DIAMETER(template (value) DIAMETER_Types.BIT8 flags, |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 133 | template (value) Command_Code cmd_code, |
| 134 | template (value) OCTET4 app_id := '00000000'O, |
Vadim Yanitskiy | 00720bd | 2021-12-12 02:05:08 +0300 | [diff] [blame] | 135 | template (value) UINT32 hbh_id := '00000000'O, |
| 136 | template (value) UINT32 ete_id := '00000000'O, |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 137 | template (value) AVP_list avps := {} |
| 138 | ) := { |
| 139 | version := 1, |
| 140 | message_length := 0, /* overwritten */ |
| 141 | RPETxxxx := flags, |
| 142 | command_code := cmd_code, |
| 143 | application_id := app_id, |
| 144 | hop_by_hop_id := hbh_id, |
| 145 | end_to_end_id := ete_id, |
| 146 | avps := avps |
| 147 | } |
| 148 | template (present) PDU_DIAMETER |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 149 | tr_DIAMETER(template (present) DIAMETER_Types.BIT8 flags := ?, |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 150 | template (present) Command_Code cmd_code := ?, |
| 151 | template (present) OCTET4 app_id := ?, |
| 152 | template (present) UINT32 hbh_id := ?, |
| 153 | template (present) UINT32 ete_id := ?, |
| 154 | template (present) AVP_list avps := ?) := { |
| 155 | version := 1, |
| 156 | message_length := ?, |
| 157 | RPETxxxx := flags, |
| 158 | command_code := cmd_code, |
| 159 | application_id := app_id, |
| 160 | hop_by_hop_id := hbh_id, |
| 161 | end_to_end_id := ete_id, |
| 162 | avps := avps |
| 163 | } |
| 164 | template (present) PDU_DIAMETER |
| 165 | tr_DIAMETER_A( |
| 166 | template (present) Command_Code cmd_code := ?, |
| 167 | template (present) OCTET4 app_id := ?, |
| 168 | template (present) UINT32 hbh_id := ?, |
| 169 | template (present) UINT32 ete_id := ?, |
| 170 | template (present) AVP_list avps := ?) := |
| 171 | tr_DIAMETER('0???????'B, cmd_code, app_id, hbh_id, ete_id, avps); |
| 172 | template (present) PDU_DIAMETER |
| 173 | tr_DIAMETER_R( |
| 174 | template (present) Command_Code cmd_code := ?, |
| 175 | template (present) OCTET4 app_id := ?, |
| 176 | template (present) UINT32 hbh_id := ?, |
| 177 | template (present) UINT32 ete_id := ?, |
| 178 | template (present) AVP_list avps := ?) := |
| 179 | tr_DIAMETER('1???????'B, cmd_code, app_id, hbh_id, ete_id, avps); |
| 180 | |
| 181 | |
| 182 | template (value) AVP_Header |
| 183 | ts_DIA_Hdr(template (value) AVP_Code avp_code, |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 184 | template (value) DIAMETER_Types.BIT8 flags := '01000000'B) := { |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 185 | avp_code := avp_code, |
| 186 | VMPxxxxx := flags, |
| 187 | avp_length := 0, /* overwritten */ |
| 188 | vendor_id := omit |
| 189 | } |
| 190 | template (present) AVP_Header |
| 191 | tr_DIA_Hdr(template (present) AVP_Code avp_code, |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 192 | template (present) DIAMETER_Types.BIT8 flags := '0???????'B) := { |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 193 | avp_code := avp_code, |
| 194 | VMPxxxxx := flags, |
| 195 | avp_length := ?, /* overwritten */ |
| 196 | vendor_id := omit |
| 197 | } |
| 198 | |
| 199 | template (value) AVP_Header |
| 200 | ts_DIA_Hdr_3GPP(template (value) AVP_Code avp_code, |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 201 | template (value) DIAMETER_Types.BIT8 flags := '11000000'B) := { |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 202 | avp_code := avp_code, |
| 203 | VMPxxxxx := flags, |
| 204 | avp_length := 0, /* overwritten */ |
| 205 | vendor_id := vendor_id_3GPP |
| 206 | } |
| 207 | template (present) AVP_Header |
| 208 | tr_DIA_Hdr_3GPP(template (present) AVP_Code avp_code, |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 209 | template (present) DIAMETER_Types.BIT8 flags := '1???????'B) := { |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 210 | avp_code := avp_code, |
| 211 | VMPxxxxx := flags, |
| 212 | avp_length := ?, /* overwritten */ |
| 213 | vendor_id := vendor_id_3GPP |
| 214 | } |
| 215 | |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 216 | template (present) AVP_Address tr_AVP_Address(template (present) AddressType addr_type := ?, |
| 217 | template (present) octetstring addr_data := ?) := { |
| 218 | address_type := addr_type, |
| 219 | address_data := addr_data |
| 220 | } |
| 221 | |
| 222 | template (present) GenericAVP tr_AVP_SubcrId(template (present) DCC_NONE_Subscription_Id t) := { |
| 223 | avp := { |
| 224 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Subscription_Id), |
| 225 | avp_data := { |
| 226 | avp_DCC_NONE_Subscription_Id := t |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | |
Pau Espin Pedrol | b8cd34a | 2022-05-18 16:34:12 +0200 | [diff] [blame] | 231 | template (present) GenericAVP tr_AVP_SubcrIdType(template (present) DCC_NONE_Subscription_Id_Type t) := { |
Harald Welte | f9fb63e | 2020-04-26 18:07:19 +0200 | [diff] [blame] | 232 | avp := { |
| 233 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Subscription_Id_Type), |
| 234 | avp_data := { |
| 235 | avp_DCC_NONE_Subscription_Id_Type := t |
| 236 | } |
| 237 | } |
| 238 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 239 | |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 240 | template (present) GenericAVP tr_AVP_SubcrIdData(template (present) DCC_NONE_Subscription_Id_Data t) := { |
| 241 | avp := { |
| 242 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Subscription_Id_Data), |
| 243 | avp_data := { |
| 244 | avp_DCC_NONE_Subscription_Id_Data := t |
| 245 | } |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | template (present) GenericAVP tr_AVP_RequestedAction(template (present) DCC_NONE_Requested_Action t := ?) := { |
| 250 | avp := { |
| 251 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Requested_Action), |
| 252 | avp_data := { |
| 253 | avp_DCC_NONE_Requested_Action := t |
| 254 | } |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | template (present) GenericAVP tr_AVP_MultipleServicesIndicator(template (present) DCC_NONE_Multiple_Services_Indicator t := ?) := { |
| 259 | avp := { |
| 260 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Multiple_Services_Indicator), |
| 261 | avp_data := { |
| 262 | avp_DCC_NONE_Multiple_Services_Indicator := t |
| 263 | } |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | template (present) GenericAVP tr_AVP_ServiceContextId(template (present) DCC_NONE_Service_Context_Id id := ?) := { |
| 268 | avp := { |
| 269 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Service_Context_Id), |
| 270 | avp_data := { |
| 271 | avp_DCC_NONE_Service_Context_Id := id |
| 272 | } |
| 273 | } |
| 274 | } |
| 275 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 276 | template (value) GenericAVP ts_AVP_OriginHost(template (value) charstring host) := { |
| 277 | avp := { |
| 278 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Host), |
| 279 | avp_data := { |
| 280 | avp_BASE_NONE_Origin_Host := host |
| 281 | } |
| 282 | } |
| 283 | } |
| 284 | template (present) GenericAVP tr_AVP_OriginHost(template (present) charstring host := ?) := { |
| 285 | avp := { |
| 286 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Host), |
| 287 | avp_data := { |
| 288 | avp_BASE_NONE_Origin_Host := host |
| 289 | } |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | |
| 294 | template (value) GenericAVP ts_AVP_OriginRealm(template (value) charstring realm) := { |
| 295 | avp := { |
| 296 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Realm), |
| 297 | avp_data := { |
| 298 | avp_BASE_NONE_Origin_Realm := realm |
| 299 | } |
| 300 | } |
| 301 | } |
| 302 | template (present) GenericAVP tr_AVP_OriginRealm(template (present) charstring realm := ?) := { |
| 303 | avp := { |
| 304 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Realm), |
| 305 | avp_data := { |
| 306 | avp_BASE_NONE_Origin_Realm := realm |
| 307 | } |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | |
| 312 | template (value) GenericAVP ts_AVP_OriginStateId(template (value) OCTET4 state_id) := { |
| 313 | avp := { |
| 314 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_State_Id), |
| 315 | avp_data := { |
| 316 | avp_BASE_NONE_Origin_State_Id := state_id |
| 317 | } |
| 318 | } |
| 319 | } |
Vadim Yanitskiy | f28b255 | 2021-12-11 03:49:14 +0300 | [diff] [blame] | 320 | template (present) GenericAVP tr_AVP_OriginStateId(template (present) OCTET4 state_id := ?) := { |
| 321 | avp := { |
| 322 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_State_Id), |
| 323 | avp_data := { |
| 324 | avp_BASE_NONE_Origin_State_Id := state_id |
| 325 | } |
| 326 | } |
| 327 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 328 | |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 329 | template (present) GenericAVP tr_AVP_TerminationCause(template (present) BASE_NONE_Termination_Cause tc) := { |
| 330 | avp := { |
| 331 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Termination_Cause), |
| 332 | avp_data := { |
| 333 | avp_BASE_NONE_Termination_Cause := tc |
| 334 | } |
| 335 | } |
| 336 | } |
| 337 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 338 | template (value) GenericAVP ts_AVP_HostIpAddr(template (value) OCTET4 ipv4_addr) := { |
| 339 | avp := { |
| 340 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Host_IP_Address), |
| 341 | avp_data := { |
| 342 | avp_BASE_NONE_Host_IP_Address := { |
| 343 | address_type := IP, |
| 344 | address_data := ipv4_addr |
| 345 | } |
| 346 | } |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | template (value) GenericAVP ts_AVP_VendorId(Vendor_Id vendor_id) := { |
| 351 | avp := { |
| 352 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id, '00000000'B), |
| 353 | avp_data := { |
| 354 | avp_BASE_NONE_Vendor_Id := int2oct(enum2int(vendor_id), 4) |
| 355 | } |
| 356 | } |
| 357 | } |
Pau Espin Pedrol | 7aa4ad8 | 2023-08-28 18:24:24 +0200 | [diff] [blame] | 358 | private function f_tr_AVP_VendorId(template (present) Vendor_Id vendor_id) |
| 359 | return template (present) BASE_NONE_Vendor_Id { |
| 360 | if (istemplatekind(vendor_id, "?")) { |
| 361 | return ?; |
| 362 | } else { |
| 363 | var template (present) BASE_NONE_Vendor_Id c; |
| 364 | c := int2oct(enum2int(valueof(vendor_id)), 4); |
| 365 | return c; |
| 366 | } |
| 367 | } |
| 368 | template (present) GenericAVP tr_AVP_VendorId(template (present) Vendor_Id vendor_id) := { |
| 369 | avp := { |
| 370 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id), |
| 371 | avp_data := { |
| 372 | avp_BASE_NONE_Vendor_Id := f_tr_AVP_VendorId(vendor_id) |
| 373 | } |
| 374 | } |
| 375 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 376 | |
| 377 | template (value) GenericAVP ts_AVP_ProductName(charstring name) := { |
| 378 | avp := { |
| 379 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Product_Name, '00000000'B), |
| 380 | avp_data := { |
| 381 | avp_BASE_NONE_Product_Name := char2oct(name) |
| 382 | } |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | template (value) GenericAVP ts_AVP_FwRevision(octetstring fw_version) := { |
| 387 | avp := { |
| 388 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Firmware_Revision, '00000000'B), |
| 389 | avp_data := { |
| 390 | avp_BASE_NONE_Firmware_Revision := fw_version |
| 391 | } |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | template (value) GenericAVP ts_AVP_InbSecId(template (value) OCTET4 inb_sec_id) := { |
| 396 | avp := { |
| 397 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Inband_Security_Id), |
| 398 | avp_data := { |
| 399 | avp_BASE_NONE_Inband_Security_Id := inb_sec_id |
| 400 | } |
| 401 | } |
| 402 | } |
| 403 | |
Pau Espin Pedrol | 462f3df | 2023-10-16 18:10:55 +0200 | [diff] [blame] | 404 | private function enum2int_Vendor_Id_tmpl(template Vendor_Id inp) return template integer |
| 405 | { |
| 406 | if (istemplatekind(inp, "omit")) { |
| 407 | return omit; |
| 408 | } else if (istemplatekind(inp, "*")) { |
| 409 | return *; |
| 410 | } else if (istemplatekind(inp, "?")) { |
| 411 | return ?; |
| 412 | } else { |
| 413 | return enum2int(valueof(inp)); |
| 414 | } |
| 415 | } |
| 416 | |
| 417 | template (present) GenericAVP tr_AVP_VendorSpecAppId(template (present) Vendor_Id vendor_id := ?, |
| 418 | template (present) uint32_t auth_app_id := ?) := { |
| 419 | avp := { |
| 420 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Specific_Application_Id), |
| 421 | avp_data := { |
| 422 | avp_BASE_NONE_Vendor_Specific_Application_Id := { |
| 423 | { |
| 424 | avp := { |
| 425 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id), |
| 426 | avp_data := { |
| 427 | avp_BASE_NONE_Vendor_Id := int2oct_tmpl(enum2int_Vendor_Id_tmpl(vendor_id), 4) |
| 428 | } |
| 429 | } |
| 430 | }, { |
| 431 | avp := { |
| 432 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id), |
| 433 | avp_data := { |
| 434 | avp_BASE_NONE_Auth_Application_Id := int2oct_tmpl(auth_app_id, 4) |
| 435 | } |
| 436 | } |
| 437 | } |
| 438 | } |
| 439 | } |
| 440 | } |
| 441 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 442 | template (value) GenericAVP ts_AVP_VendorSpecAppId(Vendor_Id vendor_id, uint32_t auth_app_id) := { |
| 443 | avp := { |
| 444 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Specific_Application_Id), |
| 445 | avp_data := { |
| 446 | avp_BASE_NONE_Vendor_Specific_Application_Id := { |
| 447 | { |
| 448 | avp := { |
| 449 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id), |
| 450 | avp_data := { |
| 451 | avp_BASE_NONE_Vendor_Id := int2oct(enum2int(vendor_id), 4) |
| 452 | } |
| 453 | } |
| 454 | }, { |
| 455 | avp := { |
| 456 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id), |
| 457 | avp_data := { |
| 458 | avp_BASE_NONE_Auth_Application_Id := int2oct(auth_app_id, 4) |
| 459 | } |
| 460 | } |
| 461 | } |
| 462 | } |
| 463 | } |
| 464 | } |
| 465 | } |
| 466 | |
| 467 | template (value) GenericAVP ts_AVP_AuthAppId(template (value) OCTET4 auth_app_id) := { |
| 468 | avp := { |
| 469 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id), |
| 470 | avp_data := { |
| 471 | avp_BASE_NONE_Auth_Application_Id := auth_app_id |
| 472 | } |
| 473 | } |
| 474 | } |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 475 | template (present) GenericAVP tr_AVP_AuthAppId(template (present) OCTET4 auth_app_id := ?) := { |
| 476 | avp := { |
| 477 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id), |
| 478 | avp_data := { |
| 479 | avp_BASE_NONE_Auth_Application_Id := auth_app_id |
| 480 | } |
| 481 | } |
| 482 | } |
| 483 | |
| 484 | template (value) GenericAVP ts_AVP_CcReqType(template (value) DCC_NONE_CC_Request_Type r) := { |
| 485 | avp := { |
| 486 | avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Type), |
| 487 | avp_data := { |
| 488 | avp_DCC_NONE_CC_Request_Type := r |
| 489 | } |
| 490 | } |
| 491 | } |
| 492 | template (present) GenericAVP tr_AVP_CcReqType(template (present) DCC_NONE_CC_Request_Type r := ?) := { |
| 493 | avp := { |
| 494 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Type), |
| 495 | avp_data := { |
| 496 | avp_DCC_NONE_CC_Request_Type := r |
| 497 | } |
| 498 | } |
| 499 | } |
| 500 | |
| 501 | template (value) GenericAVP ts_AVP_CcReqNum(template (value) AVP_Unsigned32 n) := { |
| 502 | avp := { |
| 503 | avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Number), |
| 504 | avp_data := { |
| 505 | avp_DCC_NONE_CC_Request_Number := n |
| 506 | } |
| 507 | } |
| 508 | } |
| 509 | template (present) GenericAVP tr_AVP_CcReqNum(template (present) AVP_Unsigned32 n := ?) := { |
| 510 | avp := { |
| 511 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Number), |
| 512 | avp_data := { |
| 513 | avp_DCC_NONE_CC_Request_Number := n |
| 514 | } |
| 515 | } |
| 516 | } |
| 517 | |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 518 | template (present) GenericAVP tr_AVP_EventTimestamp(template (present) AVP_Unsigned32 n := ?) := { |
| 519 | avp := { |
| 520 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Event_Timestamp), |
| 521 | avp_data := { |
| 522 | avp_BASE_NONE_Event_Timestamp := n |
| 523 | } |
| 524 | } |
| 525 | } |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 526 | |
Pau Espin Pedrol | 7aa4ad8 | 2023-08-28 18:24:24 +0200 | [diff] [blame] | 527 | template (present) GenericAVP tr_AVP_ExperimentalResultCode(template (present) AVP_Unsigned32 n := ?) := { |
| 528 | avp := { |
| 529 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Experimental_Result_Code), |
| 530 | avp_data := { |
| 531 | avp_BASE_NONE_Experimental_Result_Code := n |
| 532 | } |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | template (present) GenericAVP tr_AVP_ExperimentalResult(template (present) Vendor_Id vendor_id := ?, |
| 537 | template (present) AVP_Unsigned32 err_code := ? |
| 538 | ) := { |
| 539 | avp := { |
| 540 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Experimental_Result), |
| 541 | avp_data := { |
| 542 | avp_BASE_NONE_Experimental_Result := { |
| 543 | tr_AVP_VendorId(vendor_id), |
| 544 | tr_AVP_ExperimentalResultCode(err_code) |
| 545 | } |
| 546 | } |
| 547 | } |
| 548 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 549 | |
| 550 | template (value) GenericAVP ts_AVP_SuppVendorIdRaw(uint32_t vendor_id) := { |
| 551 | avp := { |
| 552 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Supported_Vendor_Id), |
| 553 | avp_data := { |
| 554 | avp_BASE_NONE_Supported_Vendor_Id := int2oct(vendor_id, 4) |
| 555 | } |
| 556 | } |
| 557 | } |
| 558 | template (value) GenericAVP ts_AVP_SuppVendorId(Vendor_Id vendor_id) := |
| 559 | ts_AVP_SuppVendorIdRaw(enum2int(vendor_id)); |
| 560 | |
| 561 | template (value) GenericAVP ts_AVP_ResultCode(DIAMETER_Resultcode res_code) := { |
| 562 | avp := { |
| 563 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Result_Code), |
| 564 | avp_data := { |
| 565 | avp_BASE_NONE_Result_Code := int2oct(enum2int(res_code), 4) |
| 566 | } |
| 567 | } |
| 568 | } |
Pau Espin Pedrol | 7aa4ad8 | 2023-08-28 18:24:24 +0200 | [diff] [blame] | 569 | private function f_tr_DIAMETER_Resultcode(template (present) DIAMETER_Resultcode res_code) |
| 570 | return template (present) BASE_NONE_Result_Code { |
| 571 | if (istemplatekind(res_code, "?")) { |
| 572 | return ?; |
| 573 | } else { |
| 574 | var template (present) BASE_NONE_Result_Code c; |
| 575 | c := int2oct(enum2int(valueof(res_code)), 4); |
| 576 | return c; |
| 577 | } |
| 578 | } |
| 579 | template (present) GenericAVP tr_AVP_ResultCode(template (present) DIAMETER_Resultcode res_code) := { |
Vadim Yanitskiy | f28b255 | 2021-12-11 03:49:14 +0300 | [diff] [blame] | 580 | avp := { |
| 581 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Result_Code), |
| 582 | avp_data := { |
Pau Espin Pedrol | 7aa4ad8 | 2023-08-28 18:24:24 +0200 | [diff] [blame] | 583 | avp_BASE_NONE_Result_Code := f_tr_DIAMETER_Resultcode(res_code) |
Vadim Yanitskiy | f28b255 | 2021-12-11 03:49:14 +0300 | [diff] [blame] | 584 | } |
| 585 | } |
| 586 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 587 | |
| 588 | template (value) GenericAVP ts_AVP_AuthSessionState(template (value) BASE_NONE_Auth_Session_State ass := NO_STATE_MAINTAINED) := { |
| 589 | avp := { |
| 590 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Session_State), |
| 591 | avp_data := { |
| 592 | avp_BASE_NONE_Auth_Session_State := ass |
| 593 | } |
| 594 | } |
| 595 | } |
| 596 | template (present) GenericAVP tr_AVP_AuthSessionState(template (present) BASE_NONE_Auth_Session_State ass := ?) := { |
| 597 | avp := { |
| 598 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Session_State), |
| 599 | avp_data := { |
| 600 | avp_BASE_NONE_Auth_Session_State := ass |
| 601 | } |
| 602 | } |
| 603 | } |
| 604 | |
| 605 | template (value) GenericAVP ts_AVP_SessionId(template (value) octetstring session_id) := { |
| 606 | avp := { |
| 607 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Session_Id), |
| 608 | avp_data := { |
| 609 | avp_BASE_NONE_Session_Id := session_id |
| 610 | } |
| 611 | } |
| 612 | } |
| 613 | template (present) GenericAVP tr_AVP_SessionId(template (present) octetstring session_id := ?) := { |
| 614 | avp := { |
| 615 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Session_Id), |
| 616 | avp_data := { |
| 617 | avp_BASE_NONE_Session_Id := session_id |
| 618 | } |
| 619 | } |
| 620 | } |
| 621 | |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 622 | template (present) GenericAVP tr_AVP_DestinationHost(template (present) charstring host := ?) := { |
| 623 | avp := { |
| 624 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Destination_Host), |
| 625 | avp_data := { |
| 626 | avp_BASE_NONE_Destination_Host := host |
| 627 | } |
| 628 | } |
| 629 | } |
| 630 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 631 | /* 3.3 Destination Realm */ |
| 632 | template (value) GenericAVP ts_AVP_DestinationRealm(template (value) charstring dest_realm) := { |
| 633 | avp := { |
| 634 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Destination_Realm), |
| 635 | avp_data := { |
| 636 | avp_BASE_NONE_Destination_Realm := dest_realm |
| 637 | } |
| 638 | } |
| 639 | } |
| 640 | template (present) GenericAVP tr_AVP_DestinationRealm(template (present) charstring dest_realm := ?) := { |
| 641 | avp := { |
| 642 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Destination_Realm), |
| 643 | avp_data := { |
| 644 | avp_BASE_NONE_Destination_Realm := dest_realm |
| 645 | } |
| 646 | } |
| 647 | } |
| 648 | |
| 649 | /* 8.14 User-Name */ |
| 650 | template (value) GenericAVP ts_AVP_UserName(template (value) octetstring uid) := { |
| 651 | avp := { |
| 652 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_User_Name), |
| 653 | avp_data := { |
| 654 | avp_BASE_NONE_User_Name := uid |
| 655 | } |
| 656 | } |
| 657 | } |
| 658 | template (present) GenericAVP tr_AVP_UserName(template (present) octetstring uid := ?) := { |
| 659 | avp := { |
| 660 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_User_Name), |
| 661 | avp_data := { |
| 662 | avp_BASE_NONE_User_Name := uid |
| 663 | } |
| 664 | } |
| 665 | } |
| 666 | template (value) GenericAVP ts_AVP_UserNameImsi(hexstring imsi) := ts_AVP_UserName(char2oct(hex2str(imsi))); |
Pau Espin Pedrol | f4619d8 | 2023-10-16 18:08:07 +0200 | [diff] [blame] | 667 | template (present) GenericAVP tr_AVP_UserNameImsi(template (present) hexstring imsi := ?) := tr_AVP_UserName(char2oct_tmpl(hex2str_tmpl(imsi))); |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 668 | |
| 669 | |
| 670 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 671 | /* TS 29.272 7.3.53 RAND */ |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 672 | template (value) GenericAVP ts_AVP_RAND(template (value) octetstring rand) := { |
| 673 | avp := { |
| 674 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_RAND), |
| 675 | avp_data := { |
| 676 | avp_AAA_3GPP_RAND := rand |
| 677 | } |
| 678 | } |
| 679 | } |
| 680 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 681 | /* TS 29.272 7.3.54 XRES */ |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 682 | template (value) GenericAVP ts_AVP_XRES(template (value) octetstring xres) := { |
| 683 | avp := { |
| 684 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_XRES), |
| 685 | avp_data := { |
| 686 | avp_AAA_3GPP_XRES := xres |
| 687 | } |
| 688 | } |
| 689 | } |
| 690 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 691 | /* TS 29.272 7.3.55 XRES */ |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 692 | template (value) GenericAVP ts_AVP_AUTN(template (value) octetstring autn) := { |
| 693 | avp := { |
| 694 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_AUTN), |
| 695 | avp_data := { |
| 696 | avp_AAA_3GPP_AUTN := autn |
| 697 | } |
| 698 | } |
| 699 | } |
| 700 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 701 | /* TS 29.272 7.3.56 KASME */ |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 702 | template (value) GenericAVP ts_AVP_KASME(template (value) octetstring kasme) := { |
| 703 | avp := { |
| 704 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_KASME), |
| 705 | avp_data := { |
| 706 | avp_AAA_3GPP_KASME := kasme |
| 707 | } |
| 708 | } |
| 709 | } |
| 710 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 711 | /* TS 29.272 7.3.23 Item-Number */ |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 712 | template (value) GenericAVP ts_AVP_ItemNumber(uint32_t num) := { |
| 713 | avp := { |
| 714 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_KASME), |
| 715 | avp_data := { |
| 716 | avp_AAA_3GPP_Item_Number := int2oct(num, 4) |
| 717 | } |
| 718 | } |
| 719 | } |
| 720 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 721 | /* TS 29.272 7.3.18 E-UTRAN Vector */ |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 722 | template (value) GenericAVP ts_AVP_EutranVec(uint32_t item_num, octetstring rand, octetstring xres, |
| 723 | octetstring autn, octetstring kasme) := { |
| 724 | avp := { |
| 725 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_E_UTRAN_Vector), |
| 726 | avp_data := { |
| 727 | avp_AAA_3GPP_E_UTRAN_Vector := { |
| 728 | ts_AVP_ItemNumber(item_num), |
| 729 | ts_AVP_RAND(rand), |
| 730 | ts_AVP_XRES(xres), |
| 731 | ts_AVP_AUTN(autn), |
| 732 | ts_AVP_KASME(kasme) |
| 733 | } |
| 734 | } |
| 735 | } |
| 736 | } |
| 737 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 738 | /* TS 29.272 7.3.2 Subscription-Data */ |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 739 | template (value) GenericAVP ts_AVP_3GPP_SubscriptionData(template (value) AVP_list content) := { |
| 740 | avp := { |
| 741 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscription_Data), |
| 742 | avp_data := { |
| 743 | avp_AAA_3GPP_Subscription_Data := content |
| 744 | } |
| 745 | } |
| 746 | } |
Vadim Yanitskiy | 5e1bdc0 | 2021-12-12 02:33:59 +0300 | [diff] [blame] | 747 | template (present) GenericAVP |
| 748 | tr_AVP_3GPP_SubscriptionData(template (present) AVP_list content := ?) := { |
| 749 | avp := { |
| 750 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscription_Data), |
| 751 | avp_data := { |
| 752 | avp_AAA_3GPP_Subscription_Data := content |
| 753 | } |
| 754 | } |
| 755 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 756 | |
| 757 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 758 | /* TS 29.272 7.3.17 Authentication-Info */ |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 759 | template (value) GenericAVP ts_AVP_3GPP_AuthInfo(template (value) AVP_list content) := { |
| 760 | avp := { |
| 761 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Authentication_Info), |
| 762 | avp_data := { |
| 763 | avp_AAA_3GPP_Authentication_Info := content |
| 764 | } |
| 765 | } |
| 766 | } |
Vadim Yanitskiy | 446edae | 2021-12-12 04:33:08 +0300 | [diff] [blame] | 767 | template (present) GenericAVP |
| 768 | tr_AVP_3GPP_AuthInfo(template (present) AVP_list content := ?) := { |
| 769 | avp := { |
| 770 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Authentication_Info), |
| 771 | avp_data := { |
| 772 | avp_AAA_3GPP_Authentication_Info := content |
| 773 | } |
| 774 | } |
| 775 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 776 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 777 | /* TS 29.272 7.3.9 Visited-PLMN-Id */ |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 778 | template (value) GenericAVP ts_AVP_3GPP_VisitedPlmnId(template (value) octetstring id) := { |
| 779 | avp := { |
| 780 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Visited_PLMN_Id), |
| 781 | avp_data := { |
| 782 | avp_AAA_3GPP_Visited_PLMN_Id := id |
| 783 | } |
| 784 | } |
| 785 | } |
| 786 | template (present) GenericAVP tr_AVP_3GPP_VisitedPlmnId(template (present) octetstring id := ?) := { |
| 787 | avp := { |
| 788 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Visited_PLMN_Id), |
| 789 | avp_data := { |
| 790 | avp_AAA_3GPP_Visited_PLMN_Id := id |
| 791 | } |
| 792 | } |
| 793 | } |
| 794 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 795 | /* TS 29.272 7.3.13 RAT-Type */ |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 796 | template (value) GenericAVP ts_AVP_PCC_3GPP_RatType(template (value) PCC_3GPP_RAT_Type rat_type) := { |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 797 | avp := { |
| 798 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_RAT_Type), |
| 799 | avp_data := { |
| 800 | avp_PCC_3GPP_RAT_Type := rat_type |
| 801 | } |
| 802 | } |
| 803 | } |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 804 | template (present) GenericAVP tr_AVP_PCC_3GPP_RatType(template (present) PCC_3GPP_RAT_Type rat_type := ?) := { |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 805 | avp := { |
| 806 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_RAT_Type), |
| 807 | avp_data := { |
| 808 | avp_PCC_3GPP_RAT_Type := rat_type |
| 809 | } |
| 810 | } |
| 811 | } |
| 812 | |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 813 | template (present) GenericAVP tr_AVP_GI_3GPP_RatType(template (present) GI_3GPP_3GPP_RAT_Type rat_type := ?) := { |
| 814 | avp := { |
| 815 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_RAT_Type), |
| 816 | avp_data := { |
| 817 | avp_GI_3GPP_3GPP_RAT_Type := rat_type |
| 818 | } |
| 819 | } |
| 820 | } |
| 821 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 822 | /* TS 29.272 7.3.7 ULR-Flags */ |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 823 | template (value) GenericAVP ts_AVP_3GPP_UlrFlags(template (value) UINT32 flags) := { |
| 824 | avp := { |
| 825 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULR_Flags), |
| 826 | avp_data := { |
| 827 | avp_AAA_3GPP_ULR_Flags := flags |
| 828 | } |
| 829 | } |
| 830 | } |
| 831 | template (present) GenericAVP tr_AVP_3GPP_UlrFlags(template (present) UINT32 flags := ?) := { |
| 832 | avp := { |
| 833 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULR_Flags), |
| 834 | avp_data := { |
| 835 | avp_AAA_3GPP_ULR_Flags := flags |
| 836 | } |
| 837 | } |
| 838 | } |
| 839 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 840 | /* TS 29.272 7.3.8 ULA-Flags */ |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 841 | template (value) GenericAVP ts_AVP_3GPP_UlaFlags(template (value) UINT32 flags) := { |
| 842 | avp := { |
| 843 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULA_Flags), |
| 844 | avp_data := { |
| 845 | avp_AAA_3GPP_ULA_Flags := flags |
| 846 | } |
| 847 | } |
| 848 | } |
| 849 | template (present) GenericAVP tr_AVP_3GPP_UlaFlags(template (present) UINT32 flags := ?) := { |
| 850 | avp := { |
| 851 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULA_Flags), |
| 852 | avp_data := { |
| 853 | avp_AAA_3GPP_ULA_Flags := flags |
| 854 | } |
| 855 | } |
| 856 | } |
| 857 | |
Harald Welte | 6effabb | 2020-02-18 21:39:59 +0100 | [diff] [blame] | 858 | |
| 859 | |
| 860 | template (value) GenericAVP ts_AVP_NumOfReqVectors(template (value) UINT32 num_req := '00000004'O) := { |
| 861 | avp := { |
| 862 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Number_Of_Requested_Vectors), |
| 863 | avp_data := { |
| 864 | avp_AAA_3GPP_Number_Of_Requested_Vectors := num_req |
| 865 | } |
| 866 | } |
| 867 | } |
| 868 | |
| 869 | template (value) GenericAVP ts_AVP_ImmReqPref(template (value) UINT32 par := '00000000'O) := { |
| 870 | avp := { |
| 871 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Immediate_Response_Preferred), |
| 872 | avp_data := { |
| 873 | avp_AAA_3GPP_Immediate_Response_Preferred := par |
| 874 | } |
| 875 | } |
| 876 | } |
| 877 | |
| 878 | |
| 879 | /* 7.3.11 Requested-EUTRAN-Authentication-Info */ |
| 880 | template (value) GenericAVP ts_AVP_RequestedEutranAuthInfo(template (value) UINT32 num_vec := '00000004'O) := { |
| 881 | avp := { |
| 882 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Requested_EUTRAN_Authentication_Info), |
| 883 | avp_data := { |
| 884 | avp_AAA_3GPP_Requested_EUTRAN_Authentication_Info := { |
| 885 | ts_AVP_NumOfReqVectors(num_vec), |
| 886 | ts_AVP_ImmReqPref('00000000'O) |
| 887 | } |
| 888 | } |
| 889 | } |
| 890 | } |
| 891 | |
| 892 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 893 | /* TS 29.272 7.3.27 Context-Identifier */ |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 894 | template (present) GenericAVP tr_AVP_3GPP_ContextId(template (present) uint32_t ctx := ?) := { |
| 895 | avp := { |
| 896 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Context_Identifier), |
| 897 | avp_data := { |
| 898 | avp_AAA_3GPP_Context_Identifier := int2oct_tmpl(ctx, 4) |
| 899 | } |
| 900 | } |
| 901 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 902 | template (value) GenericAVP ts_AVP_3GPP_ContextId(uint32_t ctx) := { |
| 903 | avp := { |
| 904 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Context_Identifier), |
| 905 | avp_data := { |
| 906 | avp_AAA_3GPP_Context_Identifier := int2oct(ctx, 4) |
| 907 | } |
| 908 | } |
| 909 | } |
| 910 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 911 | /* Ts 29.272 7.3.29 Subscriber-Status */ |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 912 | template (present) GenericAVP tr_AVP_3GPP_SubscriberStatus(template (present) AAA_3GPP_Subscriber_Status sts) := { |
| 913 | avp := { |
| 914 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscriber_Status), |
| 915 | avp_data := { |
| 916 | avp_AAA_3GPP_Subscriber_Status := sts |
| 917 | } |
| 918 | } |
| 919 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 920 | template (value) GenericAVP ts_AVP_3GPP_SubscriberStatus(template (value) AAA_3GPP_Subscriber_Status sts) := { |
| 921 | avp := { |
| 922 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscriber_Status), |
| 923 | avp_data := { |
| 924 | avp_AAA_3GPP_Subscriber_Status := sts |
| 925 | } |
| 926 | } |
| 927 | } |
| 928 | |
Pau Espin Pedrol | d34720f | 2023-10-11 17:49:39 +0200 | [diff] [blame] | 929 | /* Ts 29.272 7.3.30 Operator-Determined-Barring */ |
| 930 | template (present) GenericAVP tr_AVP_3GPP_OperatorDeterminedBarring(template (present) uint32_t val := ?) := { |
| 931 | avp := { |
| 932 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Operator_Determined_Barring), |
| 933 | avp_data := { |
| 934 | avp_AAA_3GPP_Operator_Determined_Barring := int2oct_tmpl(val, 4) |
| 935 | } |
| 936 | } |
| 937 | } |
| 938 | template (value) GenericAVP ts_AVP_3GPP_OperatorDeterminedBarring(uint32_t val) := { |
| 939 | avp := { |
| 940 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Operator_Determined_Barring), |
| 941 | avp_data := { |
| 942 | avp_AAA_3GPP_Operator_Determined_Barring := int2oct(val, 4) |
| 943 | } |
| 944 | } |
| 945 | } |
| 946 | |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 947 | template (present) GenericAVP tr_AVP_3GPP_SubscrRauTauTmr(template (present) uint32_t tmr := ?) := { |
| 948 | avp := { |
| 949 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer), |
| 950 | avp_data := { |
| 951 | avp_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer := int2oct_tmpl(tmr, 4) |
| 952 | } |
| 953 | } |
| 954 | } |
| 955 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 956 | template (value) GenericAVP ts_AVP_3GPP_SubscrRauTauTmr(uint32_t tmr) := { |
| 957 | avp := { |
| 958 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer), |
| 959 | avp_data := { |
| 960 | avp_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer := int2oct(tmr, 4) |
| 961 | } |
| 962 | } |
| 963 | } |
| 964 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 965 | /* TS 29.272 7.3.33 All-APN-Configurations-Included-Indicator */ |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 966 | template (present) GenericAVP tr_AVP_3GPP_AllApnConfigsIncl(template (present) AAA_3GPP_All_APN_Configurations_Included_Indicator ind := ?) := { |
| 967 | avp := { |
| 968 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_All_APN_Configurations_Included_Indicator), |
| 969 | avp_data := { |
| 970 | avp_AAA_3GPP_All_APN_Configurations_Included_Indicator := ind |
| 971 | } |
| 972 | } |
| 973 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 974 | template (value) GenericAVP ts_AVP_3GPP_AllApnConfigsIncl(template (value) AAA_3GPP_All_APN_Configurations_Included_Indicator ind := All_APN_CONFIGURATIONS_INCLUDED) := { |
| 975 | avp := { |
| 976 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_All_APN_Configurations_Included_Indicator), |
| 977 | avp_data := { |
| 978 | avp_AAA_3GPP_All_APN_Configurations_Included_Indicator := ind |
| 979 | } |
| 980 | } |
| 981 | } |
| 982 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 983 | /* TS 29.272 7.3.34 APN-Configuration-Profile */ |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 984 | template (present) GenericAVP tr_AVP_3GPP_ApnConfigProfile(template (present) AVP_list content := ?) := { |
| 985 | avp := { |
| 986 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_APN_Configuration_Profile), |
| 987 | avp_data := { |
| 988 | avp_AAA_3GPP_APN_Configuration_Profile := content |
| 989 | } |
| 990 | } |
| 991 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 992 | template (value) GenericAVP ts_AVP_3GPP_ApnConfigProfile(template (value) AVP_list content) := { |
| 993 | avp := { |
| 994 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_APN_Configuration_Profile), |
| 995 | avp_data := { |
| 996 | avp_AAA_3GPP_APN_Configuration_Profile := content |
| 997 | } |
| 998 | } |
| 999 | } |
| 1000 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 1001 | /* TS 29.272 7.3.35 APN-Configuration */ |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 1002 | template (present) GenericAVP tr_AVP_3GPP_ApnConfig(template (present) uint32_t ctx := ?, |
| 1003 | template (present) AAA_3GPP_PDN_Type pdn_type := ?, |
| 1004 | template (present) charstring apn := ?) := { |
| 1005 | avp := { |
| 1006 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_APN_Configuration), |
| 1007 | avp_data := { |
| 1008 | avp_AAA_3GPP_APN_Configuration := superset( |
| 1009 | tr_AVP_3GPP_ContextId(ctx), |
| 1010 | tr_AVP_3GPP_PdnType(pdn_type), |
| 1011 | tr_AVP_ServiceSelection(apn), |
| 1012 | tr_AVP_3GPP_EpsSubscrQosProfile(?, ?) |
| 1013 | ) |
| 1014 | } |
| 1015 | } |
| 1016 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1017 | template (value) GenericAVP ts_AVP_3GPP_ApnConfig(uint32_t ctx, AAA_3GPP_PDN_Type pdn_type, |
| 1018 | charstring apn) := { |
| 1019 | avp := { |
Pau Espin Pedrol | aaad276 | 2023-10-11 17:35:20 +0200 | [diff] [blame] | 1020 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_APN_Configuration), |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1021 | avp_data := { |
| 1022 | avp_AAA_3GPP_APN_Configuration := { |
| 1023 | ts_AVP_3GPP_ContextId(ctx), |
| 1024 | ts_AVP_3GPP_PdnType(pdn_type), |
Pau Espin Pedrol | aaad276 | 2023-10-11 17:35:20 +0200 | [diff] [blame] | 1025 | ts_AVP_ServiceSelection(apn), |
| 1026 | ts_AVP_3GPP_EpsSubscrQosProfile(1, 1) |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1027 | } |
| 1028 | } |
| 1029 | } |
| 1030 | } |
| 1031 | |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 1032 | /* Service-Selection, TS 29.272 7.3.36, TS 29.273 5.2.3.5, (RFC 5778) */ |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 1033 | template (present) GenericAVP tr_AVP_ServiceSelection(template (present) charstring apn := ?) := { |
| 1034 | avp := { |
| 1035 | avp_header := tr_DIA_Hdr(c_AVP_Code_MIPv6_NONE_Service_Selection), |
| 1036 | avp_data := { |
| 1037 | avp_MIPv6_NONE_Service_Selection := char2oct_tmpl(apn) |
| 1038 | } |
| 1039 | } |
| 1040 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1041 | template (value) GenericAVP ts_AVP_ServiceSelection(charstring apn) := { |
| 1042 | avp := { |
| 1043 | avp_header := ts_DIA_Hdr(c_AVP_Code_MIPv6_NONE_Service_Selection), |
| 1044 | avp_data := { |
| 1045 | avp_MIPv6_NONE_Service_Selection := char2oct(apn) |
| 1046 | } |
| 1047 | } |
| 1048 | } |
| 1049 | |
Pau Espin Pedrol | 6477d73 | 2022-06-03 12:04:40 +0200 | [diff] [blame] | 1050 | template (present) GenericAVP tr_AVP_PCC_3GPP_QoS_Information(template (present) AVP_list list := ?) := { |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 1051 | avp := { |
| 1052 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Information), |
| 1053 | avp_data := { |
| 1054 | avp_PCC_3GPP_QoS_Information := list |
| 1055 | } |
| 1056 | } |
| 1057 | } |
| 1058 | |
Pau Espin Pedrol | 6477d73 | 2022-06-03 12:04:40 +0200 | [diff] [blame] | 1059 | template (value) GenericAVP ts_AVP_PCC_3GPP_QoS_Information(template (value) AVP_list list) := { |
| 1060 | avp := { |
| 1061 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Information), |
| 1062 | avp_data := { |
| 1063 | avp_PCC_3GPP_QoS_Information := list |
| 1064 | } |
| 1065 | } |
| 1066 | } |
| 1067 | |
| 1068 | template (value) GenericAVP ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL(uint32_t val) := { |
| 1069 | avp := { |
| 1070 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL), |
| 1071 | avp_data := { |
| 1072 | avp_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL := int2oct(val, 4) |
| 1073 | } |
| 1074 | } |
| 1075 | } |
| 1076 | |
| 1077 | template (value) GenericAVP ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL(uint32_t val) := { |
| 1078 | avp := { |
| 1079 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL), |
| 1080 | avp_data := { |
| 1081 | avp_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL := int2oct(val, 4) |
| 1082 | } |
| 1083 | } |
| 1084 | } |
| 1085 | |
| 1086 | template (value) GenericAVP ts_AVP_PCC_3GPP_Default_EPS_Bearer_QoS(template (value) AVP_list list) := { |
| 1087 | avp := { |
| 1088 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Default_EPS_Bearer_QoS), |
| 1089 | avp_data := { |
| 1090 | avp_PCC_3GPP_Default_EPS_Bearer_QoS := list |
| 1091 | } |
| 1092 | } |
| 1093 | } |
| 1094 | |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 1095 | template (present) GenericAVP tr_AVP_PCC_3GPP_QoS_Class_Identifier(template (present) uint32_t val := ?) := { |
| 1096 | avp := { |
| 1097 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Class_Identifier), |
| 1098 | avp_data := { |
| 1099 | avp_PCC_3GPP_QoS_Class_Identifier := int2oct_tmpl(val, 4) |
| 1100 | } |
| 1101 | } |
| 1102 | } |
| 1103 | |
Pau Espin Pedrol | 6477d73 | 2022-06-03 12:04:40 +0200 | [diff] [blame] | 1104 | template (value) GenericAVP ts_AVP_PCC_3GPP_QoS_Class_Identifier(uint32_t val) := { |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1105 | avp := { |
| 1106 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Class_Identifier), |
| 1107 | avp_data := { |
Pau Espin Pedrol | 6477d73 | 2022-06-03 12:04:40 +0200 | [diff] [blame] | 1108 | avp_PCC_3GPP_QoS_Class_Identifier := int2oct(val, 4) |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1109 | } |
| 1110 | } |
| 1111 | } |
| 1112 | |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 1113 | template (present) GenericAVP tr_AVP_3GPP_PriorityLevel(template (present) uint32_t prio := ?) := { |
| 1114 | avp := { |
| 1115 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Priority_Level), |
| 1116 | avp_data := { |
| 1117 | avp_PCC_3GPP_Priority_Level := int2oct_tmpl(prio, 4) |
| 1118 | } |
| 1119 | } |
| 1120 | } |
| 1121 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1122 | template (value) GenericAVP ts_AVP_3GPP_PriorityLevel(uint32_t prio) := { |
| 1123 | avp := { |
| 1124 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Priority_Level), |
| 1125 | avp_data := { |
| 1126 | avp_PCC_3GPP_Priority_Level := int2oct(prio, 4) |
| 1127 | } |
| 1128 | } |
| 1129 | } |
| 1130 | |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 1131 | template (present) GenericAVP tr_AVP_PCC_3GPP_AllocRetenPrio(template (present) uint32_t prio := ?) := { |
| 1132 | avp := { |
| 1133 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Allocation_Retention_Priority), |
| 1134 | avp_data := { |
| 1135 | avp_PCC_3GPP_Allocation_Retention_Priority := superset( |
| 1136 | tr_AVP_3GPP_PriorityLevel(prio) |
| 1137 | /* pre-emption capability */ |
| 1138 | /* pre-emption vulnerability */ |
| 1139 | ) |
| 1140 | } |
| 1141 | } |
| 1142 | } |
Pau Espin Pedrol | 6477d73 | 2022-06-03 12:04:40 +0200 | [diff] [blame] | 1143 | template (value) GenericAVP ts_AVP_PCC_3GPP_AllocRetenPrio(uint32_t prio) := { |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1144 | avp := { |
| 1145 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Allocation_Retention_Priority), |
| 1146 | avp_data := { |
| 1147 | avp_PCC_3GPP_Allocation_Retention_Priority := { |
| 1148 | ts_AVP_3GPP_PriorityLevel(prio) |
| 1149 | /* pre-emption capability */ |
| 1150 | /* pre-emption vulnerability */ |
| 1151 | } |
| 1152 | } |
| 1153 | } |
| 1154 | } |
| 1155 | |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 1156 | /* 7.3.37 EPS-Subscribed-QoS-Profile */ |
| 1157 | template (present) GenericAVP tr_AVP_3GPP_EpsSubscrQosProfile(template (present) uint32_t qos_class := ?, |
| 1158 | template (present) uint32_t prio := ?) := { |
| 1159 | avp := { |
| 1160 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_EPS_Subscribed_QoS_Profile), |
| 1161 | avp_data := { |
| 1162 | avp_AAA_3GPP_EPS_Subscribed_QoS_Profile := superset( |
| 1163 | tr_AVP_PCC_3GPP_QoS_Class_Identifier(qos_class), |
| 1164 | tr_AVP_PCC_3GPP_AllocRetenPrio(prio) |
| 1165 | ) |
| 1166 | } |
| 1167 | } |
| 1168 | } |
| 1169 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1170 | template (value) GenericAVP ts_AVP_3GPP_EpsSubscrQosProfile(uint32_t qos_class, uint32_t prio) := { |
| 1171 | avp := { |
| 1172 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_EPS_Subscribed_QoS_Profile), |
| 1173 | avp_data := { |
| 1174 | avp_AAA_3GPP_EPS_Subscribed_QoS_Profile := { |
Pau Espin Pedrol | 6477d73 | 2022-06-03 12:04:40 +0200 | [diff] [blame] | 1175 | ts_AVP_PCC_3GPP_QoS_Class_Identifier(qos_class), |
| 1176 | ts_AVP_PCC_3GPP_AllocRetenPrio(prio) |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1177 | } |
| 1178 | } |
| 1179 | } |
| 1180 | } |
| 1181 | |
| 1182 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 1183 | /* TS 29.272 7.3.41 AMBR */ |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 1184 | template (present) GenericAVP tr_AVP_3GPP_AMBR(template (present) uint32_t ul := ?, template (present) uint32_t dl := ?) := { |
| 1185 | avp := { |
| 1186 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_AMBR), |
| 1187 | avp_data := { |
| 1188 | avp_AAA_3GPP_AMBR := { |
| 1189 | tr_AVP_3GPP_MaxReqBwUL(ul), |
| 1190 | tr_AVP_3GPP_MaxReqBwDL(dl) |
| 1191 | } |
| 1192 | } |
| 1193 | } |
| 1194 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1195 | template (value) GenericAVP ts_AVP_3GPP_AMBR(uint32_t ul, uint32_t dl) := { |
| 1196 | avp := { |
| 1197 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_AMBR), |
| 1198 | avp_data := { |
| 1199 | avp_AAA_3GPP_AMBR := { |
| 1200 | ts_AVP_3GPP_MaxReqBwUL(ul), |
| 1201 | ts_AVP_3GPP_MaxReqBwDL(dl) |
| 1202 | } |
| 1203 | } |
| 1204 | } |
| 1205 | } |
| 1206 | |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 1207 | template (present) GenericAVP tr_AVP_3GPP_MaxReqBwUL(template (present) uint32_t bw := ?) := { |
| 1208 | avp := { |
| 1209 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_RX_3GPP_Max_Requested_Bandwidth_UL), |
| 1210 | avp_data := { |
| 1211 | avp_RX_3GPP_Max_Requested_Bandwidth_UL := int2oct_tmpl(bw, 4) |
| 1212 | } |
| 1213 | } |
| 1214 | } |
| 1215 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1216 | template (value) GenericAVP ts_AVP_3GPP_MaxReqBwUL(uint32_t bw) := { |
| 1217 | avp := { |
| 1218 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_RX_3GPP_Max_Requested_Bandwidth_UL), |
| 1219 | avp_data := { |
| 1220 | avp_RX_3GPP_Max_Requested_Bandwidth_UL := int2oct(bw, 4) |
| 1221 | } |
| 1222 | } |
| 1223 | } |
| 1224 | |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 1225 | template (present) GenericAVP tr_AVP_3GPP_MaxReqBwDL(template (present) uint32_t bw := ?) := { |
| 1226 | avp := { |
| 1227 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_RX_3GPP_Max_Requested_Bandwidth_DL), |
| 1228 | avp_data := { |
| 1229 | avp_RX_3GPP_Max_Requested_Bandwidth_DL := int2oct_tmpl(bw, 4) |
| 1230 | } |
| 1231 | } |
| 1232 | } |
| 1233 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1234 | template (value) GenericAVP ts_AVP_3GPP_MaxReqBwDL(uint32_t bw) := { |
| 1235 | avp := { |
| 1236 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_RX_3GPP_Max_Requested_Bandwidth_DL), |
| 1237 | avp_data := { |
| 1238 | avp_RX_3GPP_Max_Requested_Bandwidth_DL := int2oct(bw, 4) |
| 1239 | } |
| 1240 | } |
| 1241 | } |
| 1242 | |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 1243 | template (present) GenericAVP tr_AVP_3GPP_Reporting_Reason(template (present) DCA_3GPP_Reporting_Reason r := ?) := { |
| 1244 | avp := { |
| 1245 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_Reporting_Reason), |
| 1246 | avp_data := { |
| 1247 | avp_DCA_3GPP_Reporting_Reason := r |
| 1248 | } |
| 1249 | } |
| 1250 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1251 | |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 1252 | template (present) GenericAVP tr_AVP_3GPP_AoCRequestType(template (present) DCA_3GPP_AoC_Request_Type t := ?) := { |
| 1253 | avp := { |
| 1254 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_AoC_Request_Type), |
| 1255 | avp_data := { |
| 1256 | avp_DCA_3GPP_AoC_Request_Type := t |
| 1257 | } |
| 1258 | } |
| 1259 | } |
| 1260 | |
| 1261 | template (present) GenericAVP tr_AVP_3GPP_ServiceInformation(template (present) AVP_list content := ?) := { |
| 1262 | avp := { |
| 1263 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_Service_Information), |
| 1264 | avp_data := { |
| 1265 | avp_DCA_3GPP_Service_Information := content |
| 1266 | } |
| 1267 | } |
| 1268 | } |
| 1269 | |
| 1270 | template (present) GenericAVP tr_AVP_3GPP_PSInformation(template (present) AVP_list content := ?) := { |
| 1271 | avp := { |
| 1272 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_PS_Information), |
| 1273 | avp_data := { |
| 1274 | avp_DCA_3GPP_PS_Information := content |
| 1275 | } |
| 1276 | } |
| 1277 | } |
| 1278 | |
| 1279 | template (present) GenericAVP tr_AVP_3GPP_ChargingId(template (present) AVP_OctetString id := ?) := { |
| 1280 | avp := { |
| 1281 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_Charging_Id), |
| 1282 | avp_data := { |
| 1283 | avp_GI_3GPP_3GPP_Charging_Id := id |
| 1284 | } |
| 1285 | } |
| 1286 | } |
| 1287 | |
| 1288 | template (present) GenericAVP tr_AVP_3GPP_PDPType(template (present) GI_3GPP_3GPP_PDP_Type t := ?) := { |
| 1289 | avp := { |
| 1290 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_PDP_Type), |
| 1291 | avp_data := { |
| 1292 | avp_GI_3GPP_3GPP_PDP_Type := t |
| 1293 | } |
| 1294 | } |
| 1295 | } |
| 1296 | |
| 1297 | template (present) GenericAVP tr_AVP_3GPP_PDPAddress(template (present) DCA_3GPP_PDP_Address addr := ?) := { |
| 1298 | avp := { |
| 1299 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_PDP_Address), |
| 1300 | avp_data := { |
| 1301 | avp_DCA_3GPP_PDP_Address := addr |
| 1302 | } |
| 1303 | } |
| 1304 | } |
| 1305 | |
| 1306 | template (present) GenericAVP tr_AVP_3GPP_SGSNAddress(template (present) DCA_3GPP_SGSN_Address addr := ?) := { |
| 1307 | avp := { |
| 1308 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_SGSN_Address), |
| 1309 | avp_data := { |
| 1310 | avp_DCA_3GPP_SGSN_Address := addr |
| 1311 | } |
| 1312 | } |
| 1313 | } |
| 1314 | |
| 1315 | template (present) GenericAVP tr_AVP_3GPP_GGSNAddress(template (present) DCA_3GPP_GGSN_Address addr := ?) := { |
| 1316 | avp := { |
| 1317 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_GGSN_Address), |
| 1318 | avp_data := { |
| 1319 | avp_DCA_3GPP_GGSN_Address := addr |
| 1320 | } |
| 1321 | } |
| 1322 | } |
| 1323 | |
| 1324 | template (present) GenericAVP tr_AVP_3GPP_SelectionMode(template (present) GI_3GPP_3GPP_Selection_Mode sm := ?) := { |
| 1325 | avp := { |
| 1326 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_Selection_Mode), |
| 1327 | avp_data := { |
| 1328 | avp_GI_3GPP_3GPP_Selection_Mode := sm |
| 1329 | } |
| 1330 | } |
| 1331 | } |
| 1332 | |
| 1333 | template (present) GenericAVP tr_AVP_3GPP_ChargingCharacteristics(template (present) GI_3GPP_3GPP_Charging_Characteristics cc := ?) := { |
| 1334 | avp := { |
| 1335 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_Charging_Characteristics), |
| 1336 | avp_data := { |
| 1337 | avp_GI_3GPP_3GPP_Charging_Characteristics := cc |
| 1338 | } |
| 1339 | } |
| 1340 | } |
| 1341 | |
| 1342 | template (present) GenericAVP tr_AVP_3GPP_SGSNMCCMNC(template (present) GI_3GPP_3GPP_SGSN_MCC_MNC smn := ?) := { |
| 1343 | avp := { |
| 1344 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_SGSN_MCC_MNC), |
| 1345 | avp_data := { |
| 1346 | avp_GI_3GPP_3GPP_SGSN_MCC_MNC := smn |
| 1347 | } |
| 1348 | } |
| 1349 | } |
| 1350 | |
| 1351 | template (present) GenericAVP tr_AVP_3GPP_NSAPI(template (present) GI_3GPP_3GPP_NSAPI nsapi := ?) := { |
| 1352 | avp := { |
| 1353 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_NSAPI), |
| 1354 | avp_data := { |
| 1355 | avp_GI_3GPP_3GPP_NSAPI := nsapi |
| 1356 | } |
| 1357 | } |
| 1358 | } |
| 1359 | |
| 1360 | template (present) GenericAVP tr_AVP_3GPP_MS_TimeZone(template (present) GI_3GPP_3GPP_MS_TimeZone ms_tz := ?) := { |
| 1361 | avp := { |
| 1362 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_MS_TimeZone), |
| 1363 | avp_data := { |
| 1364 | avp_GI_3GPP_3GPP_MS_TimeZone := ms_tz |
| 1365 | } |
| 1366 | } |
| 1367 | } |
| 1368 | |
| 1369 | template (present) GenericAVP tr_AVP_3GPP_ULI(template (present) GI_3GPP_3GPP_User_Location_Info uli := ?) := { |
| 1370 | avp := { |
| 1371 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_User_Location_Info), |
| 1372 | avp_data := { |
| 1373 | avp_GI_3GPP_3GPP_User_Location_Info := uli |
| 1374 | } |
| 1375 | } |
| 1376 | } |
| 1377 | |
| 1378 | template (present) GenericAVP tr_AVP_UserEquipmentInfo(template (present) DCC_NONE_User_Equipment_Info uei := ?) := { |
| 1379 | avp := { |
| 1380 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_User_Equipment_Info), |
| 1381 | avp_data := { |
| 1382 | avp_DCC_NONE_User_Equipment_Info := uei |
| 1383 | } |
| 1384 | } |
| 1385 | } |
| 1386 | |
| 1387 | template (present) GenericAVP tr_AVP_UserEquipmentInfoType(template (present) DCC_NONE_User_Equipment_Info_Type ueit := ?) := { |
| 1388 | avp := { |
| 1389 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_User_Equipment_Info_Type), |
| 1390 | avp_data := { |
| 1391 | avp_DCC_NONE_User_Equipment_Info_Type := ueit |
| 1392 | } |
| 1393 | } |
| 1394 | } |
| 1395 | |
| 1396 | template (present) GenericAVP tr_AVP_UserEquipmentInfoValue(template (present) DCC_NONE_User_Equipment_Info_Value ueiv := ?) := { |
| 1397 | avp := { |
| 1398 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_User_Equipment_Info_Value), |
| 1399 | avp_data := { |
| 1400 | avp_DCC_NONE_User_Equipment_Info_Value := ueiv |
| 1401 | } |
| 1402 | } |
| 1403 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1404 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 1405 | /* TS 29.272 7.3.62 PDN-Type */ |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 1406 | template (present) GenericAVP tr_AVP_3GPP_PdnType(template (present) AAA_3GPP_PDN_Type pdn_type := ?) := { |
| 1407 | avp := { |
| 1408 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_PDN_Type), |
| 1409 | avp_data := { |
| 1410 | avp_AAA_3GPP_PDN_Type := pdn_type |
| 1411 | } |
| 1412 | } |
| 1413 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1414 | template (value) GenericAVP ts_AVP_3GPP_PdnType(template (value) AAA_3GPP_PDN_Type pdn_type) := { |
| 1415 | avp := { |
| 1416 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_PDN_Type), |
| 1417 | avp_data := { |
| 1418 | avp_AAA_3GPP_PDN_Type := pdn_type |
| 1419 | } |
| 1420 | } |
| 1421 | } |
| 1422 | |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 1423 | /* RFC4006 8.16 Multiple-Services-Credit-Control AVP */ |
| 1424 | template (value) GenericAVP ts_AVP_Multiple_Services_Credit_Control(template (value) AVP_list content) := { |
| 1425 | avp := { |
| 1426 | avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_Multiple_Services_Credit_Control), |
| 1427 | avp_data := { |
| 1428 | avp_DCC_NONE_Multiple_Services_Credit_Control := content |
| 1429 | } |
| 1430 | } |
| 1431 | } |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 1432 | template (present) GenericAVP tr_AVP_Multiple_Services_Credit_Control(template (present) AVP_list content := ?) := { |
| 1433 | avp := { |
| 1434 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Multiple_Services_Credit_Control), |
| 1435 | avp_data := { |
| 1436 | avp_DCC_NONE_Multiple_Services_Credit_Control := content |
| 1437 | } |
| 1438 | } |
| 1439 | } |
| 1440 | |
| 1441 | /* Requested-Service-Unit AVP */ |
| 1442 | template (present) GenericAVP tr_AVP_Requested_Service_Unit(template (present) AVP_list content := ?) := { |
| 1443 | avp := { |
| 1444 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Requested_Service_Unit), |
| 1445 | avp_data := { |
| 1446 | avp_DCC_NONE_Requested_Service_Unit := content |
| 1447 | } |
| 1448 | } |
| 1449 | } |
| 1450 | |
| 1451 | /* Used-Service-Unit AVP */ |
| 1452 | template (present) GenericAVP tr_AVP_Used_Service_Unit(template (present) AVP_list content := ?) := { |
| 1453 | avp := { |
| 1454 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Used_Service_Unit), |
| 1455 | avp_data := { |
| 1456 | avp_DCC_NONE_Used_Service_Unit := content |
| 1457 | } |
| 1458 | } |
| 1459 | } |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 1460 | |
| 1461 | /* RFC4006 8.17 Granted-Service-Unit AVP */ |
| 1462 | template (value) GenericAVP ts_AVP_Granted_Service_Unit(template (value) AVP_list content) := { |
| 1463 | avp := { |
| 1464 | avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_Granted_Service_Unit), |
| 1465 | avp_data := { |
| 1466 | avp_DCC_NONE_Granted_Service_Unit := content |
| 1467 | } |
| 1468 | } |
| 1469 | } |
| 1470 | |
| 1471 | /* RFC4006 8.21 CC-Time AVP */ |
| 1472 | template (value) GenericAVP ts_AVP_CC_Time(uint32_t cc_time_val) := { |
| 1473 | avp := { |
| 1474 | avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Time), |
| 1475 | avp_data := { |
| 1476 | avp_DCC_NONE_CC_Time := int2oct(cc_time_val, 4) |
| 1477 | } |
| 1478 | } |
| 1479 | } |
| 1480 | |
| 1481 | /* RFC4006 8.23 CC-Total-Octets AVP */ |
| 1482 | template (value) GenericAVP ts_AVP_CC_Total_Octets(uint64_t cc_total_octets_val) := { |
| 1483 | avp := { |
| 1484 | avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Total_Octets), |
| 1485 | avp_data := { |
| 1486 | avp_DCC_NONE_CC_Total_Octets := int2oct(cc_total_octets_val, 8) |
| 1487 | } |
| 1488 | } |
| 1489 | } |
| 1490 | |
| 1491 | /* RFC4006 8.33 Validity-Time AVP */ |
| 1492 | template (value) GenericAVP ts_AVP_Validity_Time(uint32_t validity_time_val) := { |
| 1493 | avp := { |
| 1494 | avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_Validity_Time), |
| 1495 | avp_data := { |
| 1496 | avp_DCC_NONE_Validity_Time := int2oct(validity_time_val, 4) |
| 1497 | } |
| 1498 | } |
| 1499 | } |
| 1500 | |
Pau Espin Pedrol | 52562c9 | 2022-05-23 15:45:46 +0200 | [diff] [blame] | 1501 | template (value) GenericAVP ts_AVP_3GPP_VolumeQuotaThreshold(uint32_t volume_quota_thresh_val) := { |
| 1502 | avp := { |
| 1503 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_Volume_Quota_Threshold), |
| 1504 | avp_data := { |
| 1505 | avp_DCA_3GPP_Volume_Quota_Threshold := int2oct(volume_quota_thresh_val, 4) |
| 1506 | } |
| 1507 | } |
| 1508 | } |
| 1509 | |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 1510 | template (present) GenericAVP tr_AVP_3GPP_CalledStationId(template (present) DNAS_NONE_Called_Station_Id id := ?) := { |
| 1511 | avp := { |
| 1512 | avp_header := tr_DIA_Hdr(c_AVP_Code_DNAS_NONE_Called_Station_Id), |
| 1513 | avp_data := { |
| 1514 | avp_DNAS_NONE_Called_Station_Id := id |
| 1515 | } |
| 1516 | } |
| 1517 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1518 | |
Pau Espin Pedrol | 44b7520 | 2023-10-23 14:37:24 +0200 | [diff] [blame] | 1519 | /* RFC6733 8.7. Auth-Request-Type AVP */ |
| 1520 | template (value) GenericAVP ts_AVP_AuthRequestType(BASE_NONE_Auth_Request_Type auth_req_type) := { |
| 1521 | avp := { |
| 1522 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Request_Type, '00000000'B), |
| 1523 | avp_data := { |
| 1524 | avp_BASE_NONE_Auth_Request_Type := auth_req_type |
| 1525 | } |
| 1526 | } |
| 1527 | } |
| 1528 | template (present) GenericAVP tr_AVP_AuthRequestType(template (present) BASE_NONE_Auth_Request_Type auth_req_type) := { |
| 1529 | avp := { |
| 1530 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Request_Type), |
| 1531 | avp_data := { |
| 1532 | avp_BASE_NONE_Auth_Request_Type := auth_req_type |
| 1533 | } |
| 1534 | } |
| 1535 | } |
| 1536 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1537 | |
Vadim Yanitskiy | 0d6cbd3 | 2023-02-11 08:07:27 +0700 | [diff] [blame] | 1538 | /* 5.3.1 Capabilities Exchange Request */ |
| 1539 | template (value) PDU_DIAMETER |
| 1540 | ts_DIA_CER(octetstring host_ip, uint32_t vendor_app_id, |
| 1541 | template (value) charstring orig_host := "ttcn3.localdomain", |
| 1542 | template (value) charstring orig_realm := "localdomain", |
| 1543 | template (value) UINT32 hbh_id := '00000000'O, |
| 1544 | template (value) UINT32 ete_id := '00000000'O) := |
| 1545 | ts_DIAMETER(flags := '10000000'B, |
| 1546 | cmd_code := Capabilities_Exchange, |
| 1547 | hbh_id := hbh_id, |
| 1548 | ete_id := ete_id, |
| 1549 | avps := { |
| 1550 | ts_AVP_OriginHost(orig_host), |
| 1551 | ts_AVP_OriginRealm(orig_realm), |
| 1552 | ts_AVP_HostIpAddr(host_ip), |
| 1553 | ts_AVP_VendorId(vendor_id_3GPP), |
| 1554 | ts_AVP_ProductName("TTCN-3 Testsuite"), |
| 1555 | ts_AVP_FwRevision('00000000'O), |
| 1556 | ts_AVP_InbSecId('00000000'O), |
| 1557 | ts_AVP_AuthAppId('FFFFFFFF'O), |
| 1558 | ts_AVP_VendorSpecAppId(vendor_id_3GPP, vendor_app_id) |
| 1559 | }); |
| 1560 | |
| 1561 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1562 | /* 5.3.2 Capabilities Exchange Answer */ |
| 1563 | template (value) PDU_DIAMETER |
Pau Espin Pedrol | 33b4749 | 2022-03-08 17:43:01 +0100 | [diff] [blame] | 1564 | ts_DIA_CEA_AUTH_APP_ID(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, |
| 1565 | template (value) charstring origin_host, |
| 1566 | template (value) charstring origin_realm, |
| 1567 | template (value) octetstring host_ip, uint32_t auth_app_id) |
| 1568 | := ts_DIAMETER(flags:='00000000'B, cmd_code:=Capabilities_Exchange, hbh_id:=hbh_id, ete_id:=ete_id, |
| 1569 | avps := { |
| 1570 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1571 | ts_AVP_OriginHost(origin_host), |
| 1572 | ts_AVP_OriginRealm(origin_realm), |
| 1573 | ts_AVP_HostIpAddr(host_ip), |
| 1574 | ts_AVP_VendorId(vendor_id_3GPP), |
| 1575 | ts_AVP_ProductName("TTCN-3 Testsuite"), |
| 1576 | ts_AVP_OriginStateId('00000001'O), |
| 1577 | ts_AVP_SuppVendorIdRaw(5535), /* 3GPP2 */ |
| 1578 | ts_AVP_SuppVendorId(vendor_id_3GPP), |
| 1579 | ts_AVP_SuppVendorIdRaw(13019), /* ETSI */ |
Pau Espin Pedrol | 33b4749 | 2022-03-08 17:43:01 +0100 | [diff] [blame] | 1580 | ts_AVP_AuthAppId(int2oct(auth_app_id, 4)), |
| 1581 | ts_AVP_InbSecId('00000000'O) |
| 1582 | }); |
| 1583 | template (value) PDU_DIAMETER |
| 1584 | ts_DIA_CEA_VENDOR_APP_ID(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, |
| 1585 | template (value) charstring origin_host, |
| 1586 | template (value) charstring origin_realm, |
| 1587 | template (value) octetstring host_ip, uint32_t vendor_app_id) |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1588 | := ts_DIAMETER(flags:='00000000'B, cmd_code:=Capabilities_Exchange, hbh_id:=hbh_id, ete_id:=ete_id, |
| 1589 | avps := { |
| 1590 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
Harald Welte | 61f73d5 | 2020-04-26 21:41:12 +0200 | [diff] [blame] | 1591 | ts_AVP_OriginHost(origin_host), |
| 1592 | ts_AVP_OriginRealm(origin_realm), |
| 1593 | ts_AVP_HostIpAddr(host_ip), |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1594 | ts_AVP_VendorId(vendor_id_3GPP), |
| 1595 | ts_AVP_ProductName("TTCN-3 Testsuite"), |
| 1596 | ts_AVP_OriginStateId('00000001'O), |
| 1597 | ts_AVP_SuppVendorIdRaw(5535), /* 3GPP2 */ |
| 1598 | ts_AVP_SuppVendorId(vendor_id_3GPP), |
| 1599 | ts_AVP_SuppVendorIdRaw(13019), /* ETSI */ |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1600 | ts_AVP_InbSecId('00000000'O), |
Harald Welte | 61f73d5 | 2020-04-26 21:41:12 +0200 | [diff] [blame] | 1601 | ts_AVP_VendorSpecAppId(vendor_id_3GPP, vendor_app_id) |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1602 | }); |
Pau Espin Pedrol | 33b4749 | 2022-03-08 17:43:01 +0100 | [diff] [blame] | 1603 | function f_ts_DIA_CEA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, |
| 1604 | template (value) charstring origin_host, |
| 1605 | template (value) charstring origin_realm, |
| 1606 | template (value) octetstring host_ip, template (omit) uint32_t auth_app_id, |
| 1607 | template (omit) uint32_t vendor_app_id) |
| 1608 | return template (value) PDU_DIAMETER |
| 1609 | { |
| 1610 | var template (value) PDU_DIAMETER diam_pdu; |
| 1611 | if (istemplatekind(vendor_app_id, "omit")) { |
| 1612 | diam_pdu := ts_DIA_CEA_AUTH_APP_ID(hbh_id, ete_id, origin_host, origin_realm, host_ip, valueof(auth_app_id)); |
| 1613 | } else { |
| 1614 | diam_pdu := ts_DIA_CEA_VENDOR_APP_ID(hbh_id, ete_id, origin_host, origin_realm, host_ip, valueof(vendor_app_id)); |
| 1615 | } |
| 1616 | return diam_pdu; |
| 1617 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1618 | |
Harald Welte | 6effabb | 2020-02-18 21:39:59 +0100 | [diff] [blame] | 1619 | |
| 1620 | template (value) PDU_DIAMETER |
Vadim Yanitskiy | 2dba494 | 2021-12-11 15:46:30 +0300 | [diff] [blame] | 1621 | ts_DIA_AIR(/* template (value) */ hexstring imsi, |
Vadim Yanitskiy | 59ef8e5 | 2023-02-07 23:38:29 +0700 | [diff] [blame] | 1622 | template (value) octetstring mcc_mnc := '111F11'O, |
Vadim Yanitskiy | 2dba494 | 2021-12-11 15:46:30 +0300 | [diff] [blame] | 1623 | template (value) octetstring sess_id := c_def_sess_id, |
Vadim Yanitskiy | b57ef87 | 2021-12-12 04:14:18 +0300 | [diff] [blame] | 1624 | template (value) charstring orig_host := "ttcn3.localdomain", |
| 1625 | template (value) charstring orig_realm := "localdomain", |
Vadim Yanitskiy | 2dba494 | 2021-12-11 15:46:30 +0300 | [diff] [blame] | 1626 | template (value) charstring dest_realm := "localdomain", |
| 1627 | template (value) UINT32 hbh_id := '00000000'O, |
| 1628 | template (value) UINT32 ete_id := '00000000'O) := |
Vadim Yanitskiy | 21fd7db | 2021-12-15 05:29:35 +0300 | [diff] [blame] | 1629 | ts_DIAMETER(flags := '11000000'B, |
Vadim Yanitskiy | 2dba494 | 2021-12-11 15:46:30 +0300 | [diff] [blame] | 1630 | cmd_code := Authentication_Information, |
Vadim Yanitskiy | 463d826 | 2021-12-11 16:50:46 +0300 | [diff] [blame] | 1631 | app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
Vadim Yanitskiy | 2dba494 | 2021-12-11 15:46:30 +0300 | [diff] [blame] | 1632 | hbh_id := hbh_id, |
| 1633 | ete_id := ete_id, |
| 1634 | avps := { |
| 1635 | ts_AVP_SessionId(sess_id), |
| 1636 | ts_AVP_DestinationRealm(dest_realm), |
Vadim Yanitskiy | b57ef87 | 2021-12-12 04:14:18 +0300 | [diff] [blame] | 1637 | ts_AVP_OriginHost(orig_host), |
| 1638 | ts_AVP_OriginRealm(orig_realm), |
Vadim Yanitskiy | 2dba494 | 2021-12-11 15:46:30 +0300 | [diff] [blame] | 1639 | ts_AVP_UserNameImsi(imsi), |
| 1640 | /* Requested EUTRAN Auth Info */ |
| 1641 | ts_AVP_RequestedEutranAuthInfo, |
Vadim Yanitskiy | b57ef87 | 2021-12-12 04:14:18 +0300 | [diff] [blame] | 1642 | ts_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
Vadim Yanitskiy | 59ef8e5 | 2023-02-07 23:38:29 +0700 | [diff] [blame] | 1643 | ts_AVP_3GPP_VisitedPlmnId(mcc_mnc) |
Harald Welte | 6effabb | 2020-02-18 21:39:59 +0100 | [diff] [blame] | 1644 | }); |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1645 | template (present) PDU_DIAMETER |
Vadim Yanitskiy | 2dba494 | 2021-12-11 15:46:30 +0300 | [diff] [blame] | 1646 | tr_DIA_AIR(/* template (present) */ hexstring imsi, |
| 1647 | template (present) octetstring sess_id := ?, |
| 1648 | template (present) charstring dest_realm := ?, |
| 1649 | template (present) UINT32 hbh_id := ?, |
| 1650 | template (present) UINT32 ete_id := ?) := |
Vadim Yanitskiy | 21fd7db | 2021-12-15 05:29:35 +0300 | [diff] [blame] | 1651 | tr_DIAMETER(flags := '1???????'B, |
Vadim Yanitskiy | 2dba494 | 2021-12-11 15:46:30 +0300 | [diff] [blame] | 1652 | cmd_code := Authentication_Information, |
| 1653 | app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| 1654 | hbh_id := hbh_id, ete_id := ete_id, |
| 1655 | avps := superset( |
| 1656 | tr_AVP_SessionId(sess_id), |
| 1657 | tr_AVP_DestinationRealm(dest_realm), |
| 1658 | tr_AVP_UserNameImsi(imsi), |
| 1659 | tr_AVP_3GPP_VisitedPlmnId |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1660 | )); |
| 1661 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 1662 | /* TS 29.272 5.2.3.1 + 7.2.6 Authentication Information Answer */ |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1663 | template (value) PDU_DIAMETER |
Vadim Yanitskiy | 2dba494 | 2021-12-11 15:46:30 +0300 | [diff] [blame] | 1664 | ts_DIA_AIA(template (value) AVP_list auth_info_contents, |
| 1665 | template (value) octetstring sess_id := c_def_sess_id, |
| 1666 | template (value) charstring orig_host := "hss.localdomain", |
| 1667 | template (value) charstring orig_realm := "localdomain", |
| 1668 | template (value) UINT32 hbh_id := '00000000'O, |
| 1669 | template (value) UINT32 ete_id := '00000000'O) := |
| 1670 | ts_DIAMETER(flags := '01000000'B, |
| 1671 | cmd_code := Authentication_Information, |
| 1672 | app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| 1673 | hbh_id := hbh_id, |
| 1674 | ete_id := ete_id, |
| 1675 | avps := { |
| 1676 | ts_AVP_SessionId(sess_id), |
| 1677 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1678 | ts_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
| 1679 | ts_AVP_OriginHost(orig_host), |
| 1680 | ts_AVP_OriginRealm(orig_realm), |
| 1681 | ts_AVP_3GPP_AuthInfo(auth_info_contents) |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1682 | }); |
Vadim Yanitskiy | 446edae | 2021-12-12 04:33:08 +0300 | [diff] [blame] | 1683 | template (present) PDU_DIAMETER |
| 1684 | tr_DIA_AIA(template (present) AVP_list auth_info_contents := ?, |
| 1685 | template (present) octetstring sess_id := ?, |
| 1686 | template (present) charstring orig_host := ?, |
| 1687 | template (present) charstring orig_realm := ?, |
| 1688 | template (present) UINT32 hbh_id := ?, |
| 1689 | template (present) UINT32 ete_id := ?) := |
| 1690 | tr_DIAMETER(flags := '0???????'B, |
| 1691 | cmd_code := Authentication_Information, |
| 1692 | app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| 1693 | hbh_id := hbh_id, |
| 1694 | ete_id := ete_id, |
| 1695 | avps := superset( |
| 1696 | tr_AVP_SessionId(sess_id), |
Vadim Yanitskiy | 446edae | 2021-12-12 04:33:08 +0300 | [diff] [blame] | 1697 | tr_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
Vadim Yanitskiy | 446edae | 2021-12-12 04:33:08 +0300 | [diff] [blame] | 1698 | tr_AVP_OriginHost(orig_host), |
Pau Espin Pedrol | 7bedcf8 | 2023-08-24 19:33:49 +0200 | [diff] [blame] | 1699 | tr_AVP_OriginRealm(orig_realm), |
| 1700 | tr_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1701 | tr_AVP_3GPP_AuthInfo(auth_info_contents) |
Vadim Yanitskiy | 446edae | 2021-12-12 04:33:08 +0300 | [diff] [blame] | 1702 | )); |
Pau Espin Pedrol | 7aa4ad8 | 2023-08-28 18:24:24 +0200 | [diff] [blame] | 1703 | template (present) PDU_DIAMETER |
| 1704 | tr_DIA_AIA_ERR(template (present) GenericAVP err_avp := ?, |
| 1705 | template (present) octetstring sess_id := ?, |
| 1706 | template (present) charstring orig_host := ?, |
| 1707 | template (present) charstring orig_realm := ?, |
| 1708 | template (present) UINT32 hbh_id := ?, |
| 1709 | template (present) UINT32 ete_id := ?) := |
| 1710 | tr_DIAMETER(flags := '0???????'B, |
| 1711 | cmd_code := Authentication_Information, |
| 1712 | app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| 1713 | hbh_id := hbh_id, |
| 1714 | ete_id := ete_id, |
| 1715 | avps := superset( |
| 1716 | tr_AVP_SessionId(sess_id), |
| 1717 | tr_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
| 1718 | tr_AVP_OriginHost(orig_host), |
| 1719 | tr_AVP_OriginRealm(orig_realm), |
| 1720 | err_avp |
| 1721 | )); |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1722 | |
| 1723 | |
Harald Welte | 40b1e00 | 2023-01-27 17:26:39 +0100 | [diff] [blame] | 1724 | /* TS 29.272 7.2.3 Update Location Request */ |
Vadim Yanitskiy | 5e1bdc0 | 2021-12-12 02:33:59 +0300 | [diff] [blame] | 1725 | template (value) PDU_DIAMETER |
| 1726 | ts_DIA_ULR(/* template (value) */ hexstring imsi, |
Vadim Yanitskiy | 59ef8e5 | 2023-02-07 23:38:29 +0700 | [diff] [blame] | 1727 | template (value) octetstring mcc_mnc := '111F11'O, |
Vadim Yanitskiy | 5e1bdc0 | 2021-12-12 02:33:59 +0300 | [diff] [blame] | 1728 | template (value) octetstring sess_id := c_def_sess_id, |
| 1729 | template (value) charstring orig_host := "ttcn3.localdomain", |
| 1730 | template (value) charstring orig_realm := "localdomain", |
| 1731 | template (value) charstring dest_realm := "localdomain", |
| 1732 | template (value) UINT32 hbh_id := '00000000'O, |
| 1733 | template (value) UINT32 ete_id := '00000000'O) := |
| 1734 | ts_DIAMETER(flags := '11000000'B, |
| 1735 | cmd_code := Update_Location, |
| 1736 | app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| 1737 | hbh_id := hbh_id, |
| 1738 | ete_id := ete_id, |
| 1739 | avps := { |
| 1740 | ts_AVP_SessionId(sess_id), |
| 1741 | ts_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
| 1742 | ts_AVP_UserNameImsi(imsi), |
| 1743 | ts_AVP_3GPP_UlrFlags('00000000'O), |
Vadim Yanitskiy | 59ef8e5 | 2023-02-07 23:38:29 +0700 | [diff] [blame] | 1744 | ts_AVP_3GPP_VisitedPlmnId(mcc_mnc), |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 1745 | ts_AVP_PCC_3GPP_RatType(EUTRAN), |
Vadim Yanitskiy | 5e1bdc0 | 2021-12-12 02:33:59 +0300 | [diff] [blame] | 1746 | ts_AVP_OriginHost(orig_host), |
| 1747 | ts_AVP_OriginRealm(orig_realm), |
| 1748 | ts_AVP_DestinationRealm(dest_realm) |
| 1749 | }); |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1750 | template (present) PDU_DIAMETER |
Vadim Yanitskiy | 0e8f516 | 2021-12-15 05:00:32 +0300 | [diff] [blame] | 1751 | tr_DIA_ULR(/* template (present) */ hexstring imsi, |
| 1752 | template (present) octetstring sess_id := ?, |
| 1753 | template (present) charstring orig_host := ?, |
| 1754 | template (present) charstring orig_realm := ?, |
| 1755 | template (present) charstring dest_realm := ?, |
| 1756 | template (present) UINT32 hbh_id := ?, |
| 1757 | template (present) UINT32 ete_id := ?) := |
| 1758 | tr_DIAMETER(flags := '11000000'B, |
| 1759 | cmd_code := Update_Location, |
| 1760 | app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| 1761 | hbh_id := hbh_id, |
| 1762 | ete_id := ete_id, |
| 1763 | avps := superset( |
| 1764 | tr_AVP_SessionId(sess_id), |
| 1765 | tr_AVP_AuthSessionState, |
| 1766 | tr_AVP_OriginHost(orig_host), |
| 1767 | tr_AVP_OriginRealm(orig_realm), |
| 1768 | tr_AVP_DestinationRealm(dest_realm), |
| 1769 | tr_AVP_UserNameImsi(imsi), |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 1770 | tr_AVP_PCC_3GPP_RatType, |
Vadim Yanitskiy | 0e8f516 | 2021-12-15 05:00:32 +0300 | [diff] [blame] | 1771 | tr_AVP_3GPP_UlrFlags, |
| 1772 | tr_AVP_3GPP_VisitedPlmnId |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1773 | )); |
| 1774 | |
| 1775 | template (value) PDU_DIAMETER |
Vadim Yanitskiy | 0e8f516 | 2021-12-15 05:00:32 +0300 | [diff] [blame] | 1776 | ts_DIA_ULA(template (value) AVP_list sub_data, |
| 1777 | template (value) octetstring sess_id := c_def_sess_id, |
| 1778 | template (value) charstring orig_host := "hss.localdomain", |
| 1779 | template (value) charstring orig_realm := "localdomain", |
| 1780 | template (value) UINT32 hbh_id := '00000000'O, |
| 1781 | template (value) UINT32 ete_id := '00000000'O) := |
| 1782 | ts_DIAMETER(flags:='01000000'B, |
| 1783 | cmd_code := Update_Location, |
| 1784 | app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| 1785 | hbh_id := hbh_id, |
| 1786 | ete_id := ete_id, |
| 1787 | avps := { |
| 1788 | ts_AVP_SessionId(sess_id), |
| 1789 | ts_AVP_ResultCode(DIAMETER_SUCCESS), /* optional */ |
| 1790 | ts_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
| 1791 | ts_AVP_OriginHost(orig_host), |
| 1792 | ts_AVP_OriginRealm(orig_realm), |
| 1793 | ts_AVP_3GPP_UlaFlags('00000002'O), |
| 1794 | ts_AVP_3GPP_SubscriptionData(sub_data) |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1795 | }); |
Vadim Yanitskiy | 5e1bdc0 | 2021-12-12 02:33:59 +0300 | [diff] [blame] | 1796 | template (present) PDU_DIAMETER |
| 1797 | tr_DIA_ULA(template (present) AVP_list sub_data := ?, |
| 1798 | template (present) octetstring sess_id := ?, |
| 1799 | template (present) charstring orig_host := ?, |
| 1800 | template (present) charstring orig_realm := ?, |
| 1801 | template (present) UINT32 hbh_id := ?, |
| 1802 | template (present) UINT32 ete_id := ?) := |
| 1803 | tr_DIAMETER(flags := '0???????'B, |
| 1804 | cmd_code := Update_Location, |
| 1805 | app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| 1806 | hbh_id := hbh_id, |
| 1807 | ete_id := ete_id, |
| 1808 | avps := superset( |
| 1809 | tr_AVP_SessionId(sess_id), |
| 1810 | tr_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1811 | tr_AVP_AuthSessionState, |
| 1812 | tr_AVP_OriginHost(orig_host), |
| 1813 | tr_AVP_OriginRealm(orig_realm), |
| 1814 | tr_AVP_3GPP_UlaFlags, |
| 1815 | tr_AVP_3GPP_SubscriptionData(sub_data) |
| 1816 | )); |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1817 | |
| 1818 | |
| 1819 | |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 1820 | /* RFC 4006 3.1. Credit-Control-Request (CCR) Command */ |
| 1821 | template (present) PDU_DIAMETER |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 1822 | tr_DIA_Gx_CCR(template (present) DCC_NONE_CC_Request_Type req_type := INITIAL_REQUEST) |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 1823 | := tr_DIAMETER(flags:='11000000'B, cmd_code:=Credit_Control, |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 1824 | avps := superset( |
| 1825 | tr_AVP_SessionId, |
| 1826 | tr_AVP_OriginHost, |
| 1827 | tr_AVP_OriginRealm, |
| 1828 | tr_AVP_DestinationRealm, |
| 1829 | tr_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_Gx_AID, 4)), |
| 1830 | tr_AVP_CcReqType(req_type), |
| 1831 | tr_AVP_CcReqNum(?) |
| 1832 | )); |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 1833 | template (present) PDU_DIAMETER |
| 1834 | tr_DIA_Gy_CCR(template (present) DCC_NONE_CC_Request_Type req_type := INITIAL_REQUEST) |
| 1835 | := tr_DIAMETER(flags:='11000000'B, cmd_code:=Credit_Control, |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 1836 | avps := superset( |
| 1837 | tr_AVP_SessionId, |
| 1838 | tr_AVP_OriginHost, |
| 1839 | tr_AVP_OriginRealm, |
| 1840 | tr_AVP_DestinationRealm, |
| 1841 | tr_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)), |
| 1842 | tr_AVP_CcReqType(req_type), |
| 1843 | tr_AVP_CcReqNum(?) |
| 1844 | )); |
| 1845 | |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 1846 | |
| 1847 | |
| 1848 | /* RFC 4006 3.2. Credit-Control-Answer (CCA) Command */ |
| 1849 | template (value) PDU_DIAMETER |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 1850 | ts_DIA_Gx_CCA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 1851 | template (value) octetstring sess_id, |
| 1852 | template (value) DCC_NONE_CC_Request_Type req_type, |
| 1853 | template (value) AVP_Unsigned32 req_num) |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 1854 | := ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control, |
| 1855 | app_id:=int2oct(c_DIAMETER_3GPP_Gx_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id, |
| 1856 | avps := { |
| 1857 | ts_AVP_SessionId(sess_id), |
| 1858 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1859 | ts_AVP_OriginHost("pcrf.localdomain"), |
| 1860 | ts_AVP_OriginRealm("localdomain"), |
| 1861 | ts_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_Gx_AID, 4)), |
| 1862 | ts_AVP_CcReqType(req_type), |
Pau Espin Pedrol | ee961c7 | 2022-06-03 12:06:07 +0200 | [diff] [blame] | 1863 | ts_AVP_CcReqNum(req_num), |
| 1864 | ts_AVP_PCC_3GPP_QoS_Information({ |
| 1865 | ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL(33554432), |
| 1866 | ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL(52428800) |
| 1867 | }), |
| 1868 | ts_AVP_PCC_3GPP_Default_EPS_Bearer_QoS({ |
| 1869 | ts_AVP_PCC_3GPP_QoS_Class_Identifier(9), |
| 1870 | ts_AVP_PCC_3GPP_AllocRetenPrio(2) |
| 1871 | }) |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 1872 | // supported features |
| 1873 | // origin |
| 1874 | }); |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 1875 | template (value) PDU_DIAMETER |
| 1876 | ts_DIA_Gy_CCA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, |
| 1877 | template (value) octetstring sess_id, |
| 1878 | template (value) DCC_NONE_CC_Request_Type req_type, |
| 1879 | template (value) AVP_Unsigned32 req_num) |
| 1880 | := ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control, |
| 1881 | app_id:=int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id, |
| 1882 | avps := { |
| 1883 | ts_AVP_SessionId(sess_id), |
| 1884 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1885 | ts_AVP_OriginHost("ocs.localdomain"), |
| 1886 | ts_AVP_OriginRealm("localdomain"), |
| 1887 | ts_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)), |
| 1888 | ts_AVP_CcReqType(req_type), |
| 1889 | ts_AVP_CcReqNum(req_num)//, |
| 1890 | // qos |
| 1891 | // default eps bearer qos |
| 1892 | // supported features |
| 1893 | // origin |
| 1894 | }); |
| 1895 | /* Same as ts_DIA_Gy_CCA, but with extra AVP to grant access for limited amount of seconds */ |
| 1896 | template (value) PDU_DIAMETER |
| 1897 | ts_DIA_Gy_CCA_ValidityTime(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, |
| 1898 | template (value) octetstring sess_id, |
| 1899 | template (value) DCC_NONE_CC_Request_Type req_type, |
| 1900 | template (value) AVP_Unsigned32 req_num, |
| 1901 | uint32_t validity_time) |
| 1902 | := ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control, |
| 1903 | app_id:=int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id, |
| 1904 | avps := { |
| 1905 | ts_AVP_SessionId(sess_id), |
| 1906 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1907 | ts_AVP_OriginHost("ocs.localdomain"), |
| 1908 | ts_AVP_OriginRealm("localdomain"), |
| 1909 | ts_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)), |
| 1910 | ts_AVP_CcReqType(req_type), |
| 1911 | ts_AVP_CcReqNum(req_num), |
| 1912 | ts_AVP_Multiple_Services_Credit_Control({ |
| 1913 | ts_AVP_Validity_Time(validity_time), |
| 1914 | ts_AVP_Granted_Service_Unit({ |
| 1915 | //ts_AVP_CC_Time(validity_time*2), |
| 1916 | ts_AVP_CC_Total_Octets(1000) |
| 1917 | }) |
| 1918 | }) |
| 1919 | //, |
| 1920 | // qos |
| 1921 | // default eps bearer qos |
| 1922 | // supported features |
| 1923 | // origin |
| 1924 | }); |
Pau Espin Pedrol | 52562c9 | 2022-05-23 15:45:46 +0200 | [diff] [blame] | 1925 | /* Same as ts_DIA_Gy_CCA_ValidityTime, but with extra AVP to grant access for limited amount of octets */ |
| 1926 | template (value) PDU_DIAMETER |
| 1927 | ts_DIA_Gy_CCA_ValidityTimeVolumeThreshold(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, |
| 1928 | template (value) octetstring sess_id, |
| 1929 | template (value) DCC_NONE_CC_Request_Type req_type, |
| 1930 | template (value) AVP_Unsigned32 req_num, |
| 1931 | uint32_t validity_time, uint32_t volume_threhsold) |
| 1932 | := ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control, |
| 1933 | app_id:=int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id, |
| 1934 | avps := { |
| 1935 | ts_AVP_SessionId(sess_id), |
| 1936 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1937 | ts_AVP_OriginHost("ocs.localdomain"), |
| 1938 | ts_AVP_OriginRealm("localdomain"), |
| 1939 | ts_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)), |
| 1940 | ts_AVP_CcReqType(req_type), |
| 1941 | ts_AVP_CcReqNum(req_num), |
| 1942 | ts_AVP_Multiple_Services_Credit_Control({ |
| 1943 | ts_AVP_Validity_Time(validity_time), |
| 1944 | ts_AVP_Granted_Service_Unit({ |
| 1945 | ts_AVP_CC_Total_Octets(volume_threhsold*100) |
| 1946 | }), |
| 1947 | ts_AVP_3GPP_VolumeQuotaThreshold(volume_threhsold) |
| 1948 | }) |
| 1949 | //, |
| 1950 | // qos |
| 1951 | // default eps bearer qos |
| 1952 | // supported features |
| 1953 | // origin |
| 1954 | }); |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 1955 | |
Vadim Yanitskiy | f28b255 | 2021-12-11 03:49:14 +0300 | [diff] [blame] | 1956 | /* RFC 6733, section 5.5.1 "Device-Watchdog-Request" */ |
| 1957 | template (value) PDU_DIAMETER |
| 1958 | ts_DIA_DWR(template (value) OCTET4 state_id := '00000000'O, |
| 1959 | template (value) charstring orig_host := "ttcn3.localdomain", |
| 1960 | template (value) charstring orig_realm := "localdomain", |
| 1961 | template (value) UINT32 hbh_id := '00000000'O, |
| 1962 | template (value) UINT32 ete_id := '00000000'O) := |
| 1963 | ts_DIAMETER(flags := '10000000'B, |
| 1964 | cmd_code := Device_Watchdog, |
| 1965 | app_id := '00000000'O, |
| 1966 | hbh_id := hbh_id, |
| 1967 | ete_id := ete_id, |
| 1968 | avps := { |
| 1969 | ts_AVP_OriginHost(orig_host), |
| 1970 | ts_AVP_OriginRealm(orig_realm), |
| 1971 | ts_AVP_OriginStateId(state_id) |
| 1972 | }); |
| 1973 | template (present) PDU_DIAMETER |
| 1974 | tr_DIA_DWR(template (present) OCTET4 state_id := ?, |
| 1975 | template (present) charstring orig_host := ?, |
| 1976 | template (present) charstring orig_realm := ?, |
| 1977 | template (present) UINT32 hbh_id := ?, |
| 1978 | template (present) UINT32 ete_id := ?) := |
| 1979 | tr_DIAMETER(flags := '1???????'B, |
| 1980 | cmd_code := Device_Watchdog, |
| 1981 | app_id := '00000000'O, |
| 1982 | hbh_id := hbh_id, |
| 1983 | ete_id := ete_id, |
| 1984 | avps := superset( |
| 1985 | tr_AVP_OriginHost(orig_host), |
Pau Espin Pedrol | 8dcb061 | 2023-08-28 19:16:29 +0200 | [diff] [blame] | 1986 | tr_AVP_OriginRealm(orig_realm) |
| 1987 | /* tr_AVP_OriginStateId(state_id) is optional */ |
Vadim Yanitskiy | f28b255 | 2021-12-11 03:49:14 +0300 | [diff] [blame] | 1988 | )); |
| 1989 | |
| 1990 | /* RFC 6733, section 5.5.2 "Device-Watchdog-Answer" */ |
| 1991 | template (value) PDU_DIAMETER |
| 1992 | ts_DIA_DWA(template (value) OCTET4 state_id := '00000000'O, |
| 1993 | template (value) charstring orig_host := "ttcn3.localdomain", |
| 1994 | template (value) charstring orig_realm := "localdomain", |
| 1995 | template (value) UINT32 hbh_id := '00000000'O, |
| 1996 | template (value) UINT32 ete_id := '00000000'O) := |
| 1997 | ts_DIAMETER(flags := '00000000'B, |
| 1998 | cmd_code := Device_Watchdog, |
| 1999 | app_id := '00000000'O, |
| 2000 | hbh_id := hbh_id, |
| 2001 | ete_id := ete_id, |
| 2002 | avps := { |
| 2003 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 2004 | ts_AVP_OriginHost(orig_host), |
| 2005 | ts_AVP_OriginRealm(orig_realm), |
| 2006 | ts_AVP_OriginStateId(state_id) |
| 2007 | }); |
| 2008 | template (present) PDU_DIAMETER |
| 2009 | tr_DIA_DWA(template (present) OCTET4 state_id := ?, |
| 2010 | template (present) charstring orig_host := ?, |
| 2011 | template (present) charstring orig_realm := ?, |
| 2012 | template (present) UINT32 hbh_id := ?, |
| 2013 | template (present) UINT32 ete_id := ?) := |
| 2014 | tr_DIAMETER(flags := '0???????'B, |
| 2015 | cmd_code := Device_Watchdog, |
| 2016 | app_id := '00000000'O, |
| 2017 | hbh_id := hbh_id, |
| 2018 | ete_id := ete_id, |
| 2019 | avps := superset( |
| 2020 | tr_AVP_ResultCode(DIAMETER_SUCCESS), |
| 2021 | tr_AVP_OriginHost(orig_host), |
Pau Espin Pedrol | 8dcb061 | 2023-08-28 19:16:29 +0200 | [diff] [blame] | 2022 | tr_AVP_OriginRealm(orig_realm) |
| 2023 | /* tr_AVP_OriginStateId(state_id) is optional */ |
Vadim Yanitskiy | f28b255 | 2021-12-11 03:49:14 +0300 | [diff] [blame] | 2024 | )); |
| 2025 | |
Pau Espin Pedrol | 8fa2284 | 2022-05-20 14:47:55 +0200 | [diff] [blame] | 2026 | function f_DIAMETER_get_avp(PDU_DIAMETER pdu, template (present) AVP_Code avp_code) |
| 2027 | return template (omit) AVP |
| 2028 | { |
| 2029 | var integer i; |
| 2030 | |
| 2031 | for (i := 0; i < lengthof(pdu.avps); i := i+1) { |
| 2032 | if (not ispresent(pdu.avps[i].avp)) { |
| 2033 | continue; |
| 2034 | } |
| 2035 | var AVP_Header hdr := pdu.avps[i].avp.avp_header; |
| 2036 | if (match(hdr.avp_code, avp_code)) { |
| 2037 | return pdu.avps[i].avp; |
| 2038 | } |
| 2039 | } |
| 2040 | return omit; |
| 2041 | } |
| 2042 | function f_DIAMETER_get_avp_or_fail(PDU_DIAMETER pdu, template (present) AVP_Code avp_code) |
| 2043 | return AVP |
| 2044 | { |
| 2045 | var template (omit) AVP avp; |
| 2046 | avp := f_DIAMETER_get_avp(pdu, avp_code); |
| 2047 | if (istemplatekind(avp, "omit")) { |
| 2048 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2049 | log2str("AVP ", avp_code, " not found in ", pdu)); |
| 2050 | } |
| 2051 | return valueof(avp); |
| 2052 | } |
| 2053 | |
| 2054 | function f_AVP_Grouped_get_avp(AVP_Grouped avp_grp, template (present) AVP_Code avp_code) |
| 2055 | return template (omit) AVP |
| 2056 | { |
| 2057 | var integer i; |
| 2058 | |
| 2059 | for (i := 0; i < lengthof(avp_grp); i := i+1) { |
| 2060 | if (not ispresent(avp_grp[i].avp)) { |
| 2061 | continue; |
| 2062 | } |
| 2063 | var AVP_Header hdr := avp_grp[i].avp.avp_header; |
| 2064 | if (match(hdr.avp_code, avp_code)) { |
| 2065 | return avp_grp[i].avp; |
| 2066 | } |
| 2067 | } |
| 2068 | return omit; |
| 2069 | } |
| 2070 | function f_AVP_Grouped_get_avp_or_fail(AVP_Grouped avp_grp, template (present) AVP_Code avp_code) |
| 2071 | return AVP |
| 2072 | { |
| 2073 | var template (omit) AVP avp; |
| 2074 | avp := f_AVP_Grouped_get_avp(avp_grp, avp_code); |
| 2075 | if (istemplatekind(avp, "omit")) { |
| 2076 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2077 | log2str("AVP ", avp_code, " not found in ", avp_grp)); |
| 2078 | } |
| 2079 | return valueof(avp); |
| 2080 | } |
| 2081 | |
| 2082 | function f_validate_gy_cc_report(PDU_DIAMETER rx_dia, template (present) DCA_3GPP_Reporting_Reason repreason_exp := ?, |
| 2083 | template (present) integer cc_time_exp := ?, |
| 2084 | template (present) integer cc_in_oct_exp := ?, |
| 2085 | template (present) integer cc_out_oct_exp := ?) |
| 2086 | { |
| 2087 | var AVP multi_services_cc, used_service_unit; |
| 2088 | var AVP_Grouped multi_services_cc_data, used_service_unit_data; |
Pau Espin Pedrol | cba0f6d | 2022-05-24 13:49:46 +0200 | [diff] [blame] | 2089 | var template (omit) AVP repreason_tpl; |
Pau Espin Pedrol | 8fa2284 | 2022-05-20 14:47:55 +0200 | [diff] [blame] | 2090 | var AVP repreason, cc_time, cc_in_oct, cc_out_oct; |
| 2091 | |
| 2092 | multi_services_cc := f_DIAMETER_get_avp_or_fail(rx_dia, c_AVP_Code_DCC_NONE_Multiple_Services_Credit_Control); |
| 2093 | multi_services_cc_data := valueof(multi_services_cc.avp_data.avp_DCC_NONE_Multiple_Services_Credit_Control); |
| 2094 | |
Pau Espin Pedrol | cba0f6d | 2022-05-24 13:49:46 +0200 | [diff] [blame] | 2095 | used_service_unit := f_AVP_Grouped_get_avp_or_fail(multi_services_cc_data, c_AVP_Code_DCC_NONE_Used_Service_Unit); |
| 2096 | used_service_unit_data := valueof(used_service_unit.avp_data.avp_DCC_NONE_Used_Service_Unit); |
| 2097 | |
| 2098 | /* Reporting-Reason can be either inside Multiple-Services-Credit-Control or inside Used-Service-Unit */ |
| 2099 | repreason_tpl := f_AVP_Grouped_get_avp(multi_services_cc_data, c_AVP_Code_DCA_3GPP_Reporting_Reason); |
| 2100 | if (istemplatekind(repreason_tpl, "omit")) { |
| 2101 | repreason := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCA_3GPP_Reporting_Reason); |
| 2102 | } else { |
| 2103 | repreason := valueof(repreason_tpl); |
| 2104 | } |
Pau Espin Pedrol | 8fa2284 | 2022-05-20 14:47:55 +0200 | [diff] [blame] | 2105 | if (not match(repreason.avp_data.avp_DCA_3GPP_Reporting_Reason, repreason_exp)) { |
| 2106 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2107 | log2str("3GPP-Reporting-Reason mismatch ", repreason, " vs exp ", repreason_exp)); |
| 2108 | } |
| 2109 | |
Pau Espin Pedrol | 8fa2284 | 2022-05-20 14:47:55 +0200 | [diff] [blame] | 2110 | cc_time := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCC_NONE_CC_Time); |
| 2111 | if (not match(oct2int(cc_time.avp_data.avp_DCC_NONE_CC_Time), cc_time_exp)) { |
| 2112 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2113 | log2str("3GPP-CC-Time mismatch ", cc_time, " vs exp ", cc_time_exp)); |
| 2114 | } |
| 2115 | |
| 2116 | cc_in_oct := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCC_NONE_CC_Input_Octets); |
| 2117 | if (not match(oct2int(cc_in_oct.avp_data.avp_DCC_NONE_CC_Input_Octets), cc_in_oct_exp)) { |
| 2118 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2119 | log2str("3GPP-CC-Input-Octets mismatch ", cc_in_oct, " vs exp ", cc_in_oct_exp)); |
| 2120 | } |
| 2121 | |
| 2122 | cc_out_oct := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCC_NONE_CC_Output_Octets); |
| 2123 | if (not match(oct2int(cc_out_oct.avp_data.avp_DCC_NONE_CC_Output_Octets), cc_out_oct_exp)) { |
| 2124 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2125 | log2str("3GPP-CC-Output-Octets mismatch ", cc_out_oct, " vs exp ", cc_out_oct_exp)); |
| 2126 | } |
| 2127 | } |
| 2128 | |
Pau Espin Pedrol | 462f3df | 2023-10-16 18:10:55 +0200 | [diff] [blame] | 2129 | |
| 2130 | /***************************** |
| 2131 | * Cx, Dx, 3GPP TS 29.229 |
| 2132 | *****************************/ |
| 2133 | /* SIP-Auth-Data-Item, 3GPP TS 29.229 6.3.8 */ |
| 2134 | template (present) GenericAVP tr_AVP_3GPP_SIPNumAuthDataItems(template (present) uint32_t num := ?) := { |
| 2135 | avp := { |
| 2136 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Number_Auth_Items), |
| 2137 | avp_data := { |
| 2138 | avp_CxDx_3GPP_SIP_Number_Auth_Items := int2oct_tmpl(num, 4) /* CxDx_3GPP_SIP_Number_Auth_Items */ |
| 2139 | } |
| 2140 | } |
| 2141 | } |
| 2142 | template (value) GenericAVP ts_AVP_3GPP_SIPNumAuthDataItems(uint32_t num) := { |
| 2143 | avp := { |
| 2144 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Number_Auth_Items), |
| 2145 | avp_data := { |
| 2146 | avp_CxDx_3GPP_SIP_Number_Auth_Items := int2oct(num, 4) /* CxDx_3GPP_SIP_Number_Auth_Items */ |
| 2147 | } |
| 2148 | } |
| 2149 | } |
| 2150 | |
| 2151 | /* SIP-Authentication-Scheme, 3GPP TS 29.229 6.3.9 */ |
| 2152 | template (present) GenericAVP tr_AVP_3GPP_SIPAuthScheme(template (present) CxDx_3GPP_SIP_Authentication_Scheme scheme := ?) := { |
| 2153 | avp := { |
| 2154 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authentication_Scheme), |
| 2155 | avp_data := { |
| 2156 | avp_CxDx_3GPP_SIP_Authentication_Scheme := scheme |
| 2157 | } |
| 2158 | } |
| 2159 | } |
| 2160 | template (value) GenericAVP ts_AVP_3GPP_SIPAuthScheme(template (value) CxDx_3GPP_SIP_Authentication_Scheme scheme) := { |
| 2161 | avp := { |
| 2162 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authentication_Scheme), |
| 2163 | avp_data := { |
| 2164 | avp_CxDx_3GPP_SIP_Authentication_Scheme := scheme |
| 2165 | } |
| 2166 | } |
| 2167 | } |
| 2168 | |
| 2169 | /* SIP-Authenticate, 3GPP TS 29.229 6.3.10 */ |
| 2170 | template (present) GenericAVP tr_AVP_3GPP_SIPAuthenticate(template (present) CxDx_3GPP_SIP_Authenticate rand_autn_concatenated := ?) := { |
| 2171 | avp := { |
| 2172 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authenticate), |
| 2173 | avp_data := { |
| 2174 | avp_CxDx_3GPP_SIP_Authenticate := rand_autn_concatenated |
| 2175 | } |
| 2176 | } |
| 2177 | } |
| 2178 | template (value) GenericAVP ts_AVP_3GPP_SIPAuthenticate(template (value) CxDx_3GPP_SIP_Authenticate rand_autn_concatenated) := { |
| 2179 | avp := { |
| 2180 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authenticate), |
| 2181 | avp_data := { |
| 2182 | avp_CxDx_3GPP_SIP_Authenticate := rand_autn_concatenated |
| 2183 | } |
| 2184 | } |
| 2185 | } |
| 2186 | |
| 2187 | /* SIP-Authorization, 3GPP TS 29.229 6.3.11 */ |
| 2188 | template (present) GenericAVP tr_AVP_3GPP_SIPAuthorization(template (present) CxDx_3GPP_SIP_Authorization rand_autn_concatenated := ?) := { |
| 2189 | avp := { |
| 2190 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authorization), |
| 2191 | avp_data := { |
| 2192 | avp_CxDx_3GPP_SIP_Authorization := rand_autn_concatenated |
| 2193 | } |
| 2194 | } |
| 2195 | } |
| 2196 | template (value) GenericAVP ts_AVP_3GPP_SIPAuthorization(template (value) CxDx_3GPP_SIP_Authorization rand_autn_concatenated) := { |
| 2197 | avp := { |
| 2198 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authorization), |
| 2199 | avp_data := { |
| 2200 | avp_CxDx_3GPP_SIP_Authorization := rand_autn_concatenated |
| 2201 | } |
| 2202 | } |
| 2203 | } |
| 2204 | |
| 2205 | /* SIP-Authentication-Context, 3GPP TS 29.229 6.3.12 */ |
| 2206 | template (present) GenericAVP tr_AVP_3GPP_SIPAuthContext(template (present) CxDx_3GPP_SIP_Authentication_Context val := ?) := { |
| 2207 | avp := { |
| 2208 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authentication_Context), |
| 2209 | avp_data := { |
| 2210 | avp_CxDx_3GPP_SIP_Authentication_Context := val |
| 2211 | } |
| 2212 | } |
| 2213 | } |
| 2214 | template (value) GenericAVP ts_AVP_3GPP_SIPAuthContext(template (value) CxDx_3GPP_SIP_Authentication_Context val) := { |
| 2215 | avp := { |
| 2216 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authentication_Context), |
| 2217 | avp_data := { |
| 2218 | avp_CxDx_3GPP_SIP_Authentication_Context := val |
| 2219 | } |
| 2220 | } |
| 2221 | } |
| 2222 | |
| 2223 | /* SIP-Item-Number, 3GPP TS 29.229 6.3.14 */ |
| 2224 | template (present) GenericAVP tr_AVP_3GPP_SIPItemNumber(template (present) uint32_t num := ?) := { |
| 2225 | avp := { |
| 2226 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Item_Number), |
| 2227 | avp_data := { |
| 2228 | avp_CxDx_3GPP_SIP_Item_Number := int2oct_tmpl(num, 4) /* CxDx_3GPP_SIP_Item_Number */ |
| 2229 | } |
| 2230 | } |
| 2231 | } |
| 2232 | template (value) GenericAVP ts_AVP_3GPP_SIPItemNumber(uint32_t num) := { |
| 2233 | avp := { |
| 2234 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Item_Number), |
| 2235 | avp_data := { |
| 2236 | avp_CxDx_3GPP_SIP_Item_Number := int2oct(num, 4) /* CxDx_3GPP_SIP_Item_Number */ |
| 2237 | } |
| 2238 | } |
| 2239 | } |
| 2240 | |
| 2241 | /* Confidentiality-Key, 3GPP TS 29.229 6.3.27 */ |
| 2242 | template (present) GenericAVP tr_AVP_3GPP_ConfidentialityKey(template (present) CxDx_3GPP_Confidentiality_Key ckey := ?) := { |
| 2243 | avp := { |
| 2244 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Confidentiality_Key), |
| 2245 | avp_data := { |
| 2246 | avp_CxDx_3GPP_Confidentiality_Key := ckey |
| 2247 | } |
| 2248 | } |
| 2249 | } |
| 2250 | template (value) GenericAVP ts_AVP_3GPP_ConfidentialityKey(template (value) CxDx_3GPP_Confidentiality_Key ckey) := { |
| 2251 | avp := { |
| 2252 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Confidentiality_Key), |
| 2253 | avp_data := { |
| 2254 | avp_CxDx_3GPP_Confidentiality_Key := ckey |
| 2255 | } |
| 2256 | } |
| 2257 | } |
| 2258 | |
| 2259 | /* Inegrity-Key, 3GPP TS 29.229 6.3.28 */ |
| 2260 | template (present) GenericAVP tr_AVP_3GPP_IntegrityKey(template (present) CxDx_3GPP_Integrity_Key ckey := ?) := { |
| 2261 | avp := { |
| 2262 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Integrity_Key), |
| 2263 | avp_data := { |
| 2264 | avp_CxDx_3GPP_Integrity_Key := ckey |
| 2265 | } |
| 2266 | } |
| 2267 | } |
| 2268 | template (value) GenericAVP ts_AVP_3GPP_IntegrityKey(template (value) CxDx_3GPP_Integrity_Key ckey) := { |
| 2269 | avp := { |
| 2270 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Integrity_Key), |
| 2271 | avp_data := { |
| 2272 | avp_CxDx_3GPP_Integrity_Key := ckey |
| 2273 | } |
| 2274 | } |
| 2275 | } |
| 2276 | |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 2277 | /* Server-Assignment-Type, 3GPP TS 29.273 8.2.3.12, 3GPP TS 29.229 6.3.15 */ |
| 2278 | template (present) GenericAVP tr_AVP_3GPP_ServerAssignmentType(template (present) CxDx_3GPP_Server_Assignment_Type t := ?) := { |
| 2279 | avp := { |
| 2280 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Server_Assignment_Type), |
| 2281 | avp_data := { |
| 2282 | avp_CxDx_3GPP_Server_Assignment_Type := t |
| 2283 | } |
| 2284 | } |
| 2285 | } |
| 2286 | template (value) GenericAVP ts_AVP_3GPP_ServerAssignmentType(template (value) CxDx_3GPP_Server_Assignment_Type t) := { |
| 2287 | avp := { |
| 2288 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Server_Assignment_Type), |
| 2289 | avp_data := { |
| 2290 | avp_CxDx_3GPP_Server_Assignment_Type := t |
| 2291 | } |
| 2292 | } |
| 2293 | } |
| 2294 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 2295 | } |