aboutsummaryrefslogtreecommitdiffstats
path: root/library/DIAMETER_ts29_229_Templates.ttcn
blob: fbbfb0d0457f0d670d0db2e0d89f33300ef7690a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
module DIAMETER_ts29_229_Templates {

/* (C) 2023 by Alexander Couzens <lynxis@fe80.eu>
 * All rights reserved.
 *
 * Released under the terms of GNU General Public License, Version 2 or
 * (at your option) any later version.
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 *
 * Templates for AVPs and messages for TS 29.229
 */

import from General_Types all;
import from DIAMETER_Types all;
import from DIAMETER_Templates all;
import from DIAMETER_rfc5447_Templates all;
import from DIAMETER_ts29_273_Templates all;
import from Osmocom_Types all;
import from Misc_Helpers all;

/* 3GPP TS 29.273 Section 8.2 */
const uint32_t c_DIAMETER_3GPP_Cx_AID := 16777216;

/* Multimedia-Auth-Request, 3GPP TS 29.229 8.2.2.1 Authentication Procedure */
template (present) PDU_DIAMETER
tr_DIA_Cx_MAR(template (present) hexstring imsi := ?,
	       template (present) octetstring sess_id := ?,
	       template (present) charstring orig_host :=  ?,
	       template (present) charstring orig_realm := ?,
	       template (present) charstring dest_realm := ?,
	       template (present) octetstring server_name := ?,
	       template (present) UINT32 hbh_id := ?,
	       template (present) UINT32 ete_id := ?) :=
	tr_DIAMETER(flags := '1???????'B,
		    cmd_code := Multimedia_Auth,
		    app_id := int2oct(c_DIAMETER_3GPP_Cx_AID, 4),
		    hbh_id := hbh_id, ete_id := ete_id,
		    avps := superset(
			tr_AVP_SessionId(sess_id),
			tr_AVP_VendorSpecAppId(?, ?),
			tr_AVP_AuthSessionState(NO_STATE_MAINTAINED),
			tr_AVP_OriginHost(orig_host),
			tr_AVP_OriginRealm(orig_realm),
			tr_AVP_DestinationRealm(dest_realm),
			tr_AVP_UserNameImsi(imsi),
			tr_AVP_3GPP_SIPAuthDataItem(?),
			tr_AVP_3GPP_SIPNumAuthDataItems(?),
			tr_AVP_3GPP_ServerName(server_name)
	));

/* Multimedia-Auth-Answer, 3GPP TS 29.273 8.2.2.1 Authentication Procedure */
template (value) PDU_DIAMETER
ts_DIA_Cx_MAA(template (value) hexstring imsi,
	       template (value) GenericAVP sip_auth_data_item,
	       template (value) uint32_t vendor_app_id := c_DIAMETER_3GPP_Cx_AID,
	       template (value) octetstring sess_id := c_def_sess_id,
	       template (value) charstring orig_host := "hss.localdomain",
	       template (value) charstring orig_realm := "localdomain",
	       template (value) octetstring server_name,
	       template (value) UINT32 exp_result := '000007d1'O, /* 2001 */
	       template (value) UINT32 hbh_id := '00000000'O,
	       template (value) UINT32 ete_id := '00000000'O) :=
	ts_DIAMETER(flags := '01000000'B,
		    cmd_code := Multimedia_Auth,
		    app_id := int2oct(c_DIAMETER_3GPP_Cx_AID, 4),
		    hbh_id := hbh_id,
		    ete_id := ete_id,
		    avps := {
			ts_AVP_SessionId(sess_id),
			ts_AVP_VendorSpecAppId(vendor_id_3GPP, valueof(vendor_app_id)),
			ts_AVP_ExperimentalResult(vendor_id_3GPP, exp_result),
			ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
			ts_AVP_OriginHost(orig_host),
			ts_AVP_OriginRealm(orig_realm),
			ts_AVP_UserNameImsi(valueof(imsi)),
			sip_auth_data_item,
			ts_AVP_3GPP_ServerName(server_name),
			ts_AVP_3GPP_SIPNumAuthDataItems(1)
	});

/* Server-Assignment-Request,
 * 3GPP TS 29.273 8.1.2.2.2 UE/PDN Registration/DeRegistration Notification
 * 3GPP TS 29.273 8.2.2.3 Non-3GPP IP Access Registration Procedure */
template (present) PDU_DIAMETER
tr_DIA_SWx_SAR(template (present) hexstring imsi := ?,
	       template (present) octetstring sess_id := ?,
	       template (present) charstring orig_host :=  ?,
	       template (present) charstring orig_realm := ?,
	       template (present) charstring dest_realm := ?,
	       template (present) UINT32 hbh_id := ?,
	       template (present) UINT32 ete_id := ?,
	       template (present) CxDx_3GPP_Server_Assignment_Type server_ass_type := ?,
	       template (present) charstring service_selection := ?) :=
	tr_DIAMETER(flags := '1???????'B,
		    cmd_code := Server_Assignment,
		    app_id := int2oct(c_DIAMETER_3GPP_Cx_AID, 4),
		    hbh_id := hbh_id, ete_id := ete_id,
		    avps := superset(
			tr_AVP_SessionId(sess_id),
			tr_AVP_VendorSpecAppId(?, ?),
			tr_AVP_AuthSessionState(NO_STATE_MAINTAINED),
			tr_AVP_OriginHost(orig_host),
			tr_AVP_OriginRealm(orig_realm),
			tr_AVP_DestinationRealm(dest_realm),
			tr_AVP_UserNameImsi(imsi),
			tr_AVP_3GPP_ServerAssignmentType(server_ass_type),
			tr_AVP_ServiceSelection(service_selection)
	));
}