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