Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1 | module DIAMETER_Templates { |
| 2 | |
| 3 | /* (C) 2019 by Harald Welte <laforge@gnumonks.org> |
| 4 | * All rights reserved. |
| 5 | * |
| 6 | * Released under the terms of GNU General Public License, Version 2 or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 10 | */ |
| 11 | |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 12 | import from General_Types all; |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 13 | import from DIAMETER_Types all; |
| 14 | import from Osmocom_Types all; |
Pau Espin Pedrol | 8fa2284 | 2022-05-20 14:47:55 +0200 | [diff] [blame] | 15 | import from Misc_Helpers all; |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 16 | |
| 17 | /* https://www.iana.org/assignments/aaa-parameters/aaa-parameters.xhtml#aaa-parameters-4 */ |
| 18 | type enumerated DIAMETER_Resultcode { |
| 19 | /* Informational */ |
| 20 | DIAMETER_MULTI_ROUND_AUTH (1001), |
| 21 | |
| 22 | /* Success */ |
| 23 | DIAMETER_SUCCESS (2001), |
| 24 | DIAMETER_LIMITED_SUCCESS (2002), |
| 25 | DIAMETER_FIRST_REGISTRATION (2003), |
| 26 | DIAMETER_SUBSEQUENT_REGISTRATION (2004), |
| 27 | DIAMETER_UNREGISTERED_SERVICE (2005), |
| 28 | DIAMETER_SUCCESS_SERVER_NAME_NOT_STORED (2006), |
| 29 | DIAMETER_SERVER_SELECTION (2007), |
| 30 | DIAMETER_SUCCESS_AUTH_SENT_SERVER_NOT_STORED (2008), |
| 31 | DIAMETER_SUCCESS_RELOCATE_HA (2009), |
| 32 | |
| 33 | /* Protocol Errors */ |
| 34 | DIAMETER_COMMAND_UNSUPPORTED (3001), |
| 35 | DIAMETER_UNABLE_TO_DELIVER (3002), |
| 36 | DIAMETER_REALM_NOT_SERVED (3003), |
| 37 | DIAMETER_TOO_BUSY (3004), |
| 38 | DIAMETER_LOOP_DETECTED (3005), |
| 39 | DIAMETER_REDIRECT_INDICATION (3006), |
| 40 | DIAMETER_APPLICATION_UNSUPPORTED (3007), |
| 41 | DIAMETER_INVALID_HDR_BITS (3008), |
| 42 | DIAMETER_INVALID_AVP_BITS (3009), |
| 43 | DIAMETER_UNKNOWN_PEER (3010), |
| 44 | DIAMETER_REALM_REDIRECT_INDICATION (3011), |
| 45 | |
| 46 | /* Transient Failures */ |
| 47 | DIAMETER_AUTHENTICATION_REJECTED (4001), |
| 48 | DIAMETER_OUT_OF_SPACE (4002), |
| 49 | ELECTION_LOST (4003), |
| 50 | DIAMETER_ERROR_MIP_REPLY_FAILURE (4005), |
| 51 | DIAMETER_ERROR_HA_NOT_AVAILABLE (4006), |
| 52 | DIAMETER_ERROR_BAD_KEY (4007), |
| 53 | DIAMETER_ERROR_MIP_FILTER_NOT_SUPPORTED (4008), |
| 54 | DIAMETER_END_USER_SERVICE_DENIED (4010), |
| 55 | DIAMETER_CREDIT_CONTROL_NOT_APPLICABLE (4011), |
| 56 | DIAMETER_CREDIT_LIMIT_REACHED (4012), |
| 57 | DIAMETER_USER_NAME_REQUIRED (4013), |
| 58 | RESOURCE_FAILURE (4014), |
| 59 | |
| 60 | DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE (4181), |
| 61 | DIAMETER_ERROR_CAMEL_SUBSCRIPTION_PRESENT (4882), |
| 62 | |
| 63 | /* Permanent Failure */ |
| 64 | DIAMETER_AVP_UNSUPPORTED (5001), |
| 65 | DIAMETER_UNKNOWN_SESSION_ID (5002), |
| 66 | DIAMETER_AUTHORIZATION_REJECTED (5003), |
| 67 | DIAMETER_INVALID_AVP_VALUE (5004), |
| 68 | DIAMETER_MISSING_AVP (5005), |
| 69 | DIAMETER_RESOURCES_EXCEEDED (5006), |
| 70 | DIAMETER_CONTRADICTING_AVPS (5007), |
| 71 | DIAMETER_AVP_NOT_ALLOWED (5008), |
| 72 | DIAMETER_AVP_OCCURS_TOO_MANY_TIMES (5009), |
| 73 | DIAMETER_NO_COMMON_APPLICATION (5010), |
| 74 | DIAMETER_UNSUPPORTED_VERSION (5011), |
| 75 | DIAMETER_UNABLE_TO_COMPLY (5012), |
| 76 | DIAMETER_INVALID_BIT_IN_HEADER (5013), |
| 77 | DIAMETER_INVALID_AVP_LENGTH (5014), |
| 78 | DIAMETER_INVALID_MESSAGE_LENGTH (5015), |
| 79 | DIAMETER_INVALID_AVP_BIT_COMBO (5016), |
| 80 | DIAMETER_NO_COMMON_SECURITY (5017), |
| 81 | DIAMETER_RADIUS_AVP_UNTRANSLATABLE (5018), |
| 82 | DIAMETER_ERROR_NO_FOREIGN_HA_SERVICE (5024), |
| 83 | DIAMETER_ERROR_END_TO_END_MIP_KEY_ENCRYPTION (5025), |
| 84 | DIAMETER_USER_UNKNOWN (5030), |
| 85 | DIAMETER_RATING_FAILED (5031), |
| 86 | DIAMETER_ERROR_USER_UNKNOWN (5032), |
| 87 | DIAMETER_ERROR_IDENTITIES_DONT_MATCH (5033), |
| 88 | DIAMETER_ERROR_IDENTITY_NOT_REGISTERED (5034), |
| 89 | DIAMETER_ERROR_ROAMING_NOT_ALLOWED (5035), |
| 90 | DIAMETER_ERROR_IDENTITY_ALREADY_REGISTERED (5036), |
| 91 | DIAMETER_ERROR_AUTH_SCHEME_NOT_SUPPORTED (5037), |
| 92 | DIAMETER_ERROR_IN_ASSIGNMENT_TYPE (5038), |
| 93 | DIAMETER_ERROR_TOO_MUCH_DATA (5039), |
| 94 | DIAMETER_ERROR_NOT_SUPPORTED_USER_DATA (5040), |
| 95 | DIAMETER_ERROR_MIP6_AUTH_MODE (5041), |
| 96 | UNKNOWN_BINDING_TEMPLATE_NAME (5042), |
| 97 | BINDING_FAILURE (5043), |
| 98 | MAX_BINDINGS_SET_FAILURE (5044), |
| 99 | MAXIMUM_BINDINGS_REACHED_FOR_ENDPOINT (5045), |
| 100 | SESSION_EXISTS (5046), |
| 101 | INSUFFICIENT_CLASSIFIERS (5047), |
| 102 | DIAMETER_ERROR_EAP_CODE_UNKNOWN (5048) |
| 103 | }; |
| 104 | |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 105 | /* Gy : 3GPP TS 32.299 7.1.6, RFC4006 3.1 */ |
| 106 | const uint32_t c_DIAMETER_CREDIT_CONTROL_AID := 4; |
Pau Espin Pedrol | 117a94f | 2023-12-21 16:10:12 +0100 | [diff] [blame] | 107 | |
Harald Welte | f9fb63e | 2020-04-26 18:07:19 +0200 | [diff] [blame] | 108 | const uint32_t c_DIAMETER_3GPP_Gx_AID := 16777238; |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 109 | const uint32_t c_DIAMETER_3GPP_S7_AID := 16777308; |
| 110 | |
Vadim Yanitskiy | 0e8f516 | 2021-12-15 05:00:32 +0300 | [diff] [blame] | 111 | const octetstring c_def_sess_id := char2oct("ttcn3.session"); |
| 112 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 113 | template (value) PDU_DIAMETER |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 114 | ts_DIAMETER(template (value) DIAMETER_Types.BIT8 flags, |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 115 | template (value) Command_Code cmd_code, |
| 116 | template (value) OCTET4 app_id := '00000000'O, |
Vadim Yanitskiy | 00720bd | 2021-12-12 02:05:08 +0300 | [diff] [blame] | 117 | template (value) UINT32 hbh_id := '00000000'O, |
| 118 | template (value) UINT32 ete_id := '00000000'O, |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 119 | template (value) AVP_list avps := {} |
| 120 | ) := { |
| 121 | version := 1, |
| 122 | message_length := 0, /* overwritten */ |
| 123 | RPETxxxx := flags, |
| 124 | command_code := cmd_code, |
| 125 | application_id := app_id, |
| 126 | hop_by_hop_id := hbh_id, |
| 127 | end_to_end_id := ete_id, |
| 128 | avps := avps |
| 129 | } |
| 130 | template (present) PDU_DIAMETER |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 131 | tr_DIAMETER(template (present) DIAMETER_Types.BIT8 flags := ?, |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 132 | template (present) Command_Code cmd_code := ?, |
| 133 | template (present) OCTET4 app_id := ?, |
| 134 | template (present) UINT32 hbh_id := ?, |
| 135 | template (present) UINT32 ete_id := ?, |
| 136 | template (present) AVP_list avps := ?) := { |
| 137 | version := 1, |
| 138 | message_length := ?, |
| 139 | RPETxxxx := flags, |
| 140 | command_code := cmd_code, |
| 141 | application_id := app_id, |
| 142 | hop_by_hop_id := hbh_id, |
| 143 | end_to_end_id := ete_id, |
| 144 | avps := avps |
| 145 | } |
| 146 | template (present) PDU_DIAMETER |
| 147 | tr_DIAMETER_A( |
| 148 | template (present) Command_Code cmd_code := ?, |
| 149 | template (present) OCTET4 app_id := ?, |
| 150 | template (present) UINT32 hbh_id := ?, |
| 151 | template (present) UINT32 ete_id := ?, |
| 152 | template (present) AVP_list avps := ?) := |
| 153 | tr_DIAMETER('0???????'B, cmd_code, app_id, hbh_id, ete_id, avps); |
| 154 | template (present) PDU_DIAMETER |
| 155 | tr_DIAMETER_R( |
| 156 | template (present) Command_Code cmd_code := ?, |
| 157 | template (present) OCTET4 app_id := ?, |
| 158 | template (present) UINT32 hbh_id := ?, |
| 159 | template (present) UINT32 ete_id := ?, |
| 160 | template (present) AVP_list avps := ?) := |
| 161 | tr_DIAMETER('1???????'B, cmd_code, app_id, hbh_id, ete_id, avps); |
| 162 | |
| 163 | |
| 164 | template (value) AVP_Header |
| 165 | ts_DIA_Hdr(template (value) AVP_Code avp_code, |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 166 | template (value) DIAMETER_Types.BIT8 flags := '01000000'B) := { |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 167 | avp_code := avp_code, |
| 168 | VMPxxxxx := flags, |
| 169 | avp_length := 0, /* overwritten */ |
| 170 | vendor_id := omit |
| 171 | } |
| 172 | template (present) AVP_Header |
| 173 | tr_DIA_Hdr(template (present) AVP_Code avp_code, |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 174 | template (present) DIAMETER_Types.BIT8 flags := '0???????'B) := { |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 175 | avp_code := avp_code, |
| 176 | VMPxxxxx := flags, |
| 177 | avp_length := ?, /* overwritten */ |
| 178 | vendor_id := omit |
| 179 | } |
| 180 | |
| 181 | template (value) AVP_Header |
| 182 | ts_DIA_Hdr_3GPP(template (value) AVP_Code avp_code, |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 183 | template (value) DIAMETER_Types.BIT8 flags := '11000000'B) := { |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 184 | avp_code := avp_code, |
| 185 | VMPxxxxx := flags, |
| 186 | avp_length := 0, /* overwritten */ |
| 187 | vendor_id := vendor_id_3GPP |
| 188 | } |
| 189 | template (present) AVP_Header |
| 190 | tr_DIA_Hdr_3GPP(template (present) AVP_Code avp_code, |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 191 | template (present) DIAMETER_Types.BIT8 flags := '1???????'B) := { |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 192 | avp_code := avp_code, |
| 193 | VMPxxxxx := flags, |
| 194 | avp_length := ?, /* overwritten */ |
| 195 | vendor_id := vendor_id_3GPP |
| 196 | } |
| 197 | |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 198 | template (present) AVP_Address tr_AVP_Address(template (present) AddressType addr_type := ?, |
| 199 | template (present) octetstring addr_data := ?) := { |
| 200 | address_type := addr_type, |
| 201 | address_data := addr_data |
| 202 | } |
| 203 | |
| 204 | template (present) GenericAVP tr_AVP_SubcrId(template (present) DCC_NONE_Subscription_Id t) := { |
| 205 | avp := { |
| 206 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Subscription_Id), |
| 207 | avp_data := { |
| 208 | avp_DCC_NONE_Subscription_Id := t |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | |
Pau Espin Pedrol | b8cd34a | 2022-05-18 16:34:12 +0200 | [diff] [blame] | 213 | 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] | 214 | avp := { |
| 215 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Subscription_Id_Type), |
| 216 | avp_data := { |
| 217 | avp_DCC_NONE_Subscription_Id_Type := t |
| 218 | } |
| 219 | } |
| 220 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 221 | |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 222 | template (present) GenericAVP tr_AVP_SubcrIdData(template (present) DCC_NONE_Subscription_Id_Data t) := { |
| 223 | avp := { |
| 224 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Subscription_Id_Data), |
| 225 | avp_data := { |
| 226 | avp_DCC_NONE_Subscription_Id_Data := t |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | template (present) GenericAVP tr_AVP_RequestedAction(template (present) DCC_NONE_Requested_Action t := ?) := { |
| 232 | avp := { |
| 233 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Requested_Action), |
| 234 | avp_data := { |
| 235 | avp_DCC_NONE_Requested_Action := t |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | template (present) GenericAVP tr_AVP_MultipleServicesIndicator(template (present) DCC_NONE_Multiple_Services_Indicator t := ?) := { |
| 241 | avp := { |
| 242 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Multiple_Services_Indicator), |
| 243 | avp_data := { |
| 244 | avp_DCC_NONE_Multiple_Services_Indicator := t |
| 245 | } |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | template (present) GenericAVP tr_AVP_ServiceContextId(template (present) DCC_NONE_Service_Context_Id id := ?) := { |
| 250 | avp := { |
| 251 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Service_Context_Id), |
| 252 | avp_data := { |
| 253 | avp_DCC_NONE_Service_Context_Id := id |
| 254 | } |
| 255 | } |
| 256 | } |
| 257 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 258 | template (value) GenericAVP ts_AVP_OriginHost(template (value) charstring host) := { |
| 259 | avp := { |
| 260 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Host), |
| 261 | avp_data := { |
| 262 | avp_BASE_NONE_Origin_Host := host |
| 263 | } |
| 264 | } |
| 265 | } |
| 266 | template (present) GenericAVP tr_AVP_OriginHost(template (present) charstring host := ?) := { |
| 267 | avp := { |
| 268 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Host), |
| 269 | avp_data := { |
| 270 | avp_BASE_NONE_Origin_Host := host |
| 271 | } |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | |
| 276 | template (value) GenericAVP ts_AVP_OriginRealm(template (value) charstring realm) := { |
| 277 | avp := { |
| 278 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Realm), |
| 279 | avp_data := { |
| 280 | avp_BASE_NONE_Origin_Realm := realm |
| 281 | } |
| 282 | } |
| 283 | } |
| 284 | template (present) GenericAVP tr_AVP_OriginRealm(template (present) charstring realm := ?) := { |
| 285 | avp := { |
| 286 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Realm), |
| 287 | avp_data := { |
| 288 | avp_BASE_NONE_Origin_Realm := realm |
| 289 | } |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | |
| 294 | template (value) GenericAVP ts_AVP_OriginStateId(template (value) OCTET4 state_id) := { |
| 295 | avp := { |
| 296 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_State_Id), |
| 297 | avp_data := { |
| 298 | avp_BASE_NONE_Origin_State_Id := state_id |
| 299 | } |
| 300 | } |
| 301 | } |
Vadim Yanitskiy | f28b255 | 2021-12-11 03:49:14 +0300 | [diff] [blame] | 302 | template (present) GenericAVP tr_AVP_OriginStateId(template (present) OCTET4 state_id := ?) := { |
| 303 | avp := { |
| 304 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_State_Id), |
| 305 | avp_data := { |
| 306 | avp_BASE_NONE_Origin_State_Id := state_id |
| 307 | } |
| 308 | } |
| 309 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 310 | |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 311 | template (present) GenericAVP tr_AVP_TerminationCause(template (present) BASE_NONE_Termination_Cause tc) := { |
| 312 | avp := { |
| 313 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Termination_Cause), |
| 314 | avp_data := { |
| 315 | avp_BASE_NONE_Termination_Cause := tc |
| 316 | } |
| 317 | } |
| 318 | } |
| 319 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 320 | template (value) GenericAVP ts_AVP_HostIpAddr(template (value) OCTET4 ipv4_addr) := { |
| 321 | avp := { |
| 322 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Host_IP_Address), |
| 323 | avp_data := { |
| 324 | avp_BASE_NONE_Host_IP_Address := { |
| 325 | address_type := IP, |
| 326 | address_data := ipv4_addr |
| 327 | } |
| 328 | } |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | template (value) GenericAVP ts_AVP_VendorId(Vendor_Id vendor_id) := { |
| 333 | avp := { |
| 334 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id, '00000000'B), |
| 335 | avp_data := { |
| 336 | avp_BASE_NONE_Vendor_Id := int2oct(enum2int(vendor_id), 4) |
| 337 | } |
| 338 | } |
| 339 | } |
Pau Espin Pedrol | 7aa4ad8 | 2023-08-28 18:24:24 +0200 | [diff] [blame] | 340 | private function f_tr_AVP_VendorId(template (present) Vendor_Id vendor_id) |
| 341 | return template (present) BASE_NONE_Vendor_Id { |
| 342 | if (istemplatekind(vendor_id, "?")) { |
| 343 | return ?; |
| 344 | } else { |
| 345 | var template (present) BASE_NONE_Vendor_Id c; |
| 346 | c := int2oct(enum2int(valueof(vendor_id)), 4); |
| 347 | return c; |
| 348 | } |
| 349 | } |
| 350 | template (present) GenericAVP tr_AVP_VendorId(template (present) Vendor_Id vendor_id) := { |
| 351 | avp := { |
| 352 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id), |
| 353 | avp_data := { |
| 354 | avp_BASE_NONE_Vendor_Id := f_tr_AVP_VendorId(vendor_id) |
| 355 | } |
| 356 | } |
| 357 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 358 | |
| 359 | template (value) GenericAVP ts_AVP_ProductName(charstring name) := { |
| 360 | avp := { |
| 361 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Product_Name, '00000000'B), |
| 362 | avp_data := { |
| 363 | avp_BASE_NONE_Product_Name := char2oct(name) |
| 364 | } |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | template (value) GenericAVP ts_AVP_FwRevision(octetstring fw_version) := { |
| 369 | avp := { |
| 370 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Firmware_Revision, '00000000'B), |
| 371 | avp_data := { |
| 372 | avp_BASE_NONE_Firmware_Revision := fw_version |
| 373 | } |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | template (value) GenericAVP ts_AVP_InbSecId(template (value) OCTET4 inb_sec_id) := { |
| 378 | avp := { |
| 379 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Inband_Security_Id), |
| 380 | avp_data := { |
| 381 | avp_BASE_NONE_Inband_Security_Id := inb_sec_id |
| 382 | } |
| 383 | } |
| 384 | } |
| 385 | |
Pau Espin Pedrol | 462f3df | 2023-10-16 18:10:55 +0200 | [diff] [blame] | 386 | private function enum2int_Vendor_Id_tmpl(template Vendor_Id inp) return template integer |
| 387 | { |
| 388 | if (istemplatekind(inp, "omit")) { |
| 389 | return omit; |
| 390 | } else if (istemplatekind(inp, "*")) { |
| 391 | return *; |
| 392 | } else if (istemplatekind(inp, "?")) { |
| 393 | return ?; |
| 394 | } else { |
| 395 | return enum2int(valueof(inp)); |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | template (present) GenericAVP tr_AVP_VendorSpecAppId(template (present) Vendor_Id vendor_id := ?, |
| 400 | template (present) uint32_t auth_app_id := ?) := { |
| 401 | avp := { |
| 402 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Specific_Application_Id), |
| 403 | avp_data := { |
| 404 | avp_BASE_NONE_Vendor_Specific_Application_Id := { |
| 405 | { |
| 406 | avp := { |
| 407 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id), |
| 408 | avp_data := { |
| 409 | avp_BASE_NONE_Vendor_Id := int2oct_tmpl(enum2int_Vendor_Id_tmpl(vendor_id), 4) |
| 410 | } |
| 411 | } |
| 412 | }, { |
| 413 | avp := { |
| 414 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id), |
| 415 | avp_data := { |
| 416 | avp_BASE_NONE_Auth_Application_Id := int2oct_tmpl(auth_app_id, 4) |
| 417 | } |
| 418 | } |
| 419 | } |
| 420 | } |
| 421 | } |
| 422 | } |
| 423 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 424 | template (value) GenericAVP ts_AVP_VendorSpecAppId(Vendor_Id vendor_id, uint32_t auth_app_id) := { |
| 425 | avp := { |
| 426 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Specific_Application_Id), |
| 427 | avp_data := { |
| 428 | avp_BASE_NONE_Vendor_Specific_Application_Id := { |
| 429 | { |
| 430 | avp := { |
| 431 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id), |
| 432 | avp_data := { |
| 433 | avp_BASE_NONE_Vendor_Id := int2oct(enum2int(vendor_id), 4) |
| 434 | } |
| 435 | } |
| 436 | }, { |
| 437 | avp := { |
| 438 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id), |
| 439 | avp_data := { |
| 440 | avp_BASE_NONE_Auth_Application_Id := int2oct(auth_app_id, 4) |
| 441 | } |
| 442 | } |
| 443 | } |
| 444 | } |
| 445 | } |
| 446 | } |
| 447 | } |
| 448 | |
| 449 | template (value) GenericAVP ts_AVP_AuthAppId(template (value) OCTET4 auth_app_id) := { |
| 450 | avp := { |
| 451 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id), |
| 452 | avp_data := { |
| 453 | avp_BASE_NONE_Auth_Application_Id := auth_app_id |
| 454 | } |
| 455 | } |
| 456 | } |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 457 | template (present) GenericAVP tr_AVP_AuthAppId(template (present) OCTET4 auth_app_id := ?) := { |
| 458 | avp := { |
| 459 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id), |
| 460 | avp_data := { |
| 461 | avp_BASE_NONE_Auth_Application_Id := auth_app_id |
| 462 | } |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | template (value) GenericAVP ts_AVP_CcReqType(template (value) DCC_NONE_CC_Request_Type r) := { |
| 467 | avp := { |
| 468 | avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Type), |
| 469 | avp_data := { |
| 470 | avp_DCC_NONE_CC_Request_Type := r |
| 471 | } |
| 472 | } |
| 473 | } |
| 474 | template (present) GenericAVP tr_AVP_CcReqType(template (present) DCC_NONE_CC_Request_Type r := ?) := { |
| 475 | avp := { |
| 476 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Type), |
| 477 | avp_data := { |
| 478 | avp_DCC_NONE_CC_Request_Type := r |
| 479 | } |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | template (value) GenericAVP ts_AVP_CcReqNum(template (value) AVP_Unsigned32 n) := { |
| 484 | avp := { |
| 485 | avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Number), |
| 486 | avp_data := { |
| 487 | avp_DCC_NONE_CC_Request_Number := n |
| 488 | } |
| 489 | } |
| 490 | } |
| 491 | template (present) GenericAVP tr_AVP_CcReqNum(template (present) AVP_Unsigned32 n := ?) := { |
| 492 | avp := { |
| 493 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Number), |
| 494 | avp_data := { |
| 495 | avp_DCC_NONE_CC_Request_Number := n |
| 496 | } |
| 497 | } |
| 498 | } |
| 499 | |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 500 | template (present) GenericAVP tr_AVP_EventTimestamp(template (present) AVP_Unsigned32 n := ?) := { |
| 501 | avp := { |
| 502 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Event_Timestamp), |
| 503 | avp_data := { |
| 504 | avp_BASE_NONE_Event_Timestamp := n |
| 505 | } |
| 506 | } |
| 507 | } |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 508 | |
Pau Espin Pedrol | 7aa4ad8 | 2023-08-28 18:24:24 +0200 | [diff] [blame] | 509 | template (present) GenericAVP tr_AVP_ExperimentalResultCode(template (present) AVP_Unsigned32 n := ?) := { |
| 510 | avp := { |
| 511 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Experimental_Result_Code), |
| 512 | avp_data := { |
| 513 | avp_BASE_NONE_Experimental_Result_Code := n |
| 514 | } |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | template (present) GenericAVP tr_AVP_ExperimentalResult(template (present) Vendor_Id vendor_id := ?, |
| 519 | template (present) AVP_Unsigned32 err_code := ? |
| 520 | ) := { |
| 521 | avp := { |
| 522 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Experimental_Result), |
| 523 | avp_data := { |
| 524 | avp_BASE_NONE_Experimental_Result := { |
| 525 | tr_AVP_VendorId(vendor_id), |
| 526 | tr_AVP_ExperimentalResultCode(err_code) |
| 527 | } |
| 528 | } |
| 529 | } |
| 530 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 531 | |
| 532 | template (value) GenericAVP ts_AVP_SuppVendorIdRaw(uint32_t vendor_id) := { |
| 533 | avp := { |
| 534 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Supported_Vendor_Id), |
| 535 | avp_data := { |
| 536 | avp_BASE_NONE_Supported_Vendor_Id := int2oct(vendor_id, 4) |
| 537 | } |
| 538 | } |
| 539 | } |
| 540 | template (value) GenericAVP ts_AVP_SuppVendorId(Vendor_Id vendor_id) := |
| 541 | ts_AVP_SuppVendorIdRaw(enum2int(vendor_id)); |
| 542 | |
| 543 | template (value) GenericAVP ts_AVP_ResultCode(DIAMETER_Resultcode res_code) := { |
| 544 | avp := { |
| 545 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Result_Code), |
| 546 | avp_data := { |
| 547 | avp_BASE_NONE_Result_Code := int2oct(enum2int(res_code), 4) |
| 548 | } |
| 549 | } |
| 550 | } |
Pau Espin Pedrol | 7aa4ad8 | 2023-08-28 18:24:24 +0200 | [diff] [blame] | 551 | private function f_tr_DIAMETER_Resultcode(template (present) DIAMETER_Resultcode res_code) |
| 552 | return template (present) BASE_NONE_Result_Code { |
| 553 | if (istemplatekind(res_code, "?")) { |
| 554 | return ?; |
| 555 | } else { |
| 556 | var template (present) BASE_NONE_Result_Code c; |
| 557 | c := int2oct(enum2int(valueof(res_code)), 4); |
| 558 | return c; |
| 559 | } |
| 560 | } |
| 561 | template (present) GenericAVP tr_AVP_ResultCode(template (present) DIAMETER_Resultcode res_code) := { |
Vadim Yanitskiy | f28b255 | 2021-12-11 03:49:14 +0300 | [diff] [blame] | 562 | avp := { |
| 563 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Result_Code), |
| 564 | avp_data := { |
Pau Espin Pedrol | 7aa4ad8 | 2023-08-28 18:24:24 +0200 | [diff] [blame] | 565 | avp_BASE_NONE_Result_Code := f_tr_DIAMETER_Resultcode(res_code) |
Vadim Yanitskiy | f28b255 | 2021-12-11 03:49:14 +0300 | [diff] [blame] | 566 | } |
| 567 | } |
| 568 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 569 | |
| 570 | template (value) GenericAVP ts_AVP_AuthSessionState(template (value) BASE_NONE_Auth_Session_State ass := NO_STATE_MAINTAINED) := { |
| 571 | avp := { |
| 572 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Session_State), |
| 573 | avp_data := { |
| 574 | avp_BASE_NONE_Auth_Session_State := ass |
| 575 | } |
| 576 | } |
| 577 | } |
| 578 | template (present) GenericAVP tr_AVP_AuthSessionState(template (present) BASE_NONE_Auth_Session_State ass := ?) := { |
| 579 | avp := { |
| 580 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Session_State), |
| 581 | avp_data := { |
| 582 | avp_BASE_NONE_Auth_Session_State := ass |
| 583 | } |
| 584 | } |
| 585 | } |
| 586 | |
| 587 | template (value) GenericAVP ts_AVP_SessionId(template (value) octetstring session_id) := { |
| 588 | avp := { |
| 589 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Session_Id), |
| 590 | avp_data := { |
| 591 | avp_BASE_NONE_Session_Id := session_id |
| 592 | } |
| 593 | } |
| 594 | } |
| 595 | template (present) GenericAVP tr_AVP_SessionId(template (present) octetstring session_id := ?) := { |
| 596 | avp := { |
| 597 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Session_Id), |
| 598 | avp_data := { |
| 599 | avp_BASE_NONE_Session_Id := session_id |
| 600 | } |
| 601 | } |
| 602 | } |
| 603 | |
Pau Espin Pedrol | 3f19ce7 | 2023-12-21 19:09:12 +0100 | [diff] [blame] | 604 | template (value) GenericAVP ts_AVP_DestinationHost(template (value) charstring dest_host) := { |
| 605 | avp := { |
| 606 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Destination_Host), |
| 607 | avp_data := { |
| 608 | avp_BASE_NONE_Destination_Host := dest_host |
| 609 | } |
| 610 | } |
| 611 | } |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 612 | template (present) GenericAVP tr_AVP_DestinationHost(template (present) charstring host := ?) := { |
| 613 | avp := { |
| 614 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Destination_Host), |
| 615 | avp_data := { |
| 616 | avp_BASE_NONE_Destination_Host := host |
| 617 | } |
| 618 | } |
| 619 | } |
| 620 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 621 | /* 3.3 Destination Realm */ |
| 622 | template (value) GenericAVP ts_AVP_DestinationRealm(template (value) charstring dest_realm) := { |
| 623 | avp := { |
| 624 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Destination_Realm), |
| 625 | avp_data := { |
| 626 | avp_BASE_NONE_Destination_Realm := dest_realm |
| 627 | } |
| 628 | } |
| 629 | } |
| 630 | template (present) GenericAVP tr_AVP_DestinationRealm(template (present) charstring dest_realm := ?) := { |
| 631 | avp := { |
| 632 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Destination_Realm), |
| 633 | avp_data := { |
| 634 | avp_BASE_NONE_Destination_Realm := dest_realm |
| 635 | } |
| 636 | } |
| 637 | } |
| 638 | |
| 639 | /* 8.14 User-Name */ |
| 640 | template (value) GenericAVP ts_AVP_UserName(template (value) octetstring uid) := { |
| 641 | avp := { |
| 642 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_User_Name), |
| 643 | avp_data := { |
| 644 | avp_BASE_NONE_User_Name := uid |
| 645 | } |
| 646 | } |
| 647 | } |
| 648 | template (present) GenericAVP tr_AVP_UserName(template (present) octetstring uid := ?) := { |
| 649 | avp := { |
| 650 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_User_Name), |
| 651 | avp_data := { |
| 652 | avp_BASE_NONE_User_Name := uid |
| 653 | } |
| 654 | } |
| 655 | } |
| 656 | template (value) GenericAVP ts_AVP_UserNameImsi(hexstring imsi) := ts_AVP_UserName(char2oct(hex2str(imsi))); |
Pau Espin Pedrol | f4619d8 | 2023-10-16 18:08:07 +0200 | [diff] [blame] | 657 | template (present) GenericAVP tr_AVP_UserNameImsi(template (present) hexstring imsi := ?) := tr_AVP_UserName(char2oct_tmpl(hex2str_tmpl(imsi))); |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 658 | |
| 659 | |
Harald Welte | 6effabb | 2020-02-18 21:39:59 +0100 | [diff] [blame] | 660 | template (value) GenericAVP ts_AVP_NumOfReqVectors(template (value) UINT32 num_req := '00000004'O) := { |
| 661 | avp := { |
| 662 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Number_Of_Requested_Vectors), |
| 663 | avp_data := { |
| 664 | avp_AAA_3GPP_Number_Of_Requested_Vectors := num_req |
| 665 | } |
| 666 | } |
| 667 | } |
| 668 | |
| 669 | template (value) GenericAVP ts_AVP_ImmReqPref(template (value) UINT32 par := '00000000'O) := { |
| 670 | avp := { |
| 671 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Immediate_Response_Preferred), |
| 672 | avp_data := { |
| 673 | avp_AAA_3GPP_Immediate_Response_Preferred := par |
| 674 | } |
| 675 | } |
| 676 | } |
| 677 | |
| 678 | |
| 679 | /* 7.3.11 Requested-EUTRAN-Authentication-Info */ |
| 680 | template (value) GenericAVP ts_AVP_RequestedEutranAuthInfo(template (value) UINT32 num_vec := '00000004'O) := { |
| 681 | avp := { |
| 682 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Requested_EUTRAN_Authentication_Info), |
| 683 | avp_data := { |
| 684 | avp_AAA_3GPP_Requested_EUTRAN_Authentication_Info := { |
| 685 | ts_AVP_NumOfReqVectors(num_vec), |
| 686 | ts_AVP_ImmReqPref('00000000'O) |
| 687 | } |
| 688 | } |
| 689 | } |
| 690 | } |
| 691 | |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 692 | template (present) GenericAVP tr_AVP_3GPP_SubscrRauTauTmr(template (present) uint32_t tmr := ?) := { |
| 693 | avp := { |
| 694 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer), |
| 695 | avp_data := { |
| 696 | avp_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer := int2oct_tmpl(tmr, 4) |
| 697 | } |
| 698 | } |
| 699 | } |
| 700 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 701 | template (value) GenericAVP ts_AVP_3GPP_SubscrRauTauTmr(uint32_t tmr) := { |
| 702 | avp := { |
| 703 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer), |
| 704 | avp_data := { |
| 705 | avp_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer := int2oct(tmr, 4) |
| 706 | } |
| 707 | } |
| 708 | } |
| 709 | |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 710 | /* Service-Selection, TS 29.272 7.3.36, TS 29.273 5.2.3.5, (RFC 5778) */ |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 711 | template (present) GenericAVP tr_AVP_ServiceSelection(template (present) charstring apn := ?) := { |
| 712 | avp := { |
| 713 | avp_header := tr_DIA_Hdr(c_AVP_Code_MIPv6_NONE_Service_Selection), |
| 714 | avp_data := { |
| 715 | avp_MIPv6_NONE_Service_Selection := char2oct_tmpl(apn) |
| 716 | } |
| 717 | } |
| 718 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 719 | template (value) GenericAVP ts_AVP_ServiceSelection(charstring apn) := { |
| 720 | avp := { |
| 721 | avp_header := ts_DIA_Hdr(c_AVP_Code_MIPv6_NONE_Service_Selection), |
| 722 | avp_data := { |
| 723 | avp_MIPv6_NONE_Service_Selection := char2oct(apn) |
| 724 | } |
| 725 | } |
| 726 | } |
| 727 | |
Pau Espin Pedrol | 6477d73 | 2022-06-03 12:04:40 +0200 | [diff] [blame] | 728 | 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] | 729 | avp := { |
| 730 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Information), |
| 731 | avp_data := { |
| 732 | avp_PCC_3GPP_QoS_Information := list |
| 733 | } |
| 734 | } |
| 735 | } |
| 736 | |
Pau Espin Pedrol | 6477d73 | 2022-06-03 12:04:40 +0200 | [diff] [blame] | 737 | template (value) GenericAVP ts_AVP_PCC_3GPP_QoS_Information(template (value) AVP_list list) := { |
| 738 | avp := { |
| 739 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Information), |
| 740 | avp_data := { |
| 741 | avp_PCC_3GPP_QoS_Information := list |
| 742 | } |
| 743 | } |
| 744 | } |
| 745 | |
| 746 | template (value) GenericAVP ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL(uint32_t val) := { |
| 747 | avp := { |
| 748 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL), |
| 749 | avp_data := { |
| 750 | avp_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL := int2oct(val, 4) |
| 751 | } |
| 752 | } |
| 753 | } |
| 754 | |
| 755 | template (value) GenericAVP ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL(uint32_t val) := { |
| 756 | avp := { |
| 757 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL), |
| 758 | avp_data := { |
| 759 | avp_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL := int2oct(val, 4) |
| 760 | } |
| 761 | } |
| 762 | } |
| 763 | |
| 764 | template (value) GenericAVP ts_AVP_PCC_3GPP_Default_EPS_Bearer_QoS(template (value) AVP_list list) := { |
| 765 | avp := { |
| 766 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Default_EPS_Bearer_QoS), |
| 767 | avp_data := { |
| 768 | avp_PCC_3GPP_Default_EPS_Bearer_QoS := list |
| 769 | } |
| 770 | } |
| 771 | } |
| 772 | |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 773 | template (present) GenericAVP tr_AVP_PCC_3GPP_QoS_Class_Identifier(template (present) uint32_t val := ?) := { |
| 774 | avp := { |
| 775 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Class_Identifier), |
| 776 | avp_data := { |
| 777 | avp_PCC_3GPP_QoS_Class_Identifier := int2oct_tmpl(val, 4) |
| 778 | } |
| 779 | } |
| 780 | } |
| 781 | |
Pau Espin Pedrol | 6477d73 | 2022-06-03 12:04:40 +0200 | [diff] [blame] | 782 | 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] | 783 | avp := { |
| 784 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Class_Identifier), |
| 785 | avp_data := { |
Pau Espin Pedrol | 6477d73 | 2022-06-03 12:04:40 +0200 | [diff] [blame] | 786 | avp_PCC_3GPP_QoS_Class_Identifier := int2oct(val, 4) |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 787 | } |
| 788 | } |
| 789 | } |
| 790 | |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 791 | template (present) GenericAVP tr_AVP_3GPP_PriorityLevel(template (present) uint32_t prio := ?) := { |
| 792 | avp := { |
| 793 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Priority_Level), |
| 794 | avp_data := { |
| 795 | avp_PCC_3GPP_Priority_Level := int2oct_tmpl(prio, 4) |
| 796 | } |
| 797 | } |
| 798 | } |
| 799 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 800 | template (value) GenericAVP ts_AVP_3GPP_PriorityLevel(uint32_t prio) := { |
| 801 | avp := { |
| 802 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Priority_Level), |
| 803 | avp_data := { |
| 804 | avp_PCC_3GPP_Priority_Level := int2oct(prio, 4) |
| 805 | } |
| 806 | } |
| 807 | } |
| 808 | |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 809 | template (present) GenericAVP tr_AVP_PCC_3GPP_AllocRetenPrio(template (present) uint32_t prio := ?) := { |
| 810 | avp := { |
| 811 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Allocation_Retention_Priority), |
| 812 | avp_data := { |
| 813 | avp_PCC_3GPP_Allocation_Retention_Priority := superset( |
| 814 | tr_AVP_3GPP_PriorityLevel(prio) |
| 815 | /* pre-emption capability */ |
| 816 | /* pre-emption vulnerability */ |
| 817 | ) |
| 818 | } |
| 819 | } |
| 820 | } |
Pau Espin Pedrol | 6477d73 | 2022-06-03 12:04:40 +0200 | [diff] [blame] | 821 | template (value) GenericAVP ts_AVP_PCC_3GPP_AllocRetenPrio(uint32_t prio) := { |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 822 | avp := { |
| 823 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Allocation_Retention_Priority), |
| 824 | avp_data := { |
| 825 | avp_PCC_3GPP_Allocation_Retention_Priority := { |
| 826 | ts_AVP_3GPP_PriorityLevel(prio) |
| 827 | /* pre-emption capability */ |
| 828 | /* pre-emption vulnerability */ |
| 829 | } |
| 830 | } |
| 831 | } |
| 832 | } |
| 833 | |
Pau Espin Pedrol | 446145a | 2023-10-10 19:12:21 +0200 | [diff] [blame] | 834 | /* 7.3.37 EPS-Subscribed-QoS-Profile */ |
| 835 | template (present) GenericAVP tr_AVP_3GPP_EpsSubscrQosProfile(template (present) uint32_t qos_class := ?, |
| 836 | template (present) uint32_t prio := ?) := { |
| 837 | avp := { |
| 838 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_EPS_Subscribed_QoS_Profile), |
| 839 | avp_data := { |
| 840 | avp_AAA_3GPP_EPS_Subscribed_QoS_Profile := superset( |
| 841 | tr_AVP_PCC_3GPP_QoS_Class_Identifier(qos_class), |
| 842 | tr_AVP_PCC_3GPP_AllocRetenPrio(prio) |
| 843 | ) |
| 844 | } |
| 845 | } |
| 846 | } |
| 847 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 848 | template (value) GenericAVP ts_AVP_3GPP_EpsSubscrQosProfile(uint32_t qos_class, uint32_t prio) := { |
| 849 | avp := { |
| 850 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_EPS_Subscribed_QoS_Profile), |
| 851 | avp_data := { |
| 852 | avp_AAA_3GPP_EPS_Subscribed_QoS_Profile := { |
Pau Espin Pedrol | 6477d73 | 2022-06-03 12:04:40 +0200 | [diff] [blame] | 853 | ts_AVP_PCC_3GPP_QoS_Class_Identifier(qos_class), |
| 854 | ts_AVP_PCC_3GPP_AllocRetenPrio(prio) |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 855 | } |
| 856 | } |
| 857 | } |
| 858 | } |
| 859 | |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 860 | template (present) GenericAVP tr_AVP_3GPP_Reporting_Reason(template (present) DCA_3GPP_Reporting_Reason r := ?) := { |
| 861 | avp := { |
| 862 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_Reporting_Reason), |
| 863 | avp_data := { |
| 864 | avp_DCA_3GPP_Reporting_Reason := r |
| 865 | } |
| 866 | } |
| 867 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 868 | |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 869 | template (present) GenericAVP tr_AVP_3GPP_AoCRequestType(template (present) DCA_3GPP_AoC_Request_Type t := ?) := { |
| 870 | avp := { |
| 871 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_AoC_Request_Type), |
| 872 | avp_data := { |
| 873 | avp_DCA_3GPP_AoC_Request_Type := t |
| 874 | } |
| 875 | } |
| 876 | } |
| 877 | |
| 878 | template (present) GenericAVP tr_AVP_3GPP_ServiceInformation(template (present) AVP_list content := ?) := { |
| 879 | avp := { |
| 880 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_Service_Information), |
| 881 | avp_data := { |
| 882 | avp_DCA_3GPP_Service_Information := content |
| 883 | } |
| 884 | } |
| 885 | } |
| 886 | |
| 887 | template (present) GenericAVP tr_AVP_3GPP_PSInformation(template (present) AVP_list content := ?) := { |
| 888 | avp := { |
| 889 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_PS_Information), |
| 890 | avp_data := { |
| 891 | avp_DCA_3GPP_PS_Information := content |
| 892 | } |
| 893 | } |
| 894 | } |
| 895 | |
| 896 | template (present) GenericAVP tr_AVP_3GPP_ChargingId(template (present) AVP_OctetString id := ?) := { |
| 897 | avp := { |
| 898 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_Charging_Id), |
| 899 | avp_data := { |
| 900 | avp_GI_3GPP_3GPP_Charging_Id := id |
| 901 | } |
| 902 | } |
| 903 | } |
| 904 | |
| 905 | template (present) GenericAVP tr_AVP_3GPP_PDPType(template (present) GI_3GPP_3GPP_PDP_Type t := ?) := { |
| 906 | avp := { |
| 907 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_PDP_Type), |
| 908 | avp_data := { |
| 909 | avp_GI_3GPP_3GPP_PDP_Type := t |
| 910 | } |
| 911 | } |
| 912 | } |
| 913 | |
| 914 | template (present) GenericAVP tr_AVP_3GPP_PDPAddress(template (present) DCA_3GPP_PDP_Address addr := ?) := { |
| 915 | avp := { |
| 916 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_PDP_Address), |
| 917 | avp_data := { |
| 918 | avp_DCA_3GPP_PDP_Address := addr |
| 919 | } |
| 920 | } |
| 921 | } |
| 922 | |
| 923 | template (present) GenericAVP tr_AVP_3GPP_SGSNAddress(template (present) DCA_3GPP_SGSN_Address addr := ?) := { |
| 924 | avp := { |
| 925 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_SGSN_Address), |
| 926 | avp_data := { |
| 927 | avp_DCA_3GPP_SGSN_Address := addr |
| 928 | } |
| 929 | } |
| 930 | } |
| 931 | |
| 932 | template (present) GenericAVP tr_AVP_3GPP_GGSNAddress(template (present) DCA_3GPP_GGSN_Address addr := ?) := { |
| 933 | avp := { |
| 934 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_GGSN_Address), |
| 935 | avp_data := { |
| 936 | avp_DCA_3GPP_GGSN_Address := addr |
| 937 | } |
| 938 | } |
| 939 | } |
| 940 | |
| 941 | template (present) GenericAVP tr_AVP_3GPP_SelectionMode(template (present) GI_3GPP_3GPP_Selection_Mode sm := ?) := { |
| 942 | avp := { |
| 943 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_Selection_Mode), |
| 944 | avp_data := { |
| 945 | avp_GI_3GPP_3GPP_Selection_Mode := sm |
| 946 | } |
| 947 | } |
| 948 | } |
| 949 | |
| 950 | template (present) GenericAVP tr_AVP_3GPP_ChargingCharacteristics(template (present) GI_3GPP_3GPP_Charging_Characteristics cc := ?) := { |
| 951 | avp := { |
| 952 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_Charging_Characteristics), |
| 953 | avp_data := { |
| 954 | avp_GI_3GPP_3GPP_Charging_Characteristics := cc |
| 955 | } |
| 956 | } |
| 957 | } |
| 958 | |
| 959 | template (present) GenericAVP tr_AVP_3GPP_SGSNMCCMNC(template (present) GI_3GPP_3GPP_SGSN_MCC_MNC smn := ?) := { |
| 960 | avp := { |
| 961 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_SGSN_MCC_MNC), |
| 962 | avp_data := { |
| 963 | avp_GI_3GPP_3GPP_SGSN_MCC_MNC := smn |
| 964 | } |
| 965 | } |
| 966 | } |
| 967 | |
| 968 | template (present) GenericAVP tr_AVP_3GPP_NSAPI(template (present) GI_3GPP_3GPP_NSAPI nsapi := ?) := { |
| 969 | avp := { |
| 970 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_NSAPI), |
| 971 | avp_data := { |
| 972 | avp_GI_3GPP_3GPP_NSAPI := nsapi |
| 973 | } |
| 974 | } |
| 975 | } |
| 976 | |
| 977 | template (present) GenericAVP tr_AVP_3GPP_MS_TimeZone(template (present) GI_3GPP_3GPP_MS_TimeZone ms_tz := ?) := { |
| 978 | avp := { |
| 979 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_MS_TimeZone), |
| 980 | avp_data := { |
| 981 | avp_GI_3GPP_3GPP_MS_TimeZone := ms_tz |
| 982 | } |
| 983 | } |
| 984 | } |
| 985 | |
| 986 | template (present) GenericAVP tr_AVP_3GPP_ULI(template (present) GI_3GPP_3GPP_User_Location_Info uli := ?) := { |
| 987 | avp := { |
| 988 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_User_Location_Info), |
| 989 | avp_data := { |
| 990 | avp_GI_3GPP_3GPP_User_Location_Info := uli |
| 991 | } |
| 992 | } |
| 993 | } |
| 994 | |
| 995 | template (present) GenericAVP tr_AVP_UserEquipmentInfo(template (present) DCC_NONE_User_Equipment_Info uei := ?) := { |
| 996 | avp := { |
| 997 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_User_Equipment_Info), |
| 998 | avp_data := { |
| 999 | avp_DCC_NONE_User_Equipment_Info := uei |
| 1000 | } |
| 1001 | } |
| 1002 | } |
| 1003 | |
| 1004 | template (present) GenericAVP tr_AVP_UserEquipmentInfoType(template (present) DCC_NONE_User_Equipment_Info_Type ueit := ?) := { |
| 1005 | avp := { |
| 1006 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_User_Equipment_Info_Type), |
| 1007 | avp_data := { |
| 1008 | avp_DCC_NONE_User_Equipment_Info_Type := ueit |
| 1009 | } |
| 1010 | } |
| 1011 | } |
| 1012 | |
| 1013 | template (present) GenericAVP tr_AVP_UserEquipmentInfoValue(template (present) DCC_NONE_User_Equipment_Info_Value ueiv := ?) := { |
| 1014 | avp := { |
| 1015 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_User_Equipment_Info_Value), |
| 1016 | avp_data := { |
| 1017 | avp_DCC_NONE_User_Equipment_Info_Value := ueiv |
| 1018 | } |
| 1019 | } |
| 1020 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1021 | |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 1022 | /* RFC4006 8.16 Multiple-Services-Credit-Control AVP */ |
| 1023 | template (value) GenericAVP ts_AVP_Multiple_Services_Credit_Control(template (value) AVP_list content) := { |
| 1024 | avp := { |
| 1025 | avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_Multiple_Services_Credit_Control), |
| 1026 | avp_data := { |
| 1027 | avp_DCC_NONE_Multiple_Services_Credit_Control := content |
| 1028 | } |
| 1029 | } |
| 1030 | } |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 1031 | template (present) GenericAVP tr_AVP_Multiple_Services_Credit_Control(template (present) AVP_list content := ?) := { |
| 1032 | avp := { |
| 1033 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Multiple_Services_Credit_Control), |
| 1034 | avp_data := { |
| 1035 | avp_DCC_NONE_Multiple_Services_Credit_Control := content |
| 1036 | } |
| 1037 | } |
| 1038 | } |
| 1039 | |
| 1040 | /* Requested-Service-Unit AVP */ |
| 1041 | template (present) GenericAVP tr_AVP_Requested_Service_Unit(template (present) AVP_list content := ?) := { |
| 1042 | avp := { |
| 1043 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Requested_Service_Unit), |
| 1044 | avp_data := { |
| 1045 | avp_DCC_NONE_Requested_Service_Unit := content |
| 1046 | } |
| 1047 | } |
| 1048 | } |
| 1049 | |
| 1050 | /* Used-Service-Unit AVP */ |
| 1051 | template (present) GenericAVP tr_AVP_Used_Service_Unit(template (present) AVP_list content := ?) := { |
| 1052 | avp := { |
| 1053 | avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Used_Service_Unit), |
| 1054 | avp_data := { |
| 1055 | avp_DCC_NONE_Used_Service_Unit := content |
| 1056 | } |
| 1057 | } |
| 1058 | } |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 1059 | |
| 1060 | /* RFC4006 8.17 Granted-Service-Unit AVP */ |
| 1061 | template (value) GenericAVP ts_AVP_Granted_Service_Unit(template (value) AVP_list content) := { |
| 1062 | avp := { |
| 1063 | avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_Granted_Service_Unit), |
| 1064 | avp_data := { |
| 1065 | avp_DCC_NONE_Granted_Service_Unit := content |
| 1066 | } |
| 1067 | } |
| 1068 | } |
| 1069 | |
| 1070 | /* RFC4006 8.21 CC-Time AVP */ |
| 1071 | template (value) GenericAVP ts_AVP_CC_Time(uint32_t cc_time_val) := { |
| 1072 | avp := { |
| 1073 | avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Time), |
| 1074 | avp_data := { |
| 1075 | avp_DCC_NONE_CC_Time := int2oct(cc_time_val, 4) |
| 1076 | } |
| 1077 | } |
| 1078 | } |
| 1079 | |
| 1080 | /* RFC4006 8.23 CC-Total-Octets AVP */ |
| 1081 | template (value) GenericAVP ts_AVP_CC_Total_Octets(uint64_t cc_total_octets_val) := { |
| 1082 | avp := { |
| 1083 | avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Total_Octets), |
| 1084 | avp_data := { |
| 1085 | avp_DCC_NONE_CC_Total_Octets := int2oct(cc_total_octets_val, 8) |
| 1086 | } |
| 1087 | } |
| 1088 | } |
| 1089 | |
| 1090 | /* RFC4006 8.33 Validity-Time AVP */ |
| 1091 | template (value) GenericAVP ts_AVP_Validity_Time(uint32_t validity_time_val) := { |
| 1092 | avp := { |
| 1093 | avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_Validity_Time), |
| 1094 | avp_data := { |
| 1095 | avp_DCC_NONE_Validity_Time := int2oct(validity_time_val, 4) |
| 1096 | } |
| 1097 | } |
| 1098 | } |
| 1099 | |
Pau Espin Pedrol | 52562c9 | 2022-05-23 15:45:46 +0200 | [diff] [blame] | 1100 | template (value) GenericAVP ts_AVP_3GPP_VolumeQuotaThreshold(uint32_t volume_quota_thresh_val) := { |
| 1101 | avp := { |
| 1102 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_Volume_Quota_Threshold), |
| 1103 | avp_data := { |
| 1104 | avp_DCA_3GPP_Volume_Quota_Threshold := int2oct(volume_quota_thresh_val, 4) |
| 1105 | } |
| 1106 | } |
| 1107 | } |
| 1108 | |
Pau Espin Pedrol | a2af578 | 2022-05-18 16:34:29 +0200 | [diff] [blame] | 1109 | template (present) GenericAVP tr_AVP_3GPP_CalledStationId(template (present) DNAS_NONE_Called_Station_Id id := ?) := { |
| 1110 | avp := { |
| 1111 | avp_header := tr_DIA_Hdr(c_AVP_Code_DNAS_NONE_Called_Station_Id), |
| 1112 | avp_data := { |
| 1113 | avp_DNAS_NONE_Called_Station_Id := id |
| 1114 | } |
| 1115 | } |
| 1116 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1117 | |
Pau Espin Pedrol | 44b7520 | 2023-10-23 14:37:24 +0200 | [diff] [blame] | 1118 | /* RFC6733 8.7. Auth-Request-Type AVP */ |
| 1119 | template (value) GenericAVP ts_AVP_AuthRequestType(BASE_NONE_Auth_Request_Type auth_req_type) := { |
| 1120 | avp := { |
| 1121 | avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Request_Type, '00000000'B), |
| 1122 | avp_data := { |
| 1123 | avp_BASE_NONE_Auth_Request_Type := auth_req_type |
| 1124 | } |
| 1125 | } |
| 1126 | } |
| 1127 | template (present) GenericAVP tr_AVP_AuthRequestType(template (present) BASE_NONE_Auth_Request_Type auth_req_type) := { |
| 1128 | avp := { |
| 1129 | avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Request_Type), |
| 1130 | avp_data := { |
| 1131 | avp_BASE_NONE_Auth_Request_Type := auth_req_type |
| 1132 | } |
| 1133 | } |
| 1134 | } |
| 1135 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1136 | |
Vadim Yanitskiy | 0d6cbd3 | 2023-02-11 08:07:27 +0700 | [diff] [blame] | 1137 | /* 5.3.1 Capabilities Exchange Request */ |
| 1138 | template (value) PDU_DIAMETER |
| 1139 | ts_DIA_CER(octetstring host_ip, uint32_t vendor_app_id, |
| 1140 | template (value) charstring orig_host := "ttcn3.localdomain", |
| 1141 | template (value) charstring orig_realm := "localdomain", |
| 1142 | template (value) UINT32 hbh_id := '00000000'O, |
| 1143 | template (value) UINT32 ete_id := '00000000'O) := |
| 1144 | ts_DIAMETER(flags := '10000000'B, |
| 1145 | cmd_code := Capabilities_Exchange, |
| 1146 | hbh_id := hbh_id, |
| 1147 | ete_id := ete_id, |
| 1148 | avps := { |
| 1149 | ts_AVP_OriginHost(orig_host), |
| 1150 | ts_AVP_OriginRealm(orig_realm), |
| 1151 | ts_AVP_HostIpAddr(host_ip), |
| 1152 | ts_AVP_VendorId(vendor_id_3GPP), |
| 1153 | ts_AVP_ProductName("TTCN-3 Testsuite"), |
| 1154 | ts_AVP_FwRevision('00000000'O), |
| 1155 | ts_AVP_InbSecId('00000000'O), |
| 1156 | ts_AVP_AuthAppId('FFFFFFFF'O), |
| 1157 | ts_AVP_VendorSpecAppId(vendor_id_3GPP, vendor_app_id) |
| 1158 | }); |
| 1159 | |
| 1160 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1161 | /* 5.3.2 Capabilities Exchange Answer */ |
| 1162 | template (value) PDU_DIAMETER |
Pau Espin Pedrol | 33b4749 | 2022-03-08 17:43:01 +0100 | [diff] [blame] | 1163 | ts_DIA_CEA_AUTH_APP_ID(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, |
| 1164 | template (value) charstring origin_host, |
| 1165 | template (value) charstring origin_realm, |
| 1166 | template (value) octetstring host_ip, uint32_t auth_app_id) |
| 1167 | := ts_DIAMETER(flags:='00000000'B, cmd_code:=Capabilities_Exchange, hbh_id:=hbh_id, ete_id:=ete_id, |
| 1168 | avps := { |
| 1169 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1170 | ts_AVP_OriginHost(origin_host), |
| 1171 | ts_AVP_OriginRealm(origin_realm), |
| 1172 | ts_AVP_HostIpAddr(host_ip), |
| 1173 | ts_AVP_VendorId(vendor_id_3GPP), |
| 1174 | ts_AVP_ProductName("TTCN-3 Testsuite"), |
| 1175 | ts_AVP_OriginStateId('00000001'O), |
| 1176 | ts_AVP_SuppVendorIdRaw(5535), /* 3GPP2 */ |
| 1177 | ts_AVP_SuppVendorId(vendor_id_3GPP), |
| 1178 | ts_AVP_SuppVendorIdRaw(13019), /* ETSI */ |
Pau Espin Pedrol | 33b4749 | 2022-03-08 17:43:01 +0100 | [diff] [blame] | 1179 | ts_AVP_AuthAppId(int2oct(auth_app_id, 4)), |
| 1180 | ts_AVP_InbSecId('00000000'O) |
| 1181 | }); |
| 1182 | template (value) PDU_DIAMETER |
| 1183 | ts_DIA_CEA_VENDOR_APP_ID(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, |
| 1184 | template (value) charstring origin_host, |
| 1185 | template (value) charstring origin_realm, |
| 1186 | template (value) octetstring host_ip, uint32_t vendor_app_id) |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1187 | := ts_DIAMETER(flags:='00000000'B, cmd_code:=Capabilities_Exchange, hbh_id:=hbh_id, ete_id:=ete_id, |
| 1188 | avps := { |
| 1189 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
Harald Welte | 61f73d5 | 2020-04-26 21:41:12 +0200 | [diff] [blame] | 1190 | ts_AVP_OriginHost(origin_host), |
| 1191 | ts_AVP_OriginRealm(origin_realm), |
| 1192 | ts_AVP_HostIpAddr(host_ip), |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1193 | ts_AVP_VendorId(vendor_id_3GPP), |
| 1194 | ts_AVP_ProductName("TTCN-3 Testsuite"), |
| 1195 | ts_AVP_OriginStateId('00000001'O), |
| 1196 | ts_AVP_SuppVendorIdRaw(5535), /* 3GPP2 */ |
| 1197 | ts_AVP_SuppVendorId(vendor_id_3GPP), |
| 1198 | ts_AVP_SuppVendorIdRaw(13019), /* ETSI */ |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1199 | ts_AVP_InbSecId('00000000'O), |
Harald Welte | 61f73d5 | 2020-04-26 21:41:12 +0200 | [diff] [blame] | 1200 | ts_AVP_VendorSpecAppId(vendor_id_3GPP, vendor_app_id) |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1201 | }); |
Pau Espin Pedrol | 33b4749 | 2022-03-08 17:43:01 +0100 | [diff] [blame] | 1202 | function f_ts_DIA_CEA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, |
| 1203 | template (value) charstring origin_host, |
| 1204 | template (value) charstring origin_realm, |
| 1205 | template (value) octetstring host_ip, template (omit) uint32_t auth_app_id, |
| 1206 | template (omit) uint32_t vendor_app_id) |
| 1207 | return template (value) PDU_DIAMETER |
| 1208 | { |
| 1209 | var template (value) PDU_DIAMETER diam_pdu; |
| 1210 | if (istemplatekind(vendor_app_id, "omit")) { |
| 1211 | diam_pdu := ts_DIA_CEA_AUTH_APP_ID(hbh_id, ete_id, origin_host, origin_realm, host_ip, valueof(auth_app_id)); |
| 1212 | } else { |
| 1213 | diam_pdu := ts_DIA_CEA_VENDOR_APP_ID(hbh_id, ete_id, origin_host, origin_realm, host_ip, valueof(vendor_app_id)); |
| 1214 | } |
| 1215 | return diam_pdu; |
| 1216 | } |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1217 | |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 1218 | /* RFC 4006 3.1. Credit-Control-Request (CCR) Command */ |
| 1219 | template (present) PDU_DIAMETER |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 1220 | 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] | 1221 | := tr_DIAMETER(flags:='11000000'B, cmd_code:=Credit_Control, |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 1222 | avps := superset( |
| 1223 | tr_AVP_SessionId, |
| 1224 | tr_AVP_OriginHost, |
| 1225 | tr_AVP_OriginRealm, |
| 1226 | tr_AVP_DestinationRealm, |
| 1227 | tr_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_Gx_AID, 4)), |
| 1228 | tr_AVP_CcReqType(req_type), |
| 1229 | tr_AVP_CcReqNum(?) |
| 1230 | )); |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 1231 | template (present) PDU_DIAMETER |
| 1232 | tr_DIA_Gy_CCR(template (present) DCC_NONE_CC_Request_Type req_type := INITIAL_REQUEST) |
| 1233 | := tr_DIAMETER(flags:='11000000'B, cmd_code:=Credit_Control, |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 1234 | avps := superset( |
| 1235 | tr_AVP_SessionId, |
| 1236 | tr_AVP_OriginHost, |
| 1237 | tr_AVP_OriginRealm, |
| 1238 | tr_AVP_DestinationRealm, |
| 1239 | tr_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)), |
| 1240 | tr_AVP_CcReqType(req_type), |
| 1241 | tr_AVP_CcReqNum(?) |
| 1242 | )); |
| 1243 | |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 1244 | |
| 1245 | |
| 1246 | /* RFC 4006 3.2. Credit-Control-Answer (CCA) Command */ |
| 1247 | template (value) PDU_DIAMETER |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 1248 | 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] | 1249 | template (value) octetstring sess_id, |
| 1250 | template (value) DCC_NONE_CC_Request_Type req_type, |
| 1251 | template (value) AVP_Unsigned32 req_num) |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 1252 | := ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control, |
| 1253 | app_id:=int2oct(c_DIAMETER_3GPP_Gx_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id, |
| 1254 | avps := { |
| 1255 | ts_AVP_SessionId(sess_id), |
| 1256 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1257 | ts_AVP_OriginHost("pcrf.localdomain"), |
| 1258 | ts_AVP_OriginRealm("localdomain"), |
| 1259 | ts_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_Gx_AID, 4)), |
| 1260 | ts_AVP_CcReqType(req_type), |
Pau Espin Pedrol | ee961c7 | 2022-06-03 12:06:07 +0200 | [diff] [blame] | 1261 | ts_AVP_CcReqNum(req_num), |
| 1262 | ts_AVP_PCC_3GPP_QoS_Information({ |
| 1263 | ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL(33554432), |
| 1264 | ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL(52428800) |
| 1265 | }), |
| 1266 | ts_AVP_PCC_3GPP_Default_EPS_Bearer_QoS({ |
| 1267 | ts_AVP_PCC_3GPP_QoS_Class_Identifier(9), |
| 1268 | ts_AVP_PCC_3GPP_AllocRetenPrio(2) |
| 1269 | }) |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 1270 | // supported features |
| 1271 | // origin |
| 1272 | }); |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 1273 | template (value) PDU_DIAMETER |
| 1274 | ts_DIA_Gy_CCA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, |
| 1275 | template (value) octetstring sess_id, |
| 1276 | template (value) DCC_NONE_CC_Request_Type req_type, |
| 1277 | template (value) AVP_Unsigned32 req_num) |
| 1278 | := ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control, |
| 1279 | app_id:=int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id, |
| 1280 | avps := { |
| 1281 | ts_AVP_SessionId(sess_id), |
| 1282 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1283 | ts_AVP_OriginHost("ocs.localdomain"), |
| 1284 | ts_AVP_OriginRealm("localdomain"), |
| 1285 | ts_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)), |
| 1286 | ts_AVP_CcReqType(req_type), |
| 1287 | ts_AVP_CcReqNum(req_num)//, |
| 1288 | // qos |
| 1289 | // default eps bearer qos |
| 1290 | // supported features |
| 1291 | // origin |
| 1292 | }); |
| 1293 | /* Same as ts_DIA_Gy_CCA, but with extra AVP to grant access for limited amount of seconds */ |
| 1294 | template (value) PDU_DIAMETER |
| 1295 | ts_DIA_Gy_CCA_ValidityTime(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, |
| 1296 | template (value) octetstring sess_id, |
| 1297 | template (value) DCC_NONE_CC_Request_Type req_type, |
| 1298 | template (value) AVP_Unsigned32 req_num, |
| 1299 | uint32_t validity_time) |
| 1300 | := ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control, |
| 1301 | app_id:=int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id, |
| 1302 | avps := { |
| 1303 | ts_AVP_SessionId(sess_id), |
| 1304 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1305 | ts_AVP_OriginHost("ocs.localdomain"), |
| 1306 | ts_AVP_OriginRealm("localdomain"), |
| 1307 | ts_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)), |
| 1308 | ts_AVP_CcReqType(req_type), |
| 1309 | ts_AVP_CcReqNum(req_num), |
| 1310 | ts_AVP_Multiple_Services_Credit_Control({ |
| 1311 | ts_AVP_Validity_Time(validity_time), |
| 1312 | ts_AVP_Granted_Service_Unit({ |
| 1313 | //ts_AVP_CC_Time(validity_time*2), |
| 1314 | ts_AVP_CC_Total_Octets(1000) |
| 1315 | }) |
| 1316 | }) |
| 1317 | //, |
| 1318 | // qos |
| 1319 | // default eps bearer qos |
| 1320 | // supported features |
| 1321 | // origin |
| 1322 | }); |
Pau Espin Pedrol | 52562c9 | 2022-05-23 15:45:46 +0200 | [diff] [blame] | 1323 | /* Same as ts_DIA_Gy_CCA_ValidityTime, but with extra AVP to grant access for limited amount of octets */ |
| 1324 | template (value) PDU_DIAMETER |
| 1325 | ts_DIA_Gy_CCA_ValidityTimeVolumeThreshold(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, |
| 1326 | template (value) octetstring sess_id, |
| 1327 | template (value) DCC_NONE_CC_Request_Type req_type, |
| 1328 | template (value) AVP_Unsigned32 req_num, |
| 1329 | uint32_t validity_time, uint32_t volume_threhsold) |
| 1330 | := ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control, |
| 1331 | app_id:=int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id, |
| 1332 | avps := { |
| 1333 | ts_AVP_SessionId(sess_id), |
| 1334 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1335 | ts_AVP_OriginHost("ocs.localdomain"), |
| 1336 | ts_AVP_OriginRealm("localdomain"), |
| 1337 | ts_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)), |
| 1338 | ts_AVP_CcReqType(req_type), |
| 1339 | ts_AVP_CcReqNum(req_num), |
| 1340 | ts_AVP_Multiple_Services_Credit_Control({ |
| 1341 | ts_AVP_Validity_Time(validity_time), |
| 1342 | ts_AVP_Granted_Service_Unit({ |
| 1343 | ts_AVP_CC_Total_Octets(volume_threhsold*100) |
| 1344 | }), |
| 1345 | ts_AVP_3GPP_VolumeQuotaThreshold(volume_threhsold) |
| 1346 | }) |
| 1347 | //, |
| 1348 | // qos |
| 1349 | // default eps bearer qos |
| 1350 | // supported features |
| 1351 | // origin |
| 1352 | }); |
Harald Welte | f400151 | 2020-04-26 21:48:34 +0200 | [diff] [blame] | 1353 | |
Vadim Yanitskiy | f28b255 | 2021-12-11 03:49:14 +0300 | [diff] [blame] | 1354 | /* RFC 6733, section 5.5.1 "Device-Watchdog-Request" */ |
| 1355 | template (value) PDU_DIAMETER |
| 1356 | ts_DIA_DWR(template (value) OCTET4 state_id := '00000000'O, |
| 1357 | template (value) charstring orig_host := "ttcn3.localdomain", |
| 1358 | template (value) charstring orig_realm := "localdomain", |
| 1359 | template (value) UINT32 hbh_id := '00000000'O, |
| 1360 | template (value) UINT32 ete_id := '00000000'O) := |
| 1361 | ts_DIAMETER(flags := '10000000'B, |
| 1362 | cmd_code := Device_Watchdog, |
| 1363 | app_id := '00000000'O, |
| 1364 | hbh_id := hbh_id, |
| 1365 | ete_id := ete_id, |
| 1366 | avps := { |
| 1367 | ts_AVP_OriginHost(orig_host), |
| 1368 | ts_AVP_OriginRealm(orig_realm), |
| 1369 | ts_AVP_OriginStateId(state_id) |
| 1370 | }); |
| 1371 | template (present) PDU_DIAMETER |
| 1372 | tr_DIA_DWR(template (present) OCTET4 state_id := ?, |
| 1373 | template (present) charstring orig_host := ?, |
| 1374 | template (present) charstring orig_realm := ?, |
| 1375 | template (present) UINT32 hbh_id := ?, |
| 1376 | template (present) UINT32 ete_id := ?) := |
| 1377 | tr_DIAMETER(flags := '1???????'B, |
| 1378 | cmd_code := Device_Watchdog, |
| 1379 | app_id := '00000000'O, |
| 1380 | hbh_id := hbh_id, |
| 1381 | ete_id := ete_id, |
| 1382 | avps := superset( |
| 1383 | tr_AVP_OriginHost(orig_host), |
Pau Espin Pedrol | 8dcb061 | 2023-08-28 19:16:29 +0200 | [diff] [blame] | 1384 | tr_AVP_OriginRealm(orig_realm) |
| 1385 | /* tr_AVP_OriginStateId(state_id) is optional */ |
Vadim Yanitskiy | f28b255 | 2021-12-11 03:49:14 +0300 | [diff] [blame] | 1386 | )); |
| 1387 | |
| 1388 | /* RFC 6733, section 5.5.2 "Device-Watchdog-Answer" */ |
| 1389 | template (value) PDU_DIAMETER |
| 1390 | ts_DIA_DWA(template (value) OCTET4 state_id := '00000000'O, |
| 1391 | template (value) charstring orig_host := "ttcn3.localdomain", |
| 1392 | template (value) charstring orig_realm := "localdomain", |
| 1393 | template (value) UINT32 hbh_id := '00000000'O, |
| 1394 | template (value) UINT32 ete_id := '00000000'O) := |
| 1395 | ts_DIAMETER(flags := '00000000'B, |
| 1396 | cmd_code := Device_Watchdog, |
| 1397 | app_id := '00000000'O, |
| 1398 | hbh_id := hbh_id, |
| 1399 | ete_id := ete_id, |
| 1400 | avps := { |
| 1401 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1402 | ts_AVP_OriginHost(orig_host), |
| 1403 | ts_AVP_OriginRealm(orig_realm), |
| 1404 | ts_AVP_OriginStateId(state_id) |
| 1405 | }); |
| 1406 | template (present) PDU_DIAMETER |
| 1407 | tr_DIA_DWA(template (present) OCTET4 state_id := ?, |
| 1408 | template (present) charstring orig_host := ?, |
| 1409 | template (present) charstring orig_realm := ?, |
| 1410 | template (present) UINT32 hbh_id := ?, |
| 1411 | template (present) UINT32 ete_id := ?) := |
| 1412 | tr_DIAMETER(flags := '0???????'B, |
| 1413 | cmd_code := Device_Watchdog, |
| 1414 | app_id := '00000000'O, |
| 1415 | hbh_id := hbh_id, |
| 1416 | ete_id := ete_id, |
| 1417 | avps := superset( |
| 1418 | tr_AVP_ResultCode(DIAMETER_SUCCESS), |
| 1419 | tr_AVP_OriginHost(orig_host), |
Pau Espin Pedrol | 8dcb061 | 2023-08-28 19:16:29 +0200 | [diff] [blame] | 1420 | tr_AVP_OriginRealm(orig_realm) |
| 1421 | /* tr_AVP_OriginStateId(state_id) is optional */ |
Vadim Yanitskiy | f28b255 | 2021-12-11 03:49:14 +0300 | [diff] [blame] | 1422 | )); |
| 1423 | |
Pau Espin Pedrol | 8fa2284 | 2022-05-20 14:47:55 +0200 | [diff] [blame] | 1424 | function f_DIAMETER_get_avp(PDU_DIAMETER pdu, template (present) AVP_Code avp_code) |
| 1425 | return template (omit) AVP |
| 1426 | { |
| 1427 | var integer i; |
| 1428 | |
| 1429 | for (i := 0; i < lengthof(pdu.avps); i := i+1) { |
| 1430 | if (not ispresent(pdu.avps[i].avp)) { |
| 1431 | continue; |
| 1432 | } |
| 1433 | var AVP_Header hdr := pdu.avps[i].avp.avp_header; |
| 1434 | if (match(hdr.avp_code, avp_code)) { |
| 1435 | return pdu.avps[i].avp; |
| 1436 | } |
| 1437 | } |
| 1438 | return omit; |
| 1439 | } |
| 1440 | function f_DIAMETER_get_avp_or_fail(PDU_DIAMETER pdu, template (present) AVP_Code avp_code) |
| 1441 | return AVP |
| 1442 | { |
| 1443 | var template (omit) AVP avp; |
| 1444 | avp := f_DIAMETER_get_avp(pdu, avp_code); |
| 1445 | if (istemplatekind(avp, "omit")) { |
| 1446 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 1447 | log2str("AVP ", avp_code, " not found in ", pdu)); |
| 1448 | } |
| 1449 | return valueof(avp); |
| 1450 | } |
| 1451 | |
| 1452 | function f_AVP_Grouped_get_avp(AVP_Grouped avp_grp, template (present) AVP_Code avp_code) |
| 1453 | return template (omit) AVP |
| 1454 | { |
| 1455 | var integer i; |
| 1456 | |
| 1457 | for (i := 0; i < lengthof(avp_grp); i := i+1) { |
| 1458 | if (not ispresent(avp_grp[i].avp)) { |
| 1459 | continue; |
| 1460 | } |
| 1461 | var AVP_Header hdr := avp_grp[i].avp.avp_header; |
| 1462 | if (match(hdr.avp_code, avp_code)) { |
| 1463 | return avp_grp[i].avp; |
| 1464 | } |
| 1465 | } |
| 1466 | return omit; |
| 1467 | } |
| 1468 | function f_AVP_Grouped_get_avp_or_fail(AVP_Grouped avp_grp, template (present) AVP_Code avp_code) |
| 1469 | return AVP |
| 1470 | { |
| 1471 | var template (omit) AVP avp; |
| 1472 | avp := f_AVP_Grouped_get_avp(avp_grp, avp_code); |
| 1473 | if (istemplatekind(avp, "omit")) { |
| 1474 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 1475 | log2str("AVP ", avp_code, " not found in ", avp_grp)); |
| 1476 | } |
| 1477 | return valueof(avp); |
| 1478 | } |
| 1479 | |
| 1480 | function f_validate_gy_cc_report(PDU_DIAMETER rx_dia, template (present) DCA_3GPP_Reporting_Reason repreason_exp := ?, |
| 1481 | template (present) integer cc_time_exp := ?, |
| 1482 | template (present) integer cc_in_oct_exp := ?, |
| 1483 | template (present) integer cc_out_oct_exp := ?) |
| 1484 | { |
| 1485 | var AVP multi_services_cc, used_service_unit; |
| 1486 | var AVP_Grouped multi_services_cc_data, used_service_unit_data; |
Pau Espin Pedrol | cba0f6d | 2022-05-24 13:49:46 +0200 | [diff] [blame] | 1487 | var template (omit) AVP repreason_tpl; |
Pau Espin Pedrol | 8fa2284 | 2022-05-20 14:47:55 +0200 | [diff] [blame] | 1488 | var AVP repreason, cc_time, cc_in_oct, cc_out_oct; |
| 1489 | |
| 1490 | multi_services_cc := f_DIAMETER_get_avp_or_fail(rx_dia, c_AVP_Code_DCC_NONE_Multiple_Services_Credit_Control); |
| 1491 | multi_services_cc_data := valueof(multi_services_cc.avp_data.avp_DCC_NONE_Multiple_Services_Credit_Control); |
| 1492 | |
Pau Espin Pedrol | cba0f6d | 2022-05-24 13:49:46 +0200 | [diff] [blame] | 1493 | used_service_unit := f_AVP_Grouped_get_avp_or_fail(multi_services_cc_data, c_AVP_Code_DCC_NONE_Used_Service_Unit); |
| 1494 | used_service_unit_data := valueof(used_service_unit.avp_data.avp_DCC_NONE_Used_Service_Unit); |
| 1495 | |
| 1496 | /* Reporting-Reason can be either inside Multiple-Services-Credit-Control or inside Used-Service-Unit */ |
| 1497 | repreason_tpl := f_AVP_Grouped_get_avp(multi_services_cc_data, c_AVP_Code_DCA_3GPP_Reporting_Reason); |
| 1498 | if (istemplatekind(repreason_tpl, "omit")) { |
| 1499 | repreason := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCA_3GPP_Reporting_Reason); |
| 1500 | } else { |
| 1501 | repreason := valueof(repreason_tpl); |
| 1502 | } |
Pau Espin Pedrol | 8fa2284 | 2022-05-20 14:47:55 +0200 | [diff] [blame] | 1503 | if (not match(repreason.avp_data.avp_DCA_3GPP_Reporting_Reason, repreason_exp)) { |
| 1504 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 1505 | log2str("3GPP-Reporting-Reason mismatch ", repreason, " vs exp ", repreason_exp)); |
| 1506 | } |
| 1507 | |
Pau Espin Pedrol | 8fa2284 | 2022-05-20 14:47:55 +0200 | [diff] [blame] | 1508 | cc_time := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCC_NONE_CC_Time); |
| 1509 | if (not match(oct2int(cc_time.avp_data.avp_DCC_NONE_CC_Time), cc_time_exp)) { |
| 1510 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 1511 | log2str("3GPP-CC-Time mismatch ", cc_time, " vs exp ", cc_time_exp)); |
| 1512 | } |
| 1513 | |
| 1514 | cc_in_oct := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCC_NONE_CC_Input_Octets); |
| 1515 | if (not match(oct2int(cc_in_oct.avp_data.avp_DCC_NONE_CC_Input_Octets), cc_in_oct_exp)) { |
| 1516 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 1517 | log2str("3GPP-CC-Input-Octets mismatch ", cc_in_oct, " vs exp ", cc_in_oct_exp)); |
| 1518 | } |
| 1519 | |
| 1520 | cc_out_oct := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCC_NONE_CC_Output_Octets); |
| 1521 | if (not match(oct2int(cc_out_oct.avp_data.avp_DCC_NONE_CC_Output_Octets), cc_out_oct_exp)) { |
| 1522 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 1523 | log2str("3GPP-CC-Output-Octets mismatch ", cc_out_oct, " vs exp ", cc_out_oct_exp)); |
| 1524 | } |
| 1525 | } |
| 1526 | |
Pau Espin Pedrol | 462f3df | 2023-10-16 18:10:55 +0200 | [diff] [blame] | 1527 | |
| 1528 | /***************************** |
| 1529 | * Cx, Dx, 3GPP TS 29.229 |
| 1530 | *****************************/ |
| 1531 | /* SIP-Auth-Data-Item, 3GPP TS 29.229 6.3.8 */ |
| 1532 | template (present) GenericAVP tr_AVP_3GPP_SIPNumAuthDataItems(template (present) uint32_t num := ?) := { |
| 1533 | avp := { |
| 1534 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Number_Auth_Items), |
| 1535 | avp_data := { |
| 1536 | avp_CxDx_3GPP_SIP_Number_Auth_Items := int2oct_tmpl(num, 4) /* CxDx_3GPP_SIP_Number_Auth_Items */ |
| 1537 | } |
| 1538 | } |
| 1539 | } |
| 1540 | template (value) GenericAVP ts_AVP_3GPP_SIPNumAuthDataItems(uint32_t num) := { |
| 1541 | avp := { |
| 1542 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Number_Auth_Items), |
| 1543 | avp_data := { |
| 1544 | avp_CxDx_3GPP_SIP_Number_Auth_Items := int2oct(num, 4) /* CxDx_3GPP_SIP_Number_Auth_Items */ |
| 1545 | } |
| 1546 | } |
| 1547 | } |
| 1548 | |
| 1549 | /* SIP-Authentication-Scheme, 3GPP TS 29.229 6.3.9 */ |
| 1550 | template (present) GenericAVP tr_AVP_3GPP_SIPAuthScheme(template (present) CxDx_3GPP_SIP_Authentication_Scheme scheme := ?) := { |
| 1551 | avp := { |
| 1552 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authentication_Scheme), |
| 1553 | avp_data := { |
| 1554 | avp_CxDx_3GPP_SIP_Authentication_Scheme := scheme |
| 1555 | } |
| 1556 | } |
| 1557 | } |
| 1558 | template (value) GenericAVP ts_AVP_3GPP_SIPAuthScheme(template (value) CxDx_3GPP_SIP_Authentication_Scheme scheme) := { |
| 1559 | avp := { |
| 1560 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authentication_Scheme), |
| 1561 | avp_data := { |
| 1562 | avp_CxDx_3GPP_SIP_Authentication_Scheme := scheme |
| 1563 | } |
| 1564 | } |
| 1565 | } |
| 1566 | |
| 1567 | /* SIP-Authenticate, 3GPP TS 29.229 6.3.10 */ |
| 1568 | template (present) GenericAVP tr_AVP_3GPP_SIPAuthenticate(template (present) CxDx_3GPP_SIP_Authenticate rand_autn_concatenated := ?) := { |
| 1569 | avp := { |
| 1570 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authenticate), |
| 1571 | avp_data := { |
| 1572 | avp_CxDx_3GPP_SIP_Authenticate := rand_autn_concatenated |
| 1573 | } |
| 1574 | } |
| 1575 | } |
| 1576 | template (value) GenericAVP ts_AVP_3GPP_SIPAuthenticate(template (value) CxDx_3GPP_SIP_Authenticate rand_autn_concatenated) := { |
| 1577 | avp := { |
| 1578 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authenticate), |
| 1579 | avp_data := { |
| 1580 | avp_CxDx_3GPP_SIP_Authenticate := rand_autn_concatenated |
| 1581 | } |
| 1582 | } |
| 1583 | } |
| 1584 | |
| 1585 | /* SIP-Authorization, 3GPP TS 29.229 6.3.11 */ |
| 1586 | template (present) GenericAVP tr_AVP_3GPP_SIPAuthorization(template (present) CxDx_3GPP_SIP_Authorization rand_autn_concatenated := ?) := { |
| 1587 | avp := { |
| 1588 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authorization), |
| 1589 | avp_data := { |
| 1590 | avp_CxDx_3GPP_SIP_Authorization := rand_autn_concatenated |
| 1591 | } |
| 1592 | } |
| 1593 | } |
| 1594 | template (value) GenericAVP ts_AVP_3GPP_SIPAuthorization(template (value) CxDx_3GPP_SIP_Authorization rand_autn_concatenated) := { |
| 1595 | avp := { |
| 1596 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authorization), |
| 1597 | avp_data := { |
| 1598 | avp_CxDx_3GPP_SIP_Authorization := rand_autn_concatenated |
| 1599 | } |
| 1600 | } |
| 1601 | } |
| 1602 | |
| 1603 | /* SIP-Authentication-Context, 3GPP TS 29.229 6.3.12 */ |
| 1604 | template (present) GenericAVP tr_AVP_3GPP_SIPAuthContext(template (present) CxDx_3GPP_SIP_Authentication_Context val := ?) := { |
| 1605 | avp := { |
| 1606 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authentication_Context), |
| 1607 | avp_data := { |
| 1608 | avp_CxDx_3GPP_SIP_Authentication_Context := val |
| 1609 | } |
| 1610 | } |
| 1611 | } |
| 1612 | template (value) GenericAVP ts_AVP_3GPP_SIPAuthContext(template (value) CxDx_3GPP_SIP_Authentication_Context val) := { |
| 1613 | avp := { |
| 1614 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authentication_Context), |
| 1615 | avp_data := { |
| 1616 | avp_CxDx_3GPP_SIP_Authentication_Context := val |
| 1617 | } |
| 1618 | } |
| 1619 | } |
| 1620 | |
| 1621 | /* SIP-Item-Number, 3GPP TS 29.229 6.3.14 */ |
| 1622 | template (present) GenericAVP tr_AVP_3GPP_SIPItemNumber(template (present) uint32_t num := ?) := { |
| 1623 | avp := { |
| 1624 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Item_Number), |
| 1625 | avp_data := { |
| 1626 | avp_CxDx_3GPP_SIP_Item_Number := int2oct_tmpl(num, 4) /* CxDx_3GPP_SIP_Item_Number */ |
| 1627 | } |
| 1628 | } |
| 1629 | } |
| 1630 | template (value) GenericAVP ts_AVP_3GPP_SIPItemNumber(uint32_t num) := { |
| 1631 | avp := { |
| 1632 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Item_Number), |
| 1633 | avp_data := { |
| 1634 | avp_CxDx_3GPP_SIP_Item_Number := int2oct(num, 4) /* CxDx_3GPP_SIP_Item_Number */ |
| 1635 | } |
| 1636 | } |
| 1637 | } |
| 1638 | |
| 1639 | /* Confidentiality-Key, 3GPP TS 29.229 6.3.27 */ |
| 1640 | template (present) GenericAVP tr_AVP_3GPP_ConfidentialityKey(template (present) CxDx_3GPP_Confidentiality_Key ckey := ?) := { |
| 1641 | avp := { |
| 1642 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Confidentiality_Key), |
| 1643 | avp_data := { |
| 1644 | avp_CxDx_3GPP_Confidentiality_Key := ckey |
| 1645 | } |
| 1646 | } |
| 1647 | } |
| 1648 | template (value) GenericAVP ts_AVP_3GPP_ConfidentialityKey(template (value) CxDx_3GPP_Confidentiality_Key ckey) := { |
| 1649 | avp := { |
| 1650 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Confidentiality_Key), |
| 1651 | avp_data := { |
| 1652 | avp_CxDx_3GPP_Confidentiality_Key := ckey |
| 1653 | } |
| 1654 | } |
| 1655 | } |
| 1656 | |
| 1657 | /* Inegrity-Key, 3GPP TS 29.229 6.3.28 */ |
| 1658 | template (present) GenericAVP tr_AVP_3GPP_IntegrityKey(template (present) CxDx_3GPP_Integrity_Key ckey := ?) := { |
| 1659 | avp := { |
| 1660 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Integrity_Key), |
| 1661 | avp_data := { |
| 1662 | avp_CxDx_3GPP_Integrity_Key := ckey |
| 1663 | } |
| 1664 | } |
| 1665 | } |
| 1666 | template (value) GenericAVP ts_AVP_3GPP_IntegrityKey(template (value) CxDx_3GPP_Integrity_Key ckey) := { |
| 1667 | avp := { |
| 1668 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Integrity_Key), |
| 1669 | avp_data := { |
| 1670 | avp_CxDx_3GPP_Integrity_Key := ckey |
| 1671 | } |
| 1672 | } |
| 1673 | } |
| 1674 | |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 1675 | /* Server-Assignment-Type, 3GPP TS 29.273 8.2.3.12, 3GPP TS 29.229 6.3.15 */ |
| 1676 | template (present) GenericAVP tr_AVP_3GPP_ServerAssignmentType(template (present) CxDx_3GPP_Server_Assignment_Type t := ?) := { |
| 1677 | avp := { |
| 1678 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Server_Assignment_Type), |
| 1679 | avp_data := { |
| 1680 | avp_CxDx_3GPP_Server_Assignment_Type := t |
| 1681 | } |
| 1682 | } |
| 1683 | } |
| 1684 | template (value) GenericAVP ts_AVP_3GPP_ServerAssignmentType(template (value) CxDx_3GPP_Server_Assignment_Type t) := { |
| 1685 | avp := { |
| 1686 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Server_Assignment_Type), |
| 1687 | avp_data := { |
| 1688 | avp_CxDx_3GPP_Server_Assignment_Type := t |
| 1689 | } |
| 1690 | } |
| 1691 | } |
| 1692 | |
Harald Welte | d27ab24 | 2019-07-26 13:45:18 +0200 | [diff] [blame] | 1693 | } |