| module DIAMETER_Templates { |
| |
| /* (C) 2019 by Harald Welte <laforge@gnumonks.org> |
| * 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 |
| */ |
| |
| import from DIAMETER_Types all; |
| import from Osmocom_Types all; |
| import from Misc_Helpers all; |
| |
| /* https://www.iana.org/assignments/aaa-parameters/aaa-parameters.xhtml#aaa-parameters-4 */ |
| type enumerated DIAMETER_Resultcode { |
| /* Informational */ |
| DIAMETER_MULTI_ROUND_AUTH (1001), |
| |
| /* Success */ |
| DIAMETER_SUCCESS (2001), |
| DIAMETER_LIMITED_SUCCESS (2002), |
| DIAMETER_FIRST_REGISTRATION (2003), |
| DIAMETER_SUBSEQUENT_REGISTRATION (2004), |
| DIAMETER_UNREGISTERED_SERVICE (2005), |
| DIAMETER_SUCCESS_SERVER_NAME_NOT_STORED (2006), |
| DIAMETER_SERVER_SELECTION (2007), |
| DIAMETER_SUCCESS_AUTH_SENT_SERVER_NOT_STORED (2008), |
| DIAMETER_SUCCESS_RELOCATE_HA (2009), |
| |
| /* Protocol Errors */ |
| DIAMETER_COMMAND_UNSUPPORTED (3001), |
| DIAMETER_UNABLE_TO_DELIVER (3002), |
| DIAMETER_REALM_NOT_SERVED (3003), |
| DIAMETER_TOO_BUSY (3004), |
| DIAMETER_LOOP_DETECTED (3005), |
| DIAMETER_REDIRECT_INDICATION (3006), |
| DIAMETER_APPLICATION_UNSUPPORTED (3007), |
| DIAMETER_INVALID_HDR_BITS (3008), |
| DIAMETER_INVALID_AVP_BITS (3009), |
| DIAMETER_UNKNOWN_PEER (3010), |
| DIAMETER_REALM_REDIRECT_INDICATION (3011), |
| |
| /* Transient Failures */ |
| DIAMETER_AUTHENTICATION_REJECTED (4001), |
| DIAMETER_OUT_OF_SPACE (4002), |
| ELECTION_LOST (4003), |
| DIAMETER_ERROR_MIP_REPLY_FAILURE (4005), |
| DIAMETER_ERROR_HA_NOT_AVAILABLE (4006), |
| DIAMETER_ERROR_BAD_KEY (4007), |
| DIAMETER_ERROR_MIP_FILTER_NOT_SUPPORTED (4008), |
| DIAMETER_END_USER_SERVICE_DENIED (4010), |
| DIAMETER_CREDIT_CONTROL_NOT_APPLICABLE (4011), |
| DIAMETER_CREDIT_LIMIT_REACHED (4012), |
| DIAMETER_USER_NAME_REQUIRED (4013), |
| RESOURCE_FAILURE (4014), |
| |
| DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE (4181), |
| DIAMETER_ERROR_CAMEL_SUBSCRIPTION_PRESENT (4882), |
| |
| /* Permanent Failure */ |
| DIAMETER_AVP_UNSUPPORTED (5001), |
| DIAMETER_UNKNOWN_SESSION_ID (5002), |
| DIAMETER_AUTHORIZATION_REJECTED (5003), |
| DIAMETER_INVALID_AVP_VALUE (5004), |
| DIAMETER_MISSING_AVP (5005), |
| DIAMETER_RESOURCES_EXCEEDED (5006), |
| DIAMETER_CONTRADICTING_AVPS (5007), |
| DIAMETER_AVP_NOT_ALLOWED (5008), |
| DIAMETER_AVP_OCCURS_TOO_MANY_TIMES (5009), |
| DIAMETER_NO_COMMON_APPLICATION (5010), |
| DIAMETER_UNSUPPORTED_VERSION (5011), |
| DIAMETER_UNABLE_TO_COMPLY (5012), |
| DIAMETER_INVALID_BIT_IN_HEADER (5013), |
| DIAMETER_INVALID_AVP_LENGTH (5014), |
| DIAMETER_INVALID_MESSAGE_LENGTH (5015), |
| DIAMETER_INVALID_AVP_BIT_COMBO (5016), |
| DIAMETER_NO_COMMON_SECURITY (5017), |
| DIAMETER_RADIUS_AVP_UNTRANSLATABLE (5018), |
| DIAMETER_ERROR_NO_FOREIGN_HA_SERVICE (5024), |
| DIAMETER_ERROR_END_TO_END_MIP_KEY_ENCRYPTION (5025), |
| DIAMETER_USER_UNKNOWN (5030), |
| DIAMETER_RATING_FAILED (5031), |
| DIAMETER_ERROR_USER_UNKNOWN (5032), |
| DIAMETER_ERROR_IDENTITIES_DONT_MATCH (5033), |
| DIAMETER_ERROR_IDENTITY_NOT_REGISTERED (5034), |
| DIAMETER_ERROR_ROAMING_NOT_ALLOWED (5035), |
| DIAMETER_ERROR_IDENTITY_ALREADY_REGISTERED (5036), |
| DIAMETER_ERROR_AUTH_SCHEME_NOT_SUPPORTED (5037), |
| DIAMETER_ERROR_IN_ASSIGNMENT_TYPE (5038), |
| DIAMETER_ERROR_TOO_MUCH_DATA (5039), |
| DIAMETER_ERROR_NOT_SUPPORTED_USER_DATA (5040), |
| DIAMETER_ERROR_MIP6_AUTH_MODE (5041), |
| UNKNOWN_BINDING_TEMPLATE_NAME (5042), |
| BINDING_FAILURE (5043), |
| MAX_BINDINGS_SET_FAILURE (5044), |
| MAXIMUM_BINDINGS_REACHED_FOR_ENDPOINT (5045), |
| SESSION_EXISTS (5046), |
| INSUFFICIENT_CLASSIFIERS (5047), |
| 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; |
| const uint32_t c_DIAMETER_3GPP_S13_AID := 16777252; |
| const uint32_t c_DIAMETER_3GPP_S7_AID := 16777308; |
| |
| const octetstring c_def_sess_id := char2oct("ttcn3.session"); |
| |
| template (value) PDU_DIAMETER |
| ts_DIAMETER(template (value) BIT8 flags, |
| template (value) Command_Code cmd_code, |
| template (value) OCTET4 app_id := '00000000'O, |
| template (value) UINT32 hbh_id := '00000000'O, |
| template (value) UINT32 ete_id := '00000000'O, |
| template (value) AVP_list avps := {} |
| ) := { |
| version := 1, |
| message_length := 0, /* overwritten */ |
| RPETxxxx := flags, |
| command_code := cmd_code, |
| application_id := app_id, |
| hop_by_hop_id := hbh_id, |
| end_to_end_id := ete_id, |
| avps := avps |
| } |
| template (present) PDU_DIAMETER |
| tr_DIAMETER(template (present) BIT8 flags := ?, |
| template (present) Command_Code cmd_code := ?, |
| template (present) OCTET4 app_id := ?, |
| template (present) UINT32 hbh_id := ?, |
| template (present) UINT32 ete_id := ?, |
| template (present) AVP_list avps := ?) := { |
| version := 1, |
| message_length := ?, |
| RPETxxxx := flags, |
| command_code := cmd_code, |
| application_id := app_id, |
| hop_by_hop_id := hbh_id, |
| end_to_end_id := ete_id, |
| avps := avps |
| } |
| template (present) PDU_DIAMETER |
| tr_DIAMETER_A( |
| template (present) Command_Code cmd_code := ?, |
| template (present) OCTET4 app_id := ?, |
| template (present) UINT32 hbh_id := ?, |
| template (present) UINT32 ete_id := ?, |
| template (present) AVP_list avps := ?) := |
| tr_DIAMETER('0???????'B, cmd_code, app_id, hbh_id, ete_id, avps); |
| template (present) PDU_DIAMETER |
| tr_DIAMETER_R( |
| template (present) Command_Code cmd_code := ?, |
| template (present) OCTET4 app_id := ?, |
| template (present) UINT32 hbh_id := ?, |
| template (present) UINT32 ete_id := ?, |
| template (present) AVP_list avps := ?) := |
| tr_DIAMETER('1???????'B, cmd_code, app_id, hbh_id, ete_id, avps); |
| |
| |
| template (value) AVP_Header |
| ts_DIA_Hdr(template (value) AVP_Code avp_code, |
| template (value) BIT8 flags := '01000000'B) := { |
| avp_code := avp_code, |
| VMPxxxxx := flags, |
| avp_length := 0, /* overwritten */ |
| vendor_id := omit |
| } |
| template (present) AVP_Header |
| tr_DIA_Hdr(template (present) AVP_Code avp_code, |
| template (present) BIT8 flags := '0???????'B) := { |
| avp_code := avp_code, |
| VMPxxxxx := flags, |
| avp_length := ?, /* overwritten */ |
| vendor_id := omit |
| } |
| |
| template (value) AVP_Header |
| ts_DIA_Hdr_3GPP(template (value) AVP_Code avp_code, |
| template (value) BIT8 flags := '11000000'B) := { |
| avp_code := avp_code, |
| VMPxxxxx := flags, |
| avp_length := 0, /* overwritten */ |
| vendor_id := vendor_id_3GPP |
| } |
| template (present) AVP_Header |
| tr_DIA_Hdr_3GPP(template (present) AVP_Code avp_code, |
| template (present) BIT8 flags := '1???????'B) := { |
| avp_code := avp_code, |
| VMPxxxxx := flags, |
| avp_length := ?, /* overwritten */ |
| vendor_id := vendor_id_3GPP |
| } |
| |
| template (present) AVP_Address tr_AVP_Address(template (present) AddressType addr_type := ?, |
| template (present) octetstring addr_data := ?) := { |
| address_type := addr_type, |
| address_data := addr_data |
| } |
| |
| template (present) GenericAVP tr_AVP_SubcrId(template (present) DCC_NONE_Subscription_Id t) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Subscription_Id), |
| avp_data := { |
| avp_DCC_NONE_Subscription_Id := t |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_SubcrIdType(template (present) DCC_NONE_Subscription_Id_Type t) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Subscription_Id_Type), |
| avp_data := { |
| avp_DCC_NONE_Subscription_Id_Type := t |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_SubcrIdData(template (present) DCC_NONE_Subscription_Id_Data t) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Subscription_Id_Data), |
| avp_data := { |
| avp_DCC_NONE_Subscription_Id_Data := t |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_RequestedAction(template (present) DCC_NONE_Requested_Action t := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Requested_Action), |
| avp_data := { |
| avp_DCC_NONE_Requested_Action := t |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_MultipleServicesIndicator(template (present) DCC_NONE_Multiple_Services_Indicator t := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Multiple_Services_Indicator), |
| avp_data := { |
| avp_DCC_NONE_Multiple_Services_Indicator := t |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_ServiceContextId(template (present) DCC_NONE_Service_Context_Id id := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Service_Context_Id), |
| avp_data := { |
| avp_DCC_NONE_Service_Context_Id := id |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_OriginHost(template (value) charstring host) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Host), |
| avp_data := { |
| avp_BASE_NONE_Origin_Host := host |
| } |
| } |
| } |
| template (present) GenericAVP tr_AVP_OriginHost(template (present) charstring host := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Host), |
| avp_data := { |
| avp_BASE_NONE_Origin_Host := host |
| } |
| } |
| } |
| |
| |
| template (value) GenericAVP ts_AVP_OriginRealm(template (value) charstring realm) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Realm), |
| avp_data := { |
| avp_BASE_NONE_Origin_Realm := realm |
| } |
| } |
| } |
| template (present) GenericAVP tr_AVP_OriginRealm(template (present) charstring realm := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_Realm), |
| avp_data := { |
| avp_BASE_NONE_Origin_Realm := realm |
| } |
| } |
| } |
| |
| |
| template (value) GenericAVP ts_AVP_OriginStateId(template (value) OCTET4 state_id) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_State_Id), |
| avp_data := { |
| avp_BASE_NONE_Origin_State_Id := state_id |
| } |
| } |
| } |
| template (present) GenericAVP tr_AVP_OriginStateId(template (present) OCTET4 state_id := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Origin_State_Id), |
| avp_data := { |
| avp_BASE_NONE_Origin_State_Id := state_id |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_TerminationCause(template (present) BASE_NONE_Termination_Cause tc) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Termination_Cause), |
| avp_data := { |
| avp_BASE_NONE_Termination_Cause := tc |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_HostIpAddr(template (value) OCTET4 ipv4_addr) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Host_IP_Address), |
| avp_data := { |
| avp_BASE_NONE_Host_IP_Address := { |
| address_type := IP, |
| address_data := ipv4_addr |
| } |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_VendorId(Vendor_Id vendor_id) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id, '00000000'B), |
| avp_data := { |
| avp_BASE_NONE_Vendor_Id := int2oct(enum2int(vendor_id), 4) |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_ProductName(charstring name) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Product_Name, '00000000'B), |
| avp_data := { |
| avp_BASE_NONE_Product_Name := char2oct(name) |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_FwRevision(octetstring fw_version) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Firmware_Revision, '00000000'B), |
| avp_data := { |
| avp_BASE_NONE_Firmware_Revision := fw_version |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_InbSecId(template (value) OCTET4 inb_sec_id) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Inband_Security_Id), |
| avp_data := { |
| avp_BASE_NONE_Inband_Security_Id := inb_sec_id |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_VendorSpecAppId(Vendor_Id vendor_id, uint32_t auth_app_id) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Specific_Application_Id), |
| avp_data := { |
| avp_BASE_NONE_Vendor_Specific_Application_Id := { |
| { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Vendor_Id), |
| avp_data := { |
| avp_BASE_NONE_Vendor_Id := int2oct(enum2int(vendor_id), 4) |
| } |
| } |
| }, { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id), |
| avp_data := { |
| avp_BASE_NONE_Auth_Application_Id := int2oct(auth_app_id, 4) |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_AuthAppId(template (value) OCTET4 auth_app_id) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id), |
| avp_data := { |
| avp_BASE_NONE_Auth_Application_Id := auth_app_id |
| } |
| } |
| } |
| template (present) GenericAVP tr_AVP_AuthAppId(template (present) OCTET4 auth_app_id := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Application_Id), |
| avp_data := { |
| avp_BASE_NONE_Auth_Application_Id := auth_app_id |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_CcReqType(template (value) DCC_NONE_CC_Request_Type r) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Type), |
| avp_data := { |
| avp_DCC_NONE_CC_Request_Type := r |
| } |
| } |
| } |
| template (present) GenericAVP tr_AVP_CcReqType(template (present) DCC_NONE_CC_Request_Type r := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Type), |
| avp_data := { |
| avp_DCC_NONE_CC_Request_Type := r |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_CcReqNum(template (value) AVP_Unsigned32 n) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Number), |
| avp_data := { |
| avp_DCC_NONE_CC_Request_Number := n |
| } |
| } |
| } |
| template (present) GenericAVP tr_AVP_CcReqNum(template (present) AVP_Unsigned32 n := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_CC_Request_Number), |
| avp_data := { |
| avp_DCC_NONE_CC_Request_Number := n |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_EventTimestamp(template (present) AVP_Unsigned32 n := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Event_Timestamp), |
| avp_data := { |
| avp_BASE_NONE_Event_Timestamp := n |
| } |
| } |
| } |
| |
| |
| template (value) GenericAVP ts_AVP_SuppVendorIdRaw(uint32_t vendor_id) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Supported_Vendor_Id), |
| avp_data := { |
| avp_BASE_NONE_Supported_Vendor_Id := int2oct(vendor_id, 4) |
| } |
| } |
| } |
| template (value) GenericAVP ts_AVP_SuppVendorId(Vendor_Id vendor_id) := |
| ts_AVP_SuppVendorIdRaw(enum2int(vendor_id)); |
| |
| template (value) GenericAVP ts_AVP_ResultCode(DIAMETER_Resultcode res_code) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Result_Code), |
| avp_data := { |
| avp_BASE_NONE_Result_Code := int2oct(enum2int(res_code), 4) |
| } |
| } |
| } |
| template (present) GenericAVP tr_AVP_ResultCode(DIAMETER_Resultcode res_code) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Result_Code), |
| avp_data := { |
| avp_BASE_NONE_Result_Code := int2oct(enum2int(res_code), 4) |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_AuthSessionState(template (value) BASE_NONE_Auth_Session_State ass := NO_STATE_MAINTAINED) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Session_State), |
| avp_data := { |
| avp_BASE_NONE_Auth_Session_State := ass |
| } |
| } |
| } |
| template (present) GenericAVP tr_AVP_AuthSessionState(template (present) BASE_NONE_Auth_Session_State ass := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Auth_Session_State), |
| avp_data := { |
| avp_BASE_NONE_Auth_Session_State := ass |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_SessionId(template (value) octetstring session_id) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Session_Id), |
| avp_data := { |
| avp_BASE_NONE_Session_Id := session_id |
| } |
| } |
| } |
| template (present) GenericAVP tr_AVP_SessionId(template (present) octetstring session_id := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Session_Id), |
| avp_data := { |
| avp_BASE_NONE_Session_Id := session_id |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_DestinationHost(template (present) charstring host := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Destination_Host), |
| avp_data := { |
| avp_BASE_NONE_Destination_Host := host |
| } |
| } |
| } |
| |
| /* 3.3 Destination Realm */ |
| template (value) GenericAVP ts_AVP_DestinationRealm(template (value) charstring dest_realm) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_Destination_Realm), |
| avp_data := { |
| avp_BASE_NONE_Destination_Realm := dest_realm |
| } |
| } |
| } |
| template (present) GenericAVP tr_AVP_DestinationRealm(template (present) charstring dest_realm := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_Destination_Realm), |
| avp_data := { |
| avp_BASE_NONE_Destination_Realm := dest_realm |
| } |
| } |
| } |
| |
| /* 8.14 User-Name */ |
| template (value) GenericAVP ts_AVP_UserName(template (value) octetstring uid) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_BASE_NONE_User_Name), |
| avp_data := { |
| avp_BASE_NONE_User_Name := uid |
| } |
| } |
| } |
| template (present) GenericAVP tr_AVP_UserName(template (present) octetstring uid := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_BASE_NONE_User_Name), |
| avp_data := { |
| avp_BASE_NONE_User_Name := uid |
| } |
| } |
| } |
| template (value) GenericAVP ts_AVP_UserNameImsi(hexstring imsi) := ts_AVP_UserName(char2oct(hex2str(imsi))); |
| template (present) GenericAVP tr_AVP_UserNameImsi(hexstring imsi) := tr_AVP_UserName(char2oct(hex2str(imsi))); |
| |
| |
| |
| /* TS 29.272 7.3.53 RAND */ |
| template (value) GenericAVP ts_AVP_RAND(template (value) octetstring rand) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_RAND), |
| avp_data := { |
| avp_AAA_3GPP_RAND := rand |
| } |
| } |
| } |
| |
| /* TS 29.272 7.3.54 XRES */ |
| template (value) GenericAVP ts_AVP_XRES(template (value) octetstring xres) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_XRES), |
| avp_data := { |
| avp_AAA_3GPP_XRES := xres |
| } |
| } |
| } |
| |
| /* TS 29.272 7.3.55 XRES */ |
| template (value) GenericAVP ts_AVP_AUTN(template (value) octetstring autn) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_AUTN), |
| avp_data := { |
| avp_AAA_3GPP_AUTN := autn |
| } |
| } |
| } |
| |
| /* TS 29.272 7.3.56 KASME */ |
| template (value) GenericAVP ts_AVP_KASME(template (value) octetstring kasme) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_KASME), |
| avp_data := { |
| avp_AAA_3GPP_KASME := kasme |
| } |
| } |
| } |
| |
| /* TS 29.272 7.3.23 Item-Number */ |
| template (value) GenericAVP ts_AVP_ItemNumber(uint32_t num) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_KASME), |
| avp_data := { |
| avp_AAA_3GPP_Item_Number := int2oct(num, 4) |
| } |
| } |
| } |
| |
| /* TS 29.272 7.3.18 E-UTRAN Vector */ |
| template (value) GenericAVP ts_AVP_EutranVec(uint32_t item_num, octetstring rand, octetstring xres, |
| octetstring autn, octetstring kasme) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_E_UTRAN_Vector), |
| avp_data := { |
| avp_AAA_3GPP_E_UTRAN_Vector := { |
| ts_AVP_ItemNumber(item_num), |
| ts_AVP_RAND(rand), |
| ts_AVP_XRES(xres), |
| ts_AVP_AUTN(autn), |
| ts_AVP_KASME(kasme) |
| } |
| } |
| } |
| } |
| |
| /* TS 29.272 7.3.2 Subscription-Data */ |
| template (value) GenericAVP ts_AVP_3GPP_SubscriptionData(template (value) AVP_list content) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscription_Data), |
| avp_data := { |
| avp_AAA_3GPP_Subscription_Data := content |
| } |
| } |
| } |
| template (present) GenericAVP |
| tr_AVP_3GPP_SubscriptionData(template (present) AVP_list content := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscription_Data), |
| avp_data := { |
| avp_AAA_3GPP_Subscription_Data := content |
| } |
| } |
| } |
| |
| |
| /* TS 29.272 7.3.17 Authentication-Info */ |
| template (value) GenericAVP ts_AVP_3GPP_AuthInfo(template (value) AVP_list content) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Authentication_Info), |
| avp_data := { |
| avp_AAA_3GPP_Authentication_Info := content |
| } |
| } |
| } |
| template (present) GenericAVP |
| tr_AVP_3GPP_AuthInfo(template (present) AVP_list content := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Authentication_Info), |
| avp_data := { |
| avp_AAA_3GPP_Authentication_Info := content |
| } |
| } |
| } |
| |
| /* TS 29.272 7.3.9 Visited-PLMN-Id */ |
| template (value) GenericAVP ts_AVP_3GPP_VisitedPlmnId(template (value) octetstring id) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Visited_PLMN_Id), |
| avp_data := { |
| avp_AAA_3GPP_Visited_PLMN_Id := id |
| } |
| } |
| } |
| template (present) GenericAVP tr_AVP_3GPP_VisitedPlmnId(template (present) octetstring id := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Visited_PLMN_Id), |
| avp_data := { |
| avp_AAA_3GPP_Visited_PLMN_Id := id |
| } |
| } |
| } |
| |
| /* TS 29.272 7.3.13 RAT-Type */ |
| template (value) GenericAVP ts_AVP_PCC_3GPP_RatType(template (value) PCC_3GPP_RAT_Type rat_type) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_RAT_Type), |
| avp_data := { |
| avp_PCC_3GPP_RAT_Type := rat_type |
| } |
| } |
| } |
| template (present) GenericAVP tr_AVP_PCC_3GPP_RatType(template (present) PCC_3GPP_RAT_Type rat_type := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_RAT_Type), |
| avp_data := { |
| avp_PCC_3GPP_RAT_Type := rat_type |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_GI_3GPP_RatType(template (present) GI_3GPP_3GPP_RAT_Type rat_type := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_RAT_Type), |
| avp_data := { |
| avp_GI_3GPP_3GPP_RAT_Type := rat_type |
| } |
| } |
| } |
| |
| /* TS 29.272 7.3.7 ULR-Flags */ |
| template (value) GenericAVP ts_AVP_3GPP_UlrFlags(template (value) UINT32 flags) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULR_Flags), |
| avp_data := { |
| avp_AAA_3GPP_ULR_Flags := flags |
| } |
| } |
| } |
| template (present) GenericAVP tr_AVP_3GPP_UlrFlags(template (present) UINT32 flags := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULR_Flags), |
| avp_data := { |
| avp_AAA_3GPP_ULR_Flags := flags |
| } |
| } |
| } |
| |
| /* TS 29.272 7.3.8 ULA-Flags */ |
| template (value) GenericAVP ts_AVP_3GPP_UlaFlags(template (value) UINT32 flags) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULA_Flags), |
| avp_data := { |
| avp_AAA_3GPP_ULA_Flags := flags |
| } |
| } |
| } |
| template (present) GenericAVP tr_AVP_3GPP_UlaFlags(template (present) UINT32 flags := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_ULA_Flags), |
| avp_data := { |
| avp_AAA_3GPP_ULA_Flags := flags |
| } |
| } |
| } |
| |
| |
| |
| template (value) GenericAVP ts_AVP_NumOfReqVectors(template (value) UINT32 num_req := '00000004'O) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Number_Of_Requested_Vectors), |
| avp_data := { |
| avp_AAA_3GPP_Number_Of_Requested_Vectors := num_req |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_ImmReqPref(template (value) UINT32 par := '00000000'O) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Immediate_Response_Preferred), |
| avp_data := { |
| avp_AAA_3GPP_Immediate_Response_Preferred := par |
| } |
| } |
| } |
| |
| |
| /* 7.3.11 Requested-EUTRAN-Authentication-Info */ |
| template (value) GenericAVP ts_AVP_RequestedEutranAuthInfo(template (value) UINT32 num_vec := '00000004'O) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Requested_EUTRAN_Authentication_Info), |
| avp_data := { |
| avp_AAA_3GPP_Requested_EUTRAN_Authentication_Info := { |
| ts_AVP_NumOfReqVectors(num_vec), |
| ts_AVP_ImmReqPref('00000000'O) |
| } |
| } |
| } |
| } |
| |
| |
| /* TS 29.272 7.3.27 Context-Identifier */ |
| template (value) GenericAVP ts_AVP_3GPP_ContextId(uint32_t ctx) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Context_Identifier), |
| avp_data := { |
| avp_AAA_3GPP_Context_Identifier := int2oct(ctx, 4) |
| } |
| } |
| } |
| |
| /* Ts 29.272 7.3.29 Subscriber-Status */ |
| template (value) GenericAVP ts_AVP_3GPP_SubscriberStatus(template (value) AAA_3GPP_Subscriber_Status sts) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscriber_Status), |
| avp_data := { |
| avp_AAA_3GPP_Subscriber_Status := sts |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_3GPP_SubscrRauTauTmr(uint32_t tmr) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer), |
| avp_data := { |
| avp_AAA_3GPP_Subscribed_Periodic_RAU_TAU_Timer := int2oct(tmr, 4) |
| } |
| } |
| } |
| |
| /* TS 29.272 7.3.33 All-APN-Configurations-Included-Indicator */ |
| template (value) GenericAVP ts_AVP_3GPP_AllApnConfigsIncl(template (value) AAA_3GPP_All_APN_Configurations_Included_Indicator ind := All_APN_CONFIGURATIONS_INCLUDED) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_All_APN_Configurations_Included_Indicator), |
| avp_data := { |
| avp_AAA_3GPP_All_APN_Configurations_Included_Indicator := ind |
| } |
| } |
| } |
| |
| /* TS 29.272 7.3.34 APN-Configuration-Profile */ |
| template (value) GenericAVP ts_AVP_3GPP_ApnConfigProfile(template (value) AVP_list content) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_APN_Configuration_Profile), |
| avp_data := { |
| avp_AAA_3GPP_APN_Configuration_Profile := content |
| } |
| } |
| } |
| |
| /* TS 29.272 7.3.35 APN-Configuration */ |
| template (value) GenericAVP ts_AVP_3GPP_ApnConfig(uint32_t ctx, AAA_3GPP_PDN_Type pdn_type, |
| charstring apn) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_APN_Configuration_Profile), |
| avp_data := { |
| avp_AAA_3GPP_APN_Configuration := { |
| ts_AVP_3GPP_ContextId(ctx), |
| ts_AVP_3GPP_PdnType(pdn_type), |
| ts_AVP_3GPP_EpsSubscrQosProfile(1, 1), |
| ts_AVP_ServiceSelection(apn) |
| } |
| } |
| } |
| } |
| |
| /* TS 29.272 7.3.36 Service-Selection (refers to RFC 5778) */ |
| template (value) GenericAVP ts_AVP_ServiceSelection(charstring apn) := { |
| avp := { |
| avp_header := ts_DIA_Hdr(c_AVP_Code_MIPv6_NONE_Service_Selection), |
| avp_data := { |
| avp_MIPv6_NONE_Service_Selection := char2oct(apn) |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_PCC_3GPP_QoS_Information(template (present) AVP_list list := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Information), |
| avp_data := { |
| avp_PCC_3GPP_QoS_Information := list |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_PCC_3GPP_QoS_Information(template (value) AVP_list list) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Information), |
| avp_data := { |
| avp_PCC_3GPP_QoS_Information := list |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL(uint32_t val) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL), |
| avp_data := { |
| avp_PCC_3GPP_APN_Aggregate_Max_Bitrate_DL := int2oct(val, 4) |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL(uint32_t val) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL), |
| avp_data := { |
| avp_PCC_3GPP_APN_Aggregate_Max_Bitrate_UL := int2oct(val, 4) |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_PCC_3GPP_Default_EPS_Bearer_QoS(template (value) AVP_list list) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Default_EPS_Bearer_QoS), |
| avp_data := { |
| avp_PCC_3GPP_Default_EPS_Bearer_QoS := list |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_PCC_3GPP_QoS_Class_Identifier(uint32_t val) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_QoS_Class_Identifier), |
| avp_data := { |
| avp_PCC_3GPP_QoS_Class_Identifier := int2oct(val, 4) |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_3GPP_PriorityLevel(uint32_t prio) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Priority_Level), |
| avp_data := { |
| avp_PCC_3GPP_Priority_Level := int2oct(prio, 4) |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_PCC_3GPP_AllocRetenPrio(uint32_t prio) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_PCC_3GPP_Allocation_Retention_Priority), |
| avp_data := { |
| avp_PCC_3GPP_Allocation_Retention_Priority := { |
| ts_AVP_3GPP_PriorityLevel(prio) |
| /* pre-emption capability */ |
| /* pre-emption vulnerability */ |
| } |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_3GPP_EpsSubscrQosProfile(uint32_t qos_class, uint32_t prio) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_EPS_Subscribed_QoS_Profile), |
| avp_data := { |
| avp_AAA_3GPP_EPS_Subscribed_QoS_Profile := { |
| ts_AVP_PCC_3GPP_QoS_Class_Identifier(qos_class), |
| ts_AVP_PCC_3GPP_AllocRetenPrio(prio) |
| } |
| } |
| } |
| } |
| |
| |
| /* TS 29.272 7.3.41 AMBR */ |
| template (value) GenericAVP ts_AVP_3GPP_AMBR(uint32_t ul, uint32_t dl) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_AMBR), |
| avp_data := { |
| avp_AAA_3GPP_AMBR := { |
| ts_AVP_3GPP_MaxReqBwUL(ul), |
| ts_AVP_3GPP_MaxReqBwDL(dl) |
| } |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_3GPP_MaxReqBwUL(uint32_t bw) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_RX_3GPP_Max_Requested_Bandwidth_UL), |
| avp_data := { |
| avp_RX_3GPP_Max_Requested_Bandwidth_UL := int2oct(bw, 4) |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_3GPP_MaxReqBwDL(uint32_t bw) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_RX_3GPP_Max_Requested_Bandwidth_DL), |
| avp_data := { |
| avp_RX_3GPP_Max_Requested_Bandwidth_DL := int2oct(bw, 4) |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_3GPP_Reporting_Reason(template (present) DCA_3GPP_Reporting_Reason r := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_Reporting_Reason), |
| avp_data := { |
| avp_DCA_3GPP_Reporting_Reason := r |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_3GPP_AoCRequestType(template (present) DCA_3GPP_AoC_Request_Type t := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_AoC_Request_Type), |
| avp_data := { |
| avp_DCA_3GPP_AoC_Request_Type := t |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_3GPP_ServiceInformation(template (present) AVP_list content := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_Service_Information), |
| avp_data := { |
| avp_DCA_3GPP_Service_Information := content |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_3GPP_PSInformation(template (present) AVP_list content := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_PS_Information), |
| avp_data := { |
| avp_DCA_3GPP_PS_Information := content |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_3GPP_ChargingId(template (present) AVP_OctetString id := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_Charging_Id), |
| avp_data := { |
| avp_GI_3GPP_3GPP_Charging_Id := id |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_3GPP_PDPType(template (present) GI_3GPP_3GPP_PDP_Type t := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_PDP_Type), |
| avp_data := { |
| avp_GI_3GPP_3GPP_PDP_Type := t |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_3GPP_PDPAddress(template (present) DCA_3GPP_PDP_Address addr := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_PDP_Address), |
| avp_data := { |
| avp_DCA_3GPP_PDP_Address := addr |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_3GPP_SGSNAddress(template (present) DCA_3GPP_SGSN_Address addr := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_SGSN_Address), |
| avp_data := { |
| avp_DCA_3GPP_SGSN_Address := addr |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_3GPP_GGSNAddress(template (present) DCA_3GPP_GGSN_Address addr := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_GGSN_Address), |
| avp_data := { |
| avp_DCA_3GPP_GGSN_Address := addr |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_3GPP_SelectionMode(template (present) GI_3GPP_3GPP_Selection_Mode sm := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_Selection_Mode), |
| avp_data := { |
| avp_GI_3GPP_3GPP_Selection_Mode := sm |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_3GPP_ChargingCharacteristics(template (present) GI_3GPP_3GPP_Charging_Characteristics cc := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_Charging_Characteristics), |
| avp_data := { |
| avp_GI_3GPP_3GPP_Charging_Characteristics := cc |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_3GPP_SGSNMCCMNC(template (present) GI_3GPP_3GPP_SGSN_MCC_MNC smn := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_SGSN_MCC_MNC), |
| avp_data := { |
| avp_GI_3GPP_3GPP_SGSN_MCC_MNC := smn |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_3GPP_NSAPI(template (present) GI_3GPP_3GPP_NSAPI nsapi := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_NSAPI), |
| avp_data := { |
| avp_GI_3GPP_3GPP_NSAPI := nsapi |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_3GPP_MS_TimeZone(template (present) GI_3GPP_3GPP_MS_TimeZone ms_tz := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_MS_TimeZone), |
| avp_data := { |
| avp_GI_3GPP_3GPP_MS_TimeZone := ms_tz |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_3GPP_ULI(template (present) GI_3GPP_3GPP_User_Location_Info uli := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr_3GPP(c_AVP_Code_GI_3GPP_3GPP_User_Location_Info), |
| avp_data := { |
| avp_GI_3GPP_3GPP_User_Location_Info := uli |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_UserEquipmentInfo(template (present) DCC_NONE_User_Equipment_Info uei := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_User_Equipment_Info), |
| avp_data := { |
| avp_DCC_NONE_User_Equipment_Info := uei |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_UserEquipmentInfoType(template (present) DCC_NONE_User_Equipment_Info_Type ueit := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_User_Equipment_Info_Type), |
| avp_data := { |
| avp_DCC_NONE_User_Equipment_Info_Type := ueit |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_UserEquipmentInfoValue(template (present) DCC_NONE_User_Equipment_Info_Value ueiv := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_User_Equipment_Info_Value), |
| avp_data := { |
| avp_DCC_NONE_User_Equipment_Info_Value := ueiv |
| } |
| } |
| } |
| |
| /* TS 29.272 7.3.62 PDN-Type */ |
| template (value) GenericAVP ts_AVP_3GPP_PdnType(template (value) AAA_3GPP_PDN_Type pdn_type) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_PDN_Type), |
| avp_data := { |
| avp_AAA_3GPP_PDN_Type := pdn_type |
| } |
| } |
| } |
| |
| /* 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 |
| } |
| } |
| } |
| template (present) GenericAVP tr_AVP_Multiple_Services_Credit_Control(template (present) AVP_list content := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Multiple_Services_Credit_Control), |
| avp_data := { |
| avp_DCC_NONE_Multiple_Services_Credit_Control := content |
| } |
| } |
| } |
| |
| /* Requested-Service-Unit AVP */ |
| template (present) GenericAVP tr_AVP_Requested_Service_Unit(template (present) AVP_list content := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Requested_Service_Unit), |
| avp_data := { |
| avp_DCC_NONE_Requested_Service_Unit := content |
| } |
| } |
| } |
| |
| /* Used-Service-Unit AVP */ |
| template (present) GenericAVP tr_AVP_Used_Service_Unit(template (present) AVP_list content := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Used_Service_Unit), |
| avp_data := { |
| avp_DCC_NONE_Used_Service_Unit := 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) |
| } |
| } |
| } |
| |
| template (value) GenericAVP ts_AVP_3GPP_VolumeQuotaThreshold(uint32_t volume_quota_thresh_val) := { |
| avp := { |
| avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_DCA_3GPP_Volume_Quota_Threshold), |
| avp_data := { |
| avp_DCA_3GPP_Volume_Quota_Threshold := int2oct(volume_quota_thresh_val, 4) |
| } |
| } |
| } |
| |
| template (present) GenericAVP tr_AVP_3GPP_CalledStationId(template (present) DNAS_NONE_Called_Station_Id id := ?) := { |
| avp := { |
| avp_header := tr_DIA_Hdr(c_AVP_Code_DNAS_NONE_Called_Station_Id), |
| avp_data := { |
| avp_DNAS_NONE_Called_Station_Id := id |
| } |
| } |
| } |
| |
| |
| /* 5.3.2 Capabilities Exchange Answer */ |
| template (value) PDU_DIAMETER |
| ts_DIA_CEA_AUTH_APP_ID(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, |
| template (value) charstring origin_host, |
| template (value) charstring origin_realm, |
| template (value) octetstring host_ip, uint32_t auth_app_id) |
| := ts_DIAMETER(flags:='00000000'B, cmd_code:=Capabilities_Exchange, hbh_id:=hbh_id, ete_id:=ete_id, |
| avps := { |
| ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| ts_AVP_OriginHost(origin_host), |
| ts_AVP_OriginRealm(origin_realm), |
| ts_AVP_HostIpAddr(host_ip), |
| ts_AVP_VendorId(vendor_id_3GPP), |
| ts_AVP_ProductName("TTCN-3 Testsuite"), |
| ts_AVP_OriginStateId('00000001'O), |
| ts_AVP_SuppVendorIdRaw(5535), /* 3GPP2 */ |
| ts_AVP_SuppVendorId(vendor_id_3GPP), |
| ts_AVP_SuppVendorIdRaw(13019), /* ETSI */ |
| ts_AVP_AuthAppId(int2oct(auth_app_id, 4)), |
| ts_AVP_InbSecId('00000000'O) |
| }); |
| template (value) PDU_DIAMETER |
| ts_DIA_CEA_VENDOR_APP_ID(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, |
| template (value) charstring origin_host, |
| template (value) charstring origin_realm, |
| template (value) octetstring host_ip, uint32_t vendor_app_id) |
| := ts_DIAMETER(flags:='00000000'B, cmd_code:=Capabilities_Exchange, hbh_id:=hbh_id, ete_id:=ete_id, |
| avps := { |
| ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| ts_AVP_OriginHost(origin_host), |
| ts_AVP_OriginRealm(origin_realm), |
| ts_AVP_HostIpAddr(host_ip), |
| ts_AVP_VendorId(vendor_id_3GPP), |
| ts_AVP_ProductName("TTCN-3 Testsuite"), |
| ts_AVP_OriginStateId('00000001'O), |
| ts_AVP_SuppVendorIdRaw(5535), /* 3GPP2 */ |
| ts_AVP_SuppVendorId(vendor_id_3GPP), |
| ts_AVP_SuppVendorIdRaw(13019), /* ETSI */ |
| ts_AVP_InbSecId('00000000'O), |
| ts_AVP_VendorSpecAppId(vendor_id_3GPP, vendor_app_id) |
| }); |
| function f_ts_DIA_CEA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id, |
| template (value) charstring origin_host, |
| template (value) charstring origin_realm, |
| template (value) octetstring host_ip, template (omit) uint32_t auth_app_id, |
| template (omit) uint32_t vendor_app_id) |
| return template (value) PDU_DIAMETER |
| { |
| var template (value) PDU_DIAMETER diam_pdu; |
| if (istemplatekind(vendor_app_id, "omit")) { |
| diam_pdu := ts_DIA_CEA_AUTH_APP_ID(hbh_id, ete_id, origin_host, origin_realm, host_ip, valueof(auth_app_id)); |
| } else { |
| diam_pdu := ts_DIA_CEA_VENDOR_APP_ID(hbh_id, ete_id, origin_host, origin_realm, host_ip, valueof(vendor_app_id)); |
| } |
| return diam_pdu; |
| } |
| |
| |
| template (value) PDU_DIAMETER |
| ts_DIA_AIR(/* template (value) */ hexstring imsi, |
| template (value) octetstring sess_id := c_def_sess_id, |
| template (value) charstring orig_host := "ttcn3.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 := Authentication_Information, |
| app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| hbh_id := hbh_id, |
| ete_id := ete_id, |
| avps := { |
| ts_AVP_SessionId(sess_id), |
| ts_AVP_DestinationRealm(dest_realm), |
| ts_AVP_OriginHost(orig_host), |
| ts_AVP_OriginRealm(orig_realm), |
| ts_AVP_UserNameImsi(imsi), |
| /* Requested EUTRAN Auth Info */ |
| ts_AVP_RequestedEutranAuthInfo, |
| ts_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
| ts_AVP_3GPP_VisitedPlmnId('11111F'O) |
| }); |
| template (present) PDU_DIAMETER |
| tr_DIA_AIR(/* template (present) */ hexstring imsi, |
| template (present) octetstring sess_id := ?, |
| template (present) charstring dest_realm := ?, |
| template (present) UINT32 hbh_id := ?, |
| template (present) UINT32 ete_id := ?) := |
| tr_DIAMETER(flags := '1???????'B, |
| cmd_code := Authentication_Information, |
| app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| hbh_id := hbh_id, ete_id := ete_id, |
| avps := superset( |
| tr_AVP_SessionId(sess_id), |
| tr_AVP_DestinationRealm(dest_realm), |
| tr_AVP_UserNameImsi(imsi), |
| tr_AVP_3GPP_VisitedPlmnId |
| )); |
| |
| /* TS 29.272 5.2.3.1 + 7.2.6 Authentication Information Answer */ |
| template (value) PDU_DIAMETER |
| ts_DIA_AIA(template (value) AVP_list auth_info_contents, |
| template (value) octetstring sess_id := c_def_sess_id, |
| template (value) charstring orig_host := "hss.localdomain", |
| template (value) charstring orig_realm := "localdomain", |
| template (value) UINT32 hbh_id := '00000000'O, |
| template (value) UINT32 ete_id := '00000000'O) := |
| ts_DIAMETER(flags := '01000000'B, |
| cmd_code := Authentication_Information, |
| app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| hbh_id := hbh_id, |
| ete_id := ete_id, |
| avps := { |
| ts_AVP_SessionId(sess_id), |
| ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| ts_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
| ts_AVP_OriginHost(orig_host), |
| ts_AVP_OriginRealm(orig_realm), |
| ts_AVP_3GPP_AuthInfo(auth_info_contents) |
| }); |
| template (present) PDU_DIAMETER |
| tr_DIA_AIA(template (present) AVP_list auth_info_contents := ?, |
| template (present) octetstring sess_id := ?, |
| template (present) charstring orig_host := ?, |
| template (present) charstring orig_realm := ?, |
| template (present) UINT32 hbh_id := ?, |
| template (present) UINT32 ete_id := ?) := |
| tr_DIAMETER(flags := '0???????'B, |
| cmd_code := Authentication_Information, |
| app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| hbh_id := hbh_id, |
| ete_id := ete_id, |
| avps := superset( |
| tr_AVP_SessionId(sess_id), |
| tr_AVP_ResultCode(DIAMETER_SUCCESS), |
| tr_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
| tr_AVP_3GPP_AuthInfo(auth_info_contents), |
| tr_AVP_OriginHost(orig_host), |
| tr_AVP_OriginRealm(orig_realm) |
| )); |
| |
| |
| /* TS 29.272 7.2.3 Update Location Request */ |
| template (value) PDU_DIAMETER |
| ts_DIA_ULR(/* template (value) */ hexstring imsi, |
| template (value) octetstring sess_id := c_def_sess_id, |
| template (value) charstring orig_host := "ttcn3.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 := Update_Location, |
| app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| hbh_id := hbh_id, |
| ete_id := ete_id, |
| avps := { |
| ts_AVP_SessionId(sess_id), |
| ts_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
| ts_AVP_UserNameImsi(imsi), |
| ts_AVP_3GPP_UlrFlags('00000000'O), |
| ts_AVP_3GPP_VisitedPlmnId('11111F'O), |
| ts_AVP_PCC_3GPP_RatType(EUTRAN), |
| ts_AVP_OriginHost(orig_host), |
| ts_AVP_OriginRealm(orig_realm), |
| ts_AVP_DestinationRealm(dest_realm) |
| }); |
| template (present) PDU_DIAMETER |
| tr_DIA_ULR(/* 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 := ?) := |
| tr_DIAMETER(flags := '11000000'B, |
| cmd_code := Update_Location, |
| app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| hbh_id := hbh_id, |
| ete_id := ete_id, |
| avps := superset( |
| tr_AVP_SessionId(sess_id), |
| tr_AVP_AuthSessionState, |
| tr_AVP_OriginHost(orig_host), |
| tr_AVP_OriginRealm(orig_realm), |
| tr_AVP_DestinationRealm(dest_realm), |
| tr_AVP_UserNameImsi(imsi), |
| tr_AVP_PCC_3GPP_RatType, |
| tr_AVP_3GPP_UlrFlags, |
| tr_AVP_3GPP_VisitedPlmnId |
| )); |
| |
| template (value) PDU_DIAMETER |
| ts_DIA_ULA(template (value) AVP_list sub_data, |
| template (value) octetstring sess_id := c_def_sess_id, |
| template (value) charstring orig_host := "hss.localdomain", |
| template (value) charstring orig_realm := "localdomain", |
| template (value) UINT32 hbh_id := '00000000'O, |
| template (value) UINT32 ete_id := '00000000'O) := |
| ts_DIAMETER(flags:='01000000'B, |
| cmd_code := Update_Location, |
| app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| hbh_id := hbh_id, |
| ete_id := ete_id, |
| avps := { |
| ts_AVP_SessionId(sess_id), |
| ts_AVP_ResultCode(DIAMETER_SUCCESS), /* optional */ |
| ts_AVP_AuthSessionState(NO_STATE_MAINTAINED), |
| ts_AVP_OriginHost(orig_host), |
| ts_AVP_OriginRealm(orig_realm), |
| ts_AVP_3GPP_UlaFlags('00000002'O), |
| ts_AVP_3GPP_SubscriptionData(sub_data) |
| }); |
| template (present) PDU_DIAMETER |
| tr_DIA_ULA(template (present) AVP_list sub_data := ?, |
| template (present) octetstring sess_id := ?, |
| template (present) charstring orig_host := ?, |
| template (present) charstring orig_realm := ?, |
| template (present) UINT32 hbh_id := ?, |
| template (present) UINT32 ete_id := ?) := |
| tr_DIAMETER(flags := '0???????'B, |
| cmd_code := Update_Location, |
| app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), |
| hbh_id := hbh_id, |
| ete_id := ete_id, |
| avps := superset( |
| tr_AVP_SessionId(sess_id), |
| tr_AVP_ResultCode(DIAMETER_SUCCESS), |
| tr_AVP_AuthSessionState, |
| tr_AVP_OriginHost(orig_host), |
| tr_AVP_OriginRealm(orig_realm), |
| tr_AVP_3GPP_UlaFlags, |
| tr_AVP_3GPP_SubscriptionData(sub_data) |
| )); |
| |
| |
| |
| /* RFC 4006 3.1. Credit-Control-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 (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, |
| 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_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 (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 |
| }); |
| /* Same as ts_DIA_Gy_CCA_ValidityTime, but with extra AVP to grant access for limited amount of octets */ |
| template (value) PDU_DIAMETER |
| ts_DIA_Gy_CCA_ValidityTimeVolumeThreshold(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, uint32_t volume_threhsold) |
| := 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_Total_Octets(volume_threhsold*100) |
| }), |
| ts_AVP_3GPP_VolumeQuotaThreshold(volume_threhsold) |
| }) |
| //, |
| // qos |
| // default eps bearer qos |
| // supported features |
| // origin |
| }); |
| |
| /* RFC 6733, section 5.5.1 "Device-Watchdog-Request" */ |
| template (value) PDU_DIAMETER |
| ts_DIA_DWR(template (value) OCTET4 state_id := '00000000'O, |
| template (value) charstring orig_host := "ttcn3.localdomain", |
| template (value) charstring orig_realm := "localdomain", |
| template (value) UINT32 hbh_id := '00000000'O, |
| template (value) UINT32 ete_id := '00000000'O) := |
| ts_DIAMETER(flags := '10000000'B, |
| cmd_code := Device_Watchdog, |
| app_id := '00000000'O, |
| hbh_id := hbh_id, |
| ete_id := ete_id, |
| avps := { |
| ts_AVP_OriginHost(orig_host), |
| ts_AVP_OriginRealm(orig_realm), |
| ts_AVP_OriginStateId(state_id) |
| }); |
| template (present) PDU_DIAMETER |
| tr_DIA_DWR(template (present) OCTET4 state_id := ?, |
| template (present) charstring orig_host := ?, |
| template (present) charstring orig_realm := ?, |
| template (present) UINT32 hbh_id := ?, |
| template (present) UINT32 ete_id := ?) := |
| tr_DIAMETER(flags := '1???????'B, |
| cmd_code := Device_Watchdog, |
| app_id := '00000000'O, |
| hbh_id := hbh_id, |
| ete_id := ete_id, |
| avps := superset( |
| tr_AVP_OriginHost(orig_host), |
| tr_AVP_OriginRealm(orig_realm), |
| tr_AVP_OriginStateId(state_id) |
| )); |
| |
| /* RFC 6733, section 5.5.2 "Device-Watchdog-Answer" */ |
| template (value) PDU_DIAMETER |
| ts_DIA_DWA(template (value) OCTET4 state_id := '00000000'O, |
| template (value) charstring orig_host := "ttcn3.localdomain", |
| template (value) charstring orig_realm := "localdomain", |
| template (value) UINT32 hbh_id := '00000000'O, |
| template (value) UINT32 ete_id := '00000000'O) := |
| ts_DIAMETER(flags := '00000000'B, |
| cmd_code := Device_Watchdog, |
| app_id := '00000000'O, |
| hbh_id := hbh_id, |
| ete_id := ete_id, |
| avps := { |
| ts_AVP_ResultCode(DIAMETER_SUCCESS), |
| ts_AVP_OriginHost(orig_host), |
| ts_AVP_OriginRealm(orig_realm), |
| ts_AVP_OriginStateId(state_id) |
| }); |
| template (present) PDU_DIAMETER |
| tr_DIA_DWA(template (present) OCTET4 state_id := ?, |
| template (present) charstring orig_host := ?, |
| template (present) charstring orig_realm := ?, |
| template (present) UINT32 hbh_id := ?, |
| template (present) UINT32 ete_id := ?) := |
| tr_DIAMETER(flags := '0???????'B, |
| cmd_code := Device_Watchdog, |
| app_id := '00000000'O, |
| hbh_id := hbh_id, |
| ete_id := ete_id, |
| avps := superset( |
| tr_AVP_ResultCode(DIAMETER_SUCCESS), |
| tr_AVP_OriginHost(orig_host), |
| tr_AVP_OriginRealm(orig_realm), |
| tr_AVP_OriginStateId(state_id) |
| )); |
| |
| function f_DIAMETER_get_avp(PDU_DIAMETER pdu, template (present) AVP_Code avp_code) |
| return template (omit) AVP |
| { |
| var integer i; |
| |
| for (i := 0; i < lengthof(pdu.avps); i := i+1) { |
| if (not ispresent(pdu.avps[i].avp)) { |
| continue; |
| } |
| var AVP_Header hdr := pdu.avps[i].avp.avp_header; |
| if (match(hdr.avp_code, avp_code)) { |
| return pdu.avps[i].avp; |
| } |
| } |
| return omit; |
| } |
| function f_DIAMETER_get_avp_or_fail(PDU_DIAMETER pdu, template (present) AVP_Code avp_code) |
| return AVP |
| { |
| var template (omit) AVP avp; |
| avp := f_DIAMETER_get_avp(pdu, avp_code); |
| if (istemplatekind(avp, "omit")) { |
| Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| log2str("AVP ", avp_code, " not found in ", pdu)); |
| } |
| return valueof(avp); |
| } |
| |
| function f_AVP_Grouped_get_avp(AVP_Grouped avp_grp, template (present) AVP_Code avp_code) |
| return template (omit) AVP |
| { |
| var integer i; |
| |
| for (i := 0; i < lengthof(avp_grp); i := i+1) { |
| if (not ispresent(avp_grp[i].avp)) { |
| continue; |
| } |
| var AVP_Header hdr := avp_grp[i].avp.avp_header; |
| if (match(hdr.avp_code, avp_code)) { |
| return avp_grp[i].avp; |
| } |
| } |
| return omit; |
| } |
| function f_AVP_Grouped_get_avp_or_fail(AVP_Grouped avp_grp, template (present) AVP_Code avp_code) |
| return AVP |
| { |
| var template (omit) AVP avp; |
| avp := f_AVP_Grouped_get_avp(avp_grp, avp_code); |
| if (istemplatekind(avp, "omit")) { |
| Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| log2str("AVP ", avp_code, " not found in ", avp_grp)); |
| } |
| return valueof(avp); |
| } |
| |
| function f_validate_gy_cc_report(PDU_DIAMETER rx_dia, template (present) DCA_3GPP_Reporting_Reason repreason_exp := ?, |
| template (present) integer cc_time_exp := ?, |
| template (present) integer cc_in_oct_exp := ?, |
| template (present) integer cc_out_oct_exp := ?) |
| { |
| var AVP multi_services_cc, used_service_unit; |
| var AVP_Grouped multi_services_cc_data, used_service_unit_data; |
| var template (omit) AVP repreason_tpl; |
| var AVP repreason, cc_time, cc_in_oct, cc_out_oct; |
| |
| multi_services_cc := f_DIAMETER_get_avp_or_fail(rx_dia, c_AVP_Code_DCC_NONE_Multiple_Services_Credit_Control); |
| multi_services_cc_data := valueof(multi_services_cc.avp_data.avp_DCC_NONE_Multiple_Services_Credit_Control); |
| |
| used_service_unit := f_AVP_Grouped_get_avp_or_fail(multi_services_cc_data, c_AVP_Code_DCC_NONE_Used_Service_Unit); |
| used_service_unit_data := valueof(used_service_unit.avp_data.avp_DCC_NONE_Used_Service_Unit); |
| |
| /* Reporting-Reason can be either inside Multiple-Services-Credit-Control or inside Used-Service-Unit */ |
| repreason_tpl := f_AVP_Grouped_get_avp(multi_services_cc_data, c_AVP_Code_DCA_3GPP_Reporting_Reason); |
| if (istemplatekind(repreason_tpl, "omit")) { |
| repreason := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCA_3GPP_Reporting_Reason); |
| } else { |
| repreason := valueof(repreason_tpl); |
| } |
| if (not match(repreason.avp_data.avp_DCA_3GPP_Reporting_Reason, repreason_exp)) { |
| Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| log2str("3GPP-Reporting-Reason mismatch ", repreason, " vs exp ", repreason_exp)); |
| } |
| |
| cc_time := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCC_NONE_CC_Time); |
| if (not match(oct2int(cc_time.avp_data.avp_DCC_NONE_CC_Time), cc_time_exp)) { |
| Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| log2str("3GPP-CC-Time mismatch ", cc_time, " vs exp ", cc_time_exp)); |
| } |
| |
| cc_in_oct := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCC_NONE_CC_Input_Octets); |
| if (not match(oct2int(cc_in_oct.avp_data.avp_DCC_NONE_CC_Input_Octets), cc_in_oct_exp)) { |
| Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| log2str("3GPP-CC-Input-Octets mismatch ", cc_in_oct, " vs exp ", cc_in_oct_exp)); |
| } |
| |
| cc_out_oct := f_AVP_Grouped_get_avp_or_fail(used_service_unit_data, c_AVP_Code_DCC_NONE_CC_Output_Octets); |
| if (not match(oct2int(cc_out_oct.avp_data.avp_DCC_NONE_CC_Output_Octets), cc_out_oct_exp)) { |
| Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| log2str("3GPP-CC-Output-Octets mismatch ", cc_out_oct, " vs exp ", cc_out_oct_exp)); |
| } |
| } |
| |
| } |