Pau Espin Pedrol | 4669b61 | 2023-10-23 17:43:14 +0200 | [diff] [blame] | 1 | module DIAMETER_ts29_273_Templates { |
| 2 | |
| 3 | /* (C) 2023 by sysmocom s.f.m.c. GmbH <info@sysmocom.de |
| 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 | * Templates for AVPs and messages for TS 29.273 |
| 12 | */ |
| 13 | |
| 14 | import from General_Types all; |
| 15 | import from DIAMETER_Types all; |
| 16 | import from DIAMETER_Templates all; |
Pau Espin Pedrol | 7399673 | 2023-10-23 18:16:21 +0200 | [diff] [blame] | 17 | import from DIAMETER_rfc5447_Templates all; |
Pau Espin Pedrol | 5154e35 | 2024-03-05 13:23:40 +0100 | [diff] [blame] | 18 | import from DIAMETER_ts29_272_Templates all; |
Pau Espin Pedrol | 4669b61 | 2023-10-23 17:43:14 +0200 | [diff] [blame] | 19 | import from Osmocom_Types all; |
| 20 | import from Misc_Helpers all; |
| 21 | |
| 22 | /* 3GPP TS 29.273 Section 8.2 */ |
| 23 | const uint32_t c_DIAMETER_3GPP_SWx_AID := 16777265; |
| 24 | /* 3GPP TS 29.273 Section 9 */ |
| 25 | const uint32_t c_DIAMETER_3GPP_S6b_AID := 16777272; |
| 26 | |
Pau Espin Pedrol | 7399673 | 2023-10-23 18:16:21 +0200 | [diff] [blame] | 27 | /* 5.2.3.3 MIP6-Feature-Vector bits */ |
| 28 | const uint64_t DIA_TS29_373_MIP6_Feature_Vector_PMIP6_SUPPORTED := hex2int('0000010000000000'H); |
| 29 | const uint64_t DIA_TS29_373_MIP6_Feature_Vector_ASSIGN_LOCAL_IP := hex2int('0000080000000000'H); |
| 30 | const uint64_t DIA_TS29_373_MIP6_Feature_Vector_MIP4_SUPPORTED := hex2int('0000100000000000'H); |
| 31 | const uint64_t DIA_TS29_373_MIP6_Feature_Vector_OPTIMIZED_IDLE_MODE_MOBILITY := hex2int('0000200000000000'H); |
| 32 | const uint64_t DIA_TS29_373_MIP6_Feature_Vector_GTPv2_SUPPORTED := hex2int('0000400000000000'H); |
| 33 | |
Pau Espin Pedrol | 4669b61 | 2023-10-23 17:43:14 +0200 | [diff] [blame] | 34 | /******************************* |
| 35 | * SWx 3GPP TS 29.273 section 8 |
| 36 | *******************************/ |
| 37 | |
Pau Espin Pedrol | 9b2ebc0 | 2024-03-05 13:25:19 +0100 | [diff] [blame^] | 38 | /* TS 29.273 8.2.3.1 Non-3GPP-User-Data */ |
| 39 | template (value) GenericAVP ts_AVP_3GPP_Non_3GPP_User_Data(template (value) AAA_3GPP_PDN_Type pdn_type, |
| 40 | template (value) charstring apn, |
| 41 | template (value) uint32_t ambr_max_req_ul := 1000000000, |
| 42 | template (value) uint32_t ambr_max_req_dl := 1000000000) := { |
| 43 | avp := { |
| 44 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Non_3GPP_User_Data), |
| 45 | avp_data := { |
| 46 | avp_AAA_3GPP_Non_3GPP_User_Data := { |
| 47 | ts_AVP_3GPP_Non_3GPP_IP_Access(NON_3GPP_SUBSCRIPTION_ALLOWED), |
| 48 | ts_AVP_3GPP_Non_3GPP_IP_Access_APN(NON_3GPP_APNS_ENABLE), |
| 49 | ts_AVP_3GPP_AMBR(ambr_max_req_ul, ambr_max_req_dl), |
| 50 | ts_AVP_3GPP_ContextId(1), |
| 51 | ts_AVP_3GPP_ApnConfig(1, pdn_type, apn) |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | /* TS 29.273 8.2.3.3 Non-3GPP-IP-Access */ |
| 58 | template (value) GenericAVP ts_AVP_3GPP_Non_3GPP_IP_Access(template (value) AAA_3GPP_Non_3GPP_IP_Access val := NON_3GPP_SUBSCRIPTION_ALLOWED) := { |
| 59 | avp := { |
| 60 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Non_3GPP_IP_Access), |
| 61 | avp_data := { |
| 62 | avp_AAA_3GPP_Non_3GPP_IP_Access := val |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | |
| 68 | /* TS 29.273 8.2.3.4 Non-3GPP-IP-Access-APN */ |
| 69 | template (value) GenericAVP ts_AVP_3GPP_Non_3GPP_IP_Access_APN(template (value) AAA_3GPP_Non_3GPP_IP_Access_APN val := NON_3GPP_APNS_ENABLE) := { |
| 70 | avp := { |
| 71 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Non_3GPP_IP_Access_APN), |
| 72 | avp_data := { |
| 73 | avp_AAA_3GPP_Non_3GPP_IP_Access_APN := val |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | /* TS 29.273 8.2.3.7 APN-Configuration: The APN-Configuration AVP is of type Grouped AVP and is defined in 3GPP TS 29.272 */ |
| 79 | /* TS 29.273 5.2.3.8 AMBR: Please refer to 3GPP TS 29.272 [29] for the encoding of this AVP. */ |
| 80 | |
Pau Espin Pedrol | 4669b61 | 2023-10-23 17:43:14 +0200 | [diff] [blame] | 81 | /* SIP-Auth-Data-Item , 3GPP TS 29.273 8.2.3.9 */ |
| 82 | template (present) GenericAVP tr_AVP_3GPP_SIPAuthDataItem(template (present) uint32_t num := ?) := { |
| 83 | avp := { |
| 84 | avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Auth_Data_Item), |
| 85 | avp_data := { |
| 86 | avp_CxDx_3GPP_SIP_Auth_Data_Item := superset( |
| 87 | //tr_AVP_3GPP_SIPItemNumber(num), /* Optional */ |
| 88 | tr_AVP_3GPP_SIPAuthScheme(?)//, /* Optional */ |
| 89 | //tr_AVP_3GPP_SIPAuthenticate(?), /* Optional */ |
| 90 | //tr_AVP_3GPP_SIPAuthorization(?), /* Optional */ |
| 91 | //tr_AVP_3GPP_SIPAuthContext(?), /* Optional */ |
| 92 | //tr_AVP_3GPP_ConfidentialityKey(?), /* Optional */ |
| 93 | //tr_AVP_3GPP_IntegrityKey(?) /* Optional */ |
| 94 | /* TODO: |
| 95 | [ SIP-Digest-Authenticate ] |
| 96 | [ Framed-IP-Address ] |
| 97 | [ Framed-IPv6-Prefix ] |
| 98 | [ Framed-Interface-Id ] |
| 99 | [ Line-Identifier ] |
| 100 | *[AVP] |
| 101 | */ |
| 102 | ) |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | template (value) GenericAVP ts_AVP_3GPP_SIPAuthDataItem(uint32_t num, OCT16 rand, OCT16 ik, OCT16 ck, OCT16 autn, OCT14 auts) := { |
| 107 | avp := { |
| 108 | avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_SIP_Auth_Data_Item), |
| 109 | avp_data := { |
| 110 | avp_CxDx_3GPP_SIP_Auth_Data_Item := { |
| 111 | ts_AVP_3GPP_SIPItemNumber(num), |
| 112 | ts_AVP_3GPP_SIPAuthScheme(char2oct("Digest-AKAv1-MD5")), |
| 113 | ts_AVP_3GPP_SIPAuthenticate(rand & autn), |
| 114 | ts_AVP_3GPP_SIPAuthorization(rand & auts), |
| 115 | ts_AVP_3GPP_SIPAuthContext(char2oct("foobar")), |
| 116 | ts_AVP_3GPP_ConfidentialityKey(ck), |
| 117 | ts_AVP_3GPP_IntegrityKey(ik) |
| 118 | /* TODO: |
| 119 | [ SIP-Digest-Authenticate ] |
| 120 | [ Framed-IP-Address ] |
| 121 | [ Framed-IPv6-Prefix ] |
| 122 | [ Framed-Interface-Id ] |
| 123 | [ Line-Identifier ] |
| 124 | *[AVP] |
| 125 | */ |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | /* Multimedia-Auth-Request, 3GPP TS 29.273 8.2.2.1 Authentication Procedure */ |
| 132 | template (present) PDU_DIAMETER |
| 133 | tr_DIA_SWx_MAR(template (present) hexstring imsi := ?, |
| 134 | template (present) octetstring sess_id := ?, |
| 135 | template (present) charstring orig_host := ?, |
| 136 | template (present) charstring orig_realm := ?, |
| 137 | template (present) charstring dest_realm := ?, |
| 138 | template (present) UINT32 hbh_id := ?, |
| 139 | template (present) UINT32 ete_id := ?) := |
| 140 | tr_DIAMETER(flags := '1???????'B, |
| 141 | cmd_code := Multimedia_Auth, |
| 142 | app_id := int2oct(c_DIAMETER_3GPP_SWx_AID, 4), |
| 143 | hbh_id := hbh_id, ete_id := ete_id, |
| 144 | avps := superset( |
| 145 | tr_AVP_SessionId(sess_id), |
| 146 | tr_AVP_VendorSpecAppId(?, ?), |
| 147 | tr_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
| 148 | tr_AVP_OriginHost(orig_host), |
| 149 | tr_AVP_OriginRealm(orig_realm), |
| 150 | tr_AVP_DestinationRealm(dest_realm), |
| 151 | tr_AVP_UserNameImsi(imsi), |
| 152 | tr_AVP_3GPP_SIPAuthDataItem(?), |
| 153 | tr_AVP_3GPP_SIPNumAuthDataItems(?) |
| 154 | )); |
| 155 | |
| 156 | /* Multimedia-Auth-Answer, 3GPP TS 29.273 8.2.2.1 Authentication Procedure */ |
| 157 | template (value) PDU_DIAMETER |
| 158 | ts_DIA_SWx_MAA(template (value) hexstring imsi, |
| 159 | template (value) GenericAVP sip_auth_data_item, |
| 160 | template (value) uint32_t vendor_app_id := c_DIAMETER_3GPP_SWx_AID, |
| 161 | template (value) octetstring sess_id := c_def_sess_id, |
| 162 | template (value) charstring orig_host := "hss.localdomain", |
| 163 | template (value) charstring orig_realm := "localdomain", |
| 164 | template (value) UINT32 hbh_id := '00000000'O, |
| 165 | template (value) UINT32 ete_id := '00000000'O) := |
| 166 | ts_DIAMETER(flags := '01000000'B, |
| 167 | cmd_code := Multimedia_Auth, |
| 168 | app_id := int2oct(c_DIAMETER_3GPP_SWx_AID, 4), |
| 169 | hbh_id := hbh_id, |
| 170 | ete_id := ete_id, |
| 171 | avps := { |
| 172 | ts_AVP_SessionId(sess_id), |
| 173 | ts_AVP_VendorSpecAppId(vendor_id_3GPP, valueof(vendor_app_id)), |
| 174 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 175 | ts_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
| 176 | ts_AVP_OriginHost(orig_host), |
| 177 | ts_AVP_OriginRealm(orig_realm), |
| 178 | ts_AVP_UserNameImsi(valueof(imsi)), |
| 179 | sip_auth_data_item, |
| 180 | ts_AVP_3GPP_SIPNumAuthDataItems(1) |
| 181 | }); |
| 182 | |
| 183 | /* Server-Assignment-Request, |
| 184 | * 3GPP TS 29.273 8.1.2.2.2 UE/PDN Registration/DeRegistration Notification |
| 185 | * 3GPP TS 29.273 8.2.2.3 Non-3GPP IP Access Registration Procedure */ |
| 186 | template (present) PDU_DIAMETER |
| 187 | tr_DIA_SWx_SAR(template (present) hexstring imsi := ?, |
| 188 | template (present) octetstring sess_id := ?, |
| 189 | template (present) charstring orig_host := ?, |
| 190 | template (present) charstring orig_realm := ?, |
| 191 | template (present) charstring dest_realm := ?, |
| 192 | template (present) UINT32 hbh_id := ?, |
| 193 | template (present) UINT32 ete_id := ?, |
| 194 | template (present) CxDx_3GPP_Server_Assignment_Type server_ass_type := ?, |
| 195 | template (present) charstring service_selection := ?) := |
| 196 | tr_DIAMETER(flags := '1???????'B, |
| 197 | cmd_code := Server_Assignment, |
| 198 | app_id := int2oct(c_DIAMETER_3GPP_SWx_AID, 4), |
| 199 | hbh_id := hbh_id, ete_id := ete_id, |
| 200 | avps := superset( |
| 201 | tr_AVP_SessionId(sess_id), |
| 202 | tr_AVP_VendorSpecAppId(?, ?), |
| 203 | tr_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
| 204 | tr_AVP_OriginHost(orig_host), |
| 205 | tr_AVP_OriginRealm(orig_realm), |
| 206 | tr_AVP_DestinationRealm(dest_realm), |
| 207 | tr_AVP_UserNameImsi(imsi), |
| 208 | tr_AVP_3GPP_ServerAssignmentType(server_ass_type), |
| 209 | tr_AVP_ServiceSelection(service_selection) |
| 210 | )); |
| 211 | |
| 212 | /* Server-Assignment-Answer, |
| 213 | * 3GPP TS 29.273 8.1.2.2.2 UE/PDN Registration/DeRegistration Notification |
| 214 | * 3GPP TS 29.273 8.2.2.3 Non-3GPP IP Access Registration Procedure */ |
| 215 | template (value) PDU_DIAMETER |
| 216 | ts_DIA_SWx_SAA(template (value) hexstring imsi, |
Pau Espin Pedrol | 9b2ebc0 | 2024-03-05 13:25:19 +0100 | [diff] [blame^] | 217 | template (value) AAA_3GPP_PDN_Type pdn_type, |
| 218 | template (value) charstring apn, |
Pau Espin Pedrol | 4669b61 | 2023-10-23 17:43:14 +0200 | [diff] [blame] | 219 | template (value) uint32_t vendor_app_id := c_DIAMETER_3GPP_SWx_AID, |
| 220 | template (value) octetstring sess_id := c_def_sess_id, |
| 221 | template (value) charstring orig_host := "hss.localdomain", |
| 222 | template (value) charstring orig_realm := "localdomain", |
| 223 | template (value) UINT32 hbh_id := '00000000'O, |
| 224 | template (value) UINT32 ete_id := '00000000'O) := |
| 225 | ts_DIAMETER(flags := '01000000'B, |
| 226 | cmd_code := Server_Assignment, |
| 227 | app_id := int2oct(c_DIAMETER_3GPP_SWx_AID, 4), |
| 228 | hbh_id := hbh_id, |
| 229 | ete_id := ete_id, |
| 230 | avps := { |
| 231 | ts_AVP_SessionId(sess_id), |
| 232 | ts_AVP_VendorSpecAppId(vendor_id_3GPP, valueof(vendor_app_id)), |
| 233 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 234 | ts_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
| 235 | ts_AVP_OriginHost(orig_host), |
| 236 | ts_AVP_OriginRealm(orig_realm), |
Pau Espin Pedrol | 9b2ebc0 | 2024-03-05 13:25:19 +0100 | [diff] [blame^] | 237 | ts_AVP_UserNameImsi(valueof(imsi)), |
| 238 | ts_AVP_3GPP_Non_3GPP_User_Data(pdn_type, apn) |
Pau Espin Pedrol | 4669b61 | 2023-10-23 17:43:14 +0200 | [diff] [blame] | 239 | /* TODO: |
Pau Espin Pedrol | 4669b61 | 2023-10-23 17:43:14 +0200 | [diff] [blame] | 240 | * [ 3GPP-AAA-Server-Name ] |
| 241 | * [ OC-Supported-Features ] |
| 242 | * [ OC-OLR ] ] |
| 243 | * *[ Load ] |
| 244 | * *[ Supported-Features ] |
| 245 | */ |
| 246 | }); |
| 247 | |
| 248 | /******************************* |
| 249 | * S6b 3GPP TS 29.273 section 9 |
| 250 | *******************************/ |
| 251 | |
| 252 | /* TS 29.273 9.2.2.5.1 AA-Request (AAR) */ |
Pau Espin Pedrol | 518e24b | 2024-02-23 17:45:08 +0100 | [diff] [blame] | 253 | template (present) PDU_DIAMETER |
| 254 | tr_DIA_S6b_AAR(template (present) charstring username_nai := ?, |
| 255 | template (present) MIPv6_NONE_MIP6_Feature_Vector mip6_feat_vec := ?, |
| 256 | template (present) charstring apn := ?, |
| 257 | template (present) octetstring sess_id := ?, |
| 258 | template (present) charstring orig_host := ?, |
| 259 | template (present) charstring orig_realm := ?, |
| 260 | template (present) charstring dest_realm := ?, |
| 261 | template (present) UINT32 hbh_id := ?, |
| 262 | template (present) UINT32 ete_id := ?) := |
| 263 | tr_DIAMETER(flags := '1???????'B, |
| 264 | cmd_code := Authorize_Authenticate, |
| 265 | app_id := int2oct(c_DIAMETER_3GPP_S6b_AID, 4), |
| 266 | hbh_id := hbh_id, |
| 267 | ete_id := ete_id, |
| 268 | avps := superset( |
| 269 | tr_AVP_SessionId(sess_id), |
| 270 | /* Optional: DRMP, */ |
| 271 | tr_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_S6b_AID, 4)), |
| 272 | tr_AVP_OriginHost(orig_host), |
| 273 | tr_AVP_OriginRealm(orig_realm), |
| 274 | tr_AVP_DestinationRealm(dest_realm), |
| 275 | tr_AVP_AuthRequestType(AUTHORIZE_ONLY), |
| 276 | tr_AVP_UserName(char2oct_tmpl_present(username_nai)), |
| 277 | tr_AVP_MIP6FeatureVector(mip6_feat_vec), |
| 278 | tr_AVP_ServiceSelection(apn) |
| 279 | /* TODO: Lots other optional */ |
| 280 | )); |
| 281 | |
Pau Espin Pedrol | 4669b61 | 2023-10-23 17:43:14 +0200 | [diff] [blame] | 282 | template (value) PDU_DIAMETER |
Pau Espin Pedrol | 8586b26 | 2024-02-09 18:12:21 +0100 | [diff] [blame] | 283 | ts_DIA_S6b_AAR(template (value) charstring username_nai, |
Pau Espin Pedrol | 7399673 | 2023-10-23 18:16:21 +0200 | [diff] [blame] | 284 | template (value) MIPv6_NONE_MIP6_Feature_Vector mip6_feat_vec, |
Pau Espin Pedrol | 2c2e187 | 2023-10-23 18:31:03 +0200 | [diff] [blame] | 285 | template (value) charstring apn, |
Pau Espin Pedrol | 4669b61 | 2023-10-23 17:43:14 +0200 | [diff] [blame] | 286 | template (value) octetstring sess_id := c_def_sess_id, |
| 287 | template (value) charstring orig_host := "pgw.localdomain", |
| 288 | template (value) charstring orig_realm := "localdomain", |
| 289 | template (value) charstring dest_realm := "localdomain", |
| 290 | template (value) UINT32 hbh_id := '00000000'O, |
| 291 | template (value) UINT32 ete_id := '00000000'O) := |
| 292 | ts_DIAMETER(flags := '11000000'B, |
| 293 | cmd_code := Authorize_Authenticate, |
| 294 | app_id := int2oct(c_DIAMETER_3GPP_S6b_AID, 4), |
| 295 | hbh_id := hbh_id, |
| 296 | ete_id := ete_id, |
| 297 | avps := { |
| 298 | ts_AVP_SessionId(sess_id), |
| 299 | /* Optional: DRMP, */ |
| 300 | ts_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_S6b_AID, 4)), |
| 301 | ts_AVP_OriginHost(orig_host), |
| 302 | ts_AVP_OriginRealm(orig_realm), |
| 303 | ts_AVP_DestinationRealm(dest_realm), |
| 304 | ts_AVP_AuthRequestType(AUTHORIZE_ONLY), |
Pau Espin Pedrol | 8586b26 | 2024-02-09 18:12:21 +0100 | [diff] [blame] | 305 | ts_AVP_UserName(char2oct(valueof(username_nai))), |
Pau Espin Pedrol | 2c2e187 | 2023-10-23 18:31:03 +0200 | [diff] [blame] | 306 | ts_AVP_MIP6FeatureVector(mip6_feat_vec), |
| 307 | ts_AVP_ServiceSelection(valueof(apn)) |
Pau Espin Pedrol | 4669b61 | 2023-10-23 17:43:14 +0200 | [diff] [blame] | 308 | /* TODO: Lots other optional */ |
| 309 | }); |
| 310 | |
| 311 | /* TS 29.273 9.2.2.2.2 AA-Answer (AAA) */ |
| 312 | template (present) PDU_DIAMETER |
| 313 | tr_DIA_S6b_AAA(template (present) octetstring sess_id := ?, |
| 314 | template (present) charstring orig_host := ?, |
| 315 | template (present) charstring orig_realm := ?, |
| 316 | template (present) charstring dest_realm := ?, |
| 317 | template (present) UINT32 hbh_id := ?, |
| 318 | template (present) UINT32 ete_id := ?, |
| 319 | template (present) CxDx_3GPP_Server_Assignment_Type server_ass_type := ?, |
| 320 | template (present) charstring service_selection := ?) := |
| 321 | tr_DIAMETER(flags := '0???????'B, |
| 322 | cmd_code := Authorize_Authenticate, |
| 323 | app_id := int2oct(c_DIAMETER_3GPP_S6b_AID, 4), |
| 324 | hbh_id := hbh_id, ete_id := ete_id, |
| 325 | avps := superset( |
| 326 | tr_AVP_SessionId(sess_id), |
| 327 | /* Optional: DRMP, */ |
| 328 | tr_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_S6b_AID, 4)), |
| 329 | tr_AVP_AuthRequestType(AUTHORIZE_ONLY), |
| 330 | tr_AVP_ResultCode(DIAMETER_SUCCESS), |
| 331 | tr_AVP_OriginHost(orig_host), |
| 332 | tr_AVP_OriginRealm(orig_realm) |
| 333 | )); |
| 334 | |
Pau Espin Pedrol | 518e24b | 2024-02-23 17:45:08 +0100 | [diff] [blame] | 335 | template (value) PDU_DIAMETER |
| 336 | ts_DIA_S6b_AAA(template (value) octetstring sess_id := c_def_sess_id, |
| 337 | template (value) charstring orig_host := "aaa.localdomain", |
| 338 | template (value) charstring orig_realm := "localdomain", |
| 339 | template (value) charstring dest_realm := "localdomain", |
| 340 | template (value) UINT32 hbh_id := '00000000'O, |
| 341 | template (value) UINT32 ete_id := '00000000'O) := |
| 342 | ts_DIAMETER(flags := '01000000'B, |
| 343 | cmd_code := Authorize_Authenticate, |
| 344 | app_id := int2oct(c_DIAMETER_3GPP_S6b_AID, 4), |
| 345 | hbh_id := hbh_id, ete_id := ete_id, |
| 346 | avps := { |
| 347 | ts_AVP_SessionId(sess_id), |
| 348 | /* Optional: DRMP, */ |
| 349 | ts_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_S6b_AID, 4)), |
| 350 | ts_AVP_AuthRequestType(AUTHORIZE_ONLY), |
| 351 | ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| 352 | ts_AVP_OriginHost(orig_host), |
| 353 | ts_AVP_OriginRealm(orig_realm) |
| 354 | }); |
| 355 | |
Pau Espin Pedrol | 4944a5c | 2024-01-24 17:23:01 +0100 | [diff] [blame] | 356 | /* TS 29.273 9.2.2.3.1 Session-Termination-Request (STR) Command, |
| 357 | * Table 9.1.2.3.1/1: S6b Session Termination Request (STR), based on RFC 6733 8.4.1 */ |
| 358 | template (value) PDU_DIAMETER |
| 359 | ts_DIA_S6b_STR(template (value) hexstring imsi, |
| 360 | template (value) BASE_NONE_Termination_Cause term_cause := DIAMETER_LOGOUT, |
| 361 | template (value) octetstring sess_id := c_def_sess_id, |
| 362 | template (value) charstring orig_host := "pgw.localdomain", |
| 363 | template (value) charstring orig_realm := "localdomain", |
| 364 | template (value) charstring dest_realm := "localdomain", |
| 365 | template (value) UINT32 hbh_id := '00000000'O, |
| 366 | template (value) UINT32 ete_id := '00000000'O) := |
| 367 | ts_DIAMETER(flags := '11000000'B, |
| 368 | cmd_code := Session_Termination, |
| 369 | app_id := int2oct(c_DIAMETER_3GPP_S6b_AID, 4), |
| 370 | hbh_id := hbh_id, |
| 371 | ete_id := ete_id, |
| 372 | avps := { |
| 373 | ts_AVP_SessionId(sess_id), |
| 374 | /* Optional: DRMP */ |
| 375 | ts_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_S6b_AID, 4)), |
| 376 | ts_AVP_OriginHost(orig_host), |
| 377 | ts_AVP_OriginRealm(orig_realm), |
| 378 | ts_AVP_DestinationRealm(dest_realm), |
| 379 | ts_AVP_TerminationCause(term_cause), |
| 380 | ts_AVP_UserNameImsi(valueof(imsi)) |
| 381 | /* Optional: OC-Supported-Features */ |
| 382 | }); |
| 383 | |
| 384 | /* TS 29.273 9.2.2.3.2 Session-Termination-Answer (STA) Command, |
| 385 | * Table 9.1.2.3.1/2: S6b Session Termination Answer (STA), based on RFC 6733 8.4.2 */ |
| 386 | template (present) PDU_DIAMETER |
| 387 | tr_DIA_S6b_STA(template (present) DIAMETER_Resultcode res_code := ?, |
| 388 | template (present) octetstring sess_id := ?, |
| 389 | template (present) charstring orig_host := ?, |
| 390 | template (present) charstring orig_realm := ?, |
| 391 | template (present) charstring dest_realm := ?, |
| 392 | template (present) UINT32 hbh_id := ?, |
| 393 | template (present) UINT32 ete_id := ?) := |
| 394 | tr_DIAMETER(flags := '0???????'B, |
| 395 | cmd_code := Session_Termination, |
| 396 | app_id := int2oct(c_DIAMETER_3GPP_S6b_AID, 4), |
| 397 | hbh_id := hbh_id, ete_id := ete_id, |
| 398 | avps := superset( |
| 399 | tr_AVP_SessionId(sess_id), |
| 400 | /* Optional: DRMP */ |
| 401 | tr_AVP_ResultCode(res_code), |
| 402 | tr_AVP_OriginHost(orig_host), |
| 403 | tr_AVP_OriginRealm(orig_realm) |
| 404 | /* Lots other Optional */ |
| 405 | )); |
| 406 | |
Pau Espin Pedrol | 4669b61 | 2023-10-23 17:43:14 +0200 | [diff] [blame] | 407 | } |