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; |
| 14 | |
| 15 | /* https://www.iana.org/assignments/aaa-parameters/aaa-parameters.xhtml#aaa-parameters-4 */ |
| 16 | type enumerated DIAMETER_Resultcode { |
| 17 | /* Informational */ |
| 18 | DIAMETER_MULTI_ROUND_AUTH (1001), |
| 19 | |
| 20 | /* Success */ |
| 21 | DIAMETER_SUCCESS (2001), |
| 22 | DIAMETER_LIMITED_SUCCESS (2002), |
| 23 | DIAMETER_FIRST_REGISTRATION (2003), |
| 24 | DIAMETER_SUBSEQUENT_REGISTRATION (2004), |
| 25 | DIAMETER_UNREGISTERED_SERVICE (2005), |
| 26 | DIAMETER_SUCCESS_SERVER_NAME_NOT_STORED (2006), |
| 27 | DIAMETER_SERVER_SELECTION (2007), |
| 28 | DIAMETER_SUCCESS_AUTH_SENT_SERVER_NOT_STORED (2008), |
| 29 | DIAMETER_SUCCESS_RELOCATE_HA (2009), |
| 30 | |
| 31 | /* Protocol Errors */ |
| 32 | DIAMETER_COMMAND_UNSUPPORTED (3001), |
| 33 | DIAMETER_UNABLE_TO_DELIVER (3002), |
| 34 | DIAMETER_REALM_NOT_SERVED (3003), |
| 35 | DIAMETER_TOO_BUSY (3004), |
| 36 | DIAMETER_LOOP_DETECTED (3005), |
| 37 | DIAMETER_REDIRECT_INDICATION (3006), |
| 38 | DIAMETER_APPLICATION_UNSUPPORTED (3007), |
| 39 | DIAMETER_INVALID_HDR_BITS (3008), |
| 40 | DIAMETER_INVALID_AVP_BITS (3009), |
| 41 | DIAMETER_UNKNOWN_PEER (3010), |
| 42 | DIAMETER_REALM_REDIRECT_INDICATION (3011), |
| 43 | |
| 44 | /* Transient Failures */ |
| 45 | DIAMETER_AUTHENTICATION_REJECTED (4001), |
| 46 | DIAMETER_OUT_OF_SPACE (4002), |
| 47 | ELECTION_LOST (4003), |
| 48 | DIAMETER_ERROR_MIP_REPLY_FAILURE (4005), |
| 49 | DIAMETER_ERROR_HA_NOT_AVAILABLE (4006), |
| 50 | DIAMETER_ERROR_BAD_KEY (4007), |
| 51 | DIAMETER_ERROR_MIP_FILTER_NOT_SUPPORTED (4008), |
| 52 | DIAMETER_END_USER_SERVICE_DENIED (4010), |
| 53 | DIAMETER_CREDIT_CONTROL_NOT_APPLICABLE (4011), |
| 54 | DIAMETER_CREDIT_LIMIT_REACHED (4012), |
| 55 | DIAMETER_USER_NAME_REQUIRED (4013), |
| 56 | RESOURCE_FAILURE (4014), |
| 57 | |
| 58 | DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE (4181), |
| 59 | DIAMETER_ERROR_CAMEL_SUBSCRIPTION_PRESENT (4882), |
| 60 | |
| 61 | /* Permanent Failure */ |
| 62 | DIAMETER_AVP_UNSUPPORTED (5001), |
| 63 | DIAMETER_UNKNOWN_SESSION_ID (5002), |
| 64 | DIAMETER_AUTHORIZATION_REJECTED (5003), |
| 65 | DIAMETER_INVALID_AVP_VALUE (5004), |
| 66 | DIAMETER_MISSING_AVP (5005), |
| 67 | DIAMETER_RESOURCES_EXCEEDED (5006), |
| 68 | DIAMETER_CONTRADICTING_AVPS (5007), |
| 69 | DIAMETER_AVP_NOT_ALLOWED (5008), |
| 70 | DIAMETER_AVP_OCCURS_TOO_MANY_TIMES (5009), |
| 71 | DIAMETER_NO_COMMON_APPLICATION (5010), |
| 72 | DIAMETER_UNSUPPORTED_VERSION (5011), |
| 73 | DIAMETER_UNABLE_TO_COMPLY (5012), |
| 74 | DIAMETER_INVALID_BIT_IN_HEADER (5013), |
| 75 | DIAMETER_INVALID_AVP_LENGTH (5014), |
| 76 | DIAMETER_INVALID_MESSAGE_LENGTH (5015), |
| 77 | DIAMETER_INVALID_AVP_BIT_COMBO (5016), |
| 78 | DIAMETER_NO_COMMON_SECURITY (5017), |
| 79 | DIAMETER_RADIUS_AVP_UNTRANSLATABLE (5018), |
| 80 | DIAMETER_ERROR_NO_FOREIGN_HA_SERVICE (5024), |
| 81 | DIAMETER_ERROR_END_TO_END_MIP_KEY_ENCRYPTION (5025), |
| 82 | DIAMETER_USER_UNKNOWN (5030), |
| 83 | DIAMETER_RATING_FAILED (5031), |
| 84 | DIAMETER_ERROR_USER_UNKNOWN (5032), |
| 85 | DIAMETER_ERROR_IDENTITIES_DONT_MATCH (5033), |
| 86 | DIAMETER_ERROR_IDENTITY_NOT_REGISTERED (5034), |
| 87 | DIAMETER_ERROR_ROAMING_NOT_ALLOWED (5035), |
| 88 | DIAMETER_ERROR_IDENTITY_ALREADY_REGISTERED (5036), |
| 89 | DIAMETER_ERROR_AUTH_SCHEME_NOT_SUPPORTED (5037), |
| 90 | DIAMETER_ERROR_IN_ASSIGNMENT_TYPE (5038), |
| 91 | DIAMETER_ERROR_TOO_MUCH_DATA (5039), |
| 92 | DIAMETER_ERROR_NOT_SUPPORTED_USER_DATA (5040), |
| 93 | DIAMETER_ERROR_MIP6_AUTH_MODE (5041), |
| 94 | UNKNOWN_BINDING_TEMPLATE_NAME (5042), |
| 95 | BINDING_FAILURE (5043), |
| 96 | MAX_BINDINGS_SET_FAILURE (5044), |
| 97 | MAXIMUM_BINDINGS_REACHED_FOR_ENDPOINT (5045), |
| 98 | SESSION_EXISTS (5046), |
| 99 | INSUFFICIENT_CLASSIFIERS (5047), |
| 100 | DIAMETER_ERROR_EAP_CODE_UNKNOWN (5048) |
| 101 | }; |
| 102 | |
| 103 | /* 3GPP TS 29.272 Section 7.1.8 */ |
Harald Welte | f9fb63e | 2020-04-26 18:07:19 +0200 | [diff] [blame] | 104 | const uint32_t c_DIAMETER_3GPP_Gx_AID := 16777238; |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 105 | const uint32_t c_DIAMETER_3GPP_S6_AID := 16777251; |
| 106 | const uint32_t c_DIAMETER_3GPP_S13_AID := 16777252; |
| 107 | const uint32_t c_DIAMETER_3GPP_S7_AID := 16777308; |
| 108 | |
Vadim Yanitskiy | 0e8f516 | 2021-12-15 05:00:32 +0300 | [diff] [blame] | 109 | const octetstring c_def_sess_id := char2oct("ttcn3.session"); |
| 110 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 111 | template (value) PDU_DIAMETER |
| 112 | ts_DIAMETER(template (value) BIT8 flags, |
| 113 | template (value) Command_Code cmd_code, |
| 114 | template (value) OCTET4 app_id := '00000000'O, |
Vadim Yanitskiy | 00720bd | 2021-12-12 02:05:08 +0300 | [diff] [blame] | 115 | template (value) UINT32 hbh_id := '00000000'O, |
| 116 | template (value) UINT32 ete_id := '00000000'O, |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 117 | template (value) AVP_list avps := {} |
| 118 | ) := { |
| 119 | version := 1, |
| 120 | message_length := 0, /* overwritten */ |
| 121 | RPETxxxx := flags, |
| 122 | command_code := cmd_code, |
| 123 | application_id := app_id, |
| 124 | hop_by_hop_id := hbh_id, |
| 125 | end_to_end_id := ete_id, |
| 126 | avps := avps |
| 127 | } |
| 128 | template (present) PDU_DIAMETER |
| 129 | tr_DIAMETER(template (present) BIT8 flags := ?, |
| 130 | template (present) Command_Code cmd_code := ?, |
| 131 | template (present) OCTET4 app_id := ?, |
| 132 | template (present) UINT32 hbh_id := ?, |
| 133 | template (present) UINT32 ete_id := ?, |
| 134 | template (present) AVP_list avps := ?) := { |
| 135 | version := 1, |
| 136 | message_length := ?, |
| 137 | RPETxxxx := flags, |
| 138 | command_code := cmd_code, |
| 139 | application_id := app_id, |
| 140 | hop_by_hop_id := hbh_id, |
| 141 | end_to_end_id := ete_id, |
| 142 | avps := avps |
| 143 | } |
| 144 | template (present) PDU_DIAMETER |
| 145 | tr_DIAMETER_A( |
| 146 | template (present) Command_Code cmd_code := ?, |
| 147 | template (present) OCTET4 app_id := ?, |
| 148 | template (present) UINT32 hbh_id := ?, |
| 149 | template (present) UINT32 ete_id := ?, |
| 150 | template (present) AVP_list avps := ?) := |
| 151 | tr_DIAMETER('0???????'B, cmd_code, app_id, hbh_id, ete_id, avps); |
| 152 | template (present) PDU_DIAMETER |
| 153 | tr_DIAMETER_R( |
| 154 | template (present) Command_Code cmd_code := ?, |
| 155 | template (present) OCTET4 app_id := ?, |
| 156 | template (present) UINT32 hbh_id := ?, |
| 157 | template (present) UINT32 ete_id := ?, |
| 158 | template (present) AVP_list avps := ?) := |
| 159 | tr_DIAMETER('1???????'B, cmd_code, app_id, hbh_id, ete_id, avps); |
| 160 | |
| 161 | |
| 162 | template (value) AVP_Header |
| 163 | ts_DIA_Hdr(template (value) AVP_Code avp_code, |
| 164 | template (value) BIT8 flags := '01000000'B) := { |
| 165 | avp_code := avp_code, |
| 166 | VMPxxxxx := flags, |
| 167 | avp_length := 0, /* overwritten */ |
| 168 | vendor_id := omit |
| 169 | } |
| 170 | template (present) AVP_Header |
| 171 | tr_DIA_Hdr(template (present) AVP_Code avp_code, |
| 172 | template (present) BIT8 flags := '0???????'B) := { |
| 173 | avp_code := avp_code, |
| 174 | VMPxxxxx := flags, |
| 175 | avp_length := ?, /* overwritten */ |
| 176 | vendor_id := omit |
| 177 | } |
| 178 | |
| 179 | template (value) AVP_Header |
| 180 | ts_DIA_Hdr_3GPP(template (value) AVP_Code avp_code, |
| 181 | template (value) BIT8 flags := '11000000'B) := { |
| 182 | avp_code := avp_code, |
| 183 | VMPxxxxx := flags, |
| 184 | avp_length := 0, /* overwritten */ |
| 185 | vendor_id := vendor_id_3GPP |
| 186 | } |
| 187 | template (present) AVP_Header |
| 188 | tr_DIA_Hdr_3GPP(template (present) AVP_Code avp_code, |
| 189 | template (present) BIT8 flags := '1???????'B) := { |
| 190 | avp_code := avp_code, |
| 191 | VMPxxxxx := flags, |
| 192 | avp_length := ?, /* overwritten */ |
| 193 | vendor_id := vendor_id_3GPP |
| 194 | } |
| 195 | |
Harald Welte | f9fb63e | 2020-04-26 18:07:19 +0200 | [diff] [blame] | 196 | template (present) GenericAVP tr_SubcrIdType(template (present) DCC_NONE_Subscription_Id_Type t) := { |
| 197 | avp := { |
| 198 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Subscription_Id_Type), |
| 199 | avp_data := { |
| 200 | avp_DCC_NONE_Subscription_Id_Type := t |
| 201 | } |
| 202 | } |
| 203 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 204 | |
| 205 | template (value) GenericAVP ts_AVP_OriginHost(template (value) charstring host) := { |
| 206 | avp := { |
| 207 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Host), |
| 208 | avp_data := { |
| 209 | avp_BASE_NONE_Origin_Host := host |
| 210 | } |
| 211 | } |
| 212 | } |
| 213 | template (present) GenericAVP tr_AVP_OriginHost(template (present) charstring host := ?) := { |
| 214 | avp := { |
| 215 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Host), |
| 216 | avp_data := { |
| 217 | avp_BASE_NONE_Origin_Host := host |
| 218 | } |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | |
| 223 | template (value) GenericAVP ts_AVP_OriginRealm(template (value) charstring realm) := { |
| 224 | avp := { |
| 225 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Realm), |
| 226 | avp_data := { |
| 227 | avp_BASE_NONE_Origin_Realm := realm |
| 228 | } |
| 229 | } |
| 230 | } |
| 231 | template (present) GenericAVP tr_AVP_OriginRealm(template (present) charstring realm := ?) := { |
| 232 | avp := { |
| 233 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Realm), |
| 234 | avp_data := { |
| 235 | avp_BASE_NONE_Origin_Realm := realm |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | |
| 241 | template (value) GenericAVP ts_AVP_OriginStateId(template (value) OCTET4 state_id) := { |
| 242 | avp := { |
| 243 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_State_Id), |
| 244 | avp_data := { |
| 245 | avp_BASE_NONE_Origin_State_Id := state_id |
| 246 | } |
| 247 | } |
| 248 | } |
Vadim Yanitskiy | f28b255 | 2021-12-11 03:49:14 +0300 | [diff] [blame] | 249 | template (present) GenericAVP tr_AVP_OriginStateId(template (present) OCTET4 state_id := ?) := { |
| 250 | avp := { |
| 251 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_State_Id), |
| 252 | avp_data := { |
| 253 | avp_BASE_NONE_Origin_State_Id := state_id |
| 254 | } |
| 255 | } |
| 256 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 257 | |
| 258 | template (value) GenericAVP ts_AVP_HostIpAddr(template (value) OCTET4 ipv4_addr) := { |
| 259 | avp := { |
| 260 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Host_IP_Address), |
| 261 | avp_data := { |
| 262 | avp_BASE_NONE_Host_IP_Address := { |
| 263 | address_type := IP, |
| 264 | address_data := ipv4_addr |
| 265 | } |
| 266 | } |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | template (value) GenericAVP ts_AVP_VendorId(Vendor_Id vendor_id) := { |
| 271 | avp := { |
| 272 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id, '00000000'B), |
| 273 | avp_data := { |
| 274 | avp_BASE_NONE_Vendor_Id := int2oct(enum2int(vendor_id), 4) |
| 275 | } |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | template (value) GenericAVP ts_AVP_ProductName(charstring name) := { |
| 280 | avp := { |
| 281 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Product_Name, '00000000'B), |
| 282 | avp_data := { |
| 283 | avp_BASE_NONE_Product_Name := char2oct(name) |
| 284 | } |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | template (value) GenericAVP ts_AVP_FwRevision(octetstring fw_version) := { |
| 289 | avp := { |
| 290 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Firmware_Revision, '00000000'B), |
| 291 | avp_data := { |
| 292 | avp_BASE_NONE_Firmware_Revision := fw_version |
| 293 | } |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | template (value) GenericAVP ts_AVP_InbSecId(template (value) OCTET4 inb_sec_id) := { |
| 298 | avp := { |
| 299 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Inband_Security_Id), |
| 300 | avp_data := { |
| 301 | avp_BASE_NONE_Inband_Security_Id := inb_sec_id |
| 302 | } |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | template (value) GenericAVP ts_AVP_VendorSpecAppId(Vendor_Id vendor_id, uint32_t auth_app_id) := { |
| 307 | avp := { |
| 308 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Specific_Application_Id), |
| 309 | avp_data := { |
| 310 | avp_BASE_NONE_Vendor_Specific_Application_Id := { |
| 311 | { |
| 312 | avp := { |
| 313 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id), |
| 314 | avp_data := { |
| 315 | avp_BASE_NONE_Vendor_Id := int2oct(enum2int(vendor_id), 4) |
| 316 | } |
| 317 | } |
| 318 | }, { |
| 319 | avp := { |
| 320 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id), |
| 321 | avp_data := { |
| 322 | avp_BASE_NONE_Auth_Application_Id := int2oct(auth_app_id, 4) |
| 323 | } |
| 324 | } |
| 325 | } |
| 326 | } |
| 327 | } |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | template (value) GenericAVP ts_AVP_AuthAppId(template (value) OCTET4 auth_app_id) := { |
| 332 | avp := { |
| 333 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id), |
| 334 | avp_data := { |
| 335 | avp_BASE_NONE_Auth_Application_Id := auth_app_id |
| 336 | } |
| 337 | } |
| 338 | } |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 339 | template (present) GenericAVP tr_AVP_AuthAppId(template (present) OCTET4 auth_app_id := ?) := { |
| 340 | avp := { |
| 341 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id), |
| 342 | avp_data := { |
| 343 | avp_BASE_NONE_Auth_Application_Id := auth_app_id |
| 344 | } |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | template (value) GenericAVP ts_AVP_CcReqType(template (value) DCC_NONE_CC_Request_Type r) := { |
| 349 | avp := { |
| 350 | avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Type), |
| 351 | avp_data := { |
| 352 | avp_DCC_NONE_CC_Request_Type := r |
| 353 | } |
| 354 | } |
| 355 | } |
| 356 | template (present) GenericAVP tr_AVP_CcReqType(template (present) DCC_NONE_CC_Request_Type r := ?) := { |
| 357 | avp := { |
| 358 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Type), |
| 359 | avp_data := { |
| 360 | avp_DCC_NONE_CC_Request_Type := r |
| 361 | } |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | template (value) GenericAVP ts_AVP_CcReqNum(template (value) AVP_Unsigned32 n) := { |
| 366 | avp := { |
| 367 | avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Number), |
| 368 | avp_data := { |
| 369 | avp_DCC_NONE_CC_Request_Number := n |
| 370 | } |
| 371 | } |
| 372 | } |
| 373 | template (present) GenericAVP tr_AVP_CcReqNum(template (present) AVP_Unsigned32 n := ?) := { |
| 374 | avp := { |
| 375 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Number), |
| 376 | avp_data := { |
| 377 | avp_DCC_NONE_CC_Request_Number := n |
| 378 | } |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | |
| 383 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 384 | |
| 385 | template (value) GenericAVP ts_AVP_SuppVendorIdRaw(uint32_t vendor_id) := { |
| 386 | avp := { |
| 387 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Supported_Vendor_Id), |
| 388 | avp_data := { |
| 389 | avp_BASE_NONE_Supported_Vendor_Id := int2oct(vendor_id, 4) |
| 390 | } |
| 391 | } |
| 392 | } |
| 393 | template (value) GenericAVP ts_AVP_SuppVendorId(Vendor_Id vendor_id) := |
| 394 | ts_AVP_SuppVendorIdRaw(enum2int(vendor_id)); |
| 395 | |
| 396 | template (value) GenericAVP ts_AVP_ResultCode(DIAMETER_Resultcode res_code) := { |
| 397 | avp := { |
| 398 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Result_Code), |
| 399 | avp_data := { |
| 400 | avp_BASE_NONE_Result_Code := int2oct(enum2int(res_code), 4) |
| 401 | } |
| 402 | } |
| 403 | } |
Vadim Yanitskiy | f28b255 | 2021-12-11 03:49:14 +0300 | [diff] [blame] | 404 | template (present) GenericAVP tr_AVP_ResultCode(DIAMETER_Resultcode res_code) := { |
| 405 | avp := { |
| 406 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Result_Code), |
| 407 | avp_data := { |
| 408 | avp_BASE_NONE_Result_Code := int2oct(enum2int(res_code), 4) |
| 409 | } |
| 410 | } |
| 411 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 412 | |
| 413 | template (value) GenericAVP ts_AVP_AuthSessionState(template (value) BASE_NONE_Auth_Session_State ass := NO_STATE_MAINTAINED) := { |
| 414 | avp := { |
| 415 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Session_State), |
| 416 | avp_data := { |
| 417 | avp_BASE_NONE_Auth_Session_State := ass |
| 418 | } |
| 419 | } |
| 420 | } |
| 421 | template (present) GenericAVP tr_AVP_AuthSessionState(template (present) BASE_NONE_Auth_Session_State ass := ?) := { |
| 422 | avp := { |
| 423 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Session_State), |
| 424 | avp_data := { |
| 425 | avp_BASE_NONE_Auth_Session_State := ass |
| 426 | } |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | template (value) GenericAVP ts_AVP_SessionId(template (value) octetstring session_id) := { |
| 431 | avp := { |
| 432 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Session_Id), |
| 433 | avp_data := { |
| 434 | avp_BASE_NONE_Session_Id := session_id |
| 435 | } |
| 436 | } |
| 437 | } |
| 438 | template (present) GenericAVP tr_AVP_SessionId(template (present) octetstring session_id := ?) := { |
| 439 | avp := { |
| 440 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Session_Id), |
| 441 | avp_data := { |
| 442 | avp_BASE_NONE_Session_Id := session_id |
| 443 | } |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | /* 3.3 Destination Realm */ |
| 448 | template (value) GenericAVP ts_AVP_DestinationRealm(template (value) charstring dest_realm) := { |
| 449 | avp := { |
| 450 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Destination_Realm), |
| 451 | avp_data := { |
| 452 | avp_BASE_NONE_Destination_Realm := dest_realm |
| 453 | } |
| 454 | } |
| 455 | } |
| 456 | template (present) GenericAVP tr_AVP_DestinationRealm(template (present) charstring dest_realm := ?) := { |
| 457 | avp := { |
| 458 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Destination_Realm), |
| 459 | avp_data := { |
| 460 | avp_BASE_NONE_Destination_Realm := dest_realm |
| 461 | } |
| 462 | } |
| 463 | } |
| 464 | |
| 465 | /* 8.14 User-Name */ |
| 466 | template (value) GenericAVP ts_AVP_UserName(template (value) octetstring uid) := { |
| 467 | avp := { |
| 468 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_User_Name), |
| 469 | avp_data := { |
| 470 | avp_BASE_NONE_User_Name := uid |
| 471 | } |
| 472 | } |
| 473 | } |
| 474 | template (present) GenericAVP tr_AVP_UserName(template (present) octetstring uid := ?) := { |
| 475 | avp := { |
| 476 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_User_Name), |
| 477 | avp_data := { |
| 478 | avp_BASE_NONE_User_Name := uid |
| 479 | } |
| 480 | } |
| 481 | } |
| 482 | template (value) GenericAVP ts_AVP_UserNameImsi(hexstring imsi) := ts_AVP_UserName(char2oct(hex2str(imsi))); |
| 483 | template (present) GenericAVP tr_AVP_UserNameImsi(hexstring imsi) := tr_AVP_UserName(char2oct(hex2str(imsi))); |
| 484 | |
| 485 | |
| 486 | |
| 487 | /* TS 29.262 7.3.53 RAND */ |
| 488 | template (value) GenericAVP ts_AVP_RAND(template (value) octetstring rand) := { |
| 489 | avp := { |
| 490 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_RAND), |
| 491 | avp_data := { |
| 492 | avp_AAA_3GPP_RAND := rand |
| 493 | } |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | /* TS 29.262 7.3.54 XRES */ |
| 498 | template (value) GenericAVP ts_AVP_XRES(template (value) octetstring xres) := { |
| 499 | avp := { |
| 500 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_XRES), |
| 501 | avp_data := { |
| 502 | avp_AAA_3GPP_XRES := xres |
| 503 | } |
| 504 | } |
| 505 | } |
| 506 | |
| 507 | /* TS 29.262 7.3.55 XRES */ |
| 508 | template (value) GenericAVP ts_AVP_AUTN(template (value) octetstring autn) := { |
| 509 | avp := { |
| 510 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_AUTN), |
| 511 | avp_data := { |
| 512 | avp_AAA_3GPP_AUTN := autn |
| 513 | } |
| 514 | } |
| 515 | } |
| 516 | |
| 517 | /* TS 29.262 7.3.56 KASME */ |
| 518 | template (value) GenericAVP ts_AVP_KASME(template (value) octetstring kasme) := { |
| 519 | avp := { |
| 520 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_KASME), |
| 521 | avp_data := { |
| 522 | avp_AAA_3GPP_KASME := kasme |
| 523 | } |
| 524 | } |
| 525 | } |
| 526 | |
| 527 | /* TS 29.262 7.3.23 Item-Number */ |
| 528 | template (value) GenericAVP ts_AVP_ItemNumber(uint32_t num) := { |
| 529 | avp := { |
| 530 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_KASME), |
| 531 | avp_data := { |
| 532 | avp_AAA_3GPP_Item_Number := int2oct(num, 4) |
| 533 | } |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | /* TS 29.262 7.3.18 E-UTRAN Vector */ |
| 538 | template (value) GenericAVP ts_AVP_EutranVec(uint32_t item_num, octetstring rand, octetstring xres, |
| 539 | octetstring autn, octetstring kasme) := { |
| 540 | avp := { |
| 541 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_E_UTRAN_Vector), |
| 542 | avp_data := { |
| 543 | avp_AAA_3GPP_E_UTRAN_Vector := { |
| 544 | ts_AVP_ItemNumber(item_num), |
| 545 | ts_AVP_RAND(rand), |
| 546 | ts_AVP_XRES(xres), |
| 547 | ts_AVP_AUTN(autn), |
| 548 | ts_AVP_KASME(kasme) |
| 549 | } |
| 550 | } |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | /* TS 29.262 7.3.2 Subscription-Data */ |
| 555 | template (value) GenericAVP ts_AVP_3GPP_SubscriptionData(template (value) AVP_list content) := { |
| 556 | avp := { |
| 557 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscription_Data), |
| 558 | avp_data := { |
| 559 | avp_AAA_3GPP_Subscription_Data := content |
| 560 | } |
| 561 | } |
| 562 | } |
Vadim Yanitskiy | 5e1bdc0 | 2021-12-12 02:33:59 +0300 | [diff] [blame] | 563 | template (present) GenericAVP |
| 564 | tr_AVP_3GPP_SubscriptionData(template (present) AVP_list content := ?) := { |
| 565 | avp := { |
| 566 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscription_Data), |
| 567 | avp_data := { |
| 568 | avp_AAA_3GPP_Subscription_Data := content |
| 569 | } |
| 570 | } |
| 571 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 572 | |
| 573 | |
| 574 | /* TS 29.262 7.3.17 Authentication-Info */ |
| 575 | template (value) GenericAVP ts_AVP_3GPP_AuthInfo(template (value) AVP_list content) := { |
| 576 | avp := { |
| 577 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Authentication_Info), |
| 578 | avp_data := { |
| 579 | avp_AAA_3GPP_Authentication_Info := content |
| 580 | } |
| 581 | } |
| 582 | } |
Vadim Yanitskiy | 446edae | 2021-12-12 04:33:08 +0300 | [diff] [blame] | 583 | template (present) GenericAVP |
| 584 | tr_AVP_3GPP_AuthInfo(template (present) AVP_list content := ?) := { |
| 585 | avp := { |
| 586 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Authentication_Info), |
| 587 | avp_data := { |
| 588 | avp_AAA_3GPP_Authentication_Info := content |
| 589 | } |
| 590 | } |
| 591 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 592 | |
| 593 | /* TS 29.262 7.3.9 Visited-PLMN-Id */ |
| 594 | template (value) GenericAVP ts_AVP_3GPP_VisitedPlmnId(template (value) octetstring id) := { |
| 595 | avp := { |
| 596 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Visited_PLMN_Id), |
| 597 | avp_data := { |
| 598 | avp_AAA_3GPP_Visited_PLMN_Id := id |
| 599 | } |
| 600 | } |
| 601 | } |
| 602 | template (present) GenericAVP tr_AVP_3GPP_VisitedPlmnId(template (present) octetstring id := ?) := { |
| 603 | avp := { |
| 604 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Visited_PLMN_Id), |
| 605 | avp_data := { |
| 606 | avp_AAA_3GPP_Visited_PLMN_Id := id |
| 607 | } |
| 608 | } |
| 609 | } |
| 610 | |
| 611 | /* TS 29.262 7.3.13 RAT-Type */ |
| 612 | template (value) GenericAVP ts_AVP_3GPP_RatType(template (value) PCC_3GPP_RAT_Type rat_type) := { |
| 613 | avp := { |
| 614 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_RAT_Type), |
| 615 | avp_data := { |
| 616 | avp_PCC_3GPP_RAT_Type := rat_type |
| 617 | } |
| 618 | } |
| 619 | } |
| 620 | template (present) GenericAVP tr_AVP_3GPP_RatType(template (present) PCC_3GPP_RAT_Type rat_type := ?) := { |
| 621 | avp := { |
| 622 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_RAT_Type), |
| 623 | avp_data := { |
| 624 | avp_PCC_3GPP_RAT_Type := rat_type |
| 625 | } |
| 626 | } |
| 627 | } |
| 628 | |
| 629 | /* TS 29.262 7.3.7 ULR-Flags */ |
| 630 | template (value) GenericAVP ts_AVP_3GPP_UlrFlags(template (value) UINT32 flags) := { |
| 631 | avp := { |
| 632 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULR_Flags), |
| 633 | avp_data := { |
| 634 | avp_AAA_3GPP_ULR_Flags := flags |
| 635 | } |
| 636 | } |
| 637 | } |
| 638 | template (present) GenericAVP tr_AVP_3GPP_UlrFlags(template (present) UINT32 flags := ?) := { |
| 639 | avp := { |
| 640 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULR_Flags), |
| 641 | avp_data := { |
| 642 | avp_AAA_3GPP_ULR_Flags := flags |
| 643 | } |
| 644 | } |
| 645 | } |
| 646 | |
| 647 | /* TS 29.262 7.3.8 ULA-Flags */ |
| 648 | template (value) GenericAVP ts_AVP_3GPP_UlaFlags(template (value) UINT32 flags) := { |
| 649 | avp := { |
| 650 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULA_Flags), |
| 651 | avp_data := { |
| 652 | avp_AAA_3GPP_ULA_Flags := flags |
| 653 | } |
| 654 | } |
| 655 | } |
| 656 | template (present) GenericAVP tr_AVP_3GPP_UlaFlags(template (present) UINT32 flags := ?) := { |
| 657 | avp := { |
| 658 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULA_Flags), |
| 659 | avp_data := { |
| 660 | avp_AAA_3GPP_ULA_Flags := flags |
| 661 | } |
| 662 | } |
| 663 | } |
| 664 | |
Harald Welte | 6effabb | 2020-02-18 21:39:59 +0100 | [diff] [blame] | 665 | |
| 666 | |
| 667 | template (value) GenericAVP ts_AVP_NumOfReqVectors(template (value) UINT32 num_req := '00000004'O) := { |
| 668 | avp := { |
| 669 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Number_Of_Requested_Vectors), |
| 670 | avp_data := { |
| 671 | avp_AAA_3GPP_Number_Of_Requested_Vectors := num_req |
| 672 | } |
| 673 | } |
| 674 | } |
| 675 | |
| 676 | template (value) GenericAVP ts_AVP_ImmReqPref(template (value) UINT32 par := '00000000'O) := { |
| 677 | avp := { |
| 678 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Immediate_Response_Preferred), |
| 679 | avp_data := { |
| 680 | avp_AAA_3GPP_Immediate_Response_Preferred := par |
| 681 | } |
| 682 | } |
| 683 | } |
| 684 | |
| 685 | |
| 686 | /* 7.3.11 Requested-EUTRAN-Authentication-Info */ |
| 687 | template (value) GenericAVP ts_AVP_RequestedEutranAuthInfo(template (value) UINT32 num_vec := '00000004'O) := { |
| 688 | avp := { |
| 689 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Requested_EUTRAN_Authentication_Info), |
| 690 | avp_data := { |
| 691 | avp_AAA_3GPP_Requested_EUTRAN_Authentication_Info := { |
| 692 | ts_AVP_NumOfReqVectors(num_vec), |
| 693 | ts_AVP_ImmReqPref('00000000'O) |
| 694 | } |
| 695 | } |
| 696 | } |
| 697 | } |
| 698 | |
| 699 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 700 | /* TS 29.262 7.3.27 Context-Identifier */ |
| 701 | template (value) GenericAVP ts_AVP_3GPP_ContextId(uint32_t ctx) := { |
| 702 | avp := { |
| 703 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Context_Identifier), |
| 704 | avp_data := { |
| 705 | avp_AAA_3GPP_Context_Identifier := int2oct(ctx, 4) |
| 706 | } |
| 707 | } |
| 708 | } |
| 709 | |
| 710 | /* Ts 29.262 7.3.29 Subscriber-Status */ |
| 711 | template (value) GenericAVP ts_AVP_3GPP_SubscriberStatus(template (value) AAA_3GPP_Subscriber_Status sts) := { |
| 712 | avp := { |
| 713 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscriber_Status), |
| 714 | avp_data := { |
| 715 | avp_AAA_3GPP_Subscriber_Status := sts |
| 716 | } |
| 717 | } |
| 718 | } |
| 719 | |
| 720 | template (value) GenericAVP ts_AVP_3GPP_SubscrRauTauTmr(uint32_t tmr) := { |
| 721 | avp := { |
| 722 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer), |
| 723 | avp_data := { |
| 724 | avp_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer := int2oct(tmr, 4) |
| 725 | } |
| 726 | } |
| 727 | } |
| 728 | |
| 729 | /* TS 29.262 7.3.33 All-APN-Configurations-Included-Indicator */ |
| 730 | template (value) GenericAVP ts_AVP_3GPP_AllApnConfigsIncl(template (value) AAA_3GPP_All_APN_Configurations_Included_Indicator ind := All_APN_CONFIGURATIONS_INCLUDED) := { |
| 731 | avp := { |
| 732 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_All_APN_Configurations_Included_Indicator), |
| 733 | avp_data := { |
| 734 | avp_AAA_3GPP_All_APN_Configurations_Included_Indicator := ind |
| 735 | } |
| 736 | } |
| 737 | } |
| 738 | |
| 739 | /* TS 29.262 7.3.34 APN-Configuration-Profile */ |
| 740 | template (value) GenericAVP ts_AVP_3GPP_ApnConfigProfile(template (value) AVP_list content) := { |
| 741 | avp := { |
| 742 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_APN_Configuration_Profile), |
| 743 | avp_data := { |
| 744 | avp_AAA_3GPP_APN_Configuration_Profile := content |
| 745 | } |
| 746 | } |
| 747 | } |
| 748 | |
| 749 | /* TS 29.262 7.3.35 APN-Configuration */ |
| 750 | template (value) GenericAVP ts_AVP_3GPP_ApnConfig(uint32_t ctx, AAA_3GPP_PDN_Type pdn_type, |
| 751 | charstring apn) := { |
| 752 | avp := { |
| 753 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_APN_Configuration_Profile), |
| 754 | avp_data := { |
| 755 | avp_AAA_3GPP_APN_Configuration := { |
| 756 | ts_AVP_3GPP_ContextId(ctx), |
| 757 | ts_AVP_3GPP_PdnType(pdn_type), |
| 758 | ts_AVP_3GPP_EpsSubscrQosProfile(1, 1), |
| 759 | ts_AVP_ServiceSelection(apn) |
| 760 | } |
| 761 | } |
| 762 | } |
| 763 | } |
| 764 | |
| 765 | /* TS 29.262 7.3.36 Service-Selection (refers to RFC 5778) */ |
| 766 | template (value) GenericAVP ts_AVP_ServiceSelection(charstring apn) := { |
| 767 | avp := { |
| 768 | avp_header := ts_DIA_Hdr(c_AVP_Code_MIPv6_NONE_Service_Selection), |
| 769 | avp_data := { |
| 770 | avp_MIPv6_NONE_Service_Selection := char2oct(apn) |
| 771 | } |
| 772 | } |
| 773 | } |
| 774 | |
| 775 | template (value) GenericAVP ts_AVP_3GPP_QosClassId(uint32_t id) := { |
| 776 | avp := { |
| 777 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Class_Identifier), |
| 778 | avp_data := { |
| 779 | avp_PCC_3GPP_QoS_Class_Identifier := int2oct(id, 4) |
| 780 | } |
| 781 | } |
| 782 | } |
| 783 | |
| 784 | template (value) GenericAVP ts_AVP_3GPP_PriorityLevel(uint32_t prio) := { |
| 785 | avp := { |
| 786 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Priority_Level), |
| 787 | avp_data := { |
| 788 | avp_PCC_3GPP_Priority_Level := int2oct(prio, 4) |
| 789 | } |
| 790 | } |
| 791 | } |
| 792 | |
| 793 | |
| 794 | template (value) GenericAVP ts_AVP_3GPP_AllocRetenPrio(uint32_t prio) := { |
| 795 | avp := { |
| 796 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Allocation_Retention_Priority), |
| 797 | avp_data := { |
| 798 | avp_PCC_3GPP_Allocation_Retention_Priority := { |
| 799 | ts_AVP_3GPP_PriorityLevel(prio) |
| 800 | /* pre-emption capability */ |
| 801 | /* pre-emption vulnerability */ |
| 802 | } |
| 803 | } |
| 804 | } |
| 805 | } |
| 806 | |
| 807 | template (value) GenericAVP ts_AVP_3GPP_EpsSubscrQosProfile(uint32_t qos_class, uint32_t prio) := { |
| 808 | avp := { |
| 809 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_EPS_Subscribed_QoS_Profile), |
| 810 | avp_data := { |
| 811 | avp_AAA_3GPP_EPS_Subscribed_QoS_Profile := { |
| 812 | ts_AVP_3GPP_QosClassId(qos_class), |
| 813 | ts_AVP_3GPP_AllocRetenPrio(prio) |
| 814 | } |
| 815 | } |
| 816 | } |
| 817 | } |
| 818 | |
| 819 | |
| 820 | /* TS 29.262 7.3.41 AMBR */ |
| 821 | template (value) GenericAVP ts_AVP_3GPP_AMBR(uint32_t ul, uint32_t dl) := { |
| 822 | avp := { |
| 823 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_AMBR), |
| 824 | avp_data := { |
| 825 | avp_AAA_3GPP_AMBR := { |
| 826 | ts_AVP_3GPP_MaxReqBwUL(ul), |
| 827 | ts_AVP_3GPP_MaxReqBwDL(dl) |
| 828 | } |
| 829 | } |
| 830 | } |
| 831 | } |
| 832 | |
| 833 | template (value) GenericAVP ts_AVP_3GPP_MaxReqBwUL(uint32_t bw) := { |
| 834 | avp := { |
| 835 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_RX_3GPP_Max_Requested_Bandwidth_UL), |
| 836 | avp_data := { |
| 837 | avp_RX_3GPP_Max_Requested_Bandwidth_UL := int2oct(bw, 4) |
| 838 | } |
| 839 | } |
| 840 | } |
| 841 | |
| 842 | template (value) GenericAVP ts_AVP_3GPP_MaxReqBwDL(uint32_t bw) := { |
| 843 | avp := { |
| 844 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_RX_3GPP_Max_Requested_Bandwidth_DL), |
| 845 | avp_data := { |
| 846 | avp_RX_3GPP_Max_Requested_Bandwidth_DL := int2oct(bw, 4) |
| 847 | } |
| 848 | } |
| 849 | } |
| 850 | |
| 851 | |
| 852 | |
| 853 | /* TS 29.262 7.3.62 PDN-Type */ |
| 854 | template (value) GenericAVP ts_AVP_3GPP_PdnType(template (value) AAA_3GPP_PDN_Type pdn_type) := { |
| 855 | avp := { |
| 856 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_PDN_Type), |
| 857 | avp_data := { |
| 858 | avp_AAA_3GPP_PDN_Type := pdn_type |
| 859 | } |
| 860 | } |
| 861 | } |
| 862 | |
| 863 | |
| 864 | |
| 865 | /* 5.3.2 Capabilities Exchange Answer */ |
| 866 | template (value) PDU_DIAMETER |
Harald Welte | 61f73d5 | 2020-04-26 21:41:12 +0200 | [diff] [blame] | 867 | ts_DIA_CEA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, |
| 868 | template (value) charstring origin_host, template (value) charstring origin_realm, |
| 869 | template (value) octetstring host_ip, uint32_t vendor_app_id) |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 870 | := ts_DIAMETER(flags:='00000000'B, cmd_code:=Capabilities_Exchange, hbh_id:=hbh_id, ete_id:=ete_id, |
| 871 | avps := { |
| 872 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
Harald Welte | 61f73d5 | 2020-04-26 21:41:12 +0200 | [diff] [blame] | 873 | ts_AVP_OriginHost(origin_host), |
| 874 | ts_AVP_OriginRealm(origin_realm), |
| 875 | ts_AVP_HostIpAddr(host_ip), |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 876 | ts_AVP_VendorId(vendor_id_3GPP), |
| 877 | ts_AVP_ProductName("TTCN-3 Testsuite"), |
| 878 | ts_AVP_OriginStateId('00000001'O), |
| 879 | ts_AVP_SuppVendorIdRaw(5535), /* 3GPP2 */ |
| 880 | ts_AVP_SuppVendorId(vendor_id_3GPP), |
| 881 | ts_AVP_SuppVendorIdRaw(13019), /* ETSI */ |
| 882 | ts_AVP_AuthAppId('FFFFFFFF'O), |
| 883 | ts_AVP_InbSecId('00000000'O), |
Harald Welte | 61f73d5 | 2020-04-26 21:41:12 +0200 | [diff] [blame] | 884 | ts_AVP_VendorSpecAppId(vendor_id_3GPP, vendor_app_id) |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 885 | }); |
| 886 | |
Harald Welte | 6effabb | 2020-02-18 21:39:59 +0100 | [diff] [blame] | 887 | |
| 888 | template (value) PDU_DIAMETER |
Vadim Yanitskiy | 2dba494 | 2021-12-11 15:46:30 +0300 | [diff] [blame] | 889 | ts_DIA_AIR(/* template (value) */ hexstring imsi, |
| 890 | template (value) octetstring sess_id := c_def_sess_id, |
| 891 | template (value) charstring dest_realm := "localdomain", |
| 892 | template (value) UINT32 hbh_id := '00000000'O, |
| 893 | template (value) UINT32 ete_id := '00000000'O) := |
Vadim Yanitskiy | 21fd7db | 2021-12-15 05:29:35 +0300 | [diff] [blame^] | 894 | ts_DIAMETER(flags := '11000000'B, |
Vadim Yanitskiy | 2dba494 | 2021-12-11 15:46:30 +0300 | [diff] [blame] | 895 | cmd_code := Authentication_Information, |
| 896 | hbh_id := hbh_id, |
| 897 | ete_id := ete_id, |
| 898 | avps := { |
| 899 | ts_AVP_SessionId(sess_id), |
| 900 | ts_AVP_DestinationRealm(dest_realm), |
| 901 | ts_AVP_UserNameImsi(imsi), |
| 902 | /* Requested EUTRAN Auth Info */ |
| 903 | ts_AVP_RequestedEutranAuthInfo, |
| 904 | ts_AVP_3GPP_VisitedPlmnId('11111F'O) |
Harald Welte | 6effabb | 2020-02-18 21:39:59 +0100 | [diff] [blame] | 905 | }); |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 906 | template (present) PDU_DIAMETER |
Vadim Yanitskiy | 2dba494 | 2021-12-11 15:46:30 +0300 | [diff] [blame] | 907 | tr_DIA_AIR(/* template (present) */ hexstring imsi, |
| 908 | template (present) octetstring sess_id := ?, |
| 909 | template (present) charstring dest_realm := ?, |
| 910 | template (present) UINT32 hbh_id := ?, |
| 911 | template (present) UINT32 ete_id := ?) := |
Vadim Yanitskiy | 21fd7db | 2021-12-15 05:29:35 +0300 | [diff] [blame^] | 912 | tr_DIAMETER(flags := '1???????'B, |
Vadim Yanitskiy | 2dba494 | 2021-12-11 15:46:30 +0300 | [diff] [blame] | 913 | cmd_code := Authentication_Information, |
| 914 | app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| 915 | hbh_id := hbh_id, ete_id := ete_id, |
| 916 | avps := superset( |
| 917 | tr_AVP_SessionId(sess_id), |
| 918 | tr_AVP_DestinationRealm(dest_realm), |
| 919 | tr_AVP_UserNameImsi(imsi), |
| 920 | tr_AVP_3GPP_VisitedPlmnId |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 921 | )); |
| 922 | |
| 923 | /* TS 29.262 5.2.3.1 + 7.2.6 Authentication Information Answer */ |
| 924 | template (value) PDU_DIAMETER |
Vadim Yanitskiy | 2dba494 | 2021-12-11 15:46:30 +0300 | [diff] [blame] | 925 | ts_DIA_AIA(template (value) AVP_list auth_info_contents, |
| 926 | template (value) octetstring sess_id := c_def_sess_id, |
| 927 | template (value) charstring orig_host := "hss.localdomain", |
| 928 | template (value) charstring orig_realm := "localdomain", |
| 929 | template (value) UINT32 hbh_id := '00000000'O, |
| 930 | template (value) UINT32 ete_id := '00000000'O) := |
| 931 | ts_DIAMETER(flags := '01000000'B, |
| 932 | cmd_code := Authentication_Information, |
| 933 | app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| 934 | hbh_id := hbh_id, |
| 935 | ete_id := ete_id, |
| 936 | avps := { |
| 937 | ts_AVP_SessionId(sess_id), |
| 938 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 939 | ts_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
| 940 | ts_AVP_OriginHost(orig_host), |
| 941 | ts_AVP_OriginRealm(orig_realm), |
| 942 | ts_AVP_3GPP_AuthInfo(auth_info_contents) |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 943 | }); |
Vadim Yanitskiy | 446edae | 2021-12-12 04:33:08 +0300 | [diff] [blame] | 944 | template (present) PDU_DIAMETER |
| 945 | tr_DIA_AIA(template (present) AVP_list auth_info_contents := ?, |
| 946 | template (present) octetstring sess_id := ?, |
| 947 | template (present) charstring orig_host := ?, |
| 948 | template (present) charstring orig_realm := ?, |
| 949 | template (present) UINT32 hbh_id := ?, |
| 950 | template (present) UINT32 ete_id := ?) := |
| 951 | tr_DIAMETER(flags := '0???????'B, |
| 952 | cmd_code := Authentication_Information, |
| 953 | app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| 954 | hbh_id := hbh_id, |
| 955 | ete_id := ete_id, |
| 956 | avps := superset( |
| 957 | tr_AVP_SessionId(sess_id), |
| 958 | tr_AVP_ResultCode(DIAMETER_SUCCESS), |
| 959 | tr_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
| 960 | tr_AVP_3GPP_AuthInfo(auth_info_contents), |
| 961 | tr_AVP_OriginHost(orig_host), |
| 962 | tr_AVP_OriginRealm(orig_realm) |
| 963 | )); |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 964 | |
| 965 | |
| 966 | /* TS 29.262 7.2.3 Update Location Request */ |
Vadim Yanitskiy | 5e1bdc0 | 2021-12-12 02:33:59 +0300 | [diff] [blame] | 967 | template (value) PDU_DIAMETER |
| 968 | ts_DIA_ULR(/* template (value) */ hexstring imsi, |
| 969 | template (value) octetstring sess_id := c_def_sess_id, |
| 970 | template (value) charstring orig_host := "ttcn3.localdomain", |
| 971 | template (value) charstring orig_realm := "localdomain", |
| 972 | template (value) charstring dest_realm := "localdomain", |
| 973 | template (value) UINT32 hbh_id := '00000000'O, |
| 974 | template (value) UINT32 ete_id := '00000000'O) := |
| 975 | ts_DIAMETER(flags := '11000000'B, |
| 976 | cmd_code := Update_Location, |
| 977 | app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| 978 | hbh_id := hbh_id, |
| 979 | ete_id := ete_id, |
| 980 | avps := { |
| 981 | ts_AVP_SessionId(sess_id), |
| 982 | ts_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
| 983 | ts_AVP_UserNameImsi(imsi), |
| 984 | ts_AVP_3GPP_UlrFlags('00000000'O), |
| 985 | ts_AVP_3GPP_VisitedPlmnId('11111F'O), |
| 986 | ts_AVP_3GPP_RatType(EUTRAN), |
| 987 | ts_AVP_OriginHost(orig_host), |
| 988 | ts_AVP_OriginRealm(orig_realm), |
| 989 | ts_AVP_DestinationRealm(dest_realm) |
| 990 | }); |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 991 | template (present) PDU_DIAMETER |
Vadim Yanitskiy | 0e8f516 | 2021-12-15 05:00:32 +0300 | [diff] [blame] | 992 | tr_DIA_ULR(/* template (present) */ hexstring imsi, |
| 993 | template (present) octetstring sess_id := ?, |
| 994 | template (present) charstring orig_host := ?, |
| 995 | template (present) charstring orig_realm := ?, |
| 996 | template (present) charstring dest_realm := ?, |
| 997 | template (present) UINT32 hbh_id := ?, |
| 998 | template (present) UINT32 ete_id := ?) := |
| 999 | tr_DIAMETER(flags := '11000000'B, |
| 1000 | cmd_code := Update_Location, |
| 1001 | app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| 1002 | hbh_id := hbh_id, |
| 1003 | ete_id := ete_id, |
| 1004 | avps := superset( |
| 1005 | tr_AVP_SessionId(sess_id), |
| 1006 | tr_AVP_AuthSessionState, |
| 1007 | tr_AVP_OriginHost(orig_host), |
| 1008 | tr_AVP_OriginRealm(orig_realm), |
| 1009 | tr_AVP_DestinationRealm(dest_realm), |
| 1010 | tr_AVP_UserNameImsi(imsi), |
| 1011 | tr_AVP_3GPP_RatType(EUTRAN), |
| 1012 | tr_AVP_3GPP_UlrFlags, |
| 1013 | tr_AVP_3GPP_VisitedPlmnId |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1014 | )); |
| 1015 | |
| 1016 | template (value) PDU_DIAMETER |
Vadim Yanitskiy | 0e8f516 | 2021-12-15 05:00:32 +0300 | [diff] [blame] | 1017 | ts_DIA_ULA(template (value) AVP_list sub_data, |
| 1018 | template (value) octetstring sess_id := c_def_sess_id, |
| 1019 | template (value) charstring orig_host := "hss.localdomain", |
| 1020 | template (value) charstring orig_realm := "localdomain", |
| 1021 | template (value) UINT32 hbh_id := '00000000'O, |
| 1022 | template (value) UINT32 ete_id := '00000000'O) := |
| 1023 | ts_DIAMETER(flags:='01000000'B, |
| 1024 | cmd_code := Update_Location, |
| 1025 | app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| 1026 | hbh_id := hbh_id, |
| 1027 | ete_id := ete_id, |
| 1028 | avps := { |
| 1029 | ts_AVP_SessionId(sess_id), |
| 1030 | ts_AVP_ResultCode(DIAMETER_SUCCESS), /* optional */ |
| 1031 | ts_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
| 1032 | ts_AVP_OriginHost(orig_host), |
| 1033 | ts_AVP_OriginRealm(orig_realm), |
| 1034 | ts_AVP_3GPP_UlaFlags('00000002'O), |
| 1035 | ts_AVP_3GPP_SubscriptionData(sub_data) |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1036 | }); |
Vadim Yanitskiy | 5e1bdc0 | 2021-12-12 02:33:59 +0300 | [diff] [blame] | 1037 | template (present) PDU_DIAMETER |
| 1038 | tr_DIA_ULA(template (present) AVP_list sub_data := ?, |
| 1039 | template (present) octetstring sess_id := ?, |
| 1040 | template (present) charstring orig_host := ?, |
| 1041 | template (present) charstring orig_realm := ?, |
| 1042 | template (present) UINT32 hbh_id := ?, |
| 1043 | template (present) UINT32 ete_id := ?) := |
| 1044 | tr_DIAMETER(flags := '0???????'B, |
| 1045 | cmd_code := Update_Location, |
| 1046 | app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| 1047 | hbh_id := hbh_id, |
| 1048 | ete_id := ete_id, |
| 1049 | avps := superset( |
| 1050 | tr_AVP_SessionId(sess_id), |
| 1051 | tr_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1052 | tr_AVP_AuthSessionState, |
| 1053 | tr_AVP_OriginHost(orig_host), |
| 1054 | tr_AVP_OriginRealm(orig_realm), |
| 1055 | tr_AVP_3GPP_UlaFlags, |
| 1056 | tr_AVP_3GPP_SubscriptionData(sub_data) |
| 1057 | )); |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1058 | |
| 1059 | |
| 1060 | |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 1061 | /* RFC 4006 3.1. Credit-Control-Request (CCR) Command */ |
| 1062 | template (present) PDU_DIAMETER |
| 1063 | tr_DIA_CCR(template (present) DCC_NONE_CC_Request_Type req_type := INITIAL_REQUEST) |
| 1064 | := tr_DIAMETER(flags:='11000000'B, cmd_code:=Credit_Control, |
| 1065 | app_id:=int2oct(c_DIAMETER_3GPP_Gx_AID, 4), |
| 1066 | avps := superset( |
| 1067 | tr_AVP_SessionId, |
| 1068 | tr_AVP_OriginHost, |
| 1069 | tr_AVP_OriginRealm, |
| 1070 | tr_AVP_DestinationRealm, |
| 1071 | tr_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_Gx_AID, 4)), |
| 1072 | tr_AVP_CcReqType(req_type), |
| 1073 | tr_AVP_CcReqNum(?) |
| 1074 | )); |
| 1075 | |
| 1076 | |
| 1077 | /* RFC 4006 3.2. Credit-Control-Answer (CCA) Command */ |
| 1078 | template (value) PDU_DIAMETER |
| 1079 | ts_DIA_CCA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, |
| 1080 | template (value) octetstring sess_id, |
| 1081 | template (value) DCC_NONE_CC_Request_Type req_type, |
| 1082 | template (value) AVP_Unsigned32 req_num) |
| 1083 | |
| 1084 | := ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control, |
| 1085 | app_id:=int2oct(c_DIAMETER_3GPP_Gx_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id, |
| 1086 | avps := { |
| 1087 | ts_AVP_SessionId(sess_id), |
| 1088 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1089 | ts_AVP_OriginHost("pcrf.localdomain"), |
| 1090 | ts_AVP_OriginRealm("localdomain"), |
| 1091 | ts_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_Gx_AID, 4)), |
| 1092 | ts_AVP_CcReqType(req_type), |
| 1093 | ts_AVP_CcReqNum(req_num)//, |
| 1094 | // qos |
| 1095 | // default eps bearer qos |
| 1096 | // supported features |
| 1097 | // origin |
| 1098 | }); |
| 1099 | |
Vadim Yanitskiy | f28b255 | 2021-12-11 03:49:14 +0300 | [diff] [blame] | 1100 | /* RFC 6733, section 5.5.1 "Device-Watchdog-Request" */ |
| 1101 | template (value) PDU_DIAMETER |
| 1102 | ts_DIA_DWR(template (value) OCTET4 state_id := '00000000'O, |
| 1103 | template (value) charstring orig_host := "ttcn3.localdomain", |
| 1104 | template (value) charstring orig_realm := "localdomain", |
| 1105 | template (value) UINT32 hbh_id := '00000000'O, |
| 1106 | template (value) UINT32 ete_id := '00000000'O) := |
| 1107 | ts_DIAMETER(flags := '10000000'B, |
| 1108 | cmd_code := Device_Watchdog, |
| 1109 | app_id := '00000000'O, |
| 1110 | hbh_id := hbh_id, |
| 1111 | ete_id := ete_id, |
| 1112 | avps := { |
| 1113 | ts_AVP_OriginHost(orig_host), |
| 1114 | ts_AVP_OriginRealm(orig_realm), |
| 1115 | ts_AVP_OriginStateId(state_id) |
| 1116 | }); |
| 1117 | template (present) PDU_DIAMETER |
| 1118 | tr_DIA_DWR(template (present) OCTET4 state_id := ?, |
| 1119 | template (present) charstring orig_host := ?, |
| 1120 | template (present) charstring orig_realm := ?, |
| 1121 | template (present) UINT32 hbh_id := ?, |
| 1122 | template (present) UINT32 ete_id := ?) := |
| 1123 | tr_DIAMETER(flags := '1???????'B, |
| 1124 | cmd_code := Device_Watchdog, |
| 1125 | app_id := '00000000'O, |
| 1126 | hbh_id := hbh_id, |
| 1127 | ete_id := ete_id, |
| 1128 | avps := superset( |
| 1129 | tr_AVP_OriginHost(orig_host), |
| 1130 | tr_AVP_OriginRealm(orig_realm), |
| 1131 | tr_AVP_OriginStateId(state_id) |
| 1132 | )); |
| 1133 | |
| 1134 | /* RFC 6733, section 5.5.2 "Device-Watchdog-Answer" */ |
| 1135 | template (value) PDU_DIAMETER |
| 1136 | ts_DIA_DWA(template (value) OCTET4 state_id := '00000000'O, |
| 1137 | template (value) charstring orig_host := "ttcn3.localdomain", |
| 1138 | template (value) charstring orig_realm := "localdomain", |
| 1139 | template (value) UINT32 hbh_id := '00000000'O, |
| 1140 | template (value) UINT32 ete_id := '00000000'O) := |
| 1141 | ts_DIAMETER(flags := '00000000'B, |
| 1142 | cmd_code := Device_Watchdog, |
| 1143 | app_id := '00000000'O, |
| 1144 | hbh_id := hbh_id, |
| 1145 | ete_id := ete_id, |
| 1146 | avps := { |
| 1147 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1148 | ts_AVP_OriginHost(orig_host), |
| 1149 | ts_AVP_OriginRealm(orig_realm), |
| 1150 | ts_AVP_OriginStateId(state_id) |
| 1151 | }); |
| 1152 | template (present) PDU_DIAMETER |
| 1153 | tr_DIA_DWA(template (present) OCTET4 state_id := ?, |
| 1154 | template (present) charstring orig_host := ?, |
| 1155 | template (present) charstring orig_realm := ?, |
| 1156 | template (present) UINT32 hbh_id := ?, |
| 1157 | template (present) UINT32 ete_id := ?) := |
| 1158 | tr_DIAMETER(flags := '0???????'B, |
| 1159 | cmd_code := Device_Watchdog, |
| 1160 | app_id := '00000000'O, |
| 1161 | hbh_id := hbh_id, |
| 1162 | ete_id := ete_id, |
| 1163 | avps := superset( |
| 1164 | tr_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1165 | tr_AVP_OriginHost(orig_host), |
| 1166 | tr_AVP_OriginRealm(orig_realm), |
| 1167 | tr_AVP_OriginStateId(state_id) |
| 1168 | )); |
| 1169 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1170 | } |