blob: f909b5fcbae7826a35daab90191ad8a3bd143f8d [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;
Harald Welted27ab242019-07-26 13:45:18 +0200130
Vadim Yanitskiy0e8f5162021-12-15 05:00:32 +0300131const octetstring c_def_sess_id := char2oct("ttcn3.session");
132
Harald Welted27ab242019-07-26 13:45:18 +0200133template (value) PDU_DIAMETER
Pau Espin Pedrol965ac642023-10-16 18:12:45 +0200134ts_DIAMETER(template (value) DIAMETER_Types.BIT8 flags,
Harald Welted27ab242019-07-26 13:45:18 +0200135 template (value) Command_Code cmd_code,
136 template (value) OCTET4 app_id := '00000000'O,
Vadim Yanitskiy00720bd2021-12-12 02:05:08 +0300137 template (value) UINT32 hbh_id := '00000000'O,
138 template (value) UINT32 ete_id := '00000000'O,
Harald Welted27ab242019-07-26 13:45:18 +0200139 template (value) AVP_list avps := {}
140) := {
141 version := 1,
142 message_length := 0, /* overwritten */
143 RPETxxxx := flags,
144 command_code := cmd_code,
145 application_id := app_id,
146 hop_by_hop_id := hbh_id,
147 end_to_end_id := ete_id,
148 avps := avps
149}
150template (present) PDU_DIAMETER
Pau Espin Pedrol965ac642023-10-16 18:12:45 +0200151tr_DIAMETER(template (present) DIAMETER_Types.BIT8 flags := ?,
Harald Welted27ab242019-07-26 13:45:18 +0200152 template (present) Command_Code cmd_code := ?,
153 template (present) OCTET4 app_id := ?,
154 template (present) UINT32 hbh_id := ?,
155 template (present) UINT32 ete_id := ?,
156 template (present) AVP_list avps := ?) := {
157 version := 1,
158 message_length := ?,
159 RPETxxxx := flags,
160 command_code := cmd_code,
161 application_id := app_id,
162 hop_by_hop_id := hbh_id,
163 end_to_end_id := ete_id,
164 avps := avps
165}
166template (present) PDU_DIAMETER
167tr_DIAMETER_A(
168 template (present) Command_Code cmd_code := ?,
169 template (present) OCTET4 app_id := ?,
170 template (present) UINT32 hbh_id := ?,
171 template (present) UINT32 ete_id := ?,
172 template (present) AVP_list avps := ?) :=
173 tr_DIAMETER('0???????'B, cmd_code, app_id, hbh_id, ete_id, avps);
174template (present) PDU_DIAMETER
175tr_DIAMETER_R(
176 template (present) Command_Code cmd_code := ?,
177 template (present) OCTET4 app_id := ?,
178 template (present) UINT32 hbh_id := ?,
179 template (present) UINT32 ete_id := ?,
180 template (present) AVP_list avps := ?) :=
181 tr_DIAMETER('1???????'B, cmd_code, app_id, hbh_id, ete_id, avps);
182
183
184template (value) AVP_Header
185ts_DIA_Hdr(template (value) AVP_Code avp_code,
Pau Espin Pedrol965ac642023-10-16 18:12:45 +0200186 template (value) DIAMETER_Types.BIT8 flags := '01000000'B) := {
Harald Welted27ab242019-07-26 13:45:18 +0200187 avp_code := avp_code,
188 VMPxxxxx := flags,
189 avp_length := 0, /* overwritten */
190 vendor_id := omit
191}
192template (present) AVP_Header
193tr_DIA_Hdr(template (present) AVP_Code avp_code,
Pau Espin Pedrol965ac642023-10-16 18:12:45 +0200194 template (present) DIAMETER_Types.BIT8 flags := '0???????'B) := {
Harald Welted27ab242019-07-26 13:45:18 +0200195 avp_code := avp_code,
196 VMPxxxxx := flags,
197 avp_length := ?, /* overwritten */
198 vendor_id := omit
199}
200
201template (value) AVP_Header
202ts_DIA_Hdr_3GPP(template (value) AVP_Code avp_code,
Pau Espin Pedrol965ac642023-10-16 18:12:45 +0200203 template (value) DIAMETER_Types.BIT8 flags := '11000000'B) := {
Harald Welted27ab242019-07-26 13:45:18 +0200204 avp_code := avp_code,
205 VMPxxxxx := flags,
206 avp_length := 0, /* overwritten */
207 vendor_id := vendor_id_3GPP
208}
209template (present) AVP_Header
210tr_DIA_Hdr_3GPP(template (present) AVP_Code avp_code,
Pau Espin Pedrol965ac642023-10-16 18:12:45 +0200211 template (present) DIAMETER_Types.BIT8 flags := '1???????'B) := {
Harald Welted27ab242019-07-26 13:45:18 +0200212 avp_code := avp_code,
213 VMPxxxxx := flags,
214 avp_length := ?, /* overwritten */
215 vendor_id := vendor_id_3GPP
216}
217
Pau Espin Pedrola2af5782022-05-18 16:34:29 +0200218template (present) AVP_Address tr_AVP_Address(template (present) AddressType addr_type := ?,
219 template (present) octetstring addr_data := ?) := {
220 address_type := addr_type,
221 address_data := addr_data
222}
223
224template (present) GenericAVP tr_AVP_SubcrId(template (present) DCC_NONE_Subscription_Id t) := {
225 avp := {
226 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Subscription_Id),
227 avp_data := {
228 avp_DCC_NONE_Subscription_Id := t
229 }
230 }
231}
232
Pau Espin Pedrolb8cd34a2022-05-18 16:34:12 +0200233template (present) GenericAVP tr_AVP_SubcrIdType(template (present) DCC_NONE_Subscription_Id_Type t) := {
Harald Weltef9fb63e2020-04-26 18:07:19 +0200234 avp := {
235 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Subscription_Id_Type),
236 avp_data := {
237 avp_DCC_NONE_Subscription_Id_Type := t
238 }
239 }
240}
Harald Welted27ab242019-07-26 13:45:18 +0200241
Pau Espin Pedrola2af5782022-05-18 16:34:29 +0200242template (present) GenericAVP tr_AVP_SubcrIdData(template (present) DCC_NONE_Subscription_Id_Data t) := {
243 avp := {
244 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Subscription_Id_Data),
245 avp_data := {
246 avp_DCC_NONE_Subscription_Id_Data := t
247 }
248 }
249}
250
251template (present) GenericAVP tr_AVP_RequestedAction(template (present) DCC_NONE_Requested_Action t := ?) := {
252 avp := {
253 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Requested_Action),
254 avp_data := {
255 avp_DCC_NONE_Requested_Action := t
256 }
257 }
258}
259
260template (present) GenericAVP tr_AVP_MultipleServicesIndicator(template (present) DCC_NONE_Multiple_Services_Indicator t := ?) := {
261 avp := {
262 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Multiple_Services_Indicator),
263 avp_data := {
264 avp_DCC_NONE_Multiple_Services_Indicator := t
265 }
266 }
267}
268
269template (present) GenericAVP tr_AVP_ServiceContextId(template (present) DCC_NONE_Service_Context_Id id := ?) := {
270 avp := {
271 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Service_Context_Id),
272 avp_data := {
273 avp_DCC_NONE_Service_Context_Id := id
274 }
275 }
276}
277
Harald Welted27ab242019-07-26 13:45:18 +0200278template (value) GenericAVP ts_AVP_OriginHost(template (value) charstring host) := {
279 avp := {
280 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Host),
281 avp_data := {
282 avp_BASE_NONE_Origin_Host := host
283 }
284 }
285}
286template (present) GenericAVP tr_AVP_OriginHost(template (present) charstring host := ?) := {
287 avp := {
288 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Host),
289 avp_data := {
290 avp_BASE_NONE_Origin_Host := host
291 }
292 }
293}
294
295
296template (value) GenericAVP ts_AVP_OriginRealm(template (value) charstring realm) := {
297 avp := {
298 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Realm),
299 avp_data := {
300 avp_BASE_NONE_Origin_Realm := realm
301 }
302 }
303}
304template (present) GenericAVP tr_AVP_OriginRealm(template (present) charstring realm := ?) := {
305 avp := {
306 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Realm),
307 avp_data := {
308 avp_BASE_NONE_Origin_Realm := realm
309 }
310 }
311}
312
313
314template (value) GenericAVP ts_AVP_OriginStateId(template (value) OCTET4 state_id) := {
315 avp := {
316 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_State_Id),
317 avp_data := {
318 avp_BASE_NONE_Origin_State_Id := state_id
319 }
320 }
321}
Vadim Yanitskiyf28b2552021-12-11 03:49:14 +0300322template (present) GenericAVP tr_AVP_OriginStateId(template (present) OCTET4 state_id := ?) := {
323 avp := {
324 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_State_Id),
325 avp_data := {
326 avp_BASE_NONE_Origin_State_Id := state_id
327 }
328 }
329}
Harald Welted27ab242019-07-26 13:45:18 +0200330
Pau Espin Pedrola2af5782022-05-18 16:34:29 +0200331template (present) GenericAVP tr_AVP_TerminationCause(template (present) BASE_NONE_Termination_Cause tc) := {
332 avp := {
333 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Termination_Cause),
334 avp_data := {
335 avp_BASE_NONE_Termination_Cause := tc
336 }
337 }
338}
339
Harald Welted27ab242019-07-26 13:45:18 +0200340template (value) GenericAVP ts_AVP_HostIpAddr(template (value) OCTET4 ipv4_addr) := {
341 avp := {
342 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Host_IP_Address),
343 avp_data := {
344 avp_BASE_NONE_Host_IP_Address := {
345 address_type := IP,
346 address_data := ipv4_addr
347 }
348 }
349 }
350}
351
352template (value) GenericAVP ts_AVP_VendorId(Vendor_Id vendor_id) := {
353 avp := {
354 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id, '00000000'B),
355 avp_data := {
356 avp_BASE_NONE_Vendor_Id := int2oct(enum2int(vendor_id), 4)
357 }
358 }
359}
Pau Espin Pedrol7aa4ad82023-08-28 18:24:24 +0200360private function f_tr_AVP_VendorId(template (present) Vendor_Id vendor_id)
361return template (present) BASE_NONE_Vendor_Id {
362 if (istemplatekind(vendor_id, "?")) {
363 return ?;
364 } else {
365 var template (present) BASE_NONE_Vendor_Id c;
366 c := int2oct(enum2int(valueof(vendor_id)), 4);
367 return c;
368 }
369}
370template (present) GenericAVP tr_AVP_VendorId(template (present) Vendor_Id vendor_id) := {
371 avp := {
372 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id),
373 avp_data := {
374 avp_BASE_NONE_Vendor_Id := f_tr_AVP_VendorId(vendor_id)
375 }
376 }
377}
Harald Welted27ab242019-07-26 13:45:18 +0200378
379template (value) GenericAVP ts_AVP_ProductName(charstring name) := {
380 avp := {
381 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Product_Name, '00000000'B),
382 avp_data := {
383 avp_BASE_NONE_Product_Name := char2oct(name)
384 }
385 }
386}
387
388template (value) GenericAVP ts_AVP_FwRevision(octetstring fw_version) := {
389 avp := {
390 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Firmware_Revision, '00000000'B),
391 avp_data := {
392 avp_BASE_NONE_Firmware_Revision := fw_version
393 }
394 }
395}
396
397template (value) GenericAVP ts_AVP_InbSecId(template (value) OCTET4 inb_sec_id) := {
398 avp := {
399 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Inband_Security_Id),
400 avp_data := {
401 avp_BASE_NONE_Inband_Security_Id := inb_sec_id
402 }
403 }
404}
405
Pau Espin Pedrol462f3df2023-10-16 18:10:55 +0200406private function enum2int_Vendor_Id_tmpl(template Vendor_Id inp) return template integer
407{
408 if (istemplatekind(inp, "omit")) {
409 return omit;
410 } else if (istemplatekind(inp, "*")) {
411 return *;
412 } else if (istemplatekind(inp, "?")) {
413 return ?;
414 } else {
415 return enum2int(valueof(inp));
416 }
417}
418
419template (present) GenericAVP tr_AVP_VendorSpecAppId(template (present) Vendor_Id vendor_id := ?,
420 template (present) uint32_t auth_app_id := ?) := {
421 avp := {
422 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Specific_Application_Id),
423 avp_data := {
424 avp_BASE_NONE_Vendor_Specific_Application_Id := {
425 {
426 avp := {
427 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id),
428 avp_data := {
429 avp_BASE_NONE_Vendor_Id := int2oct_tmpl(enum2int_Vendor_Id_tmpl(vendor_id), 4)
430 }
431 }
432 }, {
433 avp := {
434 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id),
435 avp_data := {
436 avp_BASE_NONE_Auth_Application_Id := int2oct_tmpl(auth_app_id, 4)
437 }
438 }
439 }
440 }
441 }
442 }
443}
Harald Welted27ab242019-07-26 13:45:18 +0200444template (value) GenericAVP ts_AVP_VendorSpecAppId(Vendor_Id vendor_id, uint32_t auth_app_id) := {
445 avp := {
446 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Specific_Application_Id),
447 avp_data := {
448 avp_BASE_NONE_Vendor_Specific_Application_Id := {
449 {
450 avp := {
451 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id),
452 avp_data := {
453 avp_BASE_NONE_Vendor_Id := int2oct(enum2int(vendor_id), 4)
454 }
455 }
456 }, {
457 avp := {
458 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id),
459 avp_data := {
460 avp_BASE_NONE_Auth_Application_Id := int2oct(auth_app_id, 4)
461 }
462 }
463 }
464 }
465 }
466 }
467}
468
469template (value) GenericAVP ts_AVP_AuthAppId(template (value) OCTET4 auth_app_id) := {
470 avp := {
471 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id),
472 avp_data := {
473 avp_BASE_NONE_Auth_Application_Id := auth_app_id
474 }
475 }
476}
Harald Weltef4001512020-04-26 21:48:34 +0200477template (present) GenericAVP tr_AVP_AuthAppId(template (present) OCTET4 auth_app_id := ?) := {
478 avp := {
479 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id),
480 avp_data := {
481 avp_BASE_NONE_Auth_Application_Id := auth_app_id
482 }
483 }
484}
485
486template (value) GenericAVP ts_AVP_CcReqType(template (value) DCC_NONE_CC_Request_Type r) := {
487 avp := {
488 avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Type),
489 avp_data := {
490 avp_DCC_NONE_CC_Request_Type := r
491 }
492 }
493}
494template (present) GenericAVP tr_AVP_CcReqType(template (present) DCC_NONE_CC_Request_Type r := ?) := {
495 avp := {
496 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Type),
497 avp_data := {
498 avp_DCC_NONE_CC_Request_Type := r
499 }
500 }
501}
502
503template (value) GenericAVP ts_AVP_CcReqNum(template (value) AVP_Unsigned32 n) := {
504 avp := {
505 avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Number),
506 avp_data := {
507 avp_DCC_NONE_CC_Request_Number := n
508 }
509 }
510}
511template (present) GenericAVP tr_AVP_CcReqNum(template (present) AVP_Unsigned32 n := ?) := {
512 avp := {
513 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Number),
514 avp_data := {
515 avp_DCC_NONE_CC_Request_Number := n
516 }
517 }
518}
519
Pau Espin Pedrola2af5782022-05-18 16:34:29 +0200520template (present) GenericAVP tr_AVP_EventTimestamp(template (present) AVP_Unsigned32 n := ?) := {
521 avp := {
522 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Event_Timestamp),
523 avp_data := {
524 avp_BASE_NONE_Event_Timestamp := n
525 }
526 }
527}
Harald Weltef4001512020-04-26 21:48:34 +0200528
Pau Espin Pedrol7aa4ad82023-08-28 18:24:24 +0200529template (present) GenericAVP tr_AVP_ExperimentalResultCode(template (present) AVP_Unsigned32 n := ?) := {
530 avp := {
531 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Experimental_Result_Code),
532 avp_data := {
533 avp_BASE_NONE_Experimental_Result_Code := n
534 }
535 }
536}
537
538template (present) GenericAVP tr_AVP_ExperimentalResult(template (present) Vendor_Id vendor_id := ?,
539 template (present) AVP_Unsigned32 err_code := ?
540 ) := {
541 avp := {
542 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Experimental_Result),
543 avp_data := {
544 avp_BASE_NONE_Experimental_Result := {
545 tr_AVP_VendorId(vendor_id),
546 tr_AVP_ExperimentalResultCode(err_code)
547 }
548 }
549 }
550}
Harald Welted27ab242019-07-26 13:45:18 +0200551
552template (value) GenericAVP ts_AVP_SuppVendorIdRaw(uint32_t vendor_id) := {
553 avp := {
554 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Supported_Vendor_Id),
555 avp_data := {
556 avp_BASE_NONE_Supported_Vendor_Id := int2oct(vendor_id, 4)
557 }
558 }
559}
560template (value) GenericAVP ts_AVP_SuppVendorId(Vendor_Id vendor_id) :=
561 ts_AVP_SuppVendorIdRaw(enum2int(vendor_id));
562
563template (value) GenericAVP ts_AVP_ResultCode(DIAMETER_Resultcode res_code) := {
564 avp := {
565 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Result_Code),
566 avp_data := {
567 avp_BASE_NONE_Result_Code := int2oct(enum2int(res_code), 4)
568 }
569 }
570}
Pau Espin Pedrol7aa4ad82023-08-28 18:24:24 +0200571private function f_tr_DIAMETER_Resultcode(template (present) DIAMETER_Resultcode res_code)
572return template (present) BASE_NONE_Result_Code {
573 if (istemplatekind(res_code, "?")) {
574 return ?;
575 } else {
576 var template (present) BASE_NONE_Result_Code c;
577 c := int2oct(enum2int(valueof(res_code)), 4);
578 return c;
579 }
580}
581template (present) GenericAVP tr_AVP_ResultCode(template (present) DIAMETER_Resultcode res_code) := {
Vadim Yanitskiyf28b2552021-12-11 03:49:14 +0300582 avp := {
583 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Result_Code),
584 avp_data := {
Pau Espin Pedrol7aa4ad82023-08-28 18:24:24 +0200585 avp_BASE_NONE_Result_Code := f_tr_DIAMETER_Resultcode(res_code)
Vadim Yanitskiyf28b2552021-12-11 03:49:14 +0300586 }
587 }
588}
Harald Welted27ab242019-07-26 13:45:18 +0200589
590template (value) GenericAVP ts_AVP_AuthSessionState(template (value) BASE_NONE_Auth_Session_State ass := NO_STATE_MAINTAINED) := {
591 avp := {
592 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Session_State),
593 avp_data := {
594 avp_BASE_NONE_Auth_Session_State := ass
595 }
596 }
597}
598template (present) GenericAVP tr_AVP_AuthSessionState(template (present) BASE_NONE_Auth_Session_State ass := ?) := {
599 avp := {
600 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Session_State),
601 avp_data := {
602 avp_BASE_NONE_Auth_Session_State := ass
603 }
604 }
605}
606
607template (value) GenericAVP ts_AVP_SessionId(template (value) octetstring session_id) := {
608 avp := {
609 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Session_Id),
610 avp_data := {
611 avp_BASE_NONE_Session_Id := session_id
612 }
613 }
614}
615template (present) GenericAVP tr_AVP_SessionId(template (present) octetstring session_id := ?) := {
616 avp := {
617 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Session_Id),
618 avp_data := {
619 avp_BASE_NONE_Session_Id := session_id
620 }
621 }
622}
623
Pau Espin Pedrola2af5782022-05-18 16:34:29 +0200624template (present) GenericAVP tr_AVP_DestinationHost(template (present) charstring host := ?) := {
625 avp := {
626 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Destination_Host),
627 avp_data := {
628 avp_BASE_NONE_Destination_Host := host
629 }
630 }
631}
632
Harald Welted27ab242019-07-26 13:45:18 +0200633/* 3.3 Destination Realm */
634template (value) GenericAVP ts_AVP_DestinationRealm(template (value) charstring dest_realm) := {
635 avp := {
636 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Destination_Realm),
637 avp_data := {
638 avp_BASE_NONE_Destination_Realm := dest_realm
639 }
640 }
641}
642template (present) GenericAVP tr_AVP_DestinationRealm(template (present) charstring dest_realm := ?) := {
643 avp := {
644 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Destination_Realm),
645 avp_data := {
646 avp_BASE_NONE_Destination_Realm := dest_realm
647 }
648 }
649}
650
651/* 8.14 User-Name */
652template (value) GenericAVP ts_AVP_UserName(template (value) octetstring uid) := {
653 avp := {
654 avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_User_Name),
655 avp_data := {
656 avp_BASE_NONE_User_Name := uid
657 }
658 }
659}
660template (present) GenericAVP tr_AVP_UserName(template (present) octetstring uid := ?) := {
661 avp := {
662 avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_User_Name),
663 avp_data := {
664 avp_BASE_NONE_User_Name := uid
665 }
666 }
667}
668template (value) GenericAVP ts_AVP_UserNameImsi(hexstring imsi) := ts_AVP_UserName(char2oct(hex2str(imsi)));
Pau Espin Pedrolf4619d82023-10-16 18:08:07 +0200669template (present) GenericAVP tr_AVP_UserNameImsi(template (present) hexstring imsi := ?) := tr_AVP_UserName(char2oct_tmpl(hex2str_tmpl(imsi)));
Harald Welted27ab242019-07-26 13:45:18 +0200670
671
672
Harald Welte40b1e002023-01-27 17:26:39 +0100673/* TS 29.272 7.3.53 RAND */
Harald Welted27ab242019-07-26 13:45:18 +0200674template (value) GenericAVP ts_AVP_RAND(template (value) octetstring rand) := {
675 avp := {
676 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_RAND),
677 avp_data := {
678 avp_AAA_3GPP_RAND := rand
679 }
680 }
681}
682
Harald Welte40b1e002023-01-27 17:26:39 +0100683/* TS 29.272 7.3.54 XRES */
Harald Welted27ab242019-07-26 13:45:18 +0200684template (value) GenericAVP ts_AVP_XRES(template (value) octetstring xres) := {
685 avp := {
686 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_XRES),
687 avp_data := {
688 avp_AAA_3GPP_XRES := xres
689 }
690 }
691}
692
Harald Welte40b1e002023-01-27 17:26:39 +0100693/* TS 29.272 7.3.55 XRES */
Harald Welted27ab242019-07-26 13:45:18 +0200694template (value) GenericAVP ts_AVP_AUTN(template (value) octetstring autn) := {
695 avp := {
696 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_AUTN),
697 avp_data := {
698 avp_AAA_3GPP_AUTN := autn
699 }
700 }
701}
702
Harald Welte40b1e002023-01-27 17:26:39 +0100703/* TS 29.272 7.3.56 KASME */
Harald Welted27ab242019-07-26 13:45:18 +0200704template (value) GenericAVP ts_AVP_KASME(template (value) octetstring kasme) := {
705 avp := {
706 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_KASME),
707 avp_data := {
708 avp_AAA_3GPP_KASME := kasme
709 }
710 }
711}
712
Harald Welte40b1e002023-01-27 17:26:39 +0100713/* TS 29.272 7.3.23 Item-Number */
Harald Welted27ab242019-07-26 13:45:18 +0200714template (value) GenericAVP ts_AVP_ItemNumber(uint32_t num) := {
715 avp := {
716 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_KASME),
717 avp_data := {
718 avp_AAA_3GPP_Item_Number := int2oct(num, 4)
719 }
720 }
721}
722
Harald Welte40b1e002023-01-27 17:26:39 +0100723/* TS 29.272 7.3.18 E-UTRAN Vector */
Harald Welted27ab242019-07-26 13:45:18 +0200724template (value) GenericAVP ts_AVP_EutranVec(uint32_t item_num, octetstring rand, octetstring xres,
725 octetstring autn, octetstring kasme) := {
726 avp := {
727 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_E_UTRAN_Vector),
728 avp_data := {
729 avp_AAA_3GPP_E_UTRAN_Vector := {
730 ts_AVP_ItemNumber(item_num),
731 ts_AVP_RAND(rand),
732 ts_AVP_XRES(xres),
733 ts_AVP_AUTN(autn),
734 ts_AVP_KASME(kasme)
735 }
736 }
737 }
738}
739
Harald Welte40b1e002023-01-27 17:26:39 +0100740/* TS 29.272 7.3.2 Subscription-Data */
Harald Welted27ab242019-07-26 13:45:18 +0200741template (value) GenericAVP ts_AVP_3GPP_SubscriptionData(template (value) AVP_list content) := {
742 avp := {
743 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscription_Data),
744 avp_data := {
745 avp_AAA_3GPP_Subscription_Data := content
746 }
747 }
748}
Vadim Yanitskiy5e1bdc02021-12-12 02:33:59 +0300749template (present) GenericAVP
750tr_AVP_3GPP_SubscriptionData(template (present) AVP_list content := ?) := {
751 avp := {
752 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscription_Data),
753 avp_data := {
754 avp_AAA_3GPP_Subscription_Data := content
755 }
756 }
757}
Harald Welted27ab242019-07-26 13:45:18 +0200758
759
Harald Welte40b1e002023-01-27 17:26:39 +0100760/* TS 29.272 7.3.17 Authentication-Info */
Harald Welted27ab242019-07-26 13:45:18 +0200761template (value) GenericAVP ts_AVP_3GPP_AuthInfo(template (value) AVP_list content) := {
762 avp := {
763 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Authentication_Info),
764 avp_data := {
765 avp_AAA_3GPP_Authentication_Info := content
766 }
767 }
768}
Vadim Yanitskiy446edae2021-12-12 04:33:08 +0300769template (present) GenericAVP
770tr_AVP_3GPP_AuthInfo(template (present) AVP_list content := ?) := {
771 avp := {
772 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Authentication_Info),
773 avp_data := {
774 avp_AAA_3GPP_Authentication_Info := content
775 }
776 }
777}
Harald Welted27ab242019-07-26 13:45:18 +0200778
Harald Welte40b1e002023-01-27 17:26:39 +0100779/* TS 29.272 7.3.9 Visited-PLMN-Id */
Harald Welted27ab242019-07-26 13:45:18 +0200780template (value) GenericAVP ts_AVP_3GPP_VisitedPlmnId(template (value) octetstring id) := {
781 avp := {
782 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Visited_PLMN_Id),
783 avp_data := {
784 avp_AAA_3GPP_Visited_PLMN_Id := id
785 }
786 }
787}
788template (present) GenericAVP tr_AVP_3GPP_VisitedPlmnId(template (present) octetstring id := ?) := {
789 avp := {
790 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Visited_PLMN_Id),
791 avp_data := {
792 avp_AAA_3GPP_Visited_PLMN_Id := id
793 }
794 }
795}
796
Harald Welte40b1e002023-01-27 17:26:39 +0100797/* TS 29.272 7.3.13 RAT-Type */
Pau Espin Pedrola2af5782022-05-18 16:34:29 +0200798template (value) GenericAVP ts_AVP_PCC_3GPP_RatType(template (value) PCC_3GPP_RAT_Type rat_type) := {
Harald Welted27ab242019-07-26 13:45:18 +0200799 avp := {
800 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_RAT_Type),
801 avp_data := {
802 avp_PCC_3GPP_RAT_Type := rat_type
803 }
804 }
805}
Pau Espin Pedrola2af5782022-05-18 16:34:29 +0200806template (present) GenericAVP tr_AVP_PCC_3GPP_RatType(template (present) PCC_3GPP_RAT_Type rat_type := ?) := {
Harald Welted27ab242019-07-26 13:45:18 +0200807 avp := {
808 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_RAT_Type),
809 avp_data := {
810 avp_PCC_3GPP_RAT_Type := rat_type
811 }
812 }
813}
814
Pau Espin Pedrola2af5782022-05-18 16:34:29 +0200815template (present) GenericAVP tr_AVP_GI_3GPP_RatType(template (present) GI_3GPP_3GPP_RAT_Type rat_type := ?) := {
816 avp := {
817 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_RAT_Type),
818 avp_data := {
819 avp_GI_3GPP_3GPP_RAT_Type := rat_type
820 }
821 }
822}
823
Harald Welte40b1e002023-01-27 17:26:39 +0100824/* TS 29.272 7.3.7 ULR-Flags */
Harald Welted27ab242019-07-26 13:45:18 +0200825template (value) GenericAVP ts_AVP_3GPP_UlrFlags(template (value) UINT32 flags) := {
826 avp := {
827 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULR_Flags),
828 avp_data := {
829 avp_AAA_3GPP_ULR_Flags := flags
830 }
831 }
832}
833template (present) GenericAVP tr_AVP_3GPP_UlrFlags(template (present) UINT32 flags := ?) := {
834 avp := {
835 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULR_Flags),
836 avp_data := {
837 avp_AAA_3GPP_ULR_Flags := flags
838 }
839 }
840}
841
Harald Welte40b1e002023-01-27 17:26:39 +0100842/* TS 29.272 7.3.8 ULA-Flags */
Harald Welted27ab242019-07-26 13:45:18 +0200843template (value) GenericAVP ts_AVP_3GPP_UlaFlags(template (value) UINT32 flags) := {
844 avp := {
845 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULA_Flags),
846 avp_data := {
847 avp_AAA_3GPP_ULA_Flags := flags
848 }
849 }
850}
851template (present) GenericAVP tr_AVP_3GPP_UlaFlags(template (present) UINT32 flags := ?) := {
852 avp := {
853 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULA_Flags),
854 avp_data := {
855 avp_AAA_3GPP_ULA_Flags := flags
856 }
857 }
858}
859
Harald Welte6effabb2020-02-18 21:39:59 +0100860
861
862template (value) GenericAVP ts_AVP_NumOfReqVectors(template (value) UINT32 num_req := '00000004'O) := {
863 avp := {
864 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Number_Of_Requested_Vectors),
865 avp_data := {
866 avp_AAA_3GPP_Number_Of_Requested_Vectors := num_req
867 }
868 }
869}
870
871template (value) GenericAVP ts_AVP_ImmReqPref(template (value) UINT32 par := '00000000'O) := {
872 avp := {
873 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Immediate_Response_Preferred),
874 avp_data := {
875 avp_AAA_3GPP_Immediate_Response_Preferred := par
876 }
877 }
878}
879
880
881/* 7.3.11 Requested-EUTRAN-Authentication-Info */
882template (value) GenericAVP ts_AVP_RequestedEutranAuthInfo(template (value) UINT32 num_vec := '00000004'O) := {
883 avp := {
884 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Requested_EUTRAN_Authentication_Info),
885 avp_data := {
886 avp_AAA_3GPP_Requested_EUTRAN_Authentication_Info := {
887 ts_AVP_NumOfReqVectors(num_vec),
888 ts_AVP_ImmReqPref('00000000'O)
889 }
890 }
891 }
892}
893
894
Harald Welte40b1e002023-01-27 17:26:39 +0100895/* TS 29.272 7.3.27 Context-Identifier */
Pau Espin Pedrol446145a2023-10-10 19:12:21 +0200896template (present) GenericAVP tr_AVP_3GPP_ContextId(template (present) uint32_t ctx := ?) := {
897 avp := {
898 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Context_Identifier),
899 avp_data := {
900 avp_AAA_3GPP_Context_Identifier := int2oct_tmpl(ctx, 4)
901 }
902 }
903}
Harald Welted27ab242019-07-26 13:45:18 +0200904template (value) GenericAVP ts_AVP_3GPP_ContextId(uint32_t ctx) := {
905 avp := {
906 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Context_Identifier),
907 avp_data := {
908 avp_AAA_3GPP_Context_Identifier := int2oct(ctx, 4)
909 }
910 }
911}
912
Harald Welte40b1e002023-01-27 17:26:39 +0100913/* Ts 29.272 7.3.29 Subscriber-Status */
Pau Espin Pedrol446145a2023-10-10 19:12:21 +0200914template (present) GenericAVP tr_AVP_3GPP_SubscriberStatus(template (present) AAA_3GPP_Subscriber_Status sts) := {
915 avp := {
916 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscriber_Status),
917 avp_data := {
918 avp_AAA_3GPP_Subscriber_Status := sts
919 }
920 }
921}
Harald Welted27ab242019-07-26 13:45:18 +0200922template (value) GenericAVP ts_AVP_3GPP_SubscriberStatus(template (value) AAA_3GPP_Subscriber_Status sts) := {
923 avp := {
924 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscriber_Status),
925 avp_data := {
926 avp_AAA_3GPP_Subscriber_Status := sts
927 }
928 }
929}
930
Pau Espin Pedrold34720f2023-10-11 17:49:39 +0200931/* Ts 29.272 7.3.30 Operator-Determined-Barring */
932template (present) GenericAVP tr_AVP_3GPP_OperatorDeterminedBarring(template (present) uint32_t val := ?) := {
933 avp := {
934 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Operator_Determined_Barring),
935 avp_data := {
936 avp_AAA_3GPP_Operator_Determined_Barring := int2oct_tmpl(val, 4)
937 }
938 }
939}
940template (value) GenericAVP ts_AVP_3GPP_OperatorDeterminedBarring(uint32_t val) := {
941 avp := {
942 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Operator_Determined_Barring),
943 avp_data := {
944 avp_AAA_3GPP_Operator_Determined_Barring := int2oct(val, 4)
945 }
946 }
947}
948
Pau Espin Pedrol446145a2023-10-10 19:12:21 +0200949template (present) GenericAVP tr_AVP_3GPP_SubscrRauTauTmr(template (present) uint32_t tmr := ?) := {
950 avp := {
951 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer),
952 avp_data := {
953 avp_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer := int2oct_tmpl(tmr, 4)
954 }
955 }
956}
957
Harald Welted27ab242019-07-26 13:45:18 +0200958template (value) GenericAVP ts_AVP_3GPP_SubscrRauTauTmr(uint32_t tmr) := {
959 avp := {
960 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer),
961 avp_data := {
962 avp_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer := int2oct(tmr, 4)
963 }
964 }
965}
966
Harald Welte40b1e002023-01-27 17:26:39 +0100967/* TS 29.272 7.3.33 All-APN-Configurations-Included-Indicator */
Pau Espin Pedrol446145a2023-10-10 19:12:21 +0200968template (present) GenericAVP tr_AVP_3GPP_AllApnConfigsIncl(template (present) AAA_3GPP_All_APN_Configurations_Included_Indicator ind := ?) := {
969 avp := {
970 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_All_APN_Configurations_Included_Indicator),
971 avp_data := {
972 avp_AAA_3GPP_All_APN_Configurations_Included_Indicator := ind
973 }
974 }
975}
Harald Welted27ab242019-07-26 13:45:18 +0200976template (value) GenericAVP ts_AVP_3GPP_AllApnConfigsIncl(template (value) AAA_3GPP_All_APN_Configurations_Included_Indicator ind := All_APN_CONFIGURATIONS_INCLUDED) := {
977 avp := {
978 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_All_APN_Configurations_Included_Indicator),
979 avp_data := {
980 avp_AAA_3GPP_All_APN_Configurations_Included_Indicator := ind
981 }
982 }
983}
984
Harald Welte40b1e002023-01-27 17:26:39 +0100985/* TS 29.272 7.3.34 APN-Configuration-Profile */
Pau Espin Pedrol446145a2023-10-10 19:12:21 +0200986template (present) GenericAVP tr_AVP_3GPP_ApnConfigProfile(template (present) AVP_list content := ?) := {
987 avp := {
988 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_APN_Configuration_Profile),
989 avp_data := {
990 avp_AAA_3GPP_APN_Configuration_Profile := content
991 }
992 }
993}
Harald Welted27ab242019-07-26 13:45:18 +0200994template (value) GenericAVP ts_AVP_3GPP_ApnConfigProfile(template (value) AVP_list content) := {
995 avp := {
996 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_APN_Configuration_Profile),
997 avp_data := {
998 avp_AAA_3GPP_APN_Configuration_Profile := content
999 }
1000 }
1001}
1002
Harald Welte40b1e002023-01-27 17:26:39 +01001003/* TS 29.272 7.3.35 APN-Configuration */
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001004template (present) GenericAVP tr_AVP_3GPP_ApnConfig(template (present) uint32_t ctx := ?,
1005 template (present) AAA_3GPP_PDN_Type pdn_type := ?,
1006 template (present) charstring apn := ?) := {
1007 avp := {
1008 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_APN_Configuration),
1009 avp_data := {
1010 avp_AAA_3GPP_APN_Configuration := superset(
1011 tr_AVP_3GPP_ContextId(ctx),
1012 tr_AVP_3GPP_PdnType(pdn_type),
1013 tr_AVP_ServiceSelection(apn),
1014 tr_AVP_3GPP_EpsSubscrQosProfile(?, ?)
1015 )
1016 }
1017 }
1018}
Harald Welted27ab242019-07-26 13:45:18 +02001019template (value) GenericAVP ts_AVP_3GPP_ApnConfig(uint32_t ctx, AAA_3GPP_PDN_Type pdn_type,
1020 charstring apn) := {
1021 avp := {
Pau Espin Pedrolaaad2762023-10-11 17:35:20 +02001022 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_APN_Configuration),
Harald Welted27ab242019-07-26 13:45:18 +02001023 avp_data := {
1024 avp_AAA_3GPP_APN_Configuration := {
1025 ts_AVP_3GPP_ContextId(ctx),
1026 ts_AVP_3GPP_PdnType(pdn_type),
Pau Espin Pedrolaaad2762023-10-11 17:35:20 +02001027 ts_AVP_ServiceSelection(apn),
1028 ts_AVP_3GPP_EpsSubscrQosProfile(1, 1)
Harald Welted27ab242019-07-26 13:45:18 +02001029 }
1030 }
1031 }
1032}
1033
Pau Espin Pedrol965ac642023-10-16 18:12:45 +02001034/* 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 +02001035template (present) GenericAVP tr_AVP_ServiceSelection(template (present) charstring apn := ?) := {
1036 avp := {
1037 avp_header := tr_DIA_Hdr(c_AVP_Code_MIPv6_NONE_Service_Selection),
1038 avp_data := {
1039 avp_MIPv6_NONE_Service_Selection := char2oct_tmpl(apn)
1040 }
1041 }
1042}
Harald Welted27ab242019-07-26 13:45:18 +02001043template (value) GenericAVP ts_AVP_ServiceSelection(charstring apn) := {
1044 avp := {
1045 avp_header := ts_DIA_Hdr(c_AVP_Code_MIPv6_NONE_Service_Selection),
1046 avp_data := {
1047 avp_MIPv6_NONE_Service_Selection := char2oct(apn)
1048 }
1049 }
1050}
1051
Pau Espin Pedrol6477d732022-06-03 12:04:40 +02001052template (present) GenericAVP tr_AVP_PCC_3GPP_QoS_Information(template (present) AVP_list list := ?) := {
Pau Espin Pedrola2af5782022-05-18 16:34:29 +02001053 avp := {
1054 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Information),
1055 avp_data := {
1056 avp_PCC_3GPP_QoS_Information := list
1057 }
1058 }
1059}
1060
Pau Espin Pedrol6477d732022-06-03 12:04:40 +02001061template (value) GenericAVP ts_AVP_PCC_3GPP_QoS_Information(template (value) AVP_list list) := {
1062 avp := {
1063 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Information),
1064 avp_data := {
1065 avp_PCC_3GPP_QoS_Information := list
1066 }
1067 }
1068}
1069
1070template (value) GenericAVP ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL(uint32_t val) := {
1071 avp := {
1072 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL),
1073 avp_data := {
1074 avp_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL := int2oct(val, 4)
1075 }
1076 }
1077}
1078
1079template (value) GenericAVP ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL(uint32_t val) := {
1080 avp := {
1081 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL),
1082 avp_data := {
1083 avp_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL := int2oct(val, 4)
1084 }
1085 }
1086}
1087
1088template (value) GenericAVP ts_AVP_PCC_3GPP_Default_EPS_Bearer_QoS(template (value) AVP_list list) := {
1089 avp := {
1090 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Default_EPS_Bearer_QoS),
1091 avp_data := {
1092 avp_PCC_3GPP_Default_EPS_Bearer_QoS := list
1093 }
1094 }
1095}
1096
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001097template (present) GenericAVP tr_AVP_PCC_3GPP_QoS_Class_Identifier(template (present) uint32_t val := ?) := {
1098 avp := {
1099 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Class_Identifier),
1100 avp_data := {
1101 avp_PCC_3GPP_QoS_Class_Identifier := int2oct_tmpl(val, 4)
1102 }
1103 }
1104}
1105
Pau Espin Pedrol6477d732022-06-03 12:04:40 +02001106template (value) GenericAVP ts_AVP_PCC_3GPP_QoS_Class_Identifier(uint32_t val) := {
Harald Welted27ab242019-07-26 13:45:18 +02001107 avp := {
1108 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Class_Identifier),
1109 avp_data := {
Pau Espin Pedrol6477d732022-06-03 12:04:40 +02001110 avp_PCC_3GPP_QoS_Class_Identifier := int2oct(val, 4)
Harald Welted27ab242019-07-26 13:45:18 +02001111 }
1112 }
1113}
1114
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001115template (present) GenericAVP tr_AVP_3GPP_PriorityLevel(template (present) uint32_t prio := ?) := {
1116 avp := {
1117 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Priority_Level),
1118 avp_data := {
1119 avp_PCC_3GPP_Priority_Level := int2oct_tmpl(prio, 4)
1120 }
1121 }
1122}
1123
Harald Welted27ab242019-07-26 13:45:18 +02001124template (value) GenericAVP ts_AVP_3GPP_PriorityLevel(uint32_t prio) := {
1125 avp := {
1126 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Priority_Level),
1127 avp_data := {
1128 avp_PCC_3GPP_Priority_Level := int2oct(prio, 4)
1129 }
1130 }
1131}
1132
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001133template (present) GenericAVP tr_AVP_PCC_3GPP_AllocRetenPrio(template (present) uint32_t prio := ?) := {
1134 avp := {
1135 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Allocation_Retention_Priority),
1136 avp_data := {
1137 avp_PCC_3GPP_Allocation_Retention_Priority := superset(
1138 tr_AVP_3GPP_PriorityLevel(prio)
1139 /* pre-emption capability */
1140 /* pre-emption vulnerability */
1141 )
1142 }
1143 }
1144}
Pau Espin Pedrol6477d732022-06-03 12:04:40 +02001145template (value) GenericAVP ts_AVP_PCC_3GPP_AllocRetenPrio(uint32_t prio) := {
Harald Welted27ab242019-07-26 13:45:18 +02001146 avp := {
1147 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Allocation_Retention_Priority),
1148 avp_data := {
1149 avp_PCC_3GPP_Allocation_Retention_Priority := {
1150 ts_AVP_3GPP_PriorityLevel(prio)
1151 /* pre-emption capability */
1152 /* pre-emption vulnerability */
1153 }
1154 }
1155 }
1156}
1157
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001158/* 7.3.37 EPS-Subscribed-QoS-Profile */
1159template (present) GenericAVP tr_AVP_3GPP_EpsSubscrQosProfile(template (present) uint32_t qos_class := ?,
1160 template (present) uint32_t prio := ?) := {
1161 avp := {
1162 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_EPS_Subscribed_QoS_Profile),
1163 avp_data := {
1164 avp_AAA_3GPP_EPS_Subscribed_QoS_Profile := superset(
1165 tr_AVP_PCC_3GPP_QoS_Class_Identifier(qos_class),
1166 tr_AVP_PCC_3GPP_AllocRetenPrio(prio)
1167 )
1168 }
1169 }
1170}
1171
Harald Welted27ab242019-07-26 13:45:18 +02001172template (value) GenericAVP ts_AVP_3GPP_EpsSubscrQosProfile(uint32_t qos_class, uint32_t prio) := {
1173 avp := {
1174 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_EPS_Subscribed_QoS_Profile),
1175 avp_data := {
1176 avp_AAA_3GPP_EPS_Subscribed_QoS_Profile := {
Pau Espin Pedrol6477d732022-06-03 12:04:40 +02001177 ts_AVP_PCC_3GPP_QoS_Class_Identifier(qos_class),
1178 ts_AVP_PCC_3GPP_AllocRetenPrio(prio)
Harald Welted27ab242019-07-26 13:45:18 +02001179 }
1180 }
1181 }
1182}
1183
1184
Harald Welte40b1e002023-01-27 17:26:39 +01001185/* TS 29.272 7.3.41 AMBR */
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001186template (present) GenericAVP tr_AVP_3GPP_AMBR(template (present) uint32_t ul := ?, template (present) uint32_t dl := ?) := {
1187 avp := {
1188 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_AMBR),
1189 avp_data := {
1190 avp_AAA_3GPP_AMBR := {
1191 tr_AVP_3GPP_MaxReqBwUL(ul),
1192 tr_AVP_3GPP_MaxReqBwDL(dl)
1193 }
1194 }
1195 }
1196}
Harald Welted27ab242019-07-26 13:45:18 +02001197template (value) GenericAVP ts_AVP_3GPP_AMBR(uint32_t ul, uint32_t dl) := {
1198 avp := {
1199 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_AMBR),
1200 avp_data := {
1201 avp_AAA_3GPP_AMBR := {
1202 ts_AVP_3GPP_MaxReqBwUL(ul),
1203 ts_AVP_3GPP_MaxReqBwDL(dl)
1204 }
1205 }
1206 }
1207}
1208
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001209template (present) GenericAVP tr_AVP_3GPP_MaxReqBwUL(template (present) uint32_t bw := ?) := {
1210 avp := {
1211 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_RX_3GPP_Max_Requested_Bandwidth_UL),
1212 avp_data := {
1213 avp_RX_3GPP_Max_Requested_Bandwidth_UL := int2oct_tmpl(bw, 4)
1214 }
1215 }
1216}
1217
Harald Welted27ab242019-07-26 13:45:18 +02001218template (value) GenericAVP ts_AVP_3GPP_MaxReqBwUL(uint32_t bw) := {
1219 avp := {
1220 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_RX_3GPP_Max_Requested_Bandwidth_UL),
1221 avp_data := {
1222 avp_RX_3GPP_Max_Requested_Bandwidth_UL := int2oct(bw, 4)
1223 }
1224 }
1225}
1226
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001227template (present) GenericAVP tr_AVP_3GPP_MaxReqBwDL(template (present) uint32_t bw := ?) := {
1228 avp := {
1229 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_RX_3GPP_Max_Requested_Bandwidth_DL),
1230 avp_data := {
1231 avp_RX_3GPP_Max_Requested_Bandwidth_DL := int2oct_tmpl(bw, 4)
1232 }
1233 }
1234}
1235
Harald Welted27ab242019-07-26 13:45:18 +02001236template (value) GenericAVP ts_AVP_3GPP_MaxReqBwDL(uint32_t bw) := {
1237 avp := {
1238 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_RX_3GPP_Max_Requested_Bandwidth_DL),
1239 avp_data := {
1240 avp_RX_3GPP_Max_Requested_Bandwidth_DL := int2oct(bw, 4)
1241 }
1242 }
1243}
1244
Pau Espin Pedrola2af5782022-05-18 16:34:29 +02001245template (present) GenericAVP tr_AVP_3GPP_Reporting_Reason(template (present) DCA_3GPP_Reporting_Reason r := ?) := {
1246 avp := {
1247 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_Reporting_Reason),
1248 avp_data := {
1249 avp_DCA_3GPP_Reporting_Reason := r
1250 }
1251 }
1252}
Harald Welted27ab242019-07-26 13:45:18 +02001253
Pau Espin Pedrola2af5782022-05-18 16:34:29 +02001254template (present) GenericAVP tr_AVP_3GPP_AoCRequestType(template (present) DCA_3GPP_AoC_Request_Type t := ?) := {
1255 avp := {
1256 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_AoC_Request_Type),
1257 avp_data := {
1258 avp_DCA_3GPP_AoC_Request_Type := t
1259 }
1260 }
1261}
1262
1263template (present) GenericAVP tr_AVP_3GPP_ServiceInformation(template (present) AVP_list content := ?) := {
1264 avp := {
1265 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_Service_Information),
1266 avp_data := {
1267 avp_DCA_3GPP_Service_Information := content
1268 }
1269 }
1270}
1271
1272template (present) GenericAVP tr_AVP_3GPP_PSInformation(template (present) AVP_list content := ?) := {
1273 avp := {
1274 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_PS_Information),
1275 avp_data := {
1276 avp_DCA_3GPP_PS_Information := content
1277 }
1278 }
1279}
1280
1281template (present) GenericAVP tr_AVP_3GPP_ChargingId(template (present) AVP_OctetString id := ?) := {
1282 avp := {
1283 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_Charging_Id),
1284 avp_data := {
1285 avp_GI_3GPP_3GPP_Charging_Id := id
1286 }
1287 }
1288}
1289
1290template (present) GenericAVP tr_AVP_3GPP_PDPType(template (present) GI_3GPP_3GPP_PDP_Type t := ?) := {
1291 avp := {
1292 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_PDP_Type),
1293 avp_data := {
1294 avp_GI_3GPP_3GPP_PDP_Type := t
1295 }
1296 }
1297}
1298
1299template (present) GenericAVP tr_AVP_3GPP_PDPAddress(template (present) DCA_3GPP_PDP_Address addr := ?) := {
1300 avp := {
1301 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_PDP_Address),
1302 avp_data := {
1303 avp_DCA_3GPP_PDP_Address := addr
1304 }
1305 }
1306}
1307
1308template (present) GenericAVP tr_AVP_3GPP_SGSNAddress(template (present) DCA_3GPP_SGSN_Address addr := ?) := {
1309 avp := {
1310 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_SGSN_Address),
1311 avp_data := {
1312 avp_DCA_3GPP_SGSN_Address := addr
1313 }
1314 }
1315}
1316
1317template (present) GenericAVP tr_AVP_3GPP_GGSNAddress(template (present) DCA_3GPP_GGSN_Address addr := ?) := {
1318 avp := {
1319 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_GGSN_Address),
1320 avp_data := {
1321 avp_DCA_3GPP_GGSN_Address := addr
1322 }
1323 }
1324}
1325
1326template (present) GenericAVP tr_AVP_3GPP_SelectionMode(template (present) GI_3GPP_3GPP_Selection_Mode sm := ?) := {
1327 avp := {
1328 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_Selection_Mode),
1329 avp_data := {
1330 avp_GI_3GPP_3GPP_Selection_Mode := sm
1331 }
1332 }
1333}
1334
1335template (present) GenericAVP tr_AVP_3GPP_ChargingCharacteristics(template (present) GI_3GPP_3GPP_Charging_Characteristics cc := ?) := {
1336 avp := {
1337 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_Charging_Characteristics),
1338 avp_data := {
1339 avp_GI_3GPP_3GPP_Charging_Characteristics := cc
1340 }
1341 }
1342}
1343
1344template (present) GenericAVP tr_AVP_3GPP_SGSNMCCMNC(template (present) GI_3GPP_3GPP_SGSN_MCC_MNC smn := ?) := {
1345 avp := {
1346 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_SGSN_MCC_MNC),
1347 avp_data := {
1348 avp_GI_3GPP_3GPP_SGSN_MCC_MNC := smn
1349 }
1350 }
1351}
1352
1353template (present) GenericAVP tr_AVP_3GPP_NSAPI(template (present) GI_3GPP_3GPP_NSAPI nsapi := ?) := {
1354 avp := {
1355 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_NSAPI),
1356 avp_data := {
1357 avp_GI_3GPP_3GPP_NSAPI := nsapi
1358 }
1359 }
1360}
1361
1362template (present) GenericAVP tr_AVP_3GPP_MS_TimeZone(template (present) GI_3GPP_3GPP_MS_TimeZone ms_tz := ?) := {
1363 avp := {
1364 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_MS_TimeZone),
1365 avp_data := {
1366 avp_GI_3GPP_3GPP_MS_TimeZone := ms_tz
1367 }
1368 }
1369}
1370
1371template (present) GenericAVP tr_AVP_3GPP_ULI(template (present) GI_3GPP_3GPP_User_Location_Info uli := ?) := {
1372 avp := {
1373 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_User_Location_Info),
1374 avp_data := {
1375 avp_GI_3GPP_3GPP_User_Location_Info := uli
1376 }
1377 }
1378}
1379
1380template (present) GenericAVP tr_AVP_UserEquipmentInfo(template (present) DCC_NONE_User_Equipment_Info uei := ?) := {
1381 avp := {
1382 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_User_Equipment_Info),
1383 avp_data := {
1384 avp_DCC_NONE_User_Equipment_Info := uei
1385 }
1386 }
1387}
1388
1389template (present) GenericAVP tr_AVP_UserEquipmentInfoType(template (present) DCC_NONE_User_Equipment_Info_Type ueit := ?) := {
1390 avp := {
1391 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_User_Equipment_Info_Type),
1392 avp_data := {
1393 avp_DCC_NONE_User_Equipment_Info_Type := ueit
1394 }
1395 }
1396}
1397
1398template (present) GenericAVP tr_AVP_UserEquipmentInfoValue(template (present) DCC_NONE_User_Equipment_Info_Value ueiv := ?) := {
1399 avp := {
1400 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_User_Equipment_Info_Value),
1401 avp_data := {
1402 avp_DCC_NONE_User_Equipment_Info_Value := ueiv
1403 }
1404 }
1405}
Harald Welted27ab242019-07-26 13:45:18 +02001406
Harald Welte40b1e002023-01-27 17:26:39 +01001407/* TS 29.272 7.3.62 PDN-Type */
Pau Espin Pedrol446145a2023-10-10 19:12:21 +02001408template (present) GenericAVP tr_AVP_3GPP_PdnType(template (present) AAA_3GPP_PDN_Type pdn_type := ?) := {
1409 avp := {
1410 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_PDN_Type),
1411 avp_data := {
1412 avp_AAA_3GPP_PDN_Type := pdn_type
1413 }
1414 }
1415}
Harald Welted27ab242019-07-26 13:45:18 +02001416template (value) GenericAVP ts_AVP_3GPP_PdnType(template (value) AAA_3GPP_PDN_Type pdn_type) := {
1417 avp := {
1418 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_PDN_Type),
1419 avp_data := {
1420 avp_AAA_3GPP_PDN_Type := pdn_type
1421 }
1422 }
1423}
1424
Pau Espin Pedrol77fdd0b2022-03-08 14:03:33 +01001425/* RFC4006 8.16 Multiple-Services-Credit-Control AVP */
1426template (value) GenericAVP ts_AVP_Multiple_Services_Credit_Control(template (value) AVP_list content) := {
1427 avp := {
1428 avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_Multiple_Services_Credit_Control),
1429 avp_data := {
1430 avp_DCC_NONE_Multiple_Services_Credit_Control := content
1431 }
1432 }
1433}
Pau Espin Pedrola2af5782022-05-18 16:34:29 +02001434template (present) GenericAVP tr_AVP_Multiple_Services_Credit_Control(template (present) AVP_list content := ?) := {
1435 avp := {
1436 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Multiple_Services_Credit_Control),
1437 avp_data := {
1438 avp_DCC_NONE_Multiple_Services_Credit_Control := content
1439 }
1440 }
1441}
1442
1443/* Requested-Service-Unit AVP */
1444template (present) GenericAVP tr_AVP_Requested_Service_Unit(template (present) AVP_list content := ?) := {
1445 avp := {
1446 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Requested_Service_Unit),
1447 avp_data := {
1448 avp_DCC_NONE_Requested_Service_Unit := content
1449 }
1450 }
1451}
1452
1453/* Used-Service-Unit AVP */
1454template (present) GenericAVP tr_AVP_Used_Service_Unit(template (present) AVP_list content := ?) := {
1455 avp := {
1456 avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Used_Service_Unit),
1457 avp_data := {
1458 avp_DCC_NONE_Used_Service_Unit := content
1459 }
1460 }
1461}
Pau Espin Pedrol77fdd0b2022-03-08 14:03:33 +01001462
1463/* RFC4006 8.17 Granted-Service-Unit AVP */
1464template (value) GenericAVP ts_AVP_Granted_Service_Unit(template (value) AVP_list content) := {
1465 avp := {
1466 avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_Granted_Service_Unit),
1467 avp_data := {
1468 avp_DCC_NONE_Granted_Service_Unit := content
1469 }
1470 }
1471}
1472
1473/* RFC4006 8.21 CC-Time AVP */
1474template (value) GenericAVP ts_AVP_CC_Time(uint32_t cc_time_val) := {
1475 avp := {
1476 avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Time),
1477 avp_data := {
1478 avp_DCC_NONE_CC_Time := int2oct(cc_time_val, 4)
1479 }
1480 }
1481}
1482
1483/* RFC4006 8.23 CC-Total-Octets AVP */
1484template (value) GenericAVP ts_AVP_CC_Total_Octets(uint64_t cc_total_octets_val) := {
1485 avp := {
1486 avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Total_Octets),
1487 avp_data := {
1488 avp_DCC_NONE_CC_Total_Octets := int2oct(cc_total_octets_val, 8)
1489 }
1490 }
1491}
1492
1493/* RFC4006 8.33 Validity-Time AVP */
1494template (value) GenericAVP ts_AVP_Validity_Time(uint32_t validity_time_val) := {
1495 avp := {
1496 avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_Validity_Time),
1497 avp_data := {
1498 avp_DCC_NONE_Validity_Time := int2oct(validity_time_val, 4)
1499 }
1500 }
1501}
1502
Pau Espin Pedrol52562c92022-05-23 15:45:46 +02001503template (value) GenericAVP ts_AVP_3GPP_VolumeQuotaThreshold(uint32_t volume_quota_thresh_val) := {
1504 avp := {
1505 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_Volume_Quota_Threshold),
1506 avp_data := {
1507 avp_DCA_3GPP_Volume_Quota_Threshold := int2oct(volume_quota_thresh_val, 4)
1508 }
1509 }
1510}
1511
Pau Espin Pedrola2af5782022-05-18 16:34:29 +02001512template (present) GenericAVP tr_AVP_3GPP_CalledStationId(template (present) DNAS_NONE_Called_Station_Id id := ?) := {
1513 avp := {
1514 avp_header := tr_DIA_Hdr(c_AVP_Code_DNAS_NONE_Called_Station_Id),
1515 avp_data := {
1516 avp_DNAS_NONE_Called_Station_Id := id
1517 }
1518 }
1519}
Harald Welted27ab242019-07-26 13:45:18 +02001520
1521
Vadim Yanitskiy0d6cbd32023-02-11 08:07:27 +07001522/* 5.3.1 Capabilities Exchange Request */
1523template (value) PDU_DIAMETER
1524ts_DIA_CER(octetstring host_ip, uint32_t vendor_app_id,
1525 template (value) charstring orig_host := "ttcn3.localdomain",
1526 template (value) charstring orig_realm := "localdomain",
1527 template (value) UINT32 hbh_id := '00000000'O,
1528 template (value) UINT32 ete_id := '00000000'O) :=
1529 ts_DIAMETER(flags := '10000000'B,
1530 cmd_code := Capabilities_Exchange,
1531 hbh_id := hbh_id,
1532 ete_id := ete_id,
1533 avps := {
1534 ts_AVP_OriginHost(orig_host),
1535 ts_AVP_OriginRealm(orig_realm),
1536 ts_AVP_HostIpAddr(host_ip),
1537 ts_AVP_VendorId(vendor_id_3GPP),
1538 ts_AVP_ProductName("TTCN-3 Testsuite"),
1539 ts_AVP_FwRevision('00000000'O),
1540 ts_AVP_InbSecId('00000000'O),
1541 ts_AVP_AuthAppId('FFFFFFFF'O),
1542 ts_AVP_VendorSpecAppId(vendor_id_3GPP, vendor_app_id)
1543 });
1544
1545
Harald Welted27ab242019-07-26 13:45:18 +02001546/* 5.3.2 Capabilities Exchange Answer */
1547template (value) PDU_DIAMETER
Pau Espin Pedrol33b47492022-03-08 17:43:01 +01001548ts_DIA_CEA_AUTH_APP_ID(template (value) UINT32 hbh_id, template (value) UINT32 ete_id,
1549 template (value) charstring origin_host,
1550 template (value) charstring origin_realm,
1551 template (value) octetstring host_ip, uint32_t auth_app_id)
1552:= ts_DIAMETER(flags:='00000000'B, cmd_code:=Capabilities_Exchange, hbh_id:=hbh_id, ete_id:=ete_id,
1553 avps := {
1554 ts_AVP_ResultCode(DIAMETER_SUCCESS),
1555 ts_AVP_OriginHost(origin_host),
1556 ts_AVP_OriginRealm(origin_realm),
1557 ts_AVP_HostIpAddr(host_ip),
1558 ts_AVP_VendorId(vendor_id_3GPP),
1559 ts_AVP_ProductName("TTCN-3 Testsuite"),
1560 ts_AVP_OriginStateId('00000001'O),
1561 ts_AVP_SuppVendorIdRaw(5535), /* 3GPP2 */
1562 ts_AVP_SuppVendorId(vendor_id_3GPP),
1563 ts_AVP_SuppVendorIdRaw(13019), /* ETSI */
Pau Espin Pedrol33b47492022-03-08 17:43:01 +01001564 ts_AVP_AuthAppId(int2oct(auth_app_id, 4)),
1565 ts_AVP_InbSecId('00000000'O)
1566 });
1567template (value) PDU_DIAMETER
1568ts_DIA_CEA_VENDOR_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 vendor_app_id)
Harald Welted27ab242019-07-26 13:45:18 +02001572:= 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),
Harald Welte61f73d52020-04-26 21:41:12 +02001575 ts_AVP_OriginHost(origin_host),
1576 ts_AVP_OriginRealm(origin_realm),
1577 ts_AVP_HostIpAddr(host_ip),
Harald Welted27ab242019-07-26 13:45:18 +02001578 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 */
Harald Welted27ab242019-07-26 13:45:18 +02001584 ts_AVP_InbSecId('00000000'O),
Harald Welte61f73d52020-04-26 21:41:12 +02001585 ts_AVP_VendorSpecAppId(vendor_id_3GPP, vendor_app_id)
Harald Welted27ab242019-07-26 13:45:18 +02001586 });
Pau Espin Pedrol33b47492022-03-08 17:43:01 +01001587function f_ts_DIA_CEA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id,
1588 template (value) charstring origin_host,
1589 template (value) charstring origin_realm,
1590 template (value) octetstring host_ip, template (omit) uint32_t auth_app_id,
1591 template (omit) uint32_t vendor_app_id)
1592 return template (value) PDU_DIAMETER
1593{
1594 var template (value) PDU_DIAMETER diam_pdu;
1595 if (istemplatekind(vendor_app_id, "omit")) {
1596 diam_pdu := ts_DIA_CEA_AUTH_APP_ID(hbh_id, ete_id, origin_host, origin_realm, host_ip, valueof(auth_app_id));
1597 } else {
1598 diam_pdu := ts_DIA_CEA_VENDOR_APP_ID(hbh_id, ete_id, origin_host, origin_realm, host_ip, valueof(vendor_app_id));
1599 }
1600 return diam_pdu;
1601}
Harald Welted27ab242019-07-26 13:45:18 +02001602
Harald Welte6effabb2020-02-18 21:39:59 +01001603
1604template (value) PDU_DIAMETER
Vadim Yanitskiy2dba4942021-12-11 15:46:30 +03001605ts_DIA_AIR(/* template (value) */ hexstring imsi,
Vadim Yanitskiy59ef8e52023-02-07 23:38:29 +07001606 template (value) octetstring mcc_mnc := '111F11'O,
Vadim Yanitskiy2dba4942021-12-11 15:46:30 +03001607 template (value) octetstring sess_id := c_def_sess_id,
Vadim Yanitskiyb57ef872021-12-12 04:14:18 +03001608 template (value) charstring orig_host := "ttcn3.localdomain",
1609 template (value) charstring orig_realm := "localdomain",
Vadim Yanitskiy2dba4942021-12-11 15:46:30 +03001610 template (value) charstring dest_realm := "localdomain",
1611 template (value) UINT32 hbh_id := '00000000'O,
1612 template (value) UINT32 ete_id := '00000000'O) :=
Vadim Yanitskiy21fd7db2021-12-15 05:29:35 +03001613 ts_DIAMETER(flags := '11000000'B,
Vadim Yanitskiy2dba4942021-12-11 15:46:30 +03001614 cmd_code := Authentication_Information,
Vadim Yanitskiy463d8262021-12-11 16:50:46 +03001615 app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
Vadim Yanitskiy2dba4942021-12-11 15:46:30 +03001616 hbh_id := hbh_id,
1617 ete_id := ete_id,
1618 avps := {
1619 ts_AVP_SessionId(sess_id),
1620 ts_AVP_DestinationRealm(dest_realm),
Vadim Yanitskiyb57ef872021-12-12 04:14:18 +03001621 ts_AVP_OriginHost(orig_host),
1622 ts_AVP_OriginRealm(orig_realm),
Vadim Yanitskiy2dba4942021-12-11 15:46:30 +03001623 ts_AVP_UserNameImsi(imsi),
1624 /* Requested EUTRAN Auth Info */
1625 ts_AVP_RequestedEutranAuthInfo,
Vadim Yanitskiyb57ef872021-12-12 04:14:18 +03001626 ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
Vadim Yanitskiy59ef8e52023-02-07 23:38:29 +07001627 ts_AVP_3GPP_VisitedPlmnId(mcc_mnc)
Harald Welte6effabb2020-02-18 21:39:59 +01001628 });
Harald Welted27ab242019-07-26 13:45:18 +02001629template (present) PDU_DIAMETER
Vadim Yanitskiy2dba4942021-12-11 15:46:30 +03001630tr_DIA_AIR(/* template (present) */ hexstring imsi,
1631 template (present) octetstring sess_id := ?,
1632 template (present) charstring dest_realm := ?,
1633 template (present) UINT32 hbh_id := ?,
1634 template (present) UINT32 ete_id := ?) :=
Vadim Yanitskiy21fd7db2021-12-15 05:29:35 +03001635 tr_DIAMETER(flags := '1???????'B,
Vadim Yanitskiy2dba4942021-12-11 15:46:30 +03001636 cmd_code := Authentication_Information,
1637 app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
1638 hbh_id := hbh_id, ete_id := ete_id,
1639 avps := superset(
1640 tr_AVP_SessionId(sess_id),
1641 tr_AVP_DestinationRealm(dest_realm),
1642 tr_AVP_UserNameImsi(imsi),
1643 tr_AVP_3GPP_VisitedPlmnId
Harald Welted27ab242019-07-26 13:45:18 +02001644 ));
1645
Harald Welte40b1e002023-01-27 17:26:39 +01001646/* TS 29.272 5.2.3.1 + 7.2.6 Authentication Information Answer */
Harald Welted27ab242019-07-26 13:45:18 +02001647template (value) PDU_DIAMETER
Vadim Yanitskiy2dba4942021-12-11 15:46:30 +03001648ts_DIA_AIA(template (value) AVP_list auth_info_contents,
1649 template (value) octetstring sess_id := c_def_sess_id,
1650 template (value) charstring orig_host := "hss.localdomain",
1651 template (value) charstring orig_realm := "localdomain",
1652 template (value) UINT32 hbh_id := '00000000'O,
1653 template (value) UINT32 ete_id := '00000000'O) :=
1654 ts_DIAMETER(flags := '01000000'B,
1655 cmd_code := Authentication_Information,
1656 app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
1657 hbh_id := hbh_id,
1658 ete_id := ete_id,
1659 avps := {
1660 ts_AVP_SessionId(sess_id),
1661 ts_AVP_ResultCode(DIAMETER_SUCCESS),
1662 ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
1663 ts_AVP_OriginHost(orig_host),
1664 ts_AVP_OriginRealm(orig_realm),
1665 ts_AVP_3GPP_AuthInfo(auth_info_contents)
Harald Welted27ab242019-07-26 13:45:18 +02001666 });
Vadim Yanitskiy446edae2021-12-12 04:33:08 +03001667template (present) PDU_DIAMETER
1668tr_DIA_AIA(template (present) AVP_list auth_info_contents := ?,
1669 template (present) octetstring sess_id := ?,
1670 template (present) charstring orig_host := ?,
1671 template (present) charstring orig_realm := ?,
1672 template (present) UINT32 hbh_id := ?,
1673 template (present) UINT32 ete_id := ?) :=
1674 tr_DIAMETER(flags := '0???????'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 := superset(
1680 tr_AVP_SessionId(sess_id),
Vadim Yanitskiy446edae2021-12-12 04:33:08 +03001681 tr_AVP_AuthSessionState(NO_STATE_MAINTAINED),
Vadim Yanitskiy446edae2021-12-12 04:33:08 +03001682 tr_AVP_OriginHost(orig_host),
Pau Espin Pedrol7bedcf82023-08-24 19:33:49 +02001683 tr_AVP_OriginRealm(orig_realm),
1684 tr_AVP_ResultCode(DIAMETER_SUCCESS),
1685 tr_AVP_3GPP_AuthInfo(auth_info_contents)
Vadim Yanitskiy446edae2021-12-12 04:33:08 +03001686 ));
Pau Espin Pedrol7aa4ad82023-08-28 18:24:24 +02001687template (present) PDU_DIAMETER
1688tr_DIA_AIA_ERR(template (present) GenericAVP err_avp := ?,
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),
1701 tr_AVP_AuthSessionState(NO_STATE_MAINTAINED),
1702 tr_AVP_OriginHost(orig_host),
1703 tr_AVP_OriginRealm(orig_realm),
1704 err_avp
1705 ));
Harald Welted27ab242019-07-26 13:45:18 +02001706
1707
Harald Welte40b1e002023-01-27 17:26:39 +01001708/* TS 29.272 7.2.3 Update Location Request */
Vadim Yanitskiy5e1bdc02021-12-12 02:33:59 +03001709template (value) PDU_DIAMETER
1710ts_DIA_ULR(/* template (value) */ hexstring imsi,
Vadim Yanitskiy59ef8e52023-02-07 23:38:29 +07001711 template (value) octetstring mcc_mnc := '111F11'O,
Vadim Yanitskiy5e1bdc02021-12-12 02:33:59 +03001712 template (value) octetstring sess_id := c_def_sess_id,
1713 template (value) charstring orig_host := "ttcn3.localdomain",
1714 template (value) charstring orig_realm := "localdomain",
1715 template (value) charstring dest_realm := "localdomain",
1716 template (value) UINT32 hbh_id := '00000000'O,
1717 template (value) UINT32 ete_id := '00000000'O) :=
1718 ts_DIAMETER(flags := '11000000'B,
1719 cmd_code := Update_Location,
1720 app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
1721 hbh_id := hbh_id,
1722 ete_id := ete_id,
1723 avps := {
1724 ts_AVP_SessionId(sess_id),
1725 ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
1726 ts_AVP_UserNameImsi(imsi),
1727 ts_AVP_3GPP_UlrFlags('00000000'O),
Vadim Yanitskiy59ef8e52023-02-07 23:38:29 +07001728 ts_AVP_3GPP_VisitedPlmnId(mcc_mnc),
Pau Espin Pedrola2af5782022-05-18 16:34:29 +02001729 ts_AVP_PCC_3GPP_RatType(EUTRAN),
Vadim Yanitskiy5e1bdc02021-12-12 02:33:59 +03001730 ts_AVP_OriginHost(orig_host),
1731 ts_AVP_OriginRealm(orig_realm),
1732 ts_AVP_DestinationRealm(dest_realm)
1733 });
Harald Welted27ab242019-07-26 13:45:18 +02001734template (present) PDU_DIAMETER
Vadim Yanitskiy0e8f5162021-12-15 05:00:32 +03001735tr_DIA_ULR(/* template (present) */ hexstring imsi,
1736 template (present) octetstring sess_id := ?,
1737 template (present) charstring orig_host := ?,
1738 template (present) charstring orig_realm := ?,
1739 template (present) charstring dest_realm := ?,
1740 template (present) UINT32 hbh_id := ?,
1741 template (present) UINT32 ete_id := ?) :=
1742 tr_DIAMETER(flags := '11000000'B,
1743 cmd_code := Update_Location,
1744 app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
1745 hbh_id := hbh_id,
1746 ete_id := ete_id,
1747 avps := superset(
1748 tr_AVP_SessionId(sess_id),
1749 tr_AVP_AuthSessionState,
1750 tr_AVP_OriginHost(orig_host),
1751 tr_AVP_OriginRealm(orig_realm),
1752 tr_AVP_DestinationRealm(dest_realm),
1753 tr_AVP_UserNameImsi(imsi),
Pau Espin Pedrola2af5782022-05-18 16:34:29 +02001754 tr_AVP_PCC_3GPP_RatType,
Vadim Yanitskiy0e8f5162021-12-15 05:00:32 +03001755 tr_AVP_3GPP_UlrFlags,
1756 tr_AVP_3GPP_VisitedPlmnId
Harald Welted27ab242019-07-26 13:45:18 +02001757 ));
1758
1759template (value) PDU_DIAMETER
Vadim Yanitskiy0e8f5162021-12-15 05:00:32 +03001760ts_DIA_ULA(template (value) AVP_list sub_data,
1761 template (value) octetstring sess_id := c_def_sess_id,
1762 template (value) charstring orig_host := "hss.localdomain",
1763 template (value) charstring orig_realm := "localdomain",
1764 template (value) UINT32 hbh_id := '00000000'O,
1765 template (value) UINT32 ete_id := '00000000'O) :=
1766 ts_DIAMETER(flags:='01000000'B,
1767 cmd_code := Update_Location,
1768 app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
1769 hbh_id := hbh_id,
1770 ete_id := ete_id,
1771 avps := {
1772 ts_AVP_SessionId(sess_id),
1773 ts_AVP_ResultCode(DIAMETER_SUCCESS), /* optional */
1774 ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
1775 ts_AVP_OriginHost(orig_host),
1776 ts_AVP_OriginRealm(orig_realm),
1777 ts_AVP_3GPP_UlaFlags('00000002'O),
1778 ts_AVP_3GPP_SubscriptionData(sub_data)
Harald Welted27ab242019-07-26 13:45:18 +02001779 });
Vadim Yanitskiy5e1bdc02021-12-12 02:33:59 +03001780template (present) PDU_DIAMETER
1781tr_DIA_ULA(template (present) AVP_list sub_data := ?,
1782 template (present) octetstring sess_id := ?,
1783 template (present) charstring orig_host := ?,
1784 template (present) charstring orig_realm := ?,
1785 template (present) UINT32 hbh_id := ?,
1786 template (present) UINT32 ete_id := ?) :=
1787 tr_DIAMETER(flags := '0???????'B,
1788 cmd_code := Update_Location,
1789 app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
1790 hbh_id := hbh_id,
1791 ete_id := ete_id,
1792 avps := superset(
1793 tr_AVP_SessionId(sess_id),
1794 tr_AVP_ResultCode(DIAMETER_SUCCESS),
1795 tr_AVP_AuthSessionState,
1796 tr_AVP_OriginHost(orig_host),
1797 tr_AVP_OriginRealm(orig_realm),
1798 tr_AVP_3GPP_UlaFlags,
1799 tr_AVP_3GPP_SubscriptionData(sub_data)
1800 ));
Harald Welted27ab242019-07-26 13:45:18 +02001801
1802
1803
Harald Weltef4001512020-04-26 21:48:34 +02001804/* RFC 4006 3.1. Credit-Control-Request (CCR) Command */
1805template (present) PDU_DIAMETER
Pau Espin Pedrol77fdd0b2022-03-08 14:03:33 +01001806tr_DIA_Gx_CCR(template (present) DCC_NONE_CC_Request_Type req_type := INITIAL_REQUEST)
Harald Weltef4001512020-04-26 21:48:34 +02001807:= tr_DIAMETER(flags:='11000000'B, cmd_code:=Credit_Control,
Harald Weltef4001512020-04-26 21:48:34 +02001808 avps := superset(
1809 tr_AVP_SessionId,
1810 tr_AVP_OriginHost,
1811 tr_AVP_OriginRealm,
1812 tr_AVP_DestinationRealm,
1813 tr_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_Gx_AID, 4)),
1814 tr_AVP_CcReqType(req_type),
1815 tr_AVP_CcReqNum(?)
1816 ));
Pau Espin Pedrol77fdd0b2022-03-08 14:03:33 +01001817template (present) PDU_DIAMETER
1818tr_DIA_Gy_CCR(template (present) DCC_NONE_CC_Request_Type req_type := INITIAL_REQUEST)
1819:= tr_DIAMETER(flags:='11000000'B, cmd_code:=Credit_Control,
Pau Espin Pedrol77fdd0b2022-03-08 14:03:33 +01001820 avps := superset(
1821 tr_AVP_SessionId,
1822 tr_AVP_OriginHost,
1823 tr_AVP_OriginRealm,
1824 tr_AVP_DestinationRealm,
1825 tr_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)),
1826 tr_AVP_CcReqType(req_type),
1827 tr_AVP_CcReqNum(?)
1828 ));
1829
Harald Weltef4001512020-04-26 21:48:34 +02001830
1831
1832/* RFC 4006 3.2. Credit-Control-Answer (CCA) Command */
1833template (value) PDU_DIAMETER
Pau Espin Pedrol77fdd0b2022-03-08 14:03:33 +01001834ts_DIA_Gx_CCA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id,
Harald Weltef4001512020-04-26 21:48:34 +02001835 template (value) octetstring sess_id,
1836 template (value) DCC_NONE_CC_Request_Type req_type,
1837 template (value) AVP_Unsigned32 req_num)
Harald Weltef4001512020-04-26 21:48:34 +02001838:= ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control,
1839 app_id:=int2oct(c_DIAMETER_3GPP_Gx_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id,
1840 avps := {
1841 ts_AVP_SessionId(sess_id),
1842 ts_AVP_ResultCode(DIAMETER_SUCCESS),
1843 ts_AVP_OriginHost("pcrf.localdomain"),
1844 ts_AVP_OriginRealm("localdomain"),
1845 ts_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_Gx_AID, 4)),
1846 ts_AVP_CcReqType(req_type),
Pau Espin Pedrolee961c72022-06-03 12:06:07 +02001847 ts_AVP_CcReqNum(req_num),
1848 ts_AVP_PCC_3GPP_QoS_Information({
1849 ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL(33554432),
1850 ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL(52428800)
1851 }),
1852 ts_AVP_PCC_3GPP_Default_EPS_Bearer_QoS({
1853 ts_AVP_PCC_3GPP_QoS_Class_Identifier(9),
1854 ts_AVP_PCC_3GPP_AllocRetenPrio(2)
1855 })
Harald Weltef4001512020-04-26 21:48:34 +02001856 // supported features
1857 // origin
1858 });
Pau Espin Pedrol77fdd0b2022-03-08 14:03:33 +01001859template (value) PDU_DIAMETER
1860ts_DIA_Gy_CCA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id,
1861 template (value) octetstring sess_id,
1862 template (value) DCC_NONE_CC_Request_Type req_type,
1863 template (value) AVP_Unsigned32 req_num)
1864:= ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control,
1865 app_id:=int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id,
1866 avps := {
1867 ts_AVP_SessionId(sess_id),
1868 ts_AVP_ResultCode(DIAMETER_SUCCESS),
1869 ts_AVP_OriginHost("ocs.localdomain"),
1870 ts_AVP_OriginRealm("localdomain"),
1871 ts_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)),
1872 ts_AVP_CcReqType(req_type),
1873 ts_AVP_CcReqNum(req_num)//,
1874 // qos
1875 // default eps bearer qos
1876 // supported features
1877 // origin
1878 });
1879/* Same as ts_DIA_Gy_CCA, but with extra AVP to grant access for limited amount of seconds */
1880template (value) PDU_DIAMETER
1881ts_DIA_Gy_CCA_ValidityTime(template (value) UINT32 hbh_id, template (value) UINT32 ete_id,
1882 template (value) octetstring sess_id,
1883 template (value) DCC_NONE_CC_Request_Type req_type,
1884 template (value) AVP_Unsigned32 req_num,
1885 uint32_t validity_time)
1886:= ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control,
1887 app_id:=int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id,
1888 avps := {
1889 ts_AVP_SessionId(sess_id),
1890 ts_AVP_ResultCode(DIAMETER_SUCCESS),
1891 ts_AVP_OriginHost("ocs.localdomain"),
1892 ts_AVP_OriginRealm("localdomain"),
1893 ts_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)),
1894 ts_AVP_CcReqType(req_type),
1895 ts_AVP_CcReqNum(req_num),
1896 ts_AVP_Multiple_Services_Credit_Control({
1897 ts_AVP_Validity_Time(validity_time),
1898 ts_AVP_Granted_Service_Unit({
1899 //ts_AVP_CC_Time(validity_time*2),
1900 ts_AVP_CC_Total_Octets(1000)
1901 })
1902 })
1903 //,
1904 // qos
1905 // default eps bearer qos
1906 // supported features
1907 // origin
1908 });
Pau Espin Pedrol52562c92022-05-23 15:45:46 +02001909/* Same as ts_DIA_Gy_CCA_ValidityTime, but with extra AVP to grant access for limited amount of octets */
1910template (value) PDU_DIAMETER
1911ts_DIA_Gy_CCA_ValidityTimeVolumeThreshold(template (value) UINT32 hbh_id, template (value) UINT32 ete_id,
1912 template (value) octetstring sess_id,
1913 template (value) DCC_NONE_CC_Request_Type req_type,
1914 template (value) AVP_Unsigned32 req_num,
1915 uint32_t validity_time, uint32_t volume_threhsold)
1916:= ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control,
1917 app_id:=int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id,
1918 avps := {
1919 ts_AVP_SessionId(sess_id),
1920 ts_AVP_ResultCode(DIAMETER_SUCCESS),
1921 ts_AVP_OriginHost("ocs.localdomain"),
1922 ts_AVP_OriginRealm("localdomain"),
1923 ts_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)),
1924 ts_AVP_CcReqType(req_type),
1925 ts_AVP_CcReqNum(req_num),
1926 ts_AVP_Multiple_Services_Credit_Control({
1927 ts_AVP_Validity_Time(validity_time),
1928 ts_AVP_Granted_Service_Unit({
1929 ts_AVP_CC_Total_Octets(volume_threhsold*100)
1930 }),
1931 ts_AVP_3GPP_VolumeQuotaThreshold(volume_threhsold)
1932 })
1933 //,
1934 // qos
1935 // default eps bearer qos
1936 // supported features
1937 // origin
1938 });
Harald Weltef4001512020-04-26 21:48:34 +02001939
Vadim Yanitskiyf28b2552021-12-11 03:49:14 +03001940/* RFC 6733, section 5.5.1 "Device-Watchdog-Request" */
1941template (value) PDU_DIAMETER
1942ts_DIA_DWR(template (value) OCTET4 state_id := '00000000'O,
1943 template (value) charstring orig_host := "ttcn3.localdomain",
1944 template (value) charstring orig_realm := "localdomain",
1945 template (value) UINT32 hbh_id := '00000000'O,
1946 template (value) UINT32 ete_id := '00000000'O) :=
1947 ts_DIAMETER(flags := '10000000'B,
1948 cmd_code := Device_Watchdog,
1949 app_id := '00000000'O,
1950 hbh_id := hbh_id,
1951 ete_id := ete_id,
1952 avps := {
1953 ts_AVP_OriginHost(orig_host),
1954 ts_AVP_OriginRealm(orig_realm),
1955 ts_AVP_OriginStateId(state_id)
1956 });
1957template (present) PDU_DIAMETER
1958tr_DIA_DWR(template (present) OCTET4 state_id := ?,
1959 template (present) charstring orig_host := ?,
1960 template (present) charstring orig_realm := ?,
1961 template (present) UINT32 hbh_id := ?,
1962 template (present) UINT32 ete_id := ?) :=
1963 tr_DIAMETER(flags := '1???????'B,
1964 cmd_code := Device_Watchdog,
1965 app_id := '00000000'O,
1966 hbh_id := hbh_id,
1967 ete_id := ete_id,
1968 avps := superset(
1969 tr_AVP_OriginHost(orig_host),
Pau Espin Pedrol8dcb0612023-08-28 19:16:29 +02001970 tr_AVP_OriginRealm(orig_realm)
1971 /* tr_AVP_OriginStateId(state_id) is optional */
Vadim Yanitskiyf28b2552021-12-11 03:49:14 +03001972 ));
1973
1974/* RFC 6733, section 5.5.2 "Device-Watchdog-Answer" */
1975template (value) PDU_DIAMETER
1976ts_DIA_DWA(template (value) OCTET4 state_id := '00000000'O,
1977 template (value) charstring orig_host := "ttcn3.localdomain",
1978 template (value) charstring orig_realm := "localdomain",
1979 template (value) UINT32 hbh_id := '00000000'O,
1980 template (value) UINT32 ete_id := '00000000'O) :=
1981 ts_DIAMETER(flags := '00000000'B,
1982 cmd_code := Device_Watchdog,
1983 app_id := '00000000'O,
1984 hbh_id := hbh_id,
1985 ete_id := ete_id,
1986 avps := {
1987 ts_AVP_ResultCode(DIAMETER_SUCCESS),
1988 ts_AVP_OriginHost(orig_host),
1989 ts_AVP_OriginRealm(orig_realm),
1990 ts_AVP_OriginStateId(state_id)
1991 });
1992template (present) PDU_DIAMETER
1993tr_DIA_DWA(template (present) OCTET4 state_id := ?,
1994 template (present) charstring orig_host := ?,
1995 template (present) charstring orig_realm := ?,
1996 template (present) UINT32 hbh_id := ?,
1997 template (present) UINT32 ete_id := ?) :=
1998 tr_DIAMETER(flags := '0???????'B,
1999 cmd_code := Device_Watchdog,
2000 app_id := '00000000'O,
2001 hbh_id := hbh_id,
2002 ete_id := ete_id,
2003 avps := superset(
2004 tr_AVP_ResultCode(DIAMETER_SUCCESS),
2005 tr_AVP_OriginHost(orig_host),
Pau Espin Pedrol8dcb0612023-08-28 19:16:29 +02002006 tr_AVP_OriginRealm(orig_realm)
2007 /* tr_AVP_OriginStateId(state_id) is optional */
Vadim Yanitskiyf28b2552021-12-11 03:49:14 +03002008 ));
2009
Pau Espin Pedrol8fa22842022-05-20 14:47:55 +02002010function f_DIAMETER_get_avp(PDU_DIAMETER pdu, template (present) AVP_Code avp_code)
2011return template (omit) AVP
2012{
2013 var integer i;
2014
2015 for (i := 0; i < lengthof(pdu.avps); i := i+1) {
2016 if (not ispresent(pdu.avps[i].avp)) {
2017 continue;
2018 }
2019 var AVP_Header hdr := pdu.avps[i].avp.avp_header;
2020 if (match(hdr.avp_code, avp_code)) {
2021 return pdu.avps[i].avp;
2022 }
2023 }
2024 return omit;
2025}
2026function f_DIAMETER_get_avp_or_fail(PDU_DIAMETER pdu, template (present) AVP_Code avp_code)
2027return AVP
2028{
2029 var template (omit) AVP avp;
2030 avp := f_DIAMETER_get_avp(pdu, avp_code);
2031 if (istemplatekind(avp, "omit")) {
2032 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
2033 log2str("AVP ", avp_code, " not found in ", pdu));
2034 }
2035 return valueof(avp);
2036}
2037
2038function f_AVP_Grouped_get_avp(AVP_Grouped avp_grp, template (present) AVP_Code avp_code)
2039return template (omit) AVP
2040{
2041 var integer i;
2042
2043 for (i := 0; i < lengthof(avp_grp); i := i+1) {
2044 if (not ispresent(avp_grp[i].avp)) {
2045 continue;
2046 }
2047 var AVP_Header hdr := avp_grp[i].avp.avp_header;
2048 if (match(hdr.avp_code, avp_code)) {
2049 return avp_grp[i].avp;
2050 }
2051 }
2052 return omit;
2053}
2054function f_AVP_Grouped_get_avp_or_fail(AVP_Grouped avp_grp, template (present) AVP_Code avp_code)
2055return AVP
2056{
2057 var template (omit) AVP avp;
2058 avp := f_AVP_Grouped_get_avp(avp_grp, avp_code);
2059 if (istemplatekind(avp, "omit")) {
2060 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
2061 log2str("AVP ", avp_code, " not found in ", avp_grp));
2062 }
2063 return valueof(avp);
2064}
2065
2066function f_validate_gy_cc_report(PDU_DIAMETER rx_dia, template (present) DCA_3GPP_Reporting_Reason repreason_exp := ?,
2067 template (present) integer cc_time_exp := ?,
2068 template (present) integer cc_in_oct_exp := ?,
2069 template (present) integer cc_out_oct_exp := ?)
2070{
2071 var AVP multi_services_cc, used_service_unit;
2072 var AVP_Grouped multi_services_cc_data, used_service_unit_data;
Pau Espin Pedrolcba0f6d2022-05-24 13:49:46 +02002073 var template (omit) AVP repreason_tpl;
Pau Espin Pedrol8fa22842022-05-20 14:47:55 +02002074 var AVP repreason, cc_time, cc_in_oct, cc_out_oct;
2075
2076 multi_services_cc := f_DIAMETER_get_avp_or_fail(rx_dia, c_AVP_Code_DCC_NONE_Multiple_Services_Credit_Control);
2077 multi_services_cc_data := valueof(multi_services_cc.avp_data.avp_DCC_NONE_Multiple_Services_Credit_Control);
2078
Pau Espin Pedrolcba0f6d2022-05-24 13:49:46 +02002079 used_service_unit := f_AVP_Grouped_get_avp_or_fail(multi_services_cc_data, c_AVP_Code_DCC_NONE_Used_Service_Unit);
2080 used_service_unit_data := valueof(used_service_unit.avp_data.avp_DCC_NONE_Used_Service_Unit);
2081
2082 /* Reporting-Reason can be either inside Multiple-Services-Credit-Control or inside Used-Service-Unit */
2083 repreason_tpl := f_AVP_Grouped_get_avp(multi_services_cc_data, c_AVP_Code_DCA_3GPP_Reporting_Reason);
2084 if (istemplatekind(repreason_tpl, "omit")) {
2085 repreason := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCA_3GPP_Reporting_Reason);
2086 } else {
2087 repreason := valueof(repreason_tpl);
2088 }
Pau Espin Pedrol8fa22842022-05-20 14:47:55 +02002089 if (not match(repreason.avp_data.avp_DCA_3GPP_Reporting_Reason, repreason_exp)) {
2090 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
2091 log2str("3GPP-Reporting-Reason mismatch ", repreason, " vs exp ", repreason_exp));
2092 }
2093
Pau Espin Pedrol8fa22842022-05-20 14:47:55 +02002094 cc_time := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCC_NONE_CC_Time);
2095 if (not match(oct2int(cc_time.avp_data.avp_DCC_NONE_CC_Time), cc_time_exp)) {
2096 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
2097 log2str("3GPP-CC-Time mismatch ", cc_time, " vs exp ", cc_time_exp));
2098 }
2099
2100 cc_in_oct := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCC_NONE_CC_Input_Octets);
2101 if (not match(oct2int(cc_in_oct.avp_data.avp_DCC_NONE_CC_Input_Octets), cc_in_oct_exp)) {
2102 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
2103 log2str("3GPP-CC-Input-Octets mismatch ", cc_in_oct, " vs exp ", cc_in_oct_exp));
2104 }
2105
2106 cc_out_oct := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCC_NONE_CC_Output_Octets);
2107 if (not match(oct2int(cc_out_oct.avp_data.avp_DCC_NONE_CC_Output_Octets), cc_out_oct_exp)) {
2108 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
2109 log2str("3GPP-CC-Output-Octets mismatch ", cc_out_oct, " vs exp ", cc_out_oct_exp));
2110 }
2111}
2112
Pau Espin Pedrol462f3df2023-10-16 18:10:55 +02002113
2114/*****************************
2115 * Cx, Dx, 3GPP TS 29.229
2116 *****************************/
2117/* SIP-Auth-Data-Item, 3GPP TS 29.229 6.3.8 */
2118template (present) GenericAVP tr_AVP_3GPP_SIPNumAuthDataItems(template (present) uint32_t num := ?) := {
2119 avp := {
2120 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Number_Auth_Items),
2121 avp_data := {
2122 avp_CxDx_3GPP_SIP_Number_Auth_Items := int2oct_tmpl(num, 4) /* CxDx_3GPP_SIP_Number_Auth_Items */
2123 }
2124 }
2125}
2126template (value) GenericAVP ts_AVP_3GPP_SIPNumAuthDataItems(uint32_t num) := {
2127 avp := {
2128 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Number_Auth_Items),
2129 avp_data := {
2130 avp_CxDx_3GPP_SIP_Number_Auth_Items := int2oct(num, 4) /* CxDx_3GPP_SIP_Number_Auth_Items */
2131 }
2132 }
2133}
2134
2135/* SIP-Authentication-Scheme, 3GPP TS 29.229 6.3.9 */
2136template (present) GenericAVP tr_AVP_3GPP_SIPAuthScheme(template (present) CxDx_3GPP_SIP_Authentication_Scheme scheme := ?) := {
2137 avp := {
2138 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authentication_Scheme),
2139 avp_data := {
2140 avp_CxDx_3GPP_SIP_Authentication_Scheme := scheme
2141 }
2142 }
2143}
2144template (value) GenericAVP ts_AVP_3GPP_SIPAuthScheme(template (value) CxDx_3GPP_SIP_Authentication_Scheme scheme) := {
2145 avp := {
2146 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authentication_Scheme),
2147 avp_data := {
2148 avp_CxDx_3GPP_SIP_Authentication_Scheme := scheme
2149 }
2150 }
2151}
2152
2153/* SIP-Authenticate, 3GPP TS 29.229 6.3.10 */
2154template (present) GenericAVP tr_AVP_3GPP_SIPAuthenticate(template (present) CxDx_3GPP_SIP_Authenticate rand_autn_concatenated := ?) := {
2155 avp := {
2156 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authenticate),
2157 avp_data := {
2158 avp_CxDx_3GPP_SIP_Authenticate := rand_autn_concatenated
2159 }
2160 }
2161}
2162template (value) GenericAVP ts_AVP_3GPP_SIPAuthenticate(template (value) CxDx_3GPP_SIP_Authenticate rand_autn_concatenated) := {
2163 avp := {
2164 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authenticate),
2165 avp_data := {
2166 avp_CxDx_3GPP_SIP_Authenticate := rand_autn_concatenated
2167 }
2168 }
2169}
2170
2171/* SIP-Authorization, 3GPP TS 29.229 6.3.11 */
2172template (present) GenericAVP tr_AVP_3GPP_SIPAuthorization(template (present) CxDx_3GPP_SIP_Authorization rand_autn_concatenated := ?) := {
2173 avp := {
2174 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authorization),
2175 avp_data := {
2176 avp_CxDx_3GPP_SIP_Authorization := rand_autn_concatenated
2177 }
2178 }
2179}
2180template (value) GenericAVP ts_AVP_3GPP_SIPAuthorization(template (value) CxDx_3GPP_SIP_Authorization rand_autn_concatenated) := {
2181 avp := {
2182 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authorization),
2183 avp_data := {
2184 avp_CxDx_3GPP_SIP_Authorization := rand_autn_concatenated
2185 }
2186 }
2187}
2188
2189/* SIP-Authentication-Context, 3GPP TS 29.229 6.3.12 */
2190template (present) GenericAVP tr_AVP_3GPP_SIPAuthContext(template (present) CxDx_3GPP_SIP_Authentication_Context val := ?) := {
2191 avp := {
2192 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authentication_Context),
2193 avp_data := {
2194 avp_CxDx_3GPP_SIP_Authentication_Context := val
2195 }
2196 }
2197}
2198template (value) GenericAVP ts_AVP_3GPP_SIPAuthContext(template (value) CxDx_3GPP_SIP_Authentication_Context val) := {
2199 avp := {
2200 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Authentication_Context),
2201 avp_data := {
2202 avp_CxDx_3GPP_SIP_Authentication_Context := val
2203 }
2204 }
2205}
2206
2207/* SIP-Item-Number, 3GPP TS 29.229 6.3.14 */
2208template (present) GenericAVP tr_AVP_3GPP_SIPItemNumber(template (present) uint32_t num := ?) := {
2209 avp := {
2210 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Item_Number),
2211 avp_data := {
2212 avp_CxDx_3GPP_SIP_Item_Number := int2oct_tmpl(num, 4) /* CxDx_3GPP_SIP_Item_Number */
2213 }
2214 }
2215}
2216template (value) GenericAVP ts_AVP_3GPP_SIPItemNumber(uint32_t num) := {
2217 avp := {
2218 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Item_Number),
2219 avp_data := {
2220 avp_CxDx_3GPP_SIP_Item_Number := int2oct(num, 4) /* CxDx_3GPP_SIP_Item_Number */
2221 }
2222 }
2223}
2224
2225/* Confidentiality-Key, 3GPP TS 29.229 6.3.27 */
2226template (present) GenericAVP tr_AVP_3GPP_ConfidentialityKey(template (present) CxDx_3GPP_Confidentiality_Key ckey := ?) := {
2227 avp := {
2228 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Confidentiality_Key),
2229 avp_data := {
2230 avp_CxDx_3GPP_Confidentiality_Key := ckey
2231 }
2232 }
2233}
2234template (value) GenericAVP ts_AVP_3GPP_ConfidentialityKey(template (value) CxDx_3GPP_Confidentiality_Key ckey) := {
2235 avp := {
2236 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Confidentiality_Key),
2237 avp_data := {
2238 avp_CxDx_3GPP_Confidentiality_Key := ckey
2239 }
2240 }
2241}
2242
2243/* Inegrity-Key, 3GPP TS 29.229 6.3.28 */
2244template (present) GenericAVP tr_AVP_3GPP_IntegrityKey(template (present) CxDx_3GPP_Integrity_Key ckey := ?) := {
2245 avp := {
2246 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Integrity_Key),
2247 avp_data := {
2248 avp_CxDx_3GPP_Integrity_Key := ckey
2249 }
2250 }
2251}
2252template (value) GenericAVP ts_AVP_3GPP_IntegrityKey(template (value) CxDx_3GPP_Integrity_Key ckey) := {
2253 avp := {
2254 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Integrity_Key),
2255 avp_data := {
2256 avp_CxDx_3GPP_Integrity_Key := ckey
2257 }
2258 }
2259}
2260
Pau Espin Pedrol965ac642023-10-16 18:12:45 +02002261/* Server-Assignment-Type, 3GPP TS 29.273 8.2.3.12, 3GPP TS 29.229 6.3.15 */
2262template (present) GenericAVP tr_AVP_3GPP_ServerAssignmentType(template (present) CxDx_3GPP_Server_Assignment_Type t := ?) := {
2263 avp := {
2264 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Server_Assignment_Type),
2265 avp_data := {
2266 avp_CxDx_3GPP_Server_Assignment_Type := t
2267 }
2268 }
2269}
2270template (value) GenericAVP ts_AVP_3GPP_ServerAssignmentType(template (value) CxDx_3GPP_Server_Assignment_Type t) := {
2271 avp := {
2272 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Server_Assignment_Type),
2273 avp_data := {
2274 avp_CxDx_3GPP_Server_Assignment_Type := t
2275 }
2276 }
2277}
2278
2279/*****************************
2280 * SWx 3GPP TS 29.273
2281 *****************************/
2282
2283/* SIP-Auth-Data-Item , 3GPP TS 29.273 8.2.3.9 */
2284template (present) GenericAVP tr_AVP_3GPP_SIPAuthDataItem(template (present) uint32_t num := ?) := {
2285 avp := {
2286 avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Auth_Data_Item),
2287 avp_data := {
2288 avp_CxDx_3GPP_SIP_Auth_Data_Item := superset(
2289 //tr_AVP_3GPP_SIPItemNumber(num), /* Optional */
2290 tr_AVP_3GPP_SIPAuthScheme(?)//, /* Optional */
2291 //tr_AVP_3GPP_SIPAuthenticate(?), /* Optional */
2292 //tr_AVP_3GPP_SIPAuthorization(?), /* Optional */
2293 //tr_AVP_3GPP_SIPAuthContext(?), /* Optional */
2294 //tr_AVP_3GPP_ConfidentialityKey(?), /* Optional */
2295 //tr_AVP_3GPP_IntegrityKey(?) /* Optional */
2296 /* TODO:
2297 [ SIP-Digest-Authenticate ]
2298 [ Framed-IP-Address ]
2299 [ Framed-IPv6-Prefix ]
2300 [ Framed-Interface-Id ]
2301 [ Line-Identifier ]
2302 *[AVP]
2303 */
2304 )
2305 }
2306 }
2307}
2308template (value) GenericAVP ts_AVP_3GPP_SIPAuthDataItem(uint32_t num, OCT16 rand, OCT16 ik, OCT16 ck, OCT16 autn, OCT14 auts) := {
2309 avp := {
2310 avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Auth_Data_Item),
2311 avp_data := {
2312 avp_CxDx_3GPP_SIP_Auth_Data_Item := {
2313 ts_AVP_3GPP_SIPItemNumber(num),
2314 ts_AVP_3GPP_SIPAuthScheme(char2oct("Digest-AKAv1-MD5")),
2315 ts_AVP_3GPP_SIPAuthenticate(rand & autn),
2316 ts_AVP_3GPP_SIPAuthorization(rand & auts),
2317 ts_AVP_3GPP_SIPAuthContext(char2oct("foobar")),
2318 ts_AVP_3GPP_ConfidentialityKey(ck),
2319 ts_AVP_3GPP_IntegrityKey(ik)
2320 /* TODO:
2321 [ SIP-Digest-Authenticate ]
2322 [ Framed-IP-Address ]
2323 [ Framed-IPv6-Prefix ]
2324 [ Framed-Interface-Id ]
2325 [ Line-Identifier ]
2326 *[AVP]
2327 */
2328 }
2329 }
2330 }
2331}
2332
2333/* Multimedia-Auth-Request, 3GPP TS 29.273 8.2.2.1 Authentication Procedure */
2334template (present) PDU_DIAMETER
2335tr_DIA_SWx_MAR(template (present) hexstring imsi := ?,
2336 template (present) octetstring sess_id := ?,
2337 template (present) charstring orig_host := ?,
2338 template (present) charstring orig_realm := ?,
2339 template (present) charstring dest_realm := ?,
2340 template (present) UINT32 hbh_id := ?,
2341 template (present) UINT32 ete_id := ?) :=
2342 tr_DIAMETER(flags := '1???????'B,
2343 cmd_code := Multimedia_Auth,
2344 app_id := int2oct(c_DIAMETER_3GPP_SWx_AID, 4),
2345 hbh_id := hbh_id, ete_id := ete_id,
2346 avps := superset(
2347 tr_AVP_SessionId(sess_id),
2348 tr_AVP_VendorSpecAppId(?, ?),
2349 tr_AVP_AuthSessionState(NO_STATE_MAINTAINED),
2350 tr_AVP_OriginHost(orig_host),
2351 tr_AVP_OriginRealm(orig_realm),
2352 tr_AVP_DestinationRealm(dest_realm),
2353 tr_AVP_UserNameImsi(imsi),
2354 tr_AVP_3GPP_SIPAuthDataItem(?),
2355 tr_AVP_3GPP_SIPNumAuthDataItems(?)
2356 ));
2357
2358/* Multimedia-Auth-Answer, 3GPP TS 29.273 8.2.2.1 Authentication Procedure */
2359template (value) PDU_DIAMETER
2360ts_DIA_SWx_MAA(template (value) hexstring imsi,
2361 template (value) GenericAVP sip_auth_data_item,
2362 template (value) uint32_t vendor_app_id := c_DIAMETER_3GPP_SWx_AID,
2363 template (value) octetstring sess_id := c_def_sess_id,
2364 template (value) charstring orig_host := "hss.localdomain",
2365 template (value) charstring orig_realm := "localdomain",
2366 template (value) UINT32 hbh_id := '00000000'O,
2367 template (value) UINT32 ete_id := '00000000'O) :=
2368 ts_DIAMETER(flags := '01000000'B,
2369 cmd_code := Multimedia_Auth,
2370 app_id := int2oct(c_DIAMETER_3GPP_SWx_AID, 4),
2371 hbh_id := hbh_id,
2372 ete_id := ete_id,
2373 avps := {
2374 ts_AVP_SessionId(sess_id),
2375 ts_AVP_VendorSpecAppId(vendor_id_3GPP, valueof(vendor_app_id)),
2376 ts_AVP_ResultCode(DIAMETER_SUCCESS),
2377 ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
2378 ts_AVP_OriginHost(orig_host),
2379 ts_AVP_OriginRealm(orig_realm),
2380 ts_AVP_UserNameImsi(valueof(imsi)),
2381 sip_auth_data_item,
2382 ts_AVP_3GPP_SIPNumAuthDataItems(1)
2383 });
2384
2385/* Server-Assignment-Request,
2386 * 3GPP TS 29.273 8.1.2.2.2 UE/PDN Registration/DeRegistration Notification
2387 * 3GPP TS 29.273 8.2.2.3 Non-3GPP IP Access Registration Procedure */
2388template (present) PDU_DIAMETER
2389tr_DIA_SWx_SAR(template (present) hexstring imsi := ?,
2390 template (present) octetstring sess_id := ?,
2391 template (present) charstring orig_host := ?,
2392 template (present) charstring orig_realm := ?,
2393 template (present) charstring dest_realm := ?,
2394 template (present) UINT32 hbh_id := ?,
2395 template (present) UINT32 ete_id := ?,
2396 template (present) CxDx_3GPP_Server_Assignment_Type server_ass_type := ?,
2397 template (present) charstring service_selection := ?) :=
2398 tr_DIAMETER(flags := '1???????'B,
2399 cmd_code := Server_Assignment,
2400 app_id := int2oct(c_DIAMETER_3GPP_SWx_AID, 4),
2401 hbh_id := hbh_id, ete_id := ete_id,
2402 avps := superset(
2403 tr_AVP_SessionId(sess_id),
2404 tr_AVP_VendorSpecAppId(?, ?),
2405 tr_AVP_AuthSessionState(NO_STATE_MAINTAINED),
2406 tr_AVP_OriginHost(orig_host),
2407 tr_AVP_OriginRealm(orig_realm),
2408 tr_AVP_DestinationRealm(dest_realm),
2409 tr_AVP_UserNameImsi(imsi),
2410 tr_AVP_3GPP_ServerAssignmentType(server_ass_type),
2411 tr_AVP_ServiceSelection(service_selection)
2412 ));
2413
2414/* Server-Assignment-Answer,
2415 * 3GPP TS 29.273 8.1.2.2.2 UE/PDN Registration/DeRegistration Notification
2416 * 3GPP TS 29.273 8.2.2.3 Non-3GPP IP Access Registration Procedure */
2417template (value) PDU_DIAMETER
2418ts_DIA_SWx_SAA(template (value) hexstring imsi,
2419 template (value) uint32_t vendor_app_id := c_DIAMETER_3GPP_SWx_AID,
2420 template (value) octetstring sess_id := c_def_sess_id,
2421 template (value) charstring orig_host := "hss.localdomain",
2422 template (value) charstring orig_realm := "localdomain",
2423 template (value) UINT32 hbh_id := '00000000'O,
2424 template (value) UINT32 ete_id := '00000000'O) :=
2425 ts_DIAMETER(flags := '01000000'B,
2426 cmd_code := Server_Assignment,
2427 app_id := int2oct(c_DIAMETER_3GPP_SWx_AID, 4),
2428 hbh_id := hbh_id,
2429 ete_id := ete_id,
2430 avps := {
2431 ts_AVP_SessionId(sess_id),
2432 ts_AVP_VendorSpecAppId(vendor_id_3GPP, valueof(vendor_app_id)),
2433 ts_AVP_ResultCode(DIAMETER_SUCCESS),
2434 ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
2435 ts_AVP_OriginHost(orig_host),
2436 ts_AVP_OriginRealm(orig_realm),
2437 ts_AVP_UserNameImsi(valueof(imsi))
2438 /* TODO:
2439 * [ Non-3GPP-User-Data ]
2440 * [ 3GPP-AAA-Server-Name ]
2441 * [ OC-Supported-Features ]
2442 * [ OC-OLR ] ]
2443 * *[ Load ]
2444 * *[ Supported-Features ]
2445 */
2446 });
2447
Harald Welted27ab242019-07-26 13:45:18 +02002448}