blob: 62b797db094fa70956bfddc4108be3c2b1235f23 [file] [log] [blame]
Harald Welted27ab242019-07-26 13:45:18 +02001module 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 Pedrol965ac642023-10-16 18:12:45 +020012import from General_Types all;
Harald Welted27ab242019-07-26 13:45:18 +020013import from DIAMETER_Types all;
14import from Osmocom_Types all;
Pau Espin Pedrol8fa22842022-05-20 14:47:55 +020015import from Misc_Helpers all;
Harald Welted27ab242019-07-26 13:45:18 +020016
17/* https://www.iana.org/assignments/aaa-parameters/aaa-parameters.xhtml#aaa-parameters-4 */
18type 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 Pedrol7aa4ad82023-08-28 18:24:24 +0200105/* 3GPP TS 29.272 section 7.4. Errors in Experimental-Result-Code */
106type enumerated DIAMETER_ExperimentalResultcode {
107 /* transient */
108 DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE (4181),
109 DIAMETER_ERROR_CAMEL_SUBSCRIPTION_PRESENT (4182),
110 /* permanent */
111 DIAMETER_ERROR_USER_UNKNOWN (5001),
112 DIAMETER_AUTHORIZATION_REJECTED (5003),
113 DIAMETER_ERROR_ROAMING_NOT_ALLOWED (5004),
114 DIAMETER_MISSING_AVP (5005),
115 DIAMETER_ERROR_UNKNOWN_EPS_SUBSCRIPTION (5420),
116 DIAMETER_ERROR_RAT_NOT_ALLOWED (5421),
117 DIAMETER_ERROR_EQUIPMENT_UNKNOWN (5422),
118 DIAMETER_ERROR_UNKOWN_SERVING_NODE (5423)
119}
120
Pau Espin Pedrol77fdd0b2022-03-08 14:03:33 +0100121/* Gy : 3GPP TS 32.299 7.1.6, RFC4006 3.1 */
122const uint32_t c_DIAMETER_CREDIT_CONTROL_AID := 4;
Harald Welted27ab242019-07-26 13:45:18 +0200123/* 3GPP TS 29.272 Section 7.1.8 */
Harald Weltef9fb63e2020-04-26 18:07:19 +0200124const uint32_t c_DIAMETER_3GPP_Gx_AID := 16777238;
Harald Welted27ab242019-07-26 13:45:18 +0200125const uint32_t c_DIAMETER_3GPP_S6_AID := 16777251;
126const uint32_t c_DIAMETER_3GPP_S13_AID := 16777252;
127const uint32_t c_DIAMETER_3GPP_S7_AID := 16777308;
Pau Espin Pedrol965ac642023-10-16 18:12:45 +0200128/* 3GPP TS 29.273 Section 8.2 */
129const uint32_t c_DIAMETER_3GPP_SWx_AID := 16777265;
Pau Espin Pedrol44b75202023-10-23 14:37:24 +0200130/* 3GPP TS 29.273 Section 9 */
131const uint32_t c_DIAMETER_3GPP_S6b_AID := 16777272;
Harald Welted27ab242019-07-26 13:45:18 +0200132
Vadim Yanitskiy0e8f5162021-12-15 05:00:32 +0300133const octetstring c_def_sess_id := char2oct("ttcn3.session");
134
Harald Welted27ab242019-07-26 13:45:18 +0200135template (value) PDU_DIAMETER
Pau Espin Pedrol965ac642023-10-16 18:12:45 +0200136ts_DIAMETER(template (value) DIAMETER_Types.BIT8 flags,
Harald Welted27ab242019-07-26 13:45:18 +0200137 template (value) Command_Code cmd_code,
138 template (value) OCTET4 app_id := '00000000'O,
Vadim Yanitskiy00720bd2021-12-12 02:05:08 +0300139 template (value) UINT32 hbh_id := '00000000'O,
140 template (value) UINT32 ete_id := '00000000'O,
Harald Welted27ab242019-07-26 13:45:18 +0200141 template (value) AVP_list avps := {}
142) := {
143 version := 1,
144 message_length := 0, /* overwritten */
145 RPETxxxx := flags,
146 command_code := cmd_code,
147 application_id := app_id,
148 hop_by_hop_id := hbh_id,
149 end_to_end_id := ete_id,
150 avps := avps
151}
152template (present) PDU_DIAMETER
Pau Espin Pedrol965ac642023-10-16 18:12:45 +0200153tr_DIAMETER(template (present) DIAMETER_Types.BIT8 flags := ?,
Harald Welted27ab242019-07-26 13:45:18 +0200154 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 version := 1,
160 message_length := ?,
161 RPETxxxx := flags,
162 command_code := cmd_code,
163 application_id := app_id,
164 hop_by_hop_id := hbh_id,
165 end_to_end_id := ete_id,
166 avps := avps
167}
168template (present) PDU_DIAMETER
169tr_DIAMETER_A(
170 template (present) Command_Code cmd_code := ?,
171 template (present) OCTET4 app_id := ?,
172 template (present) UINT32 hbh_id := ?,
173 template (present) UINT32 ete_id := ?,
174 template (present) AVP_list avps := ?) :=
175 tr_DIAMETER('0???????'B, cmd_code, app_id, hbh_id, ete_id, avps);
176template (present) PDU_DIAMETER
177tr_DIAMETER_R(
178 template (present) Command_Code cmd_code := ?,
179 template (present) OCTET4 app_id := ?,
180 template (present) UINT32 hbh_id := ?,
181 template (present) UINT32 ete_id := ?,
182 template (present) AVP_list avps := ?) :=
183 tr_DIAMETER('1???????'B, cmd_code, app_id, hbh_id, ete_id, avps);
184
185
186template (value) AVP_Header
187ts_DIA_Hdr(template (value) AVP_Code avp_code,
Pau Espin Pedrol965ac642023-10-16 18:12:45 +0200188 template (value) DIAMETER_Types.BIT8 flags := '01000000'B) := {
Harald Welted27ab242019-07-26 13:45:18 +0200189 avp_code := avp_code,
190 VMPxxxxx := flags,
191 avp_length := 0, /* overwritten */
192 vendor_id := omit
193}
194template (present) AVP_Header
195tr_DIA_Hdr(template (present) AVP_Code avp_code,
Pau Espin Pedrol965ac642023-10-16 18:12:45 +0200196 template (present) DIAMETER_Types.BIT8 flags := '0???????'B) := {
Harald Welted27ab242019-07-26 13:45:18 +0200197 avp_code := avp_code,
198 VMPxxxxx := flags,
199 avp_length := ?, /* overwritten */
200 vendor_id := omit
201}
202
203template (value) AVP_Header
204ts_DIA_Hdr_3GPP(template (value) AVP_Code avp_code,
Pau Espin Pedrol965ac642023-10-16 18:12:45 +0200205 template (value) DIAMETER_Types.BIT8 flags := '11000000'B) := {
Harald Welted27ab242019-07-26 13:45:18 +0200206 avp_code := avp_code,
207 VMPxxxxx := flags,
208 avp_length := 0, /* overwritten */
209 vendor_id := vendor_id_3GPP
210}
211template (present) AVP_Header
212tr_DIA_Hdr_3GPP(template (present) AVP_Code avp_code,
Pau Espin Pedrol965ac642023-10-16 18:12:45 +0200213 template (present) DIAMETER_Types.BIT8 flags := '1???????'B) := {
Harald Welted27ab242019-07-26 13:45:18 +0200214 avp_code := avp_code,
215 VMPxxxxx := flags,
216 avp_length := ?, /* overwritten */
217 vendor_id := vendor_id_3GPP
218}
219
Pau Espin Pedrola2af5782022-05-18 16:34:29 +0200220template (present) AVP_Address tr_AVP_Address(template (present) AddressType addr_type := ?,
221 template (present) octetstring addr_data := ?) := {
222 address_type := addr_type,
223 address_data := addr_data
224}
225
226template (present) GenericAVP tr_AVP_SubcrId(template (present) DCC_NONE_Subscription_Id t) := {
227 avp := {
228 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Subscription_Id),
229 avp_data := {
230 avp_DCC_NONE_Subscription_Id := t
231 }
232 }
233}
234
Pau Espin Pedrolb8cd34a2022-05-18 16:34:12 +0200235template (present) GenericAVP tr_AVP_SubcrIdType(template (present) DCC_NONE_Subscription_Id_Type t) := {
Harald Weltef9fb63e2020-04-26 18:07:19 +0200236 avp := {
237 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Subscription_Id_Type),
238 avp_data := {
239 avp_DCC_NONE_Subscription_Id_Type := t
240 }
241 }
242}
Harald Welted27ab242019-07-26 13:45:18 +0200243
Pau Espin Pedrola2af5782022-05-18 16:34:29 +0200244template (present) GenericAVP tr_AVP_SubcrIdData(template (present) DCC_NONE_Subscription_Id_Data t) := {
245 avp := {
246 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Subscription_Id_Data),
247 avp_data := {
248 avp_DCC_NONE_Subscription_Id_Data := t
249 }
250 }
251}
252
253template (present) GenericAVP tr_AVP_RequestedAction(template (present) DCC_NONE_Requested_Action t := ?) := {
254 avp := {
255 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Requested_Action),
256 avp_data := {
257 avp_DCC_NONE_Requested_Action := t
258 }
259 }
260}
261
262template (present) GenericAVP tr_AVP_MultipleServicesIndicator(template (present) DCC_NONE_Multiple_Services_Indicator t := ?) := {
263 avp := {
264 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Multiple_Services_Indicator),
265 avp_data := {
266 avp_DCC_NONE_Multiple_Services_Indicator := t
267 }
268 }
269}
270
271template (present) GenericAVP tr_AVP_ServiceContextId(template (present) DCC_NONE_Service_Context_Id id := ?) := {
272 avp := {
273 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Service_Context_Id),
274 avp_data := {
275 avp_DCC_NONE_Service_Context_Id := id
276 }
277 }
278}
279
Harald Welted27ab242019-07-26 13:45:18 +0200280template (value) GenericAVP ts_AVP_OriginHost(template (value) charstring host) := {
281 avp := {
282 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Host),
283 avp_data := {
284 avp_BASE_NONE_Origin_Host := host
285 }
286 }
287}
288template (present) GenericAVP tr_AVP_OriginHost(template (present) charstring host := ?) := {
289 avp := {
290 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Host),
291 avp_data := {
292 avp_BASE_NONE_Origin_Host := host
293 }
294 }
295}
296
297
298template (value) GenericAVP ts_AVP_OriginRealm(template (value) charstring realm) := {
299 avp := {
300 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Realm),
301 avp_data := {
302 avp_BASE_NONE_Origin_Realm := realm
303 }
304 }
305}
306template (present) GenericAVP tr_AVP_OriginRealm(template (present) charstring realm := ?) := {
307 avp := {
308 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Realm),
309 avp_data := {
310 avp_BASE_NONE_Origin_Realm := realm
311 }
312 }
313}
314
315
316template (value) GenericAVP ts_AVP_OriginStateId(template (value) OCTET4 state_id) := {
317 avp := {
318 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_State_Id),
319 avp_data := {
320 avp_BASE_NONE_Origin_State_Id := state_id
321 }
322 }
323}
Vadim Yanitskiyf28b2552021-12-11 03:49:14 +0300324template (present) GenericAVP tr_AVP_OriginStateId(template (present) OCTET4 state_id := ?) := {
325 avp := {
326 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_State_Id),
327 avp_data := {
328 avp_BASE_NONE_Origin_State_Id := state_id
329 }
330 }
331}
Harald Welted27ab242019-07-26 13:45:18 +0200332
Pau Espin Pedrola2af5782022-05-18 16:34:29 +0200333template (present) GenericAVP tr_AVP_TerminationCause(template (present) BASE_NONE_Termination_Cause tc) := {
334 avp := {
335 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Termination_Cause),
336 avp_data := {
337 avp_BASE_NONE_Termination_Cause := tc
338 }
339 }
340}
341
Harald Welted27ab242019-07-26 13:45:18 +0200342template (value) GenericAVP ts_AVP_HostIpAddr(template (value) OCTET4 ipv4_addr) := {
343 avp := {
344 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Host_IP_Address),
345 avp_data := {
346 avp_BASE_NONE_Host_IP_Address := {
347 address_type := IP,
348 address_data := ipv4_addr
349 }
350 }
351 }
352}
353
354template (value) GenericAVP ts_AVP_VendorId(Vendor_Id vendor_id) := {
355 avp := {
356 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id, '00000000'B),
357 avp_data := {
358 avp_BASE_NONE_Vendor_Id := int2oct(enum2int(vendor_id), 4)
359 }
360 }
361}
Pau Espin Pedrol7aa4ad82023-08-28 18:24:24 +0200362private function f_tr_AVP_VendorId(template (present) Vendor_Id vendor_id)
363return template (present) BASE_NONE_Vendor_Id {
364 if (istemplatekind(vendor_id, "?")) {
365 return ?;
366 } else {
367 var template (present) BASE_NONE_Vendor_Id c;
368 c := int2oct(enum2int(valueof(vendor_id)), 4);
369 return c;
370 }
371}
372template (present) GenericAVP tr_AVP_VendorId(template (present) Vendor_Id vendor_id) := {
373 avp := {
374 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id),
375 avp_data := {
376 avp_BASE_NONE_Vendor_Id := f_tr_AVP_VendorId(vendor_id)
377 }
378 }
379}
Harald Welted27ab242019-07-26 13:45:18 +0200380
381template (value) GenericAVP ts_AVP_ProductName(charstring name) := {
382 avp := {
383 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Product_Name, '00000000'B),
384 avp_data := {
385 avp_BASE_NONE_Product_Name := char2oct(name)
386 }
387 }
388}
389
390template (value) GenericAVP ts_AVP_FwRevision(octetstring fw_version) := {
391 avp := {
392 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Firmware_Revision, '00000000'B),
393 avp_data := {
394 avp_BASE_NONE_Firmware_Revision := fw_version
395 }
396 }
397}
398
399template (value) GenericAVP ts_AVP_InbSecId(template (value) OCTET4 inb_sec_id) := {
400 avp := {
401 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Inband_Security_Id),
402 avp_data := {
403 avp_BASE_NONE_Inband_Security_Id := inb_sec_id
404 }
405 }
406}
407
Pau Espin Pedrol462f3df2023-10-16 18:10:55 +0200408private function enum2int_Vendor_Id_tmpl(template Vendor_Id inp) return template integer
409{
410 if (istemplatekind(inp, "omit")) {
411 return omit;
412 } else if (istemplatekind(inp, "*")) {
413 return *;
414 } else if (istemplatekind(inp, "?")) {
415 return ?;
416 } else {
417 return enum2int(valueof(inp));
418 }
419}
420
421template (present) GenericAVP tr_AVP_VendorSpecAppId(template (present) Vendor_Id vendor_id := ?,
422 template (present) uint32_t auth_app_id := ?) := {
423 avp := {
424 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Specific_Application_Id),
425 avp_data := {
426 avp_BASE_NONE_Vendor_Specific_Application_Id := {
427 {
428 avp := {
429 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id),
430 avp_data := {
431 avp_BASE_NONE_Vendor_Id := int2oct_tmpl(enum2int_Vendor_Id_tmpl(vendor_id), 4)
432 }
433 }
434 }, {
435 avp := {
436 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id),
437 avp_data := {
438 avp_BASE_NONE_Auth_Application_Id := int2oct_tmpl(auth_app_id, 4)
439 }
440 }
441 }
442 }
443 }
444 }
445}
Harald Welted27ab242019-07-26 13:45:18 +0200446template (value) GenericAVP ts_AVP_VendorSpecAppId(Vendor_Id vendor_id, uint32_t auth_app_id) := {
447 avp := {
448 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Specific_Application_Id),
449 avp_data := {
450 avp_BASE_NONE_Vendor_Specific_Application_Id := {
451 {
452 avp := {
453 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id),
454 avp_data := {
455 avp_BASE_NONE_Vendor_Id := int2oct(enum2int(vendor_id), 4)
456 }
457 }
458 }, {
459 avp := {
460 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id),
461 avp_data := {
462 avp_BASE_NONE_Auth_Application_Id := int2oct(auth_app_id, 4)
463 }
464 }
465 }
466 }
467 }
468 }
469}
470
471template (value) GenericAVP ts_AVP_AuthAppId(template (value) OCTET4 auth_app_id) := {
472 avp := {
473 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id),
474 avp_data := {
475 avp_BASE_NONE_Auth_Application_Id := auth_app_id
476 }
477 }
478}
Harald Weltef4001512020-04-26 21:48:34 +0200479template (present) GenericAVP tr_AVP_AuthAppId(template (present) OCTET4 auth_app_id := ?) := {
480 avp := {
481 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id),
482 avp_data := {
483 avp_BASE_NONE_Auth_Application_Id := auth_app_id
484 }
485 }
486}
487
488template (value) GenericAVP ts_AVP_CcReqType(template (value) DCC_NONE_CC_Request_Type r) := {
489 avp := {
490 avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Type),
491 avp_data := {
492 avp_DCC_NONE_CC_Request_Type := r
493 }
494 }
495}
496template (present) GenericAVP tr_AVP_CcReqType(template (present) DCC_NONE_CC_Request_Type r := ?) := {
497 avp := {
498 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Type),
499 avp_data := {
500 avp_DCC_NONE_CC_Request_Type := r
501 }
502 }
503}
504
505template (value) GenericAVP ts_AVP_CcReqNum(template (value) AVP_Unsigned32 n) := {
506 avp := {
507 avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Number),
508 avp_data := {
509 avp_DCC_NONE_CC_Request_Number := n
510 }
511 }
512}
513template (present) GenericAVP tr_AVP_CcReqNum(template (present) AVP_Unsigned32 n := ?) := {
514 avp := {
515 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Number),
516 avp_data := {
517 avp_DCC_NONE_CC_Request_Number := n
518 }
519 }
520}
521
Pau Espin Pedrola2af5782022-05-18 16:34:29 +0200522template (present) GenericAVP tr_AVP_EventTimestamp(template (present) AVP_Unsigned32 n := ?) := {
523 avp := {
524 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Event_Timestamp),
525 avp_data := {
526 avp_BASE_NONE_Event_Timestamp := n
527 }
528 }
529}
Harald Weltef4001512020-04-26 21:48:34 +0200530
Pau Espin Pedrol7aa4ad82023-08-28 18:24:24 +0200531template (present) GenericAVP tr_AVP_ExperimentalResultCode(template (present) AVP_Unsigned32 n := ?) := {
532 avp := {
533 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Experimental_Result_Code),
534 avp_data := {
535 avp_BASE_NONE_Experimental_Result_Code := n
536 }
537 }
538}
539
540template (present) GenericAVP tr_AVP_ExperimentalResult(template (present) Vendor_Id vendor_id := ?,
541 template (present) AVP_Unsigned32 err_code := ?
542 ) := {
543 avp := {
544 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Experimental_Result),
545 avp_data := {
546 avp_BASE_NONE_Experimental_Result := {
547 tr_AVP_VendorId(vendor_id),
548 tr_AVP_ExperimentalResultCode(err_code)
549 }
550 }
551 }
552}
Harald Welted27ab242019-07-26 13:45:18 +0200553
554template (value) GenericAVP ts_AVP_SuppVendorIdRaw(uint32_t vendor_id) := {
555 avp := {
556 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Supported_Vendor_Id),
557 avp_data := {
558 avp_BASE_NONE_Supported_Vendor_Id := int2oct(vendor_id, 4)
559 }
560 }
561}
562template (value) GenericAVP ts_AVP_SuppVendorId(Vendor_Id vendor_id) :=
563 ts_AVP_SuppVendorIdRaw(enum2int(vendor_id));
564
565template (value) GenericAVP ts_AVP_ResultCode(DIAMETER_Resultcode res_code) := {
566 avp := {
567 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Result_Code),
568 avp_data := {
569 avp_BASE_NONE_Result_Code := int2oct(enum2int(res_code), 4)
570 }
571 }
572}
Pau Espin Pedrol7aa4ad82023-08-28 18:24:24 +0200573private function f_tr_DIAMETER_Resultcode(template (present) DIAMETER_Resultcode res_code)
574return template (present) BASE_NONE_Result_Code {
575 if (istemplatekind(res_code, "?")) {
576 return ?;
577 } else {
578 var template (present) BASE_NONE_Result_Code c;
579 c := int2oct(enum2int(valueof(res_code)), 4);
580 return c;
581 }
582}
583template (present) GenericAVP tr_AVP_ResultCode(template (present) DIAMETER_Resultcode res_code) := {
Vadim Yanitskiyf28b2552021-12-11 03:49:14 +0300584 avp := {
585 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Result_Code),
586 avp_data := {
Pau Espin Pedrol7aa4ad82023-08-28 18:24:24 +0200587 avp_BASE_NONE_Result_Code := f_tr_DIAMETER_Resultcode(res_code)
Vadim Yanitskiyf28b2552021-12-11 03:49:14 +0300588 }
589 }
590}
Harald Welted27ab242019-07-26 13:45:18 +0200591
592template (value) GenericAVP ts_AVP_AuthSessionState(template (value) BASE_NONE_Auth_Session_State ass := NO_STATE_MAINTAINED) := {
593 avp := {
594 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Session_State),
595 avp_data := {
596 avp_BASE_NONE_Auth_Session_State := ass
597 }
598 }
599}
600template (present) GenericAVP tr_AVP_AuthSessionState(template (present) BASE_NONE_Auth_Session_State ass := ?) := {
601 avp := {
602 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Session_State),
603 avp_data := {
604 avp_BASE_NONE_Auth_Session_State := ass
605 }
606 }
607}
608
609template (value) GenericAVP ts_AVP_SessionId(template (value) octetstring session_id) := {
610 avp := {
611 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Session_Id),
612 avp_data := {
613 avp_BASE_NONE_Session_Id := session_id
614 }
615 }
616}
617template (present) GenericAVP tr_AVP_SessionId(template (present) octetstring session_id := ?) := {
618 avp := {
619 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Session_Id),
620 avp_data := {
621 avp_BASE_NONE_Session_Id := session_id
622 }
623 }
624}
625
Pau Espin Pedrola2af5782022-05-18 16:34:29 +0200626template (present) GenericAVP tr_AVP_DestinationHost(template (present) charstring host := ?) := {
627 avp := {
628 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Destination_Host),
629 avp_data := {
630 avp_BASE_NONE_Destination_Host := host
631 }
632 }
633}
634
Harald Welted27ab242019-07-26 13:45:18 +0200635/* 3.3 Destination Realm */
636template (value) GenericAVP ts_AVP_DestinationRealm(template (value) charstring dest_realm) := {
637 avp := {
638 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Destination_Realm),
639 avp_data := {
640 avp_BASE_NONE_Destination_Realm := dest_realm
641 }
642 }
643}
644template (present) GenericAVP tr_AVP_DestinationRealm(template (present) charstring dest_realm := ?) := {
645 avp := {
646 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Destination_Realm),
647 avp_data := {
648 avp_BASE_NONE_Destination_Realm := dest_realm
649 }
650 }
651}
652
653/* 8.14 User-Name */
654template (value) GenericAVP ts_AVP_UserName(template (value) octetstring uid) := {
655 avp := {
656 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_User_Name),
657 avp_data := {
658 avp_BASE_NONE_User_Name := uid
659 }
660 }
661}
662template (present) GenericAVP tr_AVP_UserName(template (present) octetstring uid := ?) := {
663 avp := {
664 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_User_Name),
665 avp_data := {
666 avp_BASE_NONE_User_Name := uid
667 }
668 }
669}
670template (value) GenericAVP ts_AVP_UserNameImsi(hexstring imsi) := ts_AVP_UserName(char2oct(hex2str(imsi)));
Pau Espin Pedrolf4619d82023-10-16 18:08:07 +0200671template (present) GenericAVP tr_AVP_UserNameImsi(template (present) hexstring imsi := ?) := tr_AVP_UserName(char2oct_tmpl(hex2str_tmpl(imsi)));
Harald Welted27ab242019-07-26 13:45:18 +0200672
673
674
Harald Welte40b1e002023-01-27 17:26:39 +0100675/* TS 29.272 7.3.53 RAND */
Harald Welted27ab242019-07-26 13:45:18 +0200676template (value) GenericAVP ts_AVP_RAND(template (value) octetstring rand) := {
677 avp := {
678 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_RAND),
679 avp_data := {
680 avp_AAA_3GPP_RAND := rand
681 }
682 }
683}
684
Harald Welte40b1e002023-01-27 17:26:39 +0100685/* TS 29.272 7.3.54 XRES */
Harald Welted27ab242019-07-26 13:45:18 +0200686template (value) GenericAVP ts_AVP_XRES(template (value) octetstring xres) := {
687 avp := {
688 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_XRES),
689 avp_data := {
690 avp_AAA_3GPP_XRES := xres
691 }
692 }
693}
694
Harald Welte40b1e002023-01-27 17:26:39 +0100695/* TS 29.272 7.3.55 XRES */
Harald Welted27ab242019-07-26 13:45:18 +0200696template (value) GenericAVP ts_AVP_AUTN(template (value) octetstring autn) := {
697 avp := {
698 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_AUTN),
699 avp_data := {
700 avp_AAA_3GPP_AUTN := autn
701 }
702 }
703}
704
Harald Welte40b1e002023-01-27 17:26:39 +0100705/* TS 29.272 7.3.56 KASME */
Harald Welted27ab242019-07-26 13:45:18 +0200706template (value) GenericAVP ts_AVP_KASME(template (value) octetstring kasme) := {
707 avp := {
708 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_KASME),
709 avp_data := {
710 avp_AAA_3GPP_KASME := kasme
711 }
712 }
713}
714
Harald Welte40b1e002023-01-27 17:26:39 +0100715/* TS 29.272 7.3.23 Item-Number */
Harald Welted27ab242019-07-26 13:45:18 +0200716template (value) GenericAVP ts_AVP_ItemNumber(uint32_t num) := {
717 avp := {
718 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_KASME),
719 avp_data := {
720 avp_AAA_3GPP_Item_Number := int2oct(num, 4)
721 }
722 }
723}
724
Harald Welte40b1e002023-01-27 17:26:39 +0100725/* TS 29.272 7.3.18 E-UTRAN Vector */
Harald Welted27ab242019-07-26 13:45:18 +0200726template (value) GenericAVP ts_AVP_EutranVec(uint32_t item_num, octetstring rand, octetstring xres,
727 octetstring autn, octetstring kasme) := {
728 avp := {
729 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_E_UTRAN_Vector),
730 avp_data := {
731 avp_AAA_3GPP_E_UTRAN_Vector := {
732 ts_AVP_ItemNumber(item_num),
733 ts_AVP_RAND(rand),
734 ts_AVP_XRES(xres),
735 ts_AVP_AUTN(autn),
736 ts_AVP_KASME(kasme)
737 }
738 }
739 }
740}
741
Harald Welte40b1e002023-01-27 17:26:39 +0100742/* TS 29.272 7.3.2 Subscription-Data */
Harald Welted27ab242019-07-26 13:45:18 +0200743template (value) GenericAVP ts_AVP_3GPP_SubscriptionData(template (value) AVP_list content) := {
744 avp := {
745 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscription_Data),
746 avp_data := {
747 avp_AAA_3GPP_Subscription_Data := content
748 }
749 }
750}
Vadim Yanitskiy5e1bdc02021-12-12 02:33:59 +0300751template (present) GenericAVP
752tr_AVP_3GPP_SubscriptionData(template (present) AVP_list content := ?) := {
753 avp := {
754 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscription_Data),
755 avp_data := {
756 avp_AAA_3GPP_Subscription_Data := content
757 }
758 }
759}
Harald Welted27ab242019-07-26 13:45:18 +0200760
761
Harald Welte40b1e002023-01-27 17:26:39 +0100762/* TS 29.272 7.3.17 Authentication-Info */
Harald Welted27ab242019-07-26 13:45:18 +0200763template (value) GenericAVP ts_AVP_3GPP_AuthInfo(template (value) AVP_list content) := {
764 avp := {
765 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Authentication_Info),
766 avp_data := {
767 avp_AAA_3GPP_Authentication_Info := content
768 }
769 }
770}
Vadim Yanitskiy446edae2021-12-12 04:33:08 +0300771template (present) GenericAVP
772tr_AVP_3GPP_AuthInfo(template (present) AVP_list content := ?) := {
773 avp := {
774 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Authentication_Info),
775 avp_data := {
776 avp_AAA_3GPP_Authentication_Info := content
777 }
778 }
779}
Harald Welted27ab242019-07-26 13:45:18 +0200780
Harald Welte40b1e002023-01-27 17:26:39 +0100781/* TS 29.272 7.3.9 Visited-PLMN-Id */
Harald Welted27ab242019-07-26 13:45:18 +0200782template (value) GenericAVP ts_AVP_3GPP_VisitedPlmnId(template (value) octetstring id) := {
783 avp := {
784 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Visited_PLMN_Id),
785 avp_data := {
786 avp_AAA_3GPP_Visited_PLMN_Id := id
787 }
788 }
789}
790template (present) GenericAVP tr_AVP_3GPP_VisitedPlmnId(template (present) octetstring id := ?) := {
791 avp := {
792 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Visited_PLMN_Id),
793 avp_data := {
794 avp_AAA_3GPP_Visited_PLMN_Id := id
795 }
796 }
797}
798
Harald Welte40b1e002023-01-27 17:26:39 +0100799/* TS 29.272 7.3.13 RAT-Type */
Pau Espin Pedrola2af5782022-05-18 16:34:29 +0200800template (value) GenericAVP ts_AVP_PCC_3GPP_RatType(template (value) PCC_3GPP_RAT_Type rat_type) := {
Harald Welted27ab242019-07-26 13:45:18 +0200801 avp := {
802 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_RAT_Type),
803 avp_data := {
804 avp_PCC_3GPP_RAT_Type := rat_type
805 }
806 }
807}
Pau Espin Pedrola2af5782022-05-18 16:34:29 +0200808template (present) GenericAVP tr_AVP_PCC_3GPP_RatType(template (present) PCC_3GPP_RAT_Type rat_type := ?) := {
Harald Welted27ab242019-07-26 13:45:18 +0200809 avp := {
810 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_RAT_Type),
811 avp_data := {
812 avp_PCC_3GPP_RAT_Type := rat_type
813 }
814 }
815}
816
Pau Espin Pedrola2af5782022-05-18 16:34:29 +0200817template (present) GenericAVP tr_AVP_GI_3GPP_RatType(template (present) GI_3GPP_3GPP_RAT_Type rat_type := ?) := {
818 avp := {
819 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_RAT_Type),
820 avp_data := {
821 avp_GI_3GPP_3GPP_RAT_Type := rat_type
822 }
823 }
824}
825
Harald Welte40b1e002023-01-27 17:26:39 +0100826/* TS 29.272 7.3.7 ULR-Flags */
Harald Welted27ab242019-07-26 13:45:18 +0200827template (value) GenericAVP ts_AVP_3GPP_UlrFlags(template (value) UINT32 flags) := {
828 avp := {
829 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULR_Flags),
830 avp_data := {
831 avp_AAA_3GPP_ULR_Flags := flags
832 }
833 }
834}
835template (present) GenericAVP tr_AVP_3GPP_UlrFlags(template (present) UINT32 flags := ?) := {
836 avp := {
837 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULR_Flags),
838 avp_data := {
839 avp_AAA_3GPP_ULR_Flags := flags
840 }
841 }
842}
843
Harald Welte40b1e002023-01-27 17:26:39 +0100844/* TS 29.272 7.3.8 ULA-Flags */
Harald Welted27ab242019-07-26 13:45:18 +0200845template (value) GenericAVP ts_AVP_3GPP_UlaFlags(template (value) UINT32 flags) := {
846 avp := {
847 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULA_Flags),
848 avp_data := {
849 avp_AAA_3GPP_ULA_Flags := flags
850 }
851 }
852}
853template (present) GenericAVP tr_AVP_3GPP_UlaFlags(template (present) UINT32 flags := ?) := {
854 avp := {
855 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULA_Flags),
856 avp_data := {
857 avp_AAA_3GPP_ULA_Flags := flags
858 }
859 }
860}
861
Harald Welte6effabb2020-02-18 21:39:59 +0100862
863
864template (value) GenericAVP ts_AVP_NumOfReqVectors(template (value) UINT32 num_req := '00000004'O) := {
865 avp := {
866 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Number_Of_Requested_Vectors),
867 avp_data := {
868 avp_AAA_3GPP_Number_Of_Requested_Vectors := num_req
869 }
870 }
871}
872
873template (value) GenericAVP ts_AVP_ImmReqPref(template (value) UINT32 par := '00000000'O) := {
874 avp := {
875 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Immediate_Response_Preferred),
876 avp_data := {
877 avp_AAA_3GPP_Immediate_Response_Preferred := par
878 }
879 }
880}
881
882
883/* 7.3.11 Requested-EUTRAN-Authentication-Info */
884template (value) GenericAVP ts_AVP_RequestedEutranAuthInfo(template (value) UINT32 num_vec := '00000004'O) := {
885 avp := {
886 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Requested_EUTRAN_Authentication_Info),
887 avp_data := {
888 avp_AAA_3GPP_Requested_EUTRAN_Authentication_Info := {
889 ts_AVP_NumOfReqVectors(num_vec),
890 ts_AVP_ImmReqPref('00000000'O)
891 }
892 }
893 }
894}
895
896
Harald Welte40b1e002023-01-27 17:26:39 +0100897/* TS 29.272 7.3.27 Context-Identifier */
Pau Espin Pedrol446145a2023-10-10 19:12:21 +0200898template (present) GenericAVP tr_AVP_3GPP_ContextId(template (present) uint32_t ctx := ?) := {
899 avp := {
900 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Context_Identifier),
901 avp_data := {
902 avp_AAA_3GPP_Context_Identifier := int2oct_tmpl(ctx, 4)
903 }
904 }
905}
Harald Welted27ab242019-07-26 13:45:18 +0200906template (value) GenericAVP ts_AVP_3GPP_ContextId(uint32_t ctx) := {
907 avp := {
908 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Context_Identifier),
909 avp_data := {
910 avp_AAA_3GPP_Context_Identifier := int2oct(ctx, 4)
911 }
912 }
913}
914
Harald Welte40b1e002023-01-27 17:26:39 +0100915/* Ts 29.272 7.3.29 Subscriber-Status */
Pau Espin Pedrol446145a2023-10-10 19:12:21 +0200916template (present) GenericAVP tr_AVP_3GPP_SubscriberStatus(template (present) AAA_3GPP_Subscriber_Status sts) := {
917 avp := {
918 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscriber_Status),
919 avp_data := {
920 avp_AAA_3GPP_Subscriber_Status := sts
921 }
922 }
923}
Harald Welted27ab242019-07-26 13:45:18 +0200924template (value) GenericAVP ts_AVP_3GPP_SubscriberStatus(template (value) AAA_3GPP_Subscriber_Status sts) := {
925 avp := {
926 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscriber_Status),
927 avp_data := {
928 avp_AAA_3GPP_Subscriber_Status := sts
929 }
930 }
931}
932
Pau Espin Pedrold34720f2023-10-11 17:49:39 +0200933/* Ts 29.272 7.3.30 Operator-Determined-Barring */
934template (present) GenericAVP tr_AVP_3GPP_OperatorDeterminedBarring(template (present) uint32_t val := ?) := {
935 avp := {
936 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Operator_Determined_Barring),
937 avp_data := {
938 avp_AAA_3GPP_Operator_Determined_Barring := int2oct_tmpl(val, 4)
939 }
940 }
941}
942template (value) GenericAVP ts_AVP_3GPP_OperatorDeterminedBarring(uint32_t val) := {
943 avp := {
944 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Operator_Determined_Barring),
945 avp_data := {
946 avp_AAA_3GPP_Operator_Determined_Barring := int2oct(val, 4)
947 }
948 }
949}
950
Pau Espin Pedrol446145a2023-10-10 19:12:21 +0200951template (present) GenericAVP tr_AVP_3GPP_SubscrRauTauTmr(template (present) uint32_t tmr := ?) := {
952 avp := {
953 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer),
954 avp_data := {
955 avp_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer := int2oct_tmpl(tmr, 4)
956 }
957 }
958}
959
Harald Welted27ab242019-07-26 13:45:18 +0200960template (value) GenericAVP ts_AVP_3GPP_SubscrRauTauTmr(uint32_t tmr) := {
961 avp := {
962 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer),
963 avp_data := {
964 avp_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer := int2oct(tmr, 4)
965 }
966 }
967}
968
Harald Welte40b1e002023-01-27 17:26:39 +0100969/* TS 29.272 7.3.33 All-APN-Configurations-Included-Indicator */
Pau Espin Pedrol446145a2023-10-10 19:12:21 +0200970template (present) GenericAVP tr_AVP_3GPP_AllApnConfigsIncl(template (present) AAA_3GPP_All_APN_Configurations_Included_Indicator ind := ?) := {
971 avp := {
972 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_All_APN_Configurations_Included_Indicator),
973 avp_data := {
974 avp_AAA_3GPP_All_APN_Configurations_Included_Indicator := ind
975 }
976 }
977}
Harald Welted27ab242019-07-26 13:45:18 +0200978template (value) GenericAVP ts_AVP_3GPP_AllApnConfigsIncl(template (value) AAA_3GPP_All_APN_Configurations_Included_Indicator ind := All_APN_CONFIGURATIONS_INCLUDED) := {
979 avp := {
980 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_All_APN_Configurations_Included_Indicator),
981 avp_data := {
982 avp_AAA_3GPP_All_APN_Configurations_Included_Indicator := ind
983 }
984 }
985}
986
Harald Welte40b1e002023-01-27 17:26:39 +0100987/* TS 29.272 7.3.34 APN-Configuration-Profile */
Pau Espin Pedrol446145a2023-10-10 19:12:21 +0200988template (present) GenericAVP tr_AVP_3GPP_ApnConfigProfile(template (present) AVP_list content := ?) := {
989 avp := {
990 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_APN_Configuration_Profile),
991 avp_data := {
992 avp_AAA_3GPP_APN_Configuration_Profile := content
993 }
994 }
995}
Harald Welted27ab242019-07-26 13:45:18 +0200996template (value) GenericAVP ts_AVP_3GPP_ApnConfigProfile(template (value) AVP_list content) := {
997 avp := {
998 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_APN_Configuration_Profile),
999 avp_data := {
1000 avp_AAA_3GPP_APN_Configuration_Profile := content
1001 }
1002 }
1003}
1004
Harald Welte40b1e002023-01-27 17:26:39 +01001005/* TS 29.272 7.3.35 APN-Configuration */
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001006template (present) GenericAVP tr_AVP_3GPP_ApnConfig(template (present) uint32_t ctx := ?,
1007 template (present) AAA_3GPP_PDN_Type pdn_type := ?,
1008 template (present) charstring apn := ?) := {
1009 avp := {
1010 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_APN_Configuration),
1011 avp_data := {
1012 avp_AAA_3GPP_APN_Configuration := superset(
1013 tr_AVP_3GPP_ContextId(ctx),
1014 tr_AVP_3GPP_PdnType(pdn_type),
1015 tr_AVP_ServiceSelection(apn),
1016 tr_AVP_3GPP_EpsSubscrQosProfile(?, ?)
1017 )
1018 }
1019 }
1020}
Harald Welted27ab242019-07-26 13:45:18 +02001021template (value) GenericAVP ts_AVP_3GPP_ApnConfig(uint32_t ctx, AAA_3GPP_PDN_Type pdn_type,
1022 charstring apn) := {
1023 avp := {
Pau Espin Pedrolaaad2762023-10-11 17:35:20 +02001024 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_APN_Configuration),
Harald Welted27ab242019-07-26 13:45:18 +02001025 avp_data := {
1026 avp_AAA_3GPP_APN_Configuration := {
1027 ts_AVP_3GPP_ContextId(ctx),
1028 ts_AVP_3GPP_PdnType(pdn_type),
Pau Espin Pedrolaaad2762023-10-11 17:35:20 +02001029 ts_AVP_ServiceSelection(apn),
1030 ts_AVP_3GPP_EpsSubscrQosProfile(1, 1)
Harald Welted27ab242019-07-26 13:45:18 +02001031 }
1032 }
1033 }
1034}
1035
Pau Espin Pedrol965ac642023-10-16 18:12:45 +02001036/* Service-Selection, TS 29.272 7.3.36, TS 29.273 5.2.3.5, (RFC 5778) */
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001037template (present) GenericAVP tr_AVP_ServiceSelection(template (present) charstring apn := ?) := {
1038 avp := {
1039 avp_header := tr_DIA_Hdr(c_AVP_Code_MIPv6_NONE_Service_Selection),
1040 avp_data := {
1041 avp_MIPv6_NONE_Service_Selection := char2oct_tmpl(apn)
1042 }
1043 }
1044}
Harald Welted27ab242019-07-26 13:45:18 +02001045template (value) GenericAVP ts_AVP_ServiceSelection(charstring apn) := {
1046 avp := {
1047 avp_header := ts_DIA_Hdr(c_AVP_Code_MIPv6_NONE_Service_Selection),
1048 avp_data := {
1049 avp_MIPv6_NONE_Service_Selection := char2oct(apn)
1050 }
1051 }
1052}
1053
Pau Espin Pedrol6477d732022-06-03 12:04:40 +02001054template (present) GenericAVP tr_AVP_PCC_3GPP_QoS_Information(template (present) AVP_list list := ?) := {
Pau Espin Pedrola2af5782022-05-18 16:34:29 +02001055 avp := {
1056 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Information),
1057 avp_data := {
1058 avp_PCC_3GPP_QoS_Information := list
1059 }
1060 }
1061}
1062
Pau Espin Pedrol6477d732022-06-03 12:04:40 +02001063template (value) GenericAVP ts_AVP_PCC_3GPP_QoS_Information(template (value) AVP_list list) := {
1064 avp := {
1065 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Information),
1066 avp_data := {
1067 avp_PCC_3GPP_QoS_Information := list
1068 }
1069 }
1070}
1071
1072template (value) GenericAVP ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL(uint32_t val) := {
1073 avp := {
1074 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL),
1075 avp_data := {
1076 avp_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL := int2oct(val, 4)
1077 }
1078 }
1079}
1080
1081template (value) GenericAVP ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL(uint32_t val) := {
1082 avp := {
1083 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL),
1084 avp_data := {
1085 avp_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL := int2oct(val, 4)
1086 }
1087 }
1088}
1089
1090template (value) GenericAVP ts_AVP_PCC_3GPP_Default_EPS_Bearer_QoS(template (value) AVP_list list) := {
1091 avp := {
1092 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Default_EPS_Bearer_QoS),
1093 avp_data := {
1094 avp_PCC_3GPP_Default_EPS_Bearer_QoS := list
1095 }
1096 }
1097}
1098
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001099template (present) GenericAVP tr_AVP_PCC_3GPP_QoS_Class_Identifier(template (present) uint32_t val := ?) := {
1100 avp := {
1101 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Class_Identifier),
1102 avp_data := {
1103 avp_PCC_3GPP_QoS_Class_Identifier := int2oct_tmpl(val, 4)
1104 }
1105 }
1106}
1107
Pau Espin Pedrol6477d732022-06-03 12:04:40 +02001108template (value) GenericAVP ts_AVP_PCC_3GPP_QoS_Class_Identifier(uint32_t val) := {
Harald Welted27ab242019-07-26 13:45:18 +02001109 avp := {
1110 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Class_Identifier),
1111 avp_data := {
Pau Espin Pedrol6477d732022-06-03 12:04:40 +02001112 avp_PCC_3GPP_QoS_Class_Identifier := int2oct(val, 4)
Harald Welted27ab242019-07-26 13:45:18 +02001113 }
1114 }
1115}
1116
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001117template (present) GenericAVP tr_AVP_3GPP_PriorityLevel(template (present) uint32_t prio := ?) := {
1118 avp := {
1119 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Priority_Level),
1120 avp_data := {
1121 avp_PCC_3GPP_Priority_Level := int2oct_tmpl(prio, 4)
1122 }
1123 }
1124}
1125
Harald Welted27ab242019-07-26 13:45:18 +02001126template (value) GenericAVP ts_AVP_3GPP_PriorityLevel(uint32_t prio) := {
1127 avp := {
1128 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Priority_Level),
1129 avp_data := {
1130 avp_PCC_3GPP_Priority_Level := int2oct(prio, 4)
1131 }
1132 }
1133}
1134
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001135template (present) GenericAVP tr_AVP_PCC_3GPP_AllocRetenPrio(template (present) uint32_t prio := ?) := {
1136 avp := {
1137 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Allocation_Retention_Priority),
1138 avp_data := {
1139 avp_PCC_3GPP_Allocation_Retention_Priority := superset(
1140 tr_AVP_3GPP_PriorityLevel(prio)
1141 /* pre-emption capability */
1142 /* pre-emption vulnerability */
1143 )
1144 }
1145 }
1146}
Pau Espin Pedrol6477d732022-06-03 12:04:40 +02001147template (value) GenericAVP ts_AVP_PCC_3GPP_AllocRetenPrio(uint32_t prio) := {
Harald Welted27ab242019-07-26 13:45:18 +02001148 avp := {
1149 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Allocation_Retention_Priority),
1150 avp_data := {
1151 avp_PCC_3GPP_Allocation_Retention_Priority := {
1152 ts_AVP_3GPP_PriorityLevel(prio)
1153 /* pre-emption capability */
1154 /* pre-emption vulnerability */
1155 }
1156 }
1157 }
1158}
1159
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001160/* 7.3.37 EPS-Subscribed-QoS-Profile */
1161template (present) GenericAVP tr_AVP_3GPP_EpsSubscrQosProfile(template (present) uint32_t qos_class := ?,
1162 template (present) uint32_t prio := ?) := {
1163 avp := {
1164 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_EPS_Subscribed_QoS_Profile),
1165 avp_data := {
1166 avp_AAA_3GPP_EPS_Subscribed_QoS_Profile := superset(
1167 tr_AVP_PCC_3GPP_QoS_Class_Identifier(qos_class),
1168 tr_AVP_PCC_3GPP_AllocRetenPrio(prio)
1169 )
1170 }
1171 }
1172}
1173
Harald Welted27ab242019-07-26 13:45:18 +02001174template (value) GenericAVP ts_AVP_3GPP_EpsSubscrQosProfile(uint32_t qos_class, uint32_t prio) := {
1175 avp := {
1176 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_EPS_Subscribed_QoS_Profile),
1177 avp_data := {
1178 avp_AAA_3GPP_EPS_Subscribed_QoS_Profile := {
Pau Espin Pedrol6477d732022-06-03 12:04:40 +02001179 ts_AVP_PCC_3GPP_QoS_Class_Identifier(qos_class),
1180 ts_AVP_PCC_3GPP_AllocRetenPrio(prio)
Harald Welted27ab242019-07-26 13:45:18 +02001181 }
1182 }
1183 }
1184}
1185
1186
Harald Welte40b1e002023-01-27 17:26:39 +01001187/* TS 29.272 7.3.41 AMBR */
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001188template (present) GenericAVP tr_AVP_3GPP_AMBR(template (present) uint32_t ul := ?, template (present) uint32_t dl := ?) := {
1189 avp := {
1190 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_AMBR),
1191 avp_data := {
1192 avp_AAA_3GPP_AMBR := {
1193 tr_AVP_3GPP_MaxReqBwUL(ul),
1194 tr_AVP_3GPP_MaxReqBwDL(dl)
1195 }
1196 }
1197 }
1198}
Harald Welted27ab242019-07-26 13:45:18 +02001199template (value) GenericAVP ts_AVP_3GPP_AMBR(uint32_t ul, uint32_t dl) := {
1200 avp := {
1201 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_AMBR),
1202 avp_data := {
1203 avp_AAA_3GPP_AMBR := {
1204 ts_AVP_3GPP_MaxReqBwUL(ul),
1205 ts_AVP_3GPP_MaxReqBwDL(dl)
1206 }
1207 }
1208 }
1209}
1210
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001211template (present) GenericAVP tr_AVP_3GPP_MaxReqBwUL(template (present) uint32_t bw := ?) := {
1212 avp := {
1213 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_RX_3GPP_Max_Requested_Bandwidth_UL),
1214 avp_data := {
1215 avp_RX_3GPP_Max_Requested_Bandwidth_UL := int2oct_tmpl(bw, 4)
1216 }
1217 }
1218}
1219
Harald Welted27ab242019-07-26 13:45:18 +02001220template (value) GenericAVP ts_AVP_3GPP_MaxReqBwUL(uint32_t bw) := {
1221 avp := {
1222 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_RX_3GPP_Max_Requested_Bandwidth_UL),
1223 avp_data := {
1224 avp_RX_3GPP_Max_Requested_Bandwidth_UL := int2oct(bw, 4)
1225 }
1226 }
1227}
1228
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001229template (present) GenericAVP tr_AVP_3GPP_MaxReqBwDL(template (present) uint32_t bw := ?) := {
1230 avp := {
1231 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_RX_3GPP_Max_Requested_Bandwidth_DL),
1232 avp_data := {
1233 avp_RX_3GPP_Max_Requested_Bandwidth_DL := int2oct_tmpl(bw, 4)
1234 }
1235 }
1236}
1237
Harald Welted27ab242019-07-26 13:45:18 +02001238template (value) GenericAVP ts_AVP_3GPP_MaxReqBwDL(uint32_t bw) := {
1239 avp := {
1240 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_RX_3GPP_Max_Requested_Bandwidth_DL),
1241 avp_data := {
1242 avp_RX_3GPP_Max_Requested_Bandwidth_DL := int2oct(bw, 4)
1243 }
1244 }
1245}
1246
Pau Espin Pedrola2af5782022-05-18 16:34:29 +02001247template (present) GenericAVP tr_AVP_3GPP_Reporting_Reason(template (present) DCA_3GPP_Reporting_Reason r := ?) := {
1248 avp := {
1249 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_Reporting_Reason),
1250 avp_data := {
1251 avp_DCA_3GPP_Reporting_Reason := r
1252 }
1253 }
1254}
Harald Welted27ab242019-07-26 13:45:18 +02001255
Pau Espin Pedrola2af5782022-05-18 16:34:29 +02001256template (present) GenericAVP tr_AVP_3GPP_AoCRequestType(template (present) DCA_3GPP_AoC_Request_Type t := ?) := {
1257 avp := {
1258 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_AoC_Request_Type),
1259 avp_data := {
1260 avp_DCA_3GPP_AoC_Request_Type := t
1261 }
1262 }
1263}
1264
1265template (present) GenericAVP tr_AVP_3GPP_ServiceInformation(template (present) AVP_list content := ?) := {
1266 avp := {
1267 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_Service_Information),
1268 avp_data := {
1269 avp_DCA_3GPP_Service_Information := content
1270 }
1271 }
1272}
1273
1274template (present) GenericAVP tr_AVP_3GPP_PSInformation(template (present) AVP_list content := ?) := {
1275 avp := {
1276 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_PS_Information),
1277 avp_data := {
1278 avp_DCA_3GPP_PS_Information := content
1279 }
1280 }
1281}
1282
1283template (present) GenericAVP tr_AVP_3GPP_ChargingId(template (present) AVP_OctetString id := ?) := {
1284 avp := {
1285 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_Charging_Id),
1286 avp_data := {
1287 avp_GI_3GPP_3GPP_Charging_Id := id
1288 }
1289 }
1290}
1291
1292template (present) GenericAVP tr_AVP_3GPP_PDPType(template (present) GI_3GPP_3GPP_PDP_Type t := ?) := {
1293 avp := {
1294 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_PDP_Type),
1295 avp_data := {
1296 avp_GI_3GPP_3GPP_PDP_Type := t
1297 }
1298 }
1299}
1300
1301template (present) GenericAVP tr_AVP_3GPP_PDPAddress(template (present) DCA_3GPP_PDP_Address addr := ?) := {
1302 avp := {
1303 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_PDP_Address),
1304 avp_data := {
1305 avp_DCA_3GPP_PDP_Address := addr
1306 }
1307 }
1308}
1309
1310template (present) GenericAVP tr_AVP_3GPP_SGSNAddress(template (present) DCA_3GPP_SGSN_Address addr := ?) := {
1311 avp := {
1312 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_SGSN_Address),
1313 avp_data := {
1314 avp_DCA_3GPP_SGSN_Address := addr
1315 }
1316 }
1317}
1318
1319template (present) GenericAVP tr_AVP_3GPP_GGSNAddress(template (present) DCA_3GPP_GGSN_Address addr := ?) := {
1320 avp := {
1321 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_GGSN_Address),
1322 avp_data := {
1323 avp_DCA_3GPP_GGSN_Address := addr
1324 }
1325 }
1326}
1327
1328template (present) GenericAVP tr_AVP_3GPP_SelectionMode(template (present) GI_3GPP_3GPP_Selection_Mode sm := ?) := {
1329 avp := {
1330 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_Selection_Mode),
1331 avp_data := {
1332 avp_GI_3GPP_3GPP_Selection_Mode := sm
1333 }
1334 }
1335}
1336
1337template (present) GenericAVP tr_AVP_3GPP_ChargingCharacteristics(template (present) GI_3GPP_3GPP_Charging_Characteristics cc := ?) := {
1338 avp := {
1339 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_Charging_Characteristics),
1340 avp_data := {
1341 avp_GI_3GPP_3GPP_Charging_Characteristics := cc
1342 }
1343 }
1344}
1345
1346template (present) GenericAVP tr_AVP_3GPP_SGSNMCCMNC(template (present) GI_3GPP_3GPP_SGSN_MCC_MNC smn := ?) := {
1347 avp := {
1348 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_SGSN_MCC_MNC),
1349 avp_data := {
1350 avp_GI_3GPP_3GPP_SGSN_MCC_MNC := smn
1351 }
1352 }
1353}
1354
1355template (present) GenericAVP tr_AVP_3GPP_NSAPI(template (present) GI_3GPP_3GPP_NSAPI nsapi := ?) := {
1356 avp := {
1357 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_NSAPI),
1358 avp_data := {
1359 avp_GI_3GPP_3GPP_NSAPI := nsapi
1360 }
1361 }
1362}
1363
1364template (present) GenericAVP tr_AVP_3GPP_MS_TimeZone(template (present) GI_3GPP_3GPP_MS_TimeZone ms_tz := ?) := {
1365 avp := {
1366 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_MS_TimeZone),
1367 avp_data := {
1368 avp_GI_3GPP_3GPP_MS_TimeZone := ms_tz
1369 }
1370 }
1371}
1372
1373template (present) GenericAVP tr_AVP_3GPP_ULI(template (present) GI_3GPP_3GPP_User_Location_Info uli := ?) := {
1374 avp := {
1375 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_User_Location_Info),
1376 avp_data := {
1377 avp_GI_3GPP_3GPP_User_Location_Info := uli
1378 }
1379 }
1380}
1381
1382template (present) GenericAVP tr_AVP_UserEquipmentInfo(template (present) DCC_NONE_User_Equipment_Info uei := ?) := {
1383 avp := {
1384 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_User_Equipment_Info),
1385 avp_data := {
1386 avp_DCC_NONE_User_Equipment_Info := uei
1387 }
1388 }
1389}
1390
1391template (present) GenericAVP tr_AVP_UserEquipmentInfoType(template (present) DCC_NONE_User_Equipment_Info_Type ueit := ?) := {
1392 avp := {
1393 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_User_Equipment_Info_Type),
1394 avp_data := {
1395 avp_DCC_NONE_User_Equipment_Info_Type := ueit
1396 }
1397 }
1398}
1399
1400template (present) GenericAVP tr_AVP_UserEquipmentInfoValue(template (present) DCC_NONE_User_Equipment_Info_Value ueiv := ?) := {
1401 avp := {
1402 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_User_Equipment_Info_Value),
1403 avp_data := {
1404 avp_DCC_NONE_User_Equipment_Info_Value := ueiv
1405 }
1406 }
1407}
Harald Welted27ab242019-07-26 13:45:18 +02001408
Harald Welte40b1e002023-01-27 17:26:39 +01001409/* TS 29.272 7.3.62 PDN-Type */
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001410template (present) GenericAVP tr_AVP_3GPP_PdnType(template (present) AAA_3GPP_PDN_Type pdn_type := ?) := {
1411 avp := {
1412 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_PDN_Type),
1413 avp_data := {
1414 avp_AAA_3GPP_PDN_Type := pdn_type
1415 }
1416 }
1417}
Harald Welted27ab242019-07-26 13:45:18 +02001418template (value) GenericAVP ts_AVP_3GPP_PdnType(template (value) AAA_3GPP_PDN_Type pdn_type) := {
1419 avp := {
1420 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_PDN_Type),
1421 avp_data := {
1422 avp_AAA_3GPP_PDN_Type := pdn_type
1423 }
1424 }
1425}
1426
Pau Espin Pedrol77fdd0b2022-03-08 14:03:33 +01001427/* RFC4006 8.16 Multiple-Services-Credit-Control AVP */
1428template (value) GenericAVP ts_AVP_Multiple_Services_Credit_Control(template (value) AVP_list content) := {
1429 avp := {
1430 avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_Multiple_Services_Credit_Control),
1431 avp_data := {
1432 avp_DCC_NONE_Multiple_Services_Credit_Control := content
1433 }
1434 }
1435}
Pau Espin Pedrola2af5782022-05-18 16:34:29 +02001436template (present) GenericAVP tr_AVP_Multiple_Services_Credit_Control(template (present) AVP_list content := ?) := {
1437 avp := {
1438 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Multiple_Services_Credit_Control),
1439 avp_data := {
1440 avp_DCC_NONE_Multiple_Services_Credit_Control := content
1441 }
1442 }
1443}
1444
1445/* Requested-Service-Unit AVP */
1446template (present) GenericAVP tr_AVP_Requested_Service_Unit(template (present) AVP_list content := ?) := {
1447 avp := {
1448 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Requested_Service_Unit),
1449 avp_data := {
1450 avp_DCC_NONE_Requested_Service_Unit := content
1451 }
1452 }
1453}
1454
1455/* Used-Service-Unit AVP */
1456template (present) GenericAVP tr_AVP_Used_Service_Unit(template (present) AVP_list content := ?) := {
1457 avp := {
1458 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Used_Service_Unit),
1459 avp_data := {
1460 avp_DCC_NONE_Used_Service_Unit := content
1461 }
1462 }
1463}
Pau Espin Pedrol77fdd0b2022-03-08 14:03:33 +01001464
1465/* RFC4006 8.17 Granted-Service-Unit AVP */
1466template (value) GenericAVP ts_AVP_Granted_Service_Unit(template (value) AVP_list content) := {
1467 avp := {
1468 avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_Granted_Service_Unit),
1469 avp_data := {
1470 avp_DCC_NONE_Granted_Service_Unit := content
1471 }
1472 }
1473}
1474
1475/* RFC4006 8.21 CC-Time AVP */
1476template (value) GenericAVP ts_AVP_CC_Time(uint32_t cc_time_val) := {
1477 avp := {
1478 avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Time),
1479 avp_data := {
1480 avp_DCC_NONE_CC_Time := int2oct(cc_time_val, 4)
1481 }
1482 }
1483}
1484
1485/* RFC4006 8.23 CC-Total-Octets AVP */
1486template (value) GenericAVP ts_AVP_CC_Total_Octets(uint64_t cc_total_octets_val) := {
1487 avp := {
1488 avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Total_Octets),
1489 avp_data := {
1490 avp_DCC_NONE_CC_Total_Octets := int2oct(cc_total_octets_val, 8)
1491 }
1492 }
1493}
1494
1495/* RFC4006 8.33 Validity-Time AVP */
1496template (value) GenericAVP ts_AVP_Validity_Time(uint32_t validity_time_val) := {
1497 avp := {
1498 avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_Validity_Time),
1499 avp_data := {
1500 avp_DCC_NONE_Validity_Time := int2oct(validity_time_val, 4)
1501 }
1502 }
1503}
1504
Pau Espin Pedrol52562c92022-05-23 15:45:46 +02001505template (value) GenericAVP ts_AVP_3GPP_VolumeQuotaThreshold(uint32_t volume_quota_thresh_val) := {
1506 avp := {
1507 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_Volume_Quota_Threshold),
1508 avp_data := {
1509 avp_DCA_3GPP_Volume_Quota_Threshold := int2oct(volume_quota_thresh_val, 4)
1510 }
1511 }
1512}
1513
Pau Espin Pedrola2af5782022-05-18 16:34:29 +02001514template (present) GenericAVP tr_AVP_3GPP_CalledStationId(template (present) DNAS_NONE_Called_Station_Id id := ?) := {
1515 avp := {
1516 avp_header := tr_DIA_Hdr(c_AVP_Code_DNAS_NONE_Called_Station_Id),
1517 avp_data := {
1518 avp_DNAS_NONE_Called_Station_Id := id
1519 }
1520 }
1521}
Harald Welted27ab242019-07-26 13:45:18 +02001522
Pau Espin Pedrol44b75202023-10-23 14:37:24 +02001523/* RFC6733 8.7. Auth-Request-Type AVP */
1524template (value) GenericAVP ts_AVP_AuthRequestType(BASE_NONE_Auth_Request_Type auth_req_type) := {
1525 avp := {
1526 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Request_Type, '00000000'B),
1527 avp_data := {
1528 avp_BASE_NONE_Auth_Request_Type := auth_req_type
1529 }
1530 }
1531}
1532template (present) GenericAVP tr_AVP_AuthRequestType(template (present) BASE_NONE_Auth_Request_Type auth_req_type) := {
1533 avp := {
1534 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Request_Type),
1535 avp_data := {
1536 avp_BASE_NONE_Auth_Request_Type := auth_req_type
1537 }
1538 }
1539}
1540
Harald Welted27ab242019-07-26 13:45:18 +02001541
Vadim Yanitskiy0d6cbd32023-02-11 08:07:27 +07001542/* 5.3.1 Capabilities Exchange Request */
1543template (value) PDU_DIAMETER
1544ts_DIA_CER(octetstring host_ip, uint32_t vendor_app_id,
1545 template (value) charstring orig_host := "ttcn3.localdomain",
1546 template (value) charstring orig_realm := "localdomain",
1547 template (value) UINT32 hbh_id := '00000000'O,
1548 template (value) UINT32 ete_id := '00000000'O) :=
1549 ts_DIAMETER(flags := '10000000'B,
1550 cmd_code := Capabilities_Exchange,
1551 hbh_id := hbh_id,
1552 ete_id := ete_id,
1553 avps := {
1554 ts_AVP_OriginHost(orig_host),
1555 ts_AVP_OriginRealm(orig_realm),
1556 ts_AVP_HostIpAddr(host_ip),
1557 ts_AVP_VendorId(vendor_id_3GPP),
1558 ts_AVP_ProductName("TTCN-3 Testsuite"),
1559 ts_AVP_FwRevision('00000000'O),
1560 ts_AVP_InbSecId('00000000'O),
1561 ts_AVP_AuthAppId('FFFFFFFF'O),
1562 ts_AVP_VendorSpecAppId(vendor_id_3GPP, vendor_app_id)
1563 });
1564
1565
Harald Welted27ab242019-07-26 13:45:18 +02001566/* 5.3.2 Capabilities Exchange Answer */
1567template (value) PDU_DIAMETER
Pau Espin Pedrol33b47492022-03-08 17:43:01 +01001568ts_DIA_CEA_AUTH_APP_ID(template (value) UINT32 hbh_id, template (value) UINT32 ete_id,
1569 template (value) charstring origin_host,
1570 template (value) charstring origin_realm,
1571 template (value) octetstring host_ip, uint32_t auth_app_id)
1572:= ts_DIAMETER(flags:='00000000'B, cmd_code:=Capabilities_Exchange, hbh_id:=hbh_id, ete_id:=ete_id,
1573 avps := {
1574 ts_AVP_ResultCode(DIAMETER_SUCCESS),
1575 ts_AVP_OriginHost(origin_host),
1576 ts_AVP_OriginRealm(origin_realm),
1577 ts_AVP_HostIpAddr(host_ip),
1578 ts_AVP_VendorId(vendor_id_3GPP),
1579 ts_AVP_ProductName("TTCN-3 Testsuite"),
1580 ts_AVP_OriginStateId('00000001'O),
1581 ts_AVP_SuppVendorIdRaw(5535), /* 3GPP2 */
1582 ts_AVP_SuppVendorId(vendor_id_3GPP),
1583 ts_AVP_SuppVendorIdRaw(13019), /* ETSI */
Pau Espin Pedrol33b47492022-03-08 17:43:01 +01001584 ts_AVP_AuthAppId(int2oct(auth_app_id, 4)),
1585 ts_AVP_InbSecId('00000000'O)
1586 });
1587template (value) PDU_DIAMETER
1588ts_DIA_CEA_VENDOR_APP_ID(template (value) UINT32 hbh_id, template (value) UINT32 ete_id,
1589 template (value) charstring origin_host,
1590 template (value) charstring origin_realm,
1591 template (value) octetstring host_ip, uint32_t vendor_app_id)
Harald Welted27ab242019-07-26 13:45:18 +02001592:= ts_DIAMETER(flags:='00000000'B, cmd_code:=Capabilities_Exchange, hbh_id:=hbh_id, ete_id:=ete_id,
1593 avps := {
1594 ts_AVP_ResultCode(DIAMETER_SUCCESS),
Harald Welte61f73d52020-04-26 21:41:12 +02001595 ts_AVP_OriginHost(origin_host),
1596 ts_AVP_OriginRealm(origin_realm),
1597 ts_AVP_HostIpAddr(host_ip),
Harald Welted27ab242019-07-26 13:45:18 +02001598 ts_AVP_VendorId(vendor_id_3GPP),
1599 ts_AVP_ProductName("TTCN-3 Testsuite"),
1600 ts_AVP_OriginStateId('00000001'O),
1601 ts_AVP_SuppVendorIdRaw(5535), /* 3GPP2 */
1602 ts_AVP_SuppVendorId(vendor_id_3GPP),
1603 ts_AVP_SuppVendorIdRaw(13019), /* ETSI */
Harald Welted27ab242019-07-26 13:45:18 +02001604 ts_AVP_InbSecId('00000000'O),
Harald Welte61f73d52020-04-26 21:41:12 +02001605 ts_AVP_VendorSpecAppId(vendor_id_3GPP, vendor_app_id)
Harald Welted27ab242019-07-26 13:45:18 +02001606 });
Pau Espin Pedrol33b47492022-03-08 17:43:01 +01001607function f_ts_DIA_CEA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id,
1608 template (value) charstring origin_host,
1609 template (value) charstring origin_realm,
1610 template (value) octetstring host_ip, template (omit) uint32_t auth_app_id,
1611 template (omit) uint32_t vendor_app_id)
1612 return template (value) PDU_DIAMETER
1613{
1614 var template (value) PDU_DIAMETER diam_pdu;
1615 if (istemplatekind(vendor_app_id, "omit")) {
1616 diam_pdu := ts_DIA_CEA_AUTH_APP_ID(hbh_id, ete_id, origin_host, origin_realm, host_ip, valueof(auth_app_id));
1617 } else {
1618 diam_pdu := ts_DIA_CEA_VENDOR_APP_ID(hbh_id, ete_id, origin_host, origin_realm, host_ip, valueof(vendor_app_id));
1619 }
1620 return diam_pdu;
1621}
Harald Welted27ab242019-07-26 13:45:18 +02001622
Harald Welte6effabb2020-02-18 21:39:59 +01001623
1624template (value) PDU_DIAMETER
Vadim Yanitskiy2dba4942021-12-11 15:46:30 +03001625ts_DIA_AIR(/* template (value) */ hexstring imsi,
Vadim Yanitskiy59ef8e52023-02-07 23:38:29 +07001626 template (value) octetstring mcc_mnc := '111F11'O,
Vadim Yanitskiy2dba4942021-12-11 15:46:30 +03001627 template (value) octetstring sess_id := c_def_sess_id,
Vadim Yanitskiyb57ef872021-12-12 04:14:18 +03001628 template (value) charstring orig_host := "ttcn3.localdomain",
1629 template (value) charstring orig_realm := "localdomain",
Vadim Yanitskiy2dba4942021-12-11 15:46:30 +03001630 template (value) charstring dest_realm := "localdomain",
1631 template (value) UINT32 hbh_id := '00000000'O,
1632 template (value) UINT32 ete_id := '00000000'O) :=
Vadim Yanitskiy21fd7db2021-12-15 05:29:35 +03001633 ts_DIAMETER(flags := '11000000'B,
Vadim Yanitskiy2dba4942021-12-11 15:46:30 +03001634 cmd_code := Authentication_Information,
Vadim Yanitskiy463d8262021-12-11 16:50:46 +03001635 app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
Vadim Yanitskiy2dba4942021-12-11 15:46:30 +03001636 hbh_id := hbh_id,
1637 ete_id := ete_id,
1638 avps := {
1639 ts_AVP_SessionId(sess_id),
1640 ts_AVP_DestinationRealm(dest_realm),
Vadim Yanitskiyb57ef872021-12-12 04:14:18 +03001641 ts_AVP_OriginHost(orig_host),
1642 ts_AVP_OriginRealm(orig_realm),
Vadim Yanitskiy2dba4942021-12-11 15:46:30 +03001643 ts_AVP_UserNameImsi(imsi),
1644 /* Requested EUTRAN Auth Info */
1645 ts_AVP_RequestedEutranAuthInfo,
Vadim Yanitskiyb57ef872021-12-12 04:14:18 +03001646 ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
Vadim Yanitskiy59ef8e52023-02-07 23:38:29 +07001647 ts_AVP_3GPP_VisitedPlmnId(mcc_mnc)
Harald Welte6effabb2020-02-18 21:39:59 +01001648 });
Harald Welted27ab242019-07-26 13:45:18 +02001649template (present) PDU_DIAMETER
Vadim Yanitskiy2dba4942021-12-11 15:46:30 +03001650tr_DIA_AIR(/* template (present) */ hexstring imsi,
1651 template (present) octetstring sess_id := ?,
1652 template (present) charstring dest_realm := ?,
1653 template (present) UINT32 hbh_id := ?,
1654 template (present) UINT32 ete_id := ?) :=
Vadim Yanitskiy21fd7db2021-12-15 05:29:35 +03001655 tr_DIAMETER(flags := '1???????'B,
Vadim Yanitskiy2dba4942021-12-11 15:46:30 +03001656 cmd_code := Authentication_Information,
1657 app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
1658 hbh_id := hbh_id, ete_id := ete_id,
1659 avps := superset(
1660 tr_AVP_SessionId(sess_id),
1661 tr_AVP_DestinationRealm(dest_realm),
1662 tr_AVP_UserNameImsi(imsi),
1663 tr_AVP_3GPP_VisitedPlmnId
Harald Welted27ab242019-07-26 13:45:18 +02001664 ));
1665
Harald Welte40b1e002023-01-27 17:26:39 +01001666/* TS 29.272 5.2.3.1 + 7.2.6 Authentication Information Answer */
Harald Welted27ab242019-07-26 13:45:18 +02001667template (value) PDU_DIAMETER
Vadim Yanitskiy2dba4942021-12-11 15:46:30 +03001668ts_DIA_AIA(template (value) AVP_list auth_info_contents,
1669 template (value) octetstring sess_id := c_def_sess_id,
1670 template (value) charstring orig_host := "hss.localdomain",
1671 template (value) charstring orig_realm := "localdomain",
1672 template (value) UINT32 hbh_id := '00000000'O,
1673 template (value) UINT32 ete_id := '00000000'O) :=
1674 ts_DIAMETER(flags := '01000000'B,
1675 cmd_code := Authentication_Information,
1676 app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
1677 hbh_id := hbh_id,
1678 ete_id := ete_id,
1679 avps := {
1680 ts_AVP_SessionId(sess_id),
1681 ts_AVP_ResultCode(DIAMETER_SUCCESS),
1682 ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
1683 ts_AVP_OriginHost(orig_host),
1684 ts_AVP_OriginRealm(orig_realm),
1685 ts_AVP_3GPP_AuthInfo(auth_info_contents)
Harald Welted27ab242019-07-26 13:45:18 +02001686 });
Vadim Yanitskiy446edae2021-12-12 04:33:08 +03001687template (present) PDU_DIAMETER
1688tr_DIA_AIA(template (present) AVP_list auth_info_contents := ?,
1689 template (present) octetstring sess_id := ?,
1690 template (present) charstring orig_host := ?,
1691 template (present) charstring orig_realm := ?,
1692 template (present) UINT32 hbh_id := ?,
1693 template (present) UINT32 ete_id := ?) :=
1694 tr_DIAMETER(flags := '0???????'B,
1695 cmd_code := Authentication_Information,
1696 app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
1697 hbh_id := hbh_id,
1698 ete_id := ete_id,
1699 avps := superset(
1700 tr_AVP_SessionId(sess_id),
Vadim Yanitskiy446edae2021-12-12 04:33:08 +03001701 tr_AVP_AuthSessionState(NO_STATE_MAINTAINED),
Vadim Yanitskiy446edae2021-12-12 04:33:08 +03001702 tr_AVP_OriginHost(orig_host),
Pau Espin Pedrol7bedcf82023-08-24 19:33:49 +02001703 tr_AVP_OriginRealm(orig_realm),
1704 tr_AVP_ResultCode(DIAMETER_SUCCESS),
1705 tr_AVP_3GPP_AuthInfo(auth_info_contents)
Vadim Yanitskiy446edae2021-12-12 04:33:08 +03001706 ));
Pau Espin Pedrol7aa4ad82023-08-28 18:24:24 +02001707template (present) PDU_DIAMETER
1708tr_DIA_AIA_ERR(template (present) GenericAVP err_avp := ?,
1709 template (present) octetstring sess_id := ?,
1710 template (present) charstring orig_host := ?,
1711 template (present) charstring orig_realm := ?,
1712 template (present) UINT32 hbh_id := ?,
1713 template (present) UINT32 ete_id := ?) :=
1714 tr_DIAMETER(flags := '0???????'B,
1715 cmd_code := Authentication_Information,
1716 app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
1717 hbh_id := hbh_id,
1718 ete_id := ete_id,
1719 avps := superset(
1720 tr_AVP_SessionId(sess_id),
1721 tr_AVP_AuthSessionState(NO_STATE_MAINTAINED),
1722 tr_AVP_OriginHost(orig_host),
1723 tr_AVP_OriginRealm(orig_realm),
1724 err_avp
1725 ));
Harald Welted27ab242019-07-26 13:45:18 +02001726
1727
Harald Welte40b1e002023-01-27 17:26:39 +01001728/* TS 29.272 7.2.3 Update Location Request */
Vadim Yanitskiy5e1bdc02021-12-12 02:33:59 +03001729template (value) PDU_DIAMETER
1730ts_DIA_ULR(/* template (value) */ hexstring imsi,
Vadim Yanitskiy59ef8e52023-02-07 23:38:29 +07001731 template (value) octetstring mcc_mnc := '111F11'O,
Vadim Yanitskiy5e1bdc02021-12-12 02:33:59 +03001732 template (value) octetstring sess_id := c_def_sess_id,
1733 template (value) charstring orig_host := "ttcn3.localdomain",
1734 template (value) charstring orig_realm := "localdomain",
1735 template (value) charstring dest_realm := "localdomain",
1736 template (value) UINT32 hbh_id := '00000000'O,
1737 template (value) UINT32 ete_id := '00000000'O) :=
1738 ts_DIAMETER(flags := '11000000'B,
1739 cmd_code := Update_Location,
1740 app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
1741 hbh_id := hbh_id,
1742 ete_id := ete_id,
1743 avps := {
1744 ts_AVP_SessionId(sess_id),
1745 ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
1746 ts_AVP_UserNameImsi(imsi),
1747 ts_AVP_3GPP_UlrFlags('00000000'O),
Vadim Yanitskiy59ef8e52023-02-07 23:38:29 +07001748 ts_AVP_3GPP_VisitedPlmnId(mcc_mnc),
Pau Espin Pedrola2af5782022-05-18 16:34:29 +02001749 ts_AVP_PCC_3GPP_RatType(EUTRAN),
Vadim Yanitskiy5e1bdc02021-12-12 02:33:59 +03001750 ts_AVP_OriginHost(orig_host),
1751 ts_AVP_OriginRealm(orig_realm),
1752 ts_AVP_DestinationRealm(dest_realm)
1753 });
Harald Welted27ab242019-07-26 13:45:18 +02001754template (present) PDU_DIAMETER
Vadim Yanitskiy0e8f5162021-12-15 05:00:32 +03001755tr_DIA_ULR(/* template (present) */ hexstring imsi,
1756 template (present) octetstring sess_id := ?,
1757 template (present) charstring orig_host := ?,
1758 template (present) charstring orig_realm := ?,
1759 template (present) charstring dest_realm := ?,
1760 template (present) UINT32 hbh_id := ?,
1761 template (present) UINT32 ete_id := ?) :=
1762 tr_DIAMETER(flags := '11000000'B,
1763 cmd_code := Update_Location,
1764 app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
1765 hbh_id := hbh_id,
1766 ete_id := ete_id,
1767 avps := superset(
1768 tr_AVP_SessionId(sess_id),
1769 tr_AVP_AuthSessionState,
1770 tr_AVP_OriginHost(orig_host),
1771 tr_AVP_OriginRealm(orig_realm),
1772 tr_AVP_DestinationRealm(dest_realm),
1773 tr_AVP_UserNameImsi(imsi),
Pau Espin Pedrola2af5782022-05-18 16:34:29 +02001774 tr_AVP_PCC_3GPP_RatType,
Vadim Yanitskiy0e8f5162021-12-15 05:00:32 +03001775 tr_AVP_3GPP_UlrFlags,
1776 tr_AVP_3GPP_VisitedPlmnId
Harald Welted27ab242019-07-26 13:45:18 +02001777 ));
1778
1779template (value) PDU_DIAMETER
Vadim Yanitskiy0e8f5162021-12-15 05:00:32 +03001780ts_DIA_ULA(template (value) AVP_list sub_data,
1781 template (value) octetstring sess_id := c_def_sess_id,
1782 template (value) charstring orig_host := "hss.localdomain",
1783 template (value) charstring orig_realm := "localdomain",
1784 template (value) UINT32 hbh_id := '00000000'O,
1785 template (value) UINT32 ete_id := '00000000'O) :=
1786 ts_DIAMETER(flags:='01000000'B,
1787 cmd_code := Update_Location,
1788 app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
1789 hbh_id := hbh_id,
1790 ete_id := ete_id,
1791 avps := {
1792 ts_AVP_SessionId(sess_id),
1793 ts_AVP_ResultCode(DIAMETER_SUCCESS), /* optional */
1794 ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
1795 ts_AVP_OriginHost(orig_host),
1796 ts_AVP_OriginRealm(orig_realm),
1797 ts_AVP_3GPP_UlaFlags('00000002'O),
1798 ts_AVP_3GPP_SubscriptionData(sub_data)
Harald Welted27ab242019-07-26 13:45:18 +02001799 });
Vadim Yanitskiy5e1bdc02021-12-12 02:33:59 +03001800template (present) PDU_DIAMETER
1801tr_DIA_ULA(template (present) AVP_list sub_data := ?,
1802 template (present) octetstring sess_id := ?,
1803 template (present) charstring orig_host := ?,
1804 template (present) charstring orig_realm := ?,
1805 template (present) UINT32 hbh_id := ?,
1806 template (present) UINT32 ete_id := ?) :=
1807 tr_DIAMETER(flags := '0???????'B,
1808 cmd_code := Update_Location,
1809 app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
1810 hbh_id := hbh_id,
1811 ete_id := ete_id,
1812 avps := superset(
1813 tr_AVP_SessionId(sess_id),
1814 tr_AVP_ResultCode(DIAMETER_SUCCESS),
1815 tr_AVP_AuthSessionState,
1816 tr_AVP_OriginHost(orig_host),
1817 tr_AVP_OriginRealm(orig_realm),
1818 tr_AVP_3GPP_UlaFlags,
1819 tr_AVP_3GPP_SubscriptionData(sub_data)
1820 ));
Harald Welted27ab242019-07-26 13:45:18 +02001821
1822
1823
Harald Weltef4001512020-04-26 21:48:34 +02001824/* RFC 4006 3.1. Credit-Control-Request (CCR) Command */
1825template (present) PDU_DIAMETER
Pau Espin Pedrol77fdd0b2022-03-08 14:03:33 +01001826tr_DIA_Gx_CCR(template (present) DCC_NONE_CC_Request_Type req_type := INITIAL_REQUEST)
Harald Weltef4001512020-04-26 21:48:34 +02001827:= tr_DIAMETER(flags:='11000000'B, cmd_code:=Credit_Control,
Harald Weltef4001512020-04-26 21:48:34 +02001828 avps := superset(
1829 tr_AVP_SessionId,
1830 tr_AVP_OriginHost,
1831 tr_AVP_OriginRealm,
1832 tr_AVP_DestinationRealm,
1833 tr_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_Gx_AID, 4)),
1834 tr_AVP_CcReqType(req_type),
1835 tr_AVP_CcReqNum(?)
1836 ));
Pau Espin Pedrol77fdd0b2022-03-08 14:03:33 +01001837template (present) PDU_DIAMETER
1838tr_DIA_Gy_CCR(template (present) DCC_NONE_CC_Request_Type req_type := INITIAL_REQUEST)
1839:= tr_DIAMETER(flags:='11000000'B, cmd_code:=Credit_Control,
Pau Espin Pedrol77fdd0b2022-03-08 14:03:33 +01001840 avps := superset(
1841 tr_AVP_SessionId,
1842 tr_AVP_OriginHost,
1843 tr_AVP_OriginRealm,
1844 tr_AVP_DestinationRealm,
1845 tr_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)),
1846 tr_AVP_CcReqType(req_type),
1847 tr_AVP_CcReqNum(?)
1848 ));
1849
Harald Weltef4001512020-04-26 21:48:34 +02001850
1851
1852/* RFC 4006 3.2. Credit-Control-Answer (CCA) Command */
1853template (value) PDU_DIAMETER
Pau Espin Pedrol77fdd0b2022-03-08 14:03:33 +01001854ts_DIA_Gx_CCA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id,
Harald Weltef4001512020-04-26 21:48:34 +02001855 template (value) octetstring sess_id,
1856 template (value) DCC_NONE_CC_Request_Type req_type,
1857 template (value) AVP_Unsigned32 req_num)
Harald Weltef4001512020-04-26 21:48:34 +02001858:= ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control,
1859 app_id:=int2oct(c_DIAMETER_3GPP_Gx_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id,
1860 avps := {
1861 ts_AVP_SessionId(sess_id),
1862 ts_AVP_ResultCode(DIAMETER_SUCCESS),
1863 ts_AVP_OriginHost("pcrf.localdomain"),
1864 ts_AVP_OriginRealm("localdomain"),
1865 ts_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_Gx_AID, 4)),
1866 ts_AVP_CcReqType(req_type),
Pau Espin Pedrolee961c72022-06-03 12:06:07 +02001867 ts_AVP_CcReqNum(req_num),
1868 ts_AVP_PCC_3GPP_QoS_Information({
1869 ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL(33554432),
1870 ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL(52428800)
1871 }),
1872 ts_AVP_PCC_3GPP_Default_EPS_Bearer_QoS({
1873 ts_AVP_PCC_3GPP_QoS_Class_Identifier(9),
1874 ts_AVP_PCC_3GPP_AllocRetenPrio(2)
1875 })
Harald Weltef4001512020-04-26 21:48:34 +02001876 // supported features
1877 // origin
1878 });
Pau Espin Pedrol77fdd0b2022-03-08 14:03:33 +01001879template (value) PDU_DIAMETER
1880ts_DIA_Gy_CCA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id,
1881 template (value) octetstring sess_id,
1882 template (value) DCC_NONE_CC_Request_Type req_type,
1883 template (value) AVP_Unsigned32 req_num)
1884:= ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control,
1885 app_id:=int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id,
1886 avps := {
1887 ts_AVP_SessionId(sess_id),
1888 ts_AVP_ResultCode(DIAMETER_SUCCESS),
1889 ts_AVP_OriginHost("ocs.localdomain"),
1890 ts_AVP_OriginRealm("localdomain"),
1891 ts_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)),
1892 ts_AVP_CcReqType(req_type),
1893 ts_AVP_CcReqNum(req_num)//,
1894 // qos
1895 // default eps bearer qos
1896 // supported features
1897 // origin
1898 });
1899/* Same as ts_DIA_Gy_CCA, but with extra AVP to grant access for limited amount of seconds */
1900template (value) PDU_DIAMETER
1901ts_DIA_Gy_CCA_ValidityTime(template (value) UINT32 hbh_id, template (value) UINT32 ete_id,
1902 template (value) octetstring sess_id,
1903 template (value) DCC_NONE_CC_Request_Type req_type,
1904 template (value) AVP_Unsigned32 req_num,
1905 uint32_t validity_time)
1906:= ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control,
1907 app_id:=int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id,
1908 avps := {
1909 ts_AVP_SessionId(sess_id),
1910 ts_AVP_ResultCode(DIAMETER_SUCCESS),
1911 ts_AVP_OriginHost("ocs.localdomain"),
1912 ts_AVP_OriginRealm("localdomain"),
1913 ts_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)),
1914 ts_AVP_CcReqType(req_type),
1915 ts_AVP_CcReqNum(req_num),
1916 ts_AVP_Multiple_Services_Credit_Control({
1917 ts_AVP_Validity_Time(validity_time),
1918 ts_AVP_Granted_Service_Unit({
1919 //ts_AVP_CC_Time(validity_time*2),
1920 ts_AVP_CC_Total_Octets(1000)
1921 })
1922 })
1923 //,
1924 // qos
1925 // default eps bearer qos
1926 // supported features
1927 // origin
1928 });
Pau Espin Pedrol52562c92022-05-23 15:45:46 +02001929/* Same as ts_DIA_Gy_CCA_ValidityTime, but with extra AVP to grant access for limited amount of octets */
1930template (value) PDU_DIAMETER
1931ts_DIA_Gy_CCA_ValidityTimeVolumeThreshold(template (value) UINT32 hbh_id, template (value) UINT32 ete_id,
1932 template (value) octetstring sess_id,
1933 template (value) DCC_NONE_CC_Request_Type req_type,
1934 template (value) AVP_Unsigned32 req_num,
1935 uint32_t validity_time, uint32_t volume_threhsold)
1936:= ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control,
1937 app_id:=int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id,
1938 avps := {
1939 ts_AVP_SessionId(sess_id),
1940 ts_AVP_ResultCode(DIAMETER_SUCCESS),
1941 ts_AVP_OriginHost("ocs.localdomain"),
1942 ts_AVP_OriginRealm("localdomain"),
1943 ts_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)),
1944 ts_AVP_CcReqType(req_type),
1945 ts_AVP_CcReqNum(req_num),
1946 ts_AVP_Multiple_Services_Credit_Control({
1947 ts_AVP_Validity_Time(validity_time),
1948 ts_AVP_Granted_Service_Unit({
1949 ts_AVP_CC_Total_Octets(volume_threhsold*100)
1950 }),
1951 ts_AVP_3GPP_VolumeQuotaThreshold(volume_threhsold)
1952 })
1953 //,
1954 // qos
1955 // default eps bearer qos
1956 // supported features
1957 // origin
1958 });
Harald Weltef4001512020-04-26 21:48:34 +02001959
Vadim Yanitskiyf28b2552021-12-11 03:49:14 +03001960/* RFC 6733, section 5.5.1 "Device-Watchdog-Request" */
1961template (value) PDU_DIAMETER
1962ts_DIA_DWR(template (value) OCTET4 state_id := '00000000'O,
1963 template (value) charstring orig_host := "ttcn3.localdomain",
1964 template (value) charstring orig_realm := "localdomain",
1965 template (value) UINT32 hbh_id := '00000000'O,
1966 template (value) UINT32 ete_id := '00000000'O) :=
1967 ts_DIAMETER(flags := '10000000'B,
1968 cmd_code := Device_Watchdog,
1969 app_id := '00000000'O,
1970 hbh_id := hbh_id,
1971 ete_id := ete_id,
1972 avps := {
1973 ts_AVP_OriginHost(orig_host),
1974 ts_AVP_OriginRealm(orig_realm),
1975 ts_AVP_OriginStateId(state_id)
1976 });
1977template (present) PDU_DIAMETER
1978tr_DIA_DWR(template (present) OCTET4 state_id := ?,
1979 template (present) charstring orig_host := ?,
1980 template (present) charstring orig_realm := ?,
1981 template (present) UINT32 hbh_id := ?,
1982 template (present) UINT32 ete_id := ?) :=
1983 tr_DIAMETER(flags := '1???????'B,
1984 cmd_code := Device_Watchdog,
1985 app_id := '00000000'O,
1986 hbh_id := hbh_id,
1987 ete_id := ete_id,
1988 avps := superset(
1989 tr_AVP_OriginHost(orig_host),
Pau Espin Pedrol8dcb0612023-08-28 19:16:29 +02001990 tr_AVP_OriginRealm(orig_realm)
1991 /* tr_AVP_OriginStateId(state_id) is optional */
Vadim Yanitskiyf28b2552021-12-11 03:49:14 +03001992 ));
1993
1994/* RFC 6733, section 5.5.2 "Device-Watchdog-Answer" */
1995template (value) PDU_DIAMETER
1996ts_DIA_DWA(template (value) OCTET4 state_id := '00000000'O,
1997 template (value) charstring orig_host := "ttcn3.localdomain",
1998 template (value) charstring orig_realm := "localdomain",
1999 template (value) UINT32 hbh_id := '00000000'O,
2000 template (value) UINT32 ete_id := '00000000'O) :=
2001 ts_DIAMETER(flags := '00000000'B,
2002 cmd_code := Device_Watchdog,
2003 app_id := '00000000'O,
2004 hbh_id := hbh_id,
2005 ete_id := ete_id,
2006 avps := {
2007 ts_AVP_ResultCode(DIAMETER_SUCCESS),
2008 ts_AVP_OriginHost(orig_host),
2009 ts_AVP_OriginRealm(orig_realm),
2010 ts_AVP_OriginStateId(state_id)
2011 });
2012template (present) PDU_DIAMETER
2013tr_DIA_DWA(template (present) OCTET4 state_id := ?,
2014 template (present) charstring orig_host := ?,
2015 template (present) charstring orig_realm := ?,
2016 template (present) UINT32 hbh_id := ?,
2017 template (present) UINT32 ete_id := ?) :=
2018 tr_DIAMETER(flags := '0???????'B,
2019 cmd_code := Device_Watchdog,
2020 app_id := '00000000'O,
2021 hbh_id := hbh_id,
2022 ete_id := ete_id,
2023 avps := superset(
2024 tr_AVP_ResultCode(DIAMETER_SUCCESS),
2025 tr_AVP_OriginHost(orig_host),
Pau Espin Pedrol8dcb0612023-08-28 19:16:29 +02002026 tr_AVP_OriginRealm(orig_realm)
2027 /* tr_AVP_OriginStateId(state_id) is optional */
Vadim Yanitskiyf28b2552021-12-11 03:49:14 +03002028 ));
2029
Pau Espin Pedrol8fa22842022-05-20 14:47:55 +02002030function f_DIAMETER_get_avp(PDU_DIAMETER pdu, template (present) AVP_Code avp_code)
2031return template (omit) AVP
2032{
2033 var integer i;
2034
2035 for (i := 0; i < lengthof(pdu.avps); i := i+1) {
2036 if (not ispresent(pdu.avps[i].avp)) {
2037 continue;
2038 }
2039 var AVP_Header hdr := pdu.avps[i].avp.avp_header;
2040 if (match(hdr.avp_code, avp_code)) {
2041 return pdu.avps[i].avp;
2042 }
2043 }
2044 return omit;
2045}
2046function f_DIAMETER_get_avp_or_fail(PDU_DIAMETER pdu, template (present) AVP_Code avp_code)
2047return AVP
2048{
2049 var template (omit) AVP avp;
2050 avp := f_DIAMETER_get_avp(pdu, avp_code);
2051 if (istemplatekind(avp, "omit")) {
2052 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
2053 log2str("AVP ", avp_code, " not found in ", pdu));
2054 }
2055 return valueof(avp);
2056}
2057
2058function f_AVP_Grouped_get_avp(AVP_Grouped avp_grp, template (present) AVP_Code avp_code)
2059return template (omit) AVP
2060{
2061 var integer i;
2062
2063 for (i := 0; i < lengthof(avp_grp); i := i+1) {
2064 if (not ispresent(avp_grp[i].avp)) {
2065 continue;
2066 }
2067 var AVP_Header hdr := avp_grp[i].avp.avp_header;
2068 if (match(hdr.avp_code, avp_code)) {
2069 return avp_grp[i].avp;
2070 }
2071 }
2072 return omit;
2073}
2074function f_AVP_Grouped_get_avp_or_fail(AVP_Grouped avp_grp, template (present) AVP_Code avp_code)
2075return AVP
2076{
2077 var template (omit) AVP avp;
2078 avp := f_AVP_Grouped_get_avp(avp_grp, avp_code);
2079 if (istemplatekind(avp, "omit")) {
2080 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
2081 log2str("AVP ", avp_code, " not found in ", avp_grp));
2082 }
2083 return valueof(avp);
2084}
2085
2086function f_validate_gy_cc_report(PDU_DIAMETER rx_dia, template (present) DCA_3GPP_Reporting_Reason repreason_exp := ?,
2087 template (present) integer cc_time_exp := ?,
2088 template (present) integer cc_in_oct_exp := ?,
2089 template (present) integer cc_out_oct_exp := ?)
2090{
2091 var AVP multi_services_cc, used_service_unit;
2092 var AVP_Grouped multi_services_cc_data, used_service_unit_data;
Pau Espin Pedrolcba0f6d2022-05-24 13:49:46 +02002093 var template (omit) AVP repreason_tpl;
Pau Espin Pedrol8fa22842022-05-20 14:47:55 +02002094 var AVP repreason, cc_time, cc_in_oct, cc_out_oct;
2095
2096 multi_services_cc := f_DIAMETER_get_avp_or_fail(rx_dia, c_AVP_Code_DCC_NONE_Multiple_Services_Credit_Control);
2097 multi_services_cc_data := valueof(multi_services_cc.avp_data.avp_DCC_NONE_Multiple_Services_Credit_Control);
2098
Pau Espin Pedrolcba0f6d2022-05-24 13:49:46 +02002099 used_service_unit := f_AVP_Grouped_get_avp_or_fail(multi_services_cc_data, c_AVP_Code_DCC_NONE_Used_Service_Unit);
2100 used_service_unit_data := valueof(used_service_unit.avp_data.avp_DCC_NONE_Used_Service_Unit);
2101
2102 /* Reporting-Reason can be either inside Multiple-Services-Credit-Control or inside Used-Service-Unit */
2103 repreason_tpl := f_AVP_Grouped_get_avp(multi_services_cc_data, c_AVP_Code_DCA_3GPP_Reporting_Reason);
2104 if (istemplatekind(repreason_tpl, "omit")) {
2105 repreason := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCA_3GPP_Reporting_Reason);
2106 } else {
2107 repreason := valueof(repreason_tpl);
2108 }
Pau Espin Pedrol8fa22842022-05-20 14:47:55 +02002109 if (not match(repreason.avp_data.avp_DCA_3GPP_Reporting_Reason, repreason_exp)) {
2110 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
2111 log2str("3GPP-Reporting-Reason mismatch ", repreason, " vs exp ", repreason_exp));
2112 }
2113
Pau Espin Pedrol8fa22842022-05-20 14:47:55 +02002114 cc_time := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCC_NONE_CC_Time);
2115 if (not match(oct2int(cc_time.avp_data.avp_DCC_NONE_CC_Time), cc_time_exp)) {
2116 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
2117 log2str("3GPP-CC-Time mismatch ", cc_time, " vs exp ", cc_time_exp));
2118 }
2119
2120 cc_in_oct := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCC_NONE_CC_Input_Octets);
2121 if (not match(oct2int(cc_in_oct.avp_data.avp_DCC_NONE_CC_Input_Octets), cc_in_oct_exp)) {
2122 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
2123 log2str("3GPP-CC-Input-Octets mismatch ", cc_in_oct, " vs exp ", cc_in_oct_exp));
2124 }
2125
2126 cc_out_oct := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCC_NONE_CC_Output_Octets);
2127 if (not match(oct2int(cc_out_oct.avp_data.avp_DCC_NONE_CC_Output_Octets), cc_out_oct_exp)) {
2128 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
2129 log2str("3GPP-CC-Output-Octets mismatch ", cc_out_oct, " vs exp ", cc_out_oct_exp));
2130 }
2131}
2132
Pau Espin Pedrol462f3df2023-10-16 18:10:55 +02002133
2134/*****************************
2135 * Cx, Dx, 3GPP TS 29.229
2136 *****************************/
2137/* SIP-Auth-Data-Item, 3GPP TS 29.229 6.3.8 */
2138template (present) GenericAVP tr_AVP_3GPP_SIPNumAuthDataItems(template (present) uint32_t num := ?) := {
2139 avp := {
2140 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Number_Auth_Items),
2141 avp_data := {
2142 avp_CxDx_3GPP_SIP_Number_Auth_Items := int2oct_tmpl(num, 4) /* CxDx_3GPP_SIP_Number_Auth_Items */
2143 }
2144 }
2145}
2146template (value) GenericAVP ts_AVP_3GPP_SIPNumAuthDataItems(uint32_t num) := {
2147 avp := {
2148 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Number_Auth_Items),
2149 avp_data := {
2150 avp_CxDx_3GPP_SIP_Number_Auth_Items := int2oct(num, 4) /* CxDx_3GPP_SIP_Number_Auth_Items */
2151 }
2152 }
2153}
2154
2155/* SIP-Authentication-Scheme, 3GPP TS 29.229 6.3.9 */
2156template (present) GenericAVP tr_AVP_3GPP_SIPAuthScheme(template (present) CxDx_3GPP_SIP_Authentication_Scheme scheme := ?) := {
2157 avp := {
2158 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authentication_Scheme),
2159 avp_data := {
2160 avp_CxDx_3GPP_SIP_Authentication_Scheme := scheme
2161 }
2162 }
2163}
2164template (value) GenericAVP ts_AVP_3GPP_SIPAuthScheme(template (value) CxDx_3GPP_SIP_Authentication_Scheme scheme) := {
2165 avp := {
2166 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authentication_Scheme),
2167 avp_data := {
2168 avp_CxDx_3GPP_SIP_Authentication_Scheme := scheme
2169 }
2170 }
2171}
2172
2173/* SIP-Authenticate, 3GPP TS 29.229 6.3.10 */
2174template (present) GenericAVP tr_AVP_3GPP_SIPAuthenticate(template (present) CxDx_3GPP_SIP_Authenticate rand_autn_concatenated := ?) := {
2175 avp := {
2176 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authenticate),
2177 avp_data := {
2178 avp_CxDx_3GPP_SIP_Authenticate := rand_autn_concatenated
2179 }
2180 }
2181}
2182template (value) GenericAVP ts_AVP_3GPP_SIPAuthenticate(template (value) CxDx_3GPP_SIP_Authenticate rand_autn_concatenated) := {
2183 avp := {
2184 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authenticate),
2185 avp_data := {
2186 avp_CxDx_3GPP_SIP_Authenticate := rand_autn_concatenated
2187 }
2188 }
2189}
2190
2191/* SIP-Authorization, 3GPP TS 29.229 6.3.11 */
2192template (present) GenericAVP tr_AVP_3GPP_SIPAuthorization(template (present) CxDx_3GPP_SIP_Authorization rand_autn_concatenated := ?) := {
2193 avp := {
2194 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authorization),
2195 avp_data := {
2196 avp_CxDx_3GPP_SIP_Authorization := rand_autn_concatenated
2197 }
2198 }
2199}
2200template (value) GenericAVP ts_AVP_3GPP_SIPAuthorization(template (value) CxDx_3GPP_SIP_Authorization rand_autn_concatenated) := {
2201 avp := {
2202 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authorization),
2203 avp_data := {
2204 avp_CxDx_3GPP_SIP_Authorization := rand_autn_concatenated
2205 }
2206 }
2207}
2208
2209/* SIP-Authentication-Context, 3GPP TS 29.229 6.3.12 */
2210template (present) GenericAVP tr_AVP_3GPP_SIPAuthContext(template (present) CxDx_3GPP_SIP_Authentication_Context val := ?) := {
2211 avp := {
2212 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authentication_Context),
2213 avp_data := {
2214 avp_CxDx_3GPP_SIP_Authentication_Context := val
2215 }
2216 }
2217}
2218template (value) GenericAVP ts_AVP_3GPP_SIPAuthContext(template (value) CxDx_3GPP_SIP_Authentication_Context val) := {
2219 avp := {
2220 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authentication_Context),
2221 avp_data := {
2222 avp_CxDx_3GPP_SIP_Authentication_Context := val
2223 }
2224 }
2225}
2226
2227/* SIP-Item-Number, 3GPP TS 29.229 6.3.14 */
2228template (present) GenericAVP tr_AVP_3GPP_SIPItemNumber(template (present) uint32_t num := ?) := {
2229 avp := {
2230 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Item_Number),
2231 avp_data := {
2232 avp_CxDx_3GPP_SIP_Item_Number := int2oct_tmpl(num, 4) /* CxDx_3GPP_SIP_Item_Number */
2233 }
2234 }
2235}
2236template (value) GenericAVP ts_AVP_3GPP_SIPItemNumber(uint32_t num) := {
2237 avp := {
2238 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Item_Number),
2239 avp_data := {
2240 avp_CxDx_3GPP_SIP_Item_Number := int2oct(num, 4) /* CxDx_3GPP_SIP_Item_Number */
2241 }
2242 }
2243}
2244
2245/* Confidentiality-Key, 3GPP TS 29.229 6.3.27 */
2246template (present) GenericAVP tr_AVP_3GPP_ConfidentialityKey(template (present) CxDx_3GPP_Confidentiality_Key ckey := ?) := {
2247 avp := {
2248 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Confidentiality_Key),
2249 avp_data := {
2250 avp_CxDx_3GPP_Confidentiality_Key := ckey
2251 }
2252 }
2253}
2254template (value) GenericAVP ts_AVP_3GPP_ConfidentialityKey(template (value) CxDx_3GPP_Confidentiality_Key ckey) := {
2255 avp := {
2256 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Confidentiality_Key),
2257 avp_data := {
2258 avp_CxDx_3GPP_Confidentiality_Key := ckey
2259 }
2260 }
2261}
2262
2263/* Inegrity-Key, 3GPP TS 29.229 6.3.28 */
2264template (present) GenericAVP tr_AVP_3GPP_IntegrityKey(template (present) CxDx_3GPP_Integrity_Key ckey := ?) := {
2265 avp := {
2266 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Integrity_Key),
2267 avp_data := {
2268 avp_CxDx_3GPP_Integrity_Key := ckey
2269 }
2270 }
2271}
2272template (value) GenericAVP ts_AVP_3GPP_IntegrityKey(template (value) CxDx_3GPP_Integrity_Key ckey) := {
2273 avp := {
2274 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Integrity_Key),
2275 avp_data := {
2276 avp_CxDx_3GPP_Integrity_Key := ckey
2277 }
2278 }
2279}
2280
Pau Espin Pedrol965ac642023-10-16 18:12:45 +02002281/* Server-Assignment-Type, 3GPP TS 29.273 8.2.3.12, 3GPP TS 29.229 6.3.15 */
2282template (present) GenericAVP tr_AVP_3GPP_ServerAssignmentType(template (present) CxDx_3GPP_Server_Assignment_Type t := ?) := {
2283 avp := {
2284 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Server_Assignment_Type),
2285 avp_data := {
2286 avp_CxDx_3GPP_Server_Assignment_Type := t
2287 }
2288 }
2289}
2290template (value) GenericAVP ts_AVP_3GPP_ServerAssignmentType(template (value) CxDx_3GPP_Server_Assignment_Type t) := {
2291 avp := {
2292 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Server_Assignment_Type),
2293 avp_data := {
2294 avp_CxDx_3GPP_Server_Assignment_Type := t
2295 }
2296 }
2297}
2298
Pau Espin Pedrol44b75202023-10-23 14:37:24 +02002299/*******************************
2300 * SWx 3GPP TS 29.273 section 8
2301 *******************************/
Pau Espin Pedrol965ac642023-10-16 18:12:45 +02002302
2303/* SIP-Auth-Data-Item , 3GPP TS 29.273 8.2.3.9 */
2304template (present) GenericAVP tr_AVP_3GPP_SIPAuthDataItem(template (present) uint32_t num := ?) := {
2305 avp := {
2306 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Auth_Data_Item),
2307 avp_data := {
2308 avp_CxDx_3GPP_SIP_Auth_Data_Item := superset(
2309 //tr_AVP_3GPP_SIPItemNumber(num), /* Optional */
2310 tr_AVP_3GPP_SIPAuthScheme(?)//, /* Optional */
2311 //tr_AVP_3GPP_SIPAuthenticate(?), /* Optional */
2312 //tr_AVP_3GPP_SIPAuthorization(?), /* Optional */
2313 //tr_AVP_3GPP_SIPAuthContext(?), /* Optional */
2314 //tr_AVP_3GPP_ConfidentialityKey(?), /* Optional */
2315 //tr_AVP_3GPP_IntegrityKey(?) /* Optional */
2316 /* TODO:
2317 [ SIP-Digest-Authenticate ]
2318 [ Framed-IP-Address ]
2319 [ Framed-IPv6-Prefix ]
2320 [ Framed-Interface-Id ]
2321 [ Line-Identifier ]
2322 *[AVP]
2323 */
2324 )
2325 }
2326 }
2327}
2328template (value) GenericAVP ts_AVP_3GPP_SIPAuthDataItem(uint32_t num, OCT16 rand, OCT16 ik, OCT16 ck, OCT16 autn, OCT14 auts) := {
2329 avp := {
2330 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Auth_Data_Item),
2331 avp_data := {
2332 avp_CxDx_3GPP_SIP_Auth_Data_Item := {
2333 ts_AVP_3GPP_SIPItemNumber(num),
2334 ts_AVP_3GPP_SIPAuthScheme(char2oct("Digest-AKAv1-MD5")),
2335 ts_AVP_3GPP_SIPAuthenticate(rand & autn),
2336 ts_AVP_3GPP_SIPAuthorization(rand & auts),
2337 ts_AVP_3GPP_SIPAuthContext(char2oct("foobar")),
2338 ts_AVP_3GPP_ConfidentialityKey(ck),
2339 ts_AVP_3GPP_IntegrityKey(ik)
2340 /* TODO:
2341 [ SIP-Digest-Authenticate ]
2342 [ Framed-IP-Address ]
2343 [ Framed-IPv6-Prefix ]
2344 [ Framed-Interface-Id ]
2345 [ Line-Identifier ]
2346 *[AVP]
2347 */
2348 }
2349 }
2350 }
2351}
2352
2353/* Multimedia-Auth-Request, 3GPP TS 29.273 8.2.2.1 Authentication Procedure */
2354template (present) PDU_DIAMETER
2355tr_DIA_SWx_MAR(template (present) hexstring imsi := ?,
2356 template (present) octetstring sess_id := ?,
2357 template (present) charstring orig_host := ?,
2358 template (present) charstring orig_realm := ?,
2359 template (present) charstring dest_realm := ?,
2360 template (present) UINT32 hbh_id := ?,
2361 template (present) UINT32 ete_id := ?) :=
2362 tr_DIAMETER(flags := '1???????'B,
2363 cmd_code := Multimedia_Auth,
2364 app_id := int2oct(c_DIAMETER_3GPP_SWx_AID, 4),
2365 hbh_id := hbh_id, ete_id := ete_id,
2366 avps := superset(
2367 tr_AVP_SessionId(sess_id),
2368 tr_AVP_VendorSpecAppId(?, ?),
2369 tr_AVP_AuthSessionState(NO_STATE_MAINTAINED),
2370 tr_AVP_OriginHost(orig_host),
2371 tr_AVP_OriginRealm(orig_realm),
2372 tr_AVP_DestinationRealm(dest_realm),
2373 tr_AVP_UserNameImsi(imsi),
2374 tr_AVP_3GPP_SIPAuthDataItem(?),
2375 tr_AVP_3GPP_SIPNumAuthDataItems(?)
2376 ));
2377
2378/* Multimedia-Auth-Answer, 3GPP TS 29.273 8.2.2.1 Authentication Procedure */
2379template (value) PDU_DIAMETER
2380ts_DIA_SWx_MAA(template (value) hexstring imsi,
2381 template (value) GenericAVP sip_auth_data_item,
2382 template (value) uint32_t vendor_app_id := c_DIAMETER_3GPP_SWx_AID,
2383 template (value) octetstring sess_id := c_def_sess_id,
2384 template (value) charstring orig_host := "hss.localdomain",
2385 template (value) charstring orig_realm := "localdomain",
2386 template (value) UINT32 hbh_id := '00000000'O,
2387 template (value) UINT32 ete_id := '00000000'O) :=
2388 ts_DIAMETER(flags := '01000000'B,
2389 cmd_code := Multimedia_Auth,
2390 app_id := int2oct(c_DIAMETER_3GPP_SWx_AID, 4),
2391 hbh_id := hbh_id,
2392 ete_id := ete_id,
2393 avps := {
2394 ts_AVP_SessionId(sess_id),
2395 ts_AVP_VendorSpecAppId(vendor_id_3GPP, valueof(vendor_app_id)),
2396 ts_AVP_ResultCode(DIAMETER_SUCCESS),
2397 ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
2398 ts_AVP_OriginHost(orig_host),
2399 ts_AVP_OriginRealm(orig_realm),
2400 ts_AVP_UserNameImsi(valueof(imsi)),
2401 sip_auth_data_item,
2402 ts_AVP_3GPP_SIPNumAuthDataItems(1)
2403 });
2404
2405/* Server-Assignment-Request,
2406 * 3GPP TS 29.273 8.1.2.2.2 UE/PDN Registration/DeRegistration Notification
2407 * 3GPP TS 29.273 8.2.2.3 Non-3GPP IP Access Registration Procedure */
2408template (present) PDU_DIAMETER
2409tr_DIA_SWx_SAR(template (present) hexstring imsi := ?,
2410 template (present) octetstring sess_id := ?,
2411 template (present) charstring orig_host := ?,
2412 template (present) charstring orig_realm := ?,
2413 template (present) charstring dest_realm := ?,
2414 template (present) UINT32 hbh_id := ?,
2415 template (present) UINT32 ete_id := ?,
2416 template (present) CxDx_3GPP_Server_Assignment_Type server_ass_type := ?,
2417 template (present) charstring service_selection := ?) :=
2418 tr_DIAMETER(flags := '1???????'B,
2419 cmd_code := Server_Assignment,
2420 app_id := int2oct(c_DIAMETER_3GPP_SWx_AID, 4),
2421 hbh_id := hbh_id, ete_id := ete_id,
2422 avps := superset(
2423 tr_AVP_SessionId(sess_id),
2424 tr_AVP_VendorSpecAppId(?, ?),
2425 tr_AVP_AuthSessionState(NO_STATE_MAINTAINED),
2426 tr_AVP_OriginHost(orig_host),
2427 tr_AVP_OriginRealm(orig_realm),
2428 tr_AVP_DestinationRealm(dest_realm),
2429 tr_AVP_UserNameImsi(imsi),
2430 tr_AVP_3GPP_ServerAssignmentType(server_ass_type),
2431 tr_AVP_ServiceSelection(service_selection)
2432 ));
2433
2434/* Server-Assignment-Answer,
2435 * 3GPP TS 29.273 8.1.2.2.2 UE/PDN Registration/DeRegistration Notification
2436 * 3GPP TS 29.273 8.2.2.3 Non-3GPP IP Access Registration Procedure */
2437template (value) PDU_DIAMETER
2438ts_DIA_SWx_SAA(template (value) hexstring imsi,
2439 template (value) uint32_t vendor_app_id := c_DIAMETER_3GPP_SWx_AID,
2440 template (value) octetstring sess_id := c_def_sess_id,
2441 template (value) charstring orig_host := "hss.localdomain",
2442 template (value) charstring orig_realm := "localdomain",
2443 template (value) UINT32 hbh_id := '00000000'O,
2444 template (value) UINT32 ete_id := '00000000'O) :=
2445 ts_DIAMETER(flags := '01000000'B,
2446 cmd_code := Server_Assignment,
2447 app_id := int2oct(c_DIAMETER_3GPP_SWx_AID, 4),
2448 hbh_id := hbh_id,
2449 ete_id := ete_id,
2450 avps := {
2451 ts_AVP_SessionId(sess_id),
2452 ts_AVP_VendorSpecAppId(vendor_id_3GPP, valueof(vendor_app_id)),
2453 ts_AVP_ResultCode(DIAMETER_SUCCESS),
2454 ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
2455 ts_AVP_OriginHost(orig_host),
2456 ts_AVP_OriginRealm(orig_realm),
2457 ts_AVP_UserNameImsi(valueof(imsi))
2458 /* TODO:
2459 * [ Non-3GPP-User-Data ]
2460 * [ 3GPP-AAA-Server-Name ]
2461 * [ OC-Supported-Features ]
2462 * [ OC-OLR ] ]
2463 * *[ Load ]
2464 * *[ Supported-Features ]
2465 */
2466 });
2467
Pau Espin Pedrol44b75202023-10-23 14:37:24 +02002468/*******************************
2469 * S6b 3GPP TS 29.273 section 9
2470 *******************************/
2471
2472 /* TS 29.273 9.2.2.5.1 AA-Request (AAR) */
2473template (value) PDU_DIAMETER
2474ts_DIA_S6b_AAR(template (value) hexstring imsi,
2475 template (value) octetstring sess_id := c_def_sess_id,
2476 template (value) charstring orig_host := "pgw.localdomain",
2477 template (value) charstring orig_realm := "localdomain",
2478 template (value) charstring dest_realm := "localdomain",
2479 template (value) UINT32 hbh_id := '00000000'O,
2480 template (value) UINT32 ete_id := '00000000'O) :=
2481 ts_DIAMETER(flags := '11000000'B,
2482 cmd_code := Authorize_Authenticate,
2483 app_id := int2oct(c_DIAMETER_3GPP_S6b_AID, 4),
2484 hbh_id := hbh_id,
2485 ete_id := ete_id,
2486 avps := {
2487 ts_AVP_SessionId(sess_id),
2488 /* Optional: DRMP, */
2489 ts_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_S6b_AID, 4)),
2490 ts_AVP_OriginHost(orig_host),
2491 ts_AVP_OriginRealm(orig_realm),
2492 ts_AVP_DestinationRealm(dest_realm),
2493 ts_AVP_AuthRequestType(AUTHORIZE_ONLY),
2494 ts_AVP_UserNameImsi(valueof(imsi))
2495 /* TODO: Lots other optional */
2496 });
2497
2498/* TS 29.273 9.2.2.2.2 AA-Answer (AAA) */
2499template (present) PDU_DIAMETER
2500tr_DIA_S6b_AAA(template (present) octetstring sess_id := ?,
2501 template (present) charstring orig_host := ?,
2502 template (present) charstring orig_realm := ?,
2503 template (present) charstring dest_realm := ?,
2504 template (present) UINT32 hbh_id := ?,
2505 template (present) UINT32 ete_id := ?,
2506 template (present) CxDx_3GPP_Server_Assignment_Type server_ass_type := ?,
2507 template (present) charstring service_selection := ?) :=
2508 tr_DIAMETER(flags := '0???????'B,
2509 cmd_code := Authorize_Authenticate,
2510 app_id := int2oct(c_DIAMETER_3GPP_S6b_AID, 4),
2511 hbh_id := hbh_id, ete_id := ete_id,
2512 avps := superset(
2513 tr_AVP_SessionId(sess_id),
2514 /* Optional: DRMP, */
2515 tr_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_S6b_AID, 4)),
2516 tr_AVP_AuthRequestType(AUTHORIZE_ONLY),
2517 tr_AVP_ResultCode(DIAMETER_SUCCESS),
2518 tr_AVP_OriginHost(orig_host),
2519 tr_AVP_OriginRealm(orig_realm)
2520 ));
2521
Harald Welted27ab242019-07-26 13:45:18 +02002522}