diff options
Diffstat (limited to 'library/DIAMETER_Templates.ttcn')
-rw-r--r-- | library/DIAMETER_Templates.ttcn | 121 |
1 files changed, 118 insertions, 3 deletions
diff --git a/library/DIAMETER_Templates.ttcn b/library/DIAMETER_Templates.ttcn index f7244d81..24b9cd89 100644 --- a/library/DIAMETER_Templates.ttcn +++ b/library/DIAMETER_Templates.ttcn @@ -100,6 +100,8 @@ type enumerated DIAMETER_Resultcode { DIAMETER_ERROR_EAP_CODE_UNKNOWN (5048) }; +/* Gy : 3GPP TS 32.299 7.1.6, RFC4006 3.1 */ +const uint32_t c_DIAMETER_CREDIT_CONTROL_AID := 4; /* 3GPP TS 29.272 Section 7.1.8 */ const uint32_t c_DIAMETER_3GPP_Gx_AID := 16777238; const uint32_t c_DIAMETER_3GPP_S6_AID := 16777251; @@ -860,6 +862,56 @@ template (value) GenericAVP ts_AVP_3GPP_PdnType(template (value) AAA_3GPP_PDN_Ty } } +/* RFC4006 8.16 Multiple-Services-Credit-Control AVP */ +template (value) GenericAVP ts_AVP_Multiple_Services_Credit_Control(template (value) AVP_list content) := { + avp := { + avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_Multiple_Services_Credit_Control), + avp_data := { + avp_DCC_NONE_Multiple_Services_Credit_Control := content + } + } +} + +/* RFC4006 8.17 Granted-Service-Unit AVP */ +template (value) GenericAVP ts_AVP_Granted_Service_Unit(template (value) AVP_list content) := { + avp := { + avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_Granted_Service_Unit), + avp_data := { + avp_DCC_NONE_Granted_Service_Unit := content + } + } +} + +/* RFC4006 8.21 CC-Time AVP */ +template (value) GenericAVP ts_AVP_CC_Time(uint32_t cc_time_val) := { + avp := { + avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Time), + avp_data := { + avp_DCC_NONE_CC_Time := int2oct(cc_time_val, 4) + } + } +} + +/* RFC4006 8.23 CC-Total-Octets AVP */ +template (value) GenericAVP ts_AVP_CC_Total_Octets(uint64_t cc_total_octets_val) := { + avp := { + avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Total_Octets), + avp_data := { + avp_DCC_NONE_CC_Total_Octets := int2oct(cc_total_octets_val, 8) + } + } +} + +/* RFC4006 8.33 Validity-Time AVP */ +template (value) GenericAVP ts_AVP_Validity_Time(uint32_t validity_time_val) := { + avp := { + avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_Validity_Time), + avp_data := { + avp_DCC_NONE_Validity_Time := int2oct(validity_time_val, 4) + } + } +} + /* 5.3.2 Capabilities Exchange Answer */ @@ -1101,7 +1153,7 @@ tr_DIA_ULA(template (present) AVP_list sub_data := ?, /* RFC 4006 3.1. Credit-Control-Request (CCR) Command */ template (present) PDU_DIAMETER -tr_DIA_CCR(template (present) DCC_NONE_CC_Request_Type req_type := INITIAL_REQUEST) +tr_DIA_Gx_CCR(template (present) DCC_NONE_CC_Request_Type req_type := INITIAL_REQUEST) := tr_DIAMETER(flags:='11000000'B, cmd_code:=Credit_Control, app_id:=int2oct(c_DIAMETER_3GPP_Gx_AID, 4), avps := superset( @@ -1113,15 +1165,28 @@ tr_DIA_CCR(template (present) DCC_NONE_CC_Request_Type req_type := INITIAL_REQUE tr_AVP_CcReqType(req_type), tr_AVP_CcReqNum(?) )); +template (present) PDU_DIAMETER +tr_DIA_Gy_CCR(template (present) DCC_NONE_CC_Request_Type req_type := INITIAL_REQUEST) +:= tr_DIAMETER(flags:='11000000'B, cmd_code:=Credit_Control, + app_id:=int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4), + avps := superset( + tr_AVP_SessionId, + tr_AVP_OriginHost, + tr_AVP_OriginRealm, + tr_AVP_DestinationRealm, + tr_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)), + tr_AVP_CcReqType(req_type), + tr_AVP_CcReqNum(?) + )); + /* RFC 4006 3.2. Credit-Control-Answer (CCA) Command */ template (value) PDU_DIAMETER -ts_DIA_CCA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, +ts_DIA_Gx_CCA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, template (value) octetstring sess_id, template (value) DCC_NONE_CC_Request_Type req_type, template (value) AVP_Unsigned32 req_num) - := ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control, app_id:=int2oct(c_DIAMETER_3GPP_Gx_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id, avps := { @@ -1137,6 +1202,56 @@ ts_DIA_CCA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, // supported features // origin }); +template (value) PDU_DIAMETER +ts_DIA_Gy_CCA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, + template (value) octetstring sess_id, + template (value) DCC_NONE_CC_Request_Type req_type, + template (value) AVP_Unsigned32 req_num) +:= ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control, + app_id:=int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id, + avps := { + ts_AVP_SessionId(sess_id), + ts_AVP_ResultCode(DIAMETER_SUCCESS), + ts_AVP_OriginHost("ocs.localdomain"), + ts_AVP_OriginRealm("localdomain"), + ts_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)), + ts_AVP_CcReqType(req_type), + ts_AVP_CcReqNum(req_num)//, + // qos + // default eps bearer qos + // supported features + // origin + }); +/* Same as ts_DIA_Gy_CCA, but with extra AVP to grant access for limited amount of seconds */ +template (value) PDU_DIAMETER +ts_DIA_Gy_CCA_ValidityTime(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, + template (value) octetstring sess_id, + template (value) DCC_NONE_CC_Request_Type req_type, + template (value) AVP_Unsigned32 req_num, + uint32_t validity_time) +:= ts_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control, + app_id:=int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id, + avps := { + ts_AVP_SessionId(sess_id), + ts_AVP_ResultCode(DIAMETER_SUCCESS), + ts_AVP_OriginHost("ocs.localdomain"), + ts_AVP_OriginRealm("localdomain"), + ts_AVP_AuthAppId(int2oct(c_DIAMETER_CREDIT_CONTROL_AID, 4)), + ts_AVP_CcReqType(req_type), + ts_AVP_CcReqNum(req_num), + ts_AVP_Multiple_Services_Credit_Control({ + ts_AVP_Validity_Time(validity_time), + ts_AVP_Granted_Service_Unit({ + //ts_AVP_CC_Time(validity_time*2), + ts_AVP_CC_Total_Octets(1000) + }) + }) + //, + // qos + // default eps bearer qos + // supported features + // origin + }); /* RFC 6733, section 5.5.1 "Device-Watchdog-Request" */ template (value) PDU_DIAMETER |