# HG changeset patch # User Thomas Klausner # Date 1362750046 -3600 # Node ID 398e9b1ebf87ff7da6fbcc59c6c56cb6ea28faba # Parent d95cd3ca9e8dc2190d1e26498cb58494bc974649 Add a dictionary for Starent vendor specific AVPs, following publicly available Cisco documentation. diff -r d95cd3ca9e8d -r 398e9b1ebf87 extensions/dict_dcca_starent/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extensions/dict_dcca_starent/CMakeLists.txt Fri Mar 08 14:40:46 2013 +0100 @@ -0,0 +1,14 @@ +# The dict_dcca_starent extension +PROJECT("Diameter DCCA (Diameter Credit Control Application) Starent dictionary definitions " C) + +# Compile as a module +FD_ADD_EXTENSION(dict_dcca_starent dict_dcca_starent.c) + + +#### +## INSTALL section ## + +INSTALL(TARGETS dict_dcca_starent + LIBRARY DESTINATION ${INSTALL_EXTENSIONS_SUFFIX} + COMPONENT freeDiameter-dictionary-rfc4006-extension-starent) + diff -r d95cd3ca9e8d -r 398e9b1ebf87 extensions/dict_dcca_starent/dict_dcca_starent.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extensions/dict_dcca_starent/dict_dcca_starent.c Fri Mar 08 14:40:46 2013 +0100 @@ -0,0 +1,289 @@ +/* + * Dictionary definitions of objects specified in DCCA by Starent. + */ +#include + + +/* 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_starent_entry(char * conffile) +{ + /* Applications section */ + { + /* Create the vendors */ + { + struct dict_vendor_data vendor_data = { 8164, "Starent" }; + CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_VENDOR, &vendor_data, NULL, NULL)); + } + + } + + + struct dict_object * Address_type; + struct dict_object * DiameterIdentity_type; + struct dict_object * DiameterURI_type; + struct dict_object * IPFilterRule_type; + struct dict_object * Time_type; + struct dict_object * UTF8String_type; + + CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Address", &Address_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, "IPFilterRule", &IPFilterRule_type); + CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Time", &Time_type); + CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "UTF8String", &UTF8String_type); + + /* The following is created automatically. Do not modify. */ + /* Changes will be lost during the next update. Modify the source org file instead. */ + + /* Cisco ASR 5000 Series AAA Interface */ + /* Administration and Reference */ + /* Release 8.x and 9.0 */ + /* Last Updated June 30, 2010 */ + /* SN-Volume-Quota-Threshold */ + { + struct dict_avp_data data = { + 501, /* Code */ + 8164, /* Vendor */ + "SN-Volume-Quota-Threshold", /* 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); + }; + + /* SN-Unit-Quota-Threshold */ + { + struct dict_avp_data data = { + 502, /* Code */ + 8164, /* Vendor */ + "SN-Unit-Quota-Threshold", /* 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); + }; + + /* SN-Time-Quota-Threshold */ + { + struct dict_avp_data data = { + 503, /* Code */ + 8164, /* Vendor */ + "SN-Time-Quota-Threshold", /* 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); + }; + + /* SN-Total-Used-Service-Unit */ + { + struct dict_avp_data data = { + 504, /* Code */ + 8164, /* Vendor */ + "SN-Total-Used-Service-Unit", /* Name */ + AVP_FLAG_VENDOR, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_GROUPED /* base type of data */ + }; + CHECK_dict_new(DICT_AVP, &data, NULL, NULL); + }; + + /* SN-Absolute-Validity-Time */ + { + struct dict_avp_data data = { + 505, /* Code */ + 8164, /* Vendor */ + "SN-Absolute-Validity-Time", /* Name */ + AVP_FLAG_VENDOR, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new(DICT_AVP, &data, Time_type, NULL); + }; + + /* SN-Bandwidth-Control */ + { + struct dict_avp_data data = { + 512, /* Code */ + 8164, /* Vendor */ + "SN-Bandwidth-Control", /* 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 */ + }; + struct dict_object *type; + struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Starent/Enumerated(SN-Bandwidth-Control)", NULL, NULL, NULL }; + CHECK_dict_new(DICT_TYPE, &tdata, NULL, &type); + CHECK_dict_new(DICT_AVP, &data, type, NULL); + }; + + /* SN-Transparent-Data */ + { + struct dict_avp_data data = { + 513, /* Code */ + 8164, /* Vendor */ + "SN-Transparent-Data", /* Name */ + AVP_FLAG_VENDOR, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new(DICT_AVP, &data, NULL, NULL); + }; + + /* SN-Traffic-Policy */ + { + struct dict_avp_data data = { + 514, /* Code */ + 8164, /* Vendor */ + "SN-Traffic-Policy", /* Name */ + AVP_FLAG_VENDOR, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new(DICT_AVP, &data, UTF8String_type, NULL); + }; + + /* SN-Firewall-Policy */ + { + struct dict_avp_data data = { + 515, /* Code */ + 8164, /* Vendor */ + "SN-Firewall-Policy", /* Name */ + AVP_FLAG_VENDOR, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_OCTETSTRING /* base type of data */ + }; + CHECK_dict_new(DICT_AVP, &data, UTF8String_type, NULL); + }; + + /* SN-Usage-Monitoring-Control */ + { + struct dict_avp_data data = { + 517, /* Code */ + 8164, /* Vendor */ + "SN-Usage-Monitoring-Control", /* Name */ + AVP_FLAG_VENDOR, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_GROUPED /* base type of data */ + }; + CHECK_dict_new(DICT_AVP, &data, NULL, NULL); + }; + + /* SN-Monitoring-Key */ + { + struct dict_avp_data data = { + 518, /* Code */ + 8164, /* Vendor */ + "SN-Monitoring-Key", /* Name */ + AVP_FLAG_VENDOR, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_UNSIGNED32 /* base type of data */ + }; + CHECK_dict_new(DICT_AVP, &data, NULL, NULL); + }; + + /* SN-Usage-Volume */ + { + struct dict_avp_data data = { + 519, /* Code */ + 8164, /* Vendor */ + "SN-Usage-Volume", /* Name */ + AVP_FLAG_VENDOR, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_UNSIGNED64 /* base type of data */ + }; + CHECK_dict_new(DICT_AVP, &data, NULL, NULL); + }; + + /* SN-Service-Flow-Detection */ + { + struct dict_avp_data data = { + 520, /* Code */ + 8164, /* Vendor */ + "SN-Service-Flow-Detection", /* Name */ + AVP_FLAG_VENDOR, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_INTEGER32 /* base type of data */ + }; + struct dict_object *type; + struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Starent/Enumerated(SN-Service-Flow-Detection)", NULL, NULL, NULL }; + CHECK_dict_new(DICT_TYPE, &tdata, NULL, &type); + CHECK_dict_new(DICT_AVP, &data, type, NULL); + }; + + /* SN-Usage-Monitoring */ + { + struct dict_avp_data data = { + 521, /* Code */ + 8164, /* Vendor */ + "SN-Usage-Monitoring", /* Name */ + AVP_FLAG_VENDOR, /* Fixed flags */ + AVP_FLAG_VENDOR, /* Fixed flag values */ + AVP_TYPE_INTEGER32 /* base type of data */ + }; + struct dict_object *type; + struct dict_type_data tdata = { AVP_TYPE_INTEGER32, "Starent/Enumerated(SN-Usage-Monitoring)", NULL, NULL, NULL }; + CHECK_dict_new(DICT_TYPE, &tdata, NULL, &type); + CHECK_dict_new(DICT_AVP, &data, type, NULL); + }; + + + TRACE_DEBUG(INFO, "Extension 'Dictionary definitions for DCCA Starent' initialized"); + return 0; +} + +EXTENSION_ENTRY("dict_dcca_starent", dict_dcca_starent_entry, "dict_dcca_3gpp"); diff -r d95cd3ca9e8d -r 398e9b1ebf87 extensions/dict_dcca_starent/dict_dcca_starent.org --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extensions/dict_dcca_starent/dict_dcca_starent.org Fri Mar 08 14:40:46 2013 +0100 @@ -0,0 +1,19 @@ +| Attribute Name | Code | Section defined | Value Type | MUST | MAY | SHLD NOT | MUST NOT | Encr | +| # Cisco ASR 5000 Series AAA Interface | | | | | | | | | +| # Administration and Reference | | | | | | | | | +| # Release 8.x and 9.0 | | | | | | | | | +| # Last Updated June 30, 2010 | | | | | | | | | +| SN-Volume-Quota-Threshold | 501 | | Unsigned32 | M,V | | | | | +| SN-Unit-Quota-Threshold | 502 | | Unsigned32 | M,V | | | | | +| SN-Time-Quota-Threshold | 503 | | Unsigned32 | M,V | | | | | +| SN-Total-Used-Service-Unit | 504 | | Grouped | V | | | | | +| SN-Absolute-Validity-Time | 505 | | Time | V | | | | | +| SN-Bandwidth-Control | 512 | | Enumerated | M,V | | | | | +| SN-Transparent-Data | 513 | | OctetString | V | | | | | +| SN-Traffic-Policy | 514 | | UTF8String | V | | | | | +| SN-Firewall-Policy | 515 | | UTF8String | V | | | | | +| SN-Usage-Monitoring-Control | 517 | | Grouped | V | | | | | +| SN-Monitoring-Key | 518 | | Unsigned32 | V | | | | | +| SN-Usage-Volume | 519 | | Unsigned64 | V | | | | | +| SN-Service-Flow-Detection | 520 | | Enumerated | V | | | | | +| SN-Usage-Monitoring | 521 | | Enumerated | V | | | | |