module DIAMETER_ts29_212_Templates { /* (C) 2023 by sysmocom s.f.m.c. GmbH <info@sysmocom.de * 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.212 */ import from General_Types all; import from DIAMETER_Types all; import from DIAMETER_Templates all; import from Osmocom_Types all; import from Misc_Helpers all; /******************************* * S6a 3GPP TS 29.212 section 7 *******************************/ /* 3GPP TS 29.212 Section 5.1 */ const uint32_t c_DIAMETER_3GPP_Gx_AID := 16777238; /* 3GPP TS 29.212 5.6.2 Credit-Control-Request (CC-Request, CCR) Command */ template (present) PDU_DIAMETER tr_DIA_Gx_CCR(template (present) DCC_NONE_CC_Request_Type req_type := INITIAL_REQUEST) := tr_DIAMETER(flags:='11000000'B, cmd_code:=Credit_Control, avps := superset( tr_AVP_SessionId, tr_AVP_OriginHost, tr_AVP_OriginRealm, tr_AVP_DestinationRealm, tr_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_Gx_AID, 4)), tr_AVP_CcReqType(req_type), tr_AVP_CcReqNum(?) )); template (value) PDU_DIAMETER ts_DIA_Gx_CCR(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, template (value) octetstring sess_id, template (value) DCC_NONE_Subscription_Id subscr_id, template (value) DNAS_NONE_Called_Station_Id called_station_id, template (value) DCC_NONE_CC_Request_Type req_type := INITIAL_REQUEST, template (value) AVP_Unsigned32 req_num := '00000000'O) := ts_DIAMETER(flags:='11000000'B, cmd_code:=Credit_Control, app_id:=int2oct(c_DIAMETER_3GPP_Gx_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id, avps := { ts_AVP_SessionId(sess_id), ts_AVP_OriginHost("pcrf.localdomain"), ts_AVP_OriginRealm("localdomain"), ts_AVP_DestinationRealm("localdomain"), ts_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_Gx_AID, 4)), ts_AVP_CcReqType(req_type), ts_AVP_CcReqNum(req_num), ts_AVP_SubcrId(subscr_id), ts_AVP_3GPP_CalledStationId(called_station_id) }); /* 3GPP TS 29.212 5.6.3 Credit-Control-Answer (CC-Answer, CCA) Command */ template (value) PDU_DIAMETER 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 := { ts_AVP_SessionId(sess_id), ts_AVP_ResultCode(DIAMETER_SUCCESS), ts_AVP_OriginHost("pcrf.localdomain"), ts_AVP_OriginRealm("localdomain"), ts_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_Gx_AID, 4)), ts_AVP_CcReqType(req_type), ts_AVP_CcReqNum(req_num), ts_AVP_PCC_3GPP_QoS_Information({ ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL(33554432), ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL(52428800) }), ts_AVP_PCC_3GPP_Default_EPS_Bearer_QoS({ ts_AVP_PCC_3GPP_QoS_Class_Identifier(9), ts_AVP_PCC_3GPP_AllocRetenPrio(2) }) // supported features // origin }); template (present) PDU_DIAMETER tr_DIA_Gx_CCA(template (present) octetstring sess_id := ?, template (present) DCC_NONE_CC_Request_Type req_type := ?, template (present) DIAMETER_Resultcode res_code := DIAMETER_SUCCESS) := tr_DIAMETER(flags:='01000000'B, cmd_code:=Credit_Control, avps := superset( tr_AVP_SessionId(sess_id), tr_AVP_ResultCode(res_code), tr_AVP_OriginHost, tr_AVP_OriginRealm, tr_AVP_AuthAppId(int2oct(c_DIAMETER_3GPP_Gx_AID, 4)), tr_AVP_CcReqType(req_type), tr_AVP_CcReqNum(?) )); } /* module */