Mercurial > hg > freeDiameter
changeset 800:35f3fe884dc9
Updates sent by Konstantin to the dict_dcca files
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Tue, 21 Aug 2012 13:34:20 +0200 |
parents | 7895724d2787 |
children | 728cc60a7be5 |
files | contrib/README contrib/dict_dcca/README contrib/dict_dcca/dict_dcca_3gpp.c contrib/dict_dcca/dict_dcca_nokia.c extensions/dict_dcca/dict_dcca.c |
diffstat | 5 files changed, 1132 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/README Mon Aug 20 22:56:18 2012 +0200 +++ b/contrib/README Tue Aug 21 13:34:20 2012 +0200 @@ -51,5 +51,7 @@ - dict_legacy: XML and DTD files for the dict_legacy_xml.fdx extension. +- dict_dcca: partial implementations of the DCCA dictionary + - wireshark: This contains some information on how to use Wireshark to monitor Diameter exchange protected with TLS. It involves patching the wireshark software.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/dict_dcca/README Tue Aug 21 13:34:20 2012 +0200 @@ -0,0 +1,5 @@ +Files provided courtesy of Konstantin Chekushin under the same license as freeDiameter. + +Comment: +"They are not full, I've filled only that I wanted to use in our app_dcca module. " +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/dict_dcca/dict_dcca_3gpp.c Tue Aug 21 13:34:20 2012 +0200 @@ -0,0 +1,791 @@ +/* + * Dictionary definitions of objects specified in DCCA (Nokia, 3GPP). + */ +#include <freeDiameter/extension.h> + + +/* The content of this file follows the same structure as dict_base_proto.c */ + +#define CHECK_dict_new( _type, _data, _parent, _ref ) \ + CHECK_FCT( fd_dict_new( fd_g_config->cnf_dict, (_type), (_data), (_parent), (_ref)) ); + +#define CHECK_dict_search( _type, _criteria, _what, _result ) \ + CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, (_type), (_criteria), (_what), (_result), ENOENT) ); + +struct local_rules_definition { + char *avp_name; + enum rule_position position; + int min; + int max; +}; + +#define RULE_ORDER( _position ) ((((_position) == RULE_FIXED_HEAD) || ((_position) == RULE_FIXED_TAIL)) ? 1 : 0 ) + +#define PARSE_loc_rules( _rulearray, _parent) { \ + int __ar; \ + for (__ar=0; __ar < sizeof(_rulearray) / sizeof((_rulearray)[0]); __ar++) { \ + struct dict_rule_data __data = { NULL, \ + (_rulearray)[__ar].position, \ + 0, \ + (_rulearray)[__ar].min, \ + (_rulearray)[__ar].max}; \ + __data.rule_order = RULE_ORDER(__data.rule_position); \ + CHECK_FCT( fd_dict_search( \ + fd_g_config->cnf_dict, \ + DICT_AVP, \ + AVP_BY_NAME, \ + (_rulearray)[__ar].avp_name, \ + &__data.rule_avp, 0 ) ); \ + if ( !__data.rule_avp ) { \ + TRACE_DEBUG(INFO, "AVP Not found: '%s'", (_rulearray)[__ar].avp_name ); \ + return ENOENT; \ + } \ + CHECK_FCT_DO( fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &__data, _parent, NULL), \ + { \ + TRACE_DEBUG(INFO, "Error on rule with AVP '%s'", \ + (_rulearray)[__ar].avp_name ); \ + return EINVAL; \ + } ); \ + } \ +} + +#define enumval_def_u32( _val_, _str_ ) \ + { _str_, { .u32 = _val_ }} + +#define enumval_def_os( _len_, _val_, _str_ ) \ + { _str_, { .os = { .data = (unsigned char *)_val_, .len = _len_ }}} + + +static int dict_dcca_3gpp_entry(char * conffile) +{ + struct dict_object * dcca; + TRACE_ENTRY("%p", conffile); + + /* Applications section */ + { + /* DCCA */ + { + struct dict_application_data data = { 4, "Diameter Credit Control Application" }; + CHECK_dict_new( DICT_APPLICATION, &data, NULL, &dcca); + } + + /* Create the vendors */ + { + struct dict_vendor_data vendor_data = { 10415, "3GPP" }; + CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_VENDOR, &vendor_data, NULL, NULL)); + } + + } + + + /* AVP section */ + { + struct dict_object * Address_type; + struct dict_object * UTF8String_type; + struct dict_object * DiameterIdentity_type; + struct dict_object * DiameterURI_type; + struct dict_object * Time_type; + + CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Address", &Address_type); + CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "UTF8String", &UTF8String_type); + CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "DiameterIdentity", &DiameterIdentity_type); + CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "DiameterURI", &DiameterURI_type); + CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Time", &Time_type); + + /* Reporting-Reason */ + { + /* + Enumerated. Will be present if quota was + exhausted for one or more metering types. Only + one Reporting-Reason AVP can be present in the + Used-Service-Unit AVP. (Note that the Reporting- + Reason AVP may be present also at the MSCC + level; see below.) + The following values are supported: + + QUOTA_EXHAUSTED(3); Quota for the + associated metering type has been + exhausted. With this reporting reason there is + only one metering type in this Used-Service- + Unit AVP. + + OTHER_QUOTA_TYPE(5); Quota for one or + more of the other metering types has been + exhausted. With this reporting reason there + may be multiple metering types in Used- + Service-Unit AVP. + + POOL_EXHAUSTED(8); Quota from the + credit pool has been exhausted. This reporting + reason is used if the quota for the associated + metering type was granted from a credit pool + by using the GSU-Pool-Reference AVP in the + CCA. With this reporting reason there is only + one metering type in the Used-Service-Unit + AVP. + */ + + struct dict_object *type; + struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Reporting-Reason)" , NULL, NULL, NULL }; + struct dict_enumval_data t_1 = { "QHT", { .i32 = 1 }}; + struct dict_enumval_data t_2 = { "FINAL", { .i32 = 2 }}; + struct dict_enumval_data t_3 = { "QUOTA_EXHAUSTED", { .i32 = 3 }}; + struct dict_enumval_data t_4 = { "VALIDITY_TIME", { .i32 = 4 }}; + struct dict_enumval_data t_5 = { "OTHER_QUOTA_TYPE", { .i32 = 5 }}; + struct dict_enumval_data t_6 = { "RATING_CONDITION_CHANGE", { .i32 = 6 }}; + struct dict_enumval_data t_7 = { "FORCED_REAUTHORIZATION", { .i32 = 7 }}; + struct dict_enumval_data t_8 = { "POOL_EXHAUSTED", { .i32 = 8 }}; + + struct dict_avp_data data = { + 872, /* Code */ + 10415, /* Vendor */ + "Reporting-Reason", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_INTEGER32 /* base type of data */ + }; + /* Create the Enumerated type, and then the AVP */ + CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); + CHECK_dict_new( DICT_ENUMVAL, &t_3 , type, NULL); + CHECK_dict_new( DICT_ENUMVAL, &t_5 , type, NULL); + CHECK_dict_new( DICT_ENUMVAL, &t_8 , type, NULL); + CHECK_dict_new( DICT_AVP, &data , type, NULL); + } + + /* Trigger */ + { + /* + Grouped. The presence of the Trigger AVP in the + CCR identifies the event(s) triggering the CCR. + */ + + struct dict_avp_data data = { + 1264, /* Code */ + 10415, /* Vendor */ + "Trigger", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_GROUPED /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* Trigger-Type */ + { + /* + Enumerated. One or more of these AVPs may be + present. Indicates the event that triggered the + MSCC. Supported values are: + + CHANGE_IN_SGSN_IP_ADDRESS (1), a change in the SGSN address. + + CHANGEINQOS_ANY (2), a change in the QoS profile + + CHANGEINRAT (4), a change in radio access technology + + */ + + struct dict_object *type; + struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(Trigger-Type)" , NULL, NULL, NULL }; + struct dict_enumval_data t_1 = { "CHANGE_IN_SGSN_IP_ADDRESS", { .i32 = 1 }}; + struct dict_enumval_data t_2 = { "CHANGEINQOS_ANY", { .i32 = 2 }}; + struct dict_enumval_data t_4 = { "CHANGEINRAT", { .i32 = 4 }}; + + struct dict_avp_data data = { + 870, /* Code */ + 10415, /* Vendor */ + "Trigger-Type", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_INTEGER32 /* base type of data */ + }; + /* Create the Enumerated type, and then the AVP */ + CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); + CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL); + CHECK_dict_new( DICT_ENUMVAL, &t_2 , type, NULL); + CHECK_dict_new( DICT_ENUMVAL, &t_4 , type, NULL); + CHECK_dict_new( DICT_AVP, &data , type, NULL); + } + + /* Service-Information */ + { + /* + Grouped. The Service-Information purpose is to + allow the transmission of additional 3GPP service + specific information elements (3GPP 32.299 + Rel7). + */ + + struct dict_avp_data data = { + 873, /* Code */ + 10415, /* Vendor */ + "Service-Information", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_GROUPED /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* PS-Information */ + { + /* + Grouped. Its purpose is to allow the transmission + of additional PS service specific information + elements (3GPP 32.299 Rel7). + */ + + struct dict_avp_data data = { + 874, /* Code */ + 10415, /* Vendor */ + "PS-Information", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_GROUPED /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* PDP-Address */ + { + /* + Address. Present only in the initial CCR. Contains + the user equipment IP address. This AVP is + defined in 3GPP 32.299 Rel7. + */ + + struct dict_avp_data data = { + 1227, /* Code */ + 10415, /* Vendor */ + "PDP-Address", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , Address_type, NULL); + } + + /* 3GPP-IMSI-MCC-MNC */ + { + /* + UTF8String. MCC and MNC extracted from the + user's IMSI (first 5 or 6 digits, as applicable from + the presented IMSI). The MCC-MNCs are + extracted from the tables configured in FlexiISN + configuration under the General and Roaming + configurations. + */ + struct dict_avp_data data = { + 8, /* Code */ + 10415, /* Vendor */ + "3GPP-IMSI-MCC-MNC", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL); + } + + /* 3GPP-GGSN-Address */ + { + /* + Address. (3GPP TS 32.299 Rel7 ). Usually the IP + address of Flexi ISN. The only exception is when + the Flexi ISN acts as a NAS server and the + charging ID selection is set to NAS Client; then the + GGSN IP address will be the NAIP address. Present in the initial CCR only.S client + */ + + struct dict_avp_data data = { + 847, /* Code */ + 10415, /* Vendor */ + "3GPP-GGSN-Address", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , Address_type, NULL); + } + + /* 3GPP-SGSN-Address */ + { + /* + Address. (3GPP TS 32.299 Rel7 ). The IP address + of the SGSN Gn interface. In update and termina- + tion requests, this AVP is present only when the + CCR has been triggered by a routing area update. + */ + struct dict_avp_data data = { + 1228, /* Code */ + 10415, /* Vendor */ + "3GPP-SGSN-Address", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , Address_type, NULL); + } + + /* 3GPP-Charging-Id */ + { + /* + Unsigned32. (3GPP TS 29.061 Rel7) . The + charging identifier for the PDP context. The Flexi + ISN generates the 3GPP charging ID for both + virtual and normal PDP contexts with one excep- + tion. If the Flexi ISN acts as a NAS server and the + charging ID selection is set to NAS Client, the + charging ID will be the NAand not the 3GPP charging ID of Flexi ISN. + Present in the initial CCR only.S client + */ + struct dict_avp_data data = { + 2, /* Code */ + 10415, /* Vendor */ + "3GPP-Charging-Id", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_UNSIGNED32 /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* 3GPP-GPRS-Neg-QoS-Profile */ + { + /* + UTF8String. (3GPP TS 29.061 Rel7 ). The QoS + profile applied by the Flexi ISN. In update and ter- + mination requests, this AVP is present only when + the CCR has been triggered by a PDP context + update affecting the negotiated QoS + */ + struct dict_avp_data data = { + 5, /* Code */ + 10415, /* Vendor */ + "3GPP-GPRS-Neg-QoS-Profile", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL); + } + + /* 3GPP-Charging-Characteristics */ + { + /* + UTF8String. (3GPP TS 29.061 Rel7 ). The + charging characteristics for the PDP context. + Present in the initial CCR only. Consists of four + octets. Each octet contains a single UTF-8 + encoded digit. The content of the charging charac- + teristics is described in 3GPP TS 32.215. + */ + struct dict_avp_data data = { + 13, /* Code */ + 10415, /* Vendor */ + "3GPP-Charging-Characteristics", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL); + } + + /* 3GPP-PDP-Type */ + { + /* + Enumerated. (3GPP TS 29.061 Rel7 ). Type of + PDP context, for example, IP or PPP. Present in + the initial CCR only. + */ + struct dict_avp_data data = { + 3, /* Code */ + 10415, /* Vendor */ + "3GPP-PDP-Type", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_INTEGER32 /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* 3GPP-SGSN-MCC-MNC */ + { + /* + UTF8String. (3GPP TS 29.061 Rel7 ). MCC and + MNC extracted from the RAI within Create or + Update PDP Context Request. In update and ter- + mination requests, this AVP is present only when + the CCR has been triggered by a routing area + update. + */ + struct dict_avp_data data = { + 18, /* Code */ + 10415, /* Vendor */ + "3GPP-SGSN-MCC-MNC", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL); + } + + /* CG-Address */ + { + /* + Address. (3GPP 32.299 Rel7). The address of the + charging gateway that has been marked as the + default charging gateway for the PDP context. + Present in the initial CCR only. + */ + struct dict_avp_data data = { + 846, /* Code */ + 10415, /* Vendor */ + "CG-Address", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , Address_type, NULL); + } + + /* 3GPP-GGSN-MCC-MNC */ + { + /* + UTF8String. (3GPP TS 29.061 Rel7 ). Contains + the mobile country and network code of the PLMN + that the Flexi ISN belongs to. Present in the initial + CCR only. The first entry in the list of local PLMNs + in the Flexi ISN configuration determines the value + of this AVP. + */ + struct dict_avp_data data = { + 9, /* Code */ + 10415, /* Vendor */ + "3GPP-GGSN-MCC-MNC", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL); + } + + /* 3GPP-NSAPI */ + { + /* + UTF8String. (3GPP TS 29.061 Rel7 ). Indicates + the NSAPI of the PDP context. Contains one octet + consisting of a single digit. Present in the initial + CCR only. + */ + struct dict_avp_data data = { + 10, /* Code */ + 10415, /* Vendor */ + "3GPP-NSAPI", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL); + } + + /* 3GPP-Selection-Mode */ + { + /* + UTF8String. (3GPP TS 29.061 Rel7 ). Consists of + one octet containing the selection mode as + received from SGSN in the Create PDP Context + Request. Present in the initial CCR only. + */ + struct dict_avp_data data = { + 12, /* Code */ + 10415, /* Vendor */ + "3GPP-Selection-Mode", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL); + + } + + /* 3GPP-RAT-Type */ + { + /* + OctetString. (3GPP TS 29.061 Rel7 ) Defines the + method used to access the network. Consists of a + single octet. The following values may be sent: + UTRAN (1), GERAN (2), WLAN (3), NAS (254), + Unspecified (255). + This AVP is included in the initial CCR and in + update or termination CCRs if the value changes. + */ + struct dict_avp_data data = { + 21, /* Code */ + 10415, /* Vendor */ + "3GPP-RAT-Type", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* 3GPP-User-Location-Info */ + { + /* + OctetString. (3GPP TS 29.061 Rel7 ) Contains + information about the user's current geographical + location as received from the SGSN. Present + always in initial CCR if the value is known and in + update and termination CCRs if the value + changes. + */ + struct dict_avp_data data = { + 22, /* Code */ + 10415, /* Vendor */ + "3GPP-User-Location-Info", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* 3GPP-MS-TimeZone */ + { + /* + OctetString. (3GPP TS 29.061 Rel7 ) 3GPP-MS- + TimeZone is AVP is present always in the initial CCR if the + value is known and in the update and termination + CCRs if the value changes. This IE is encoded + according to 3GPP TS 29.061 Rel7 + */ + struct dict_avp_data data = { + 23, /* Code */ + 10415, /* Vendor */ + "3GPP-MS-TimeZone", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* PDP-Context-Type */ + { + /* + Enumerated. Indicates the type of a PDP context + and is only included in CCR initial. + + values are 0 for primary and 1 for secondary + (3GPP 32.299 Rel7) + */ + struct dict_object *type; + struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Enumerated(PDP-Context-Type)" , NULL, NULL, NULL }; + struct dict_enumval_data t_0 = { "PRIMARY", { .i32 = 0 }}; + struct dict_enumval_data t_1 = { "SECONDARY", { .i32 = 1 }}; + + struct dict_avp_data data = { + 1247, /* Code */ + 10415, /* Vendor */ + "PDP-Context-Type", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_INTEGER32 /* base type of data */ + }; + /* Create the Enumerated type, and then the AVP */ + CHECK_dict_new( DICT_TYPE, &tdata , NULL, &type); + CHECK_dict_new( DICT_ENUMVAL, &t_0 , type, NULL); + CHECK_dict_new( DICT_ENUMVAL, &t_1 , type, NULL); + CHECK_dict_new( DICT_AVP, &data , type, NULL); + } + + /* IMS-Information */ + { + /* + Grouped. Its purpose is to allow the transmission + of additional IMS service specific information ele- + ments. (3GPP 32.299 Rel7) + */ + struct dict_avp_data data = { + 876, /* Code */ + 10415, /* Vendor */ + "IMS-Information", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_GROUPED /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* IMS-Charging-Identifier */ + { + /* + UTF8String. Contains the IMS charging identifier + as given to the Flexi ISN by the IMS. This AVP is + defined in 3GPP TS 32.225. This AVP is present + in IMS sessions only. Present in the initial CCR + only. + */ + struct dict_avp_data data = { + 841, /* Code */ + 10415, /* Vendor */ + "IMS-Charging-Identifier", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL); + } + + + + + /* Max-Requested-Bandwidth-UL */ + { + /* + Unsigned32. The Max-Requested-Bandwidth- + UL/DL AVP indicates the maximum allowed bit + rate (in bits per second) for the uplink direction. + (Re-used from 3GPP 29.214) + */ + struct dict_avp_data data = { + 515, /* Code */ + 10415, /* Vendor */ + "Max-Requested-Bandwidth-UL", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_UNSIGNED32 /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* Max-Requested-Bandwidth-DL */ + { + /* + Unsigned32. The Max-Requested-Bandwidth- + UL/DL AVP indicates the maximum allowed bit + rate (in bits per second) for the uplink direction. + */ + struct dict_avp_data data = { + 516, /* Code */ + 10415, /* Vendor */ + "Max-Requested-Bandwidth-DL", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_UNSIGNED32 /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* 3GPP-GGSN-IP-Address */ + { + /* + OctetString. (3GPP TS 29.061 Rel4). Usually the + IP address of Flexi ISN. The only exception is + when the Flexi ISN acts as a NAS server and the + charging ID selection is set to NAS Client; then the + GGSN IP address will be the NAIP address. Present in the initial CCR only.S client + */ + struct dict_avp_data data = { + 7, /* Code */ + 10415, /* Vendor */ + "3GPP-GGSN-IP-Address", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* 3GPP-CG-Address */ + { + /* + OctetString. (3GPP TS 29.061 Rel4). The address + of the charging gateway that has been marked as + the default charging gateway for the PDP context. + The address is expressed as a four-byte integer. + Present in the initial CCR only. + */ + struct dict_avp_data data = { + 4, /* Code */ + 10415, /* Vendor */ + "3GPP-CG-Address", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* 3GPP-SGSN-IP-Address */ + { + /* + OctetString. (3GPP TS 29.061 Rel4). The address + of the charging gateway that has been marked as + the default charging gateway for the PDP context. + The address is expressed as a four-byte integer. + Present in the initial CCR only. + */ + struct dict_avp_data data = { + 6, /* Code */ + 10415, /* Vendor */ + "3GPP-SGSN-IP-Address", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* Session-Stop-Indicator */ + { + /* + OctetString. (3GPP TS 29.061 Rel4). The + presence of this AVP indicates that the last + context of the PDP session has been deleted. May + be present in the termination CCR only. Contains + one octet that has a value of 0xff. + */ + struct dict_avp_data data = { + 11, /* Code */ + 10415, /* Vendor */ + "Session-Stop-Indicator", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* QoS-Information */ + { + /* + Grouped. This is the QoS that the DCCA + server requests from Flexi ISN to be applied for + this PDP context. This AVP and all AVPs con- + tained within are described in 3GPP TS 29.212 + Release 7. The ARP AVP is introduced with + Release 8. The relevant types are defined on + table 5.3.1 of TS 29.212. + */ + + struct dict_avp_data data = { + 1016, /* Code */ + 10415, /* Vendor */ + "QoS-Information", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_GROUPED /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + } + + + + TRACE_DEBUG(INFO, "Extension 'Dictionary definitions for DCCA 3GPP' initialized"); + return 0; +} + +EXTENSION_ENTRY("dict_dcca_3gpp", dict_dcca_3gpp_entry);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/dict_dcca/dict_dcca_nokia.c Tue Aug 21 13:34:20 2012 +0200 @@ -0,0 +1,288 @@ +/* + * Dictionary definitions of objects specified in DCCA (Nokia, 3GPP). + */ +#include <freeDiameter/extension.h> + + +/* The content of this file follows the same structure as dict_base_proto.c */ + +#define CHECK_dict_new( _type, _data, _parent, _ref ) \ + CHECK_FCT( fd_dict_new( fd_g_config->cnf_dict, (_type), (_data), (_parent), (_ref)) ); + +#define CHECK_dict_search( _type, _criteria, _what, _result ) \ + CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, (_type), (_criteria), (_what), (_result), ENOENT) ); + +struct local_rules_definition { + char *avp_name; + enum rule_position position; + int min; + int max; +}; + +#define RULE_ORDER( _position ) ((((_position) == RULE_FIXED_HEAD) || ((_position) == RULE_FIXED_TAIL)) ? 1 : 0 ) + +#define PARSE_loc_rules( _rulearray, _parent) { \ + int __ar; \ + for (__ar=0; __ar < sizeof(_rulearray) / sizeof((_rulearray)[0]); __ar++) { \ + struct dict_rule_data __data = { NULL, \ + (_rulearray)[__ar].position, \ + 0, \ + (_rulearray)[__ar].min, \ + (_rulearray)[__ar].max}; \ + __data.rule_order = RULE_ORDER(__data.rule_position); \ + CHECK_FCT( fd_dict_search( \ + fd_g_config->cnf_dict, \ + DICT_AVP, \ + AVP_BY_NAME, \ + (_rulearray)[__ar].avp_name, \ + &__data.rule_avp, 0 ) ); \ + if ( !__data.rule_avp ) { \ + TRACE_DEBUG(INFO, "AVP Not found: '%s'", (_rulearray)[__ar].avp_name ); \ + return ENOENT; \ + } \ + CHECK_FCT_DO( fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &__data, _parent, NULL), \ + { \ + TRACE_DEBUG(INFO, "Error on rule with AVP '%s'", \ + (_rulearray)[__ar].avp_name ); \ + return EINVAL; \ + } ); \ + } \ +} + +#define enumval_def_u32( _val_, _str_ ) \ + { _str_, { .u32 = _val_ }} + +#define enumval_def_os( _len_, _val_, _str_ ) \ + { _str_, { .os = { .data = (unsigned char *)_val_, .len = _len_ }}} + + +static int dict_dcca_nokia_entry(char * conffile) +{ + struct dict_object * dcca; + TRACE_ENTRY("%p", conffile); + + /* Applications section */ + { + /* DCCA */ + { + struct dict_application_data data = { 4, "Diameter Credit Control Application" }; + CHECK_dict_new( DICT_APPLICATION, &data, NULL, &dcca); + } + + /* Create the vendors */ + { + struct dict_vendor_data vendor_data = { 94, "Nokia" }; + CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_VENDOR, &vendor_data, NULL, NULL)); + } + + } + + + /* AVP section */ + { + struct dict_object * Address_type; + struct dict_object * UTF8String_type; + struct dict_object * DiameterIdentity_type; + struct dict_object * DiameterURI_type; + struct dict_object * Time_type; + + CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Address", &Address_type); + CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "UTF8String", &UTF8String_type); + CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "DiameterIdentity", &DiameterIdentity_type); + CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "DiameterURI", &DiameterURI_type); + CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Time", &Time_type); + + /* NSN-Token-Value */ + { + /* + OctetString. A token that was received, for + example, from the subscription portal [14]. The + maximum length of the token is 64 octets. + When this AVP is included in the MSCC, the USU + and Reporting-Reason AVPs will not be included + (because the token is not a trigger to report quota + usage). Additionally, the Rating-Group and + Service-Id AVPs will have the values received + from the subscription portal. + */ + struct dict_avp_data data = { + 5113, /* Code */ + 94, /* Vendor */ + "NSN-Token-Value", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* Quota-Consumption-Time */ + { + /* + Unsigned32. Contains the time quota envelope + expiration time in seconds. This is the time + elapsed from the previous service request, to + the moment the Flexi ISN considers that the + time envelope finishes. The value of this AVP + will be in effect for the remainder of the session + or until a new value is received. If this AVP is + not present, the default value configured for the + rating group will be used. The OCS may + disable the time quota envelope expiration by + setting the value of this AVP to 0. The value of + QCT sent from the OCS for a certain MSCC + instance is stored in the Flexi ISN and it is used + if the OCS does not sent a new value in the + CCAs that follow + */ + struct dict_avp_data data = { + 5109, /* Code */ + 94, /* Vendor */ + "Quota-Consumption-Time", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_UNSIGNED32 /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* Quota-Holding-Time */ + { + /* + Unsigned32. Indicates how long the Flexi ISN + will keep the granted quota after a service + request has been received. The unit is in + seconds. When this time elapses, the Flexi ISN + ends the MSCC instance and reports the used + quota without requesting more. The value of + this AVP will be in effect for the remainder of + the session or until a new value is received. If + this AVP is not present, the default value con- + figured for the rating group will be used. The + OCS may disable the Quota Holding Timer by + setting the value of this AVP to 0. The value of + the QHT sent from the OCS for a certain + MSCC instance is stored in the Flexi ISN, and + it is used if the OCS does not sent a new value + in the CCAs that follow. + */ + struct dict_avp_data data = { + 5110, /* Code */ + 94, /* Vendor */ + "Quota-Holding-Time", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_UNSIGNED32 /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* Default-Quota */ + { + /* + Grouped. Indicates the absolute number of + units that are available for consumption during + each upcoming OCS interrogation (e.g. after a + CCR has been sent but before the CCA is + received). If this AVP is not present, the Flexi + ISN will use the configured or earlier received + default quota. If this AVP is present but does + not include the default quota for a certain unit + type, that unit type is considered to have no + default quota. + The usage of default quota can be disabled in + certain situations by modifying the Flexi ISN + settings + */ + struct dict_avp_data data = { + 5111, /* Code */ + 94, /* Vendor */ + "Default-Quota", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flag values */ + AVP_TYPE_GROUPED /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* Session-Start-Indicator */ + { + /* + OctetString. (3GPP TS 29.061 Rel4). The address + of the charging gateway that has been marked as + the default charging gateway for the PDP context. + The address is expressed as a four-byte integer. + Present in the initial CCR only. + */ + struct dict_avp_data data = { + 5105, /* Code */ + 94, /* Vendor */ + "Session-Start-Indicator", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , NULL, NULL); + } + + /* Rulebase-id */ + { + /* + */ + struct dict_avp_data data = { + 5106, /* Code */ + 94, /* Vendor */ + "Rulebase-id", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , UTF8String_type, NULL); + } + + /* Time-Of-First-Usage */ + { + /* + Time. Contains a time-stamp identifying the date + and time of the first increment of the used units + counter since the previous report. If no used units + were gathered during the previous reporting inter- + val, this AVP will not be present. + */ + struct dict_avp_data data = { + 5103, /* Code */ + 94, /* Vendor */ + "Time-Of-First-Usage", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , Time_type, NULL); + } + + /* Time-Of-Last-Usage */ + { + /* + Time. Contains a time-stamp identifying the date + and time of the first increment of the used units + counter since the previous report. If no used units + were gathered during the previous reporting inter- + val, this AVP will not be present. + */ + struct dict_avp_data data = { + 5104, /* Code */ + 94, /* Vendor */ + "Time-Of-Last-Usage", /* Name */ + AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new( DICT_AVP, &data , Time_type, NULL); + } + } + + TRACE_DEBUG(INFO, "Extension 'Dictionary definitions for DCCA Nokia' initialized"); + return 0; +} + +EXTENSION_ENTRY("dict_dcca_nokia", dict_dcca_nokia_entry);
--- a/extensions/dict_dcca/dict_dcca.c Mon Aug 20 22:56:18 2012 +0200 +++ b/extensions/dict_dcca/dict_dcca.c Tue Aug 21 13:34:20 2012 +0200 @@ -1,10 +1,8 @@ /**************** Contributed by: Konstantin Chekushin <koch@lmt.lv> - License: to be specified. + License: same as freeDiameter TODO: - - CCR/CCA definition missing. - rules for CCR/CCA and all Grouped AVPs - - new Result-Code values ****************/ @@ -81,6 +79,51 @@ } + /* Result codes */ + { + struct dict_object *ResultCodeType; + CHECK_dict_search(DICT_TYPE, TYPE_BY_NAME, "Enumerated*(Result-Code)", &ResultCodeType); + + { + struct dict_enumval_data error_code = {"END_USER_SERVICE_DENIED", + { .u32 = 4010}}; + CHECK_dict_new(DICT_ENUMVAL, &error_code, ResultCodeType, NULL); + } + { + struct dict_enumval_data error_code = {"CREDIT_CONTROL_NOT_APPLICABLE", + { .u32 = 4011}}; + CHECK_dict_new(DICT_ENUMVAL, &error_code, ResultCodeType, NULL); + } + + } + + + /* Commands section */ + { + /*Credit Control Request*/ + { + struct dict_object * cmd; + struct dict_cmd_data data = { + 272, /* Code */ + "Credit-Control-Request", /* Name */ + CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */ + CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE /* Fixed flag values */ + }; + CHECK_dict_new(DICT_COMMAND, &data, NULL, &cmd); + } + + /*Credit Control Response*/ + { + struct dict_object * cmd; + struct dict_cmd_data data = { + 272, /* Code */ + "Credit-Control-Answer", /* Name */ + CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE, /* Fixed flags */ + CMD_FLAG_PROXIABLE /* Fixed flag values */ + }; + CHECK_dict_new(DICT_COMMAND, &data, NULL, &cmd); + } + } /* AVP section */ {