DIAMETER_Templates: Add S6b AAR and AAA message templates

Related: OS#6229
Change-Id: I302d9a94e6ffbb62b6db81e1b14484355e55ebe5
This commit is contained in:
Pau Espin 2023-10-23 14:37:24 +02:00
parent d19fdf59b3
commit 44b7520f62
1 changed files with 77 additions and 3 deletions

View File

@ -127,6 +127,8 @@ const uint32_t c_DIAMETER_3GPP_S13_AID := 16777252;
const uint32_t c_DIAMETER_3GPP_S7_AID := 16777308;
/* 3GPP TS 29.273 Section 8.2 */
const uint32_t c_DIAMETER_3GPP_SWx_AID := 16777265;
/* 3GPP TS 29.273 Section 9 */
const uint32_t c_DIAMETER_3GPP_S6b_AID := 16777272;
const octetstring c_def_sess_id := char2oct("ttcn3.session");
@ -1518,6 +1520,24 @@ template (present) GenericAVP tr_AVP_3GPP_CalledStationId(template (present) DNA
}
}
/* RFC6733 8.7. Auth-Request-Type AVP */
template (value) GenericAVP ts_AVP_AuthRequestType(BASE_NONE_Auth_Request_Type auth_req_type) := {
avp := {
avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Request_Type, '00000000'B),
avp_data := {
avp_BASE_NONE_Auth_Request_Type := auth_req_type
}
}
}
template (present) GenericAVP tr_AVP_AuthRequestType(template (present) BASE_NONE_Auth_Request_Type auth_req_type) := {
avp := {
avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Request_Type),
avp_data := {
avp_BASE_NONE_Auth_Request_Type := auth_req_type
}
}
}
/* 5.3.1 Capabilities Exchange Request */
template (value) PDU_DIAMETER
@ -2276,9 +2296,9 @@ template (value) GenericAVP ts_AVP_3GPP_ServerAssignmentType(template (value) Cx
}
}
/*****************************
* SWx 3GPP TS 29.273
*****************************/
/*******************************
* SWx 3GPP TS 29.273 section 8
*******************************/
/* SIP-Auth-Data-Item , 3GPP TS 29.273 8.2.3.9 */
template (present) GenericAVP tr_AVP_3GPP_SIPAuthDataItem(template (present) uint32_t num := ?) := {
@ -2445,4 +2465,58 @@ ts_DIA_SWx_SAA(template (value) hexstring imsi,
*/
});
/*******************************
* S6b 3GPP TS 29.273 section 9
*******************************/
/* TS 29.273 9.2.2.5.1 AA-Request (AAR) */
template (value) PDU_DIAMETER
ts_DIA_S6b_AAR(template (value) hexstring imsi,
template (value) octetstring sess_id := c_def_sess_id,
template (value) charstring orig_host := "pgw.localdomain",
template (value) charstring orig_realm := "localdomain",
template (value) charstring dest_realm := "localdomain",
template (value) UINT32 hbh_id := '00000000'O,
template (value) UINT32 ete_id := '00000000'O) :=
ts_DIAMETER(flags := '11000000'B,
cmd_code := Authorize_Authenticate,
app_id := int2oct(c_DIAMETER_3GPP_S6b_AID, 4),
hbh_id := hbh_id,
ete_id := ete_id,
avps := {
ts_AVP_SessionId(sess_id),
/* Optional: DRMP, */
ts_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_S6b_AID, 4)),
ts_AVP_OriginHost(orig_host),
ts_AVP_OriginRealm(orig_realm),
ts_AVP_DestinationRealm(dest_realm),
ts_AVP_AuthRequestType(AUTHORIZE_ONLY),
ts_AVP_UserNameImsi(valueof(imsi))
/* TODO: Lots other optional */
});
/* TS 29.273 9.2.2.2.2 AA-Answer (AAA) */
template (present) PDU_DIAMETER
tr_DIA_S6b_AAA(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 := '0???????'B,
cmd_code := Authorize_Authenticate,
app_id := int2oct(c_DIAMETER_3GPP_S6b_AID, 4),
hbh_id := hbh_id, ete_id := ete_id,
avps := superset(
tr_AVP_SessionId(sess_id),
/* Optional: DRMP, */
tr_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_S6b_AID, 4)),
tr_AVP_AuthRequestType(AUTHORIZE_ONLY),
tr_AVP_ResultCode(DIAMETER_SUCCESS),
tr_AVP_OriginHost(orig_host),
tr_AVP_OriginRealm(orig_realm)
));
}