|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <freeDiameter/extension.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#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 { |
|
|
struct dict_avp_request avp_vendor_plus_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_AND_VENDOR, \ |
|
|
&(_rulearray)[__ar].avp_vendor_plus_name, \ |
|
|
&__data.rule_avp, 0 ) ); \ |
|
|
if ( !__data.rule_avp ) { \ |
|
|
TRACE_DEBUG(INFO, "AVP Not found: '%s'", (_rulearray)[__ar].avp_vendor_plus_name.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_vendor_plus_name.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_ }}} |
|
|
|
|
|
|
|
|
int ogs_dict_common_entry(char *conffile) |
|
|
{ |
|
|
|
|
|
{ |
|
|
{ |
|
|
struct dict_vendor_data vendor_data = { 13019, "ETSI" }; |
|
|
CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_VENDOR, &vendor_data, NULL, NULL)); |
|
|
} |
|
|
} |
|
|
|
|
|
struct dict_object * UTF8String_type; |
|
|
|
|
|
CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "UTF8String", &UTF8String_type); |
|
|
|
|
|
|
|
|
{ |
|
|
struct dict_avp_data data = { |
|
|
302, |
|
|
13019, |
|
|
"Logical-Access-ID", |
|
|
AVP_FLAG_VENDOR, |
|
|
AVP_FLAG_VENDOR, |
|
|
AVP_TYPE_OCTETSTRING |
|
|
}; |
|
|
CHECK_dict_new(DICT_AVP, &data, NULL, NULL); |
|
|
}; |
|
|
|
|
|
|
|
|
{ |
|
|
struct dict_avp_data data = { |
|
|
313, |
|
|
13019, |
|
|
"Physical-Access-ID", |
|
|
AVP_FLAG_VENDOR, |
|
|
AVP_FLAG_VENDOR, |
|
|
AVP_TYPE_OCTETSTRING |
|
|
}; |
|
|
CHECK_dict_new(DICT_AVP, &data, UTF8String_type, NULL); |
|
|
}; |
|
|
|
|
|
|
|
|
{ |
|
|
struct dict_avp_data data = { |
|
|
458, |
|
|
13019, |
|
|
"Reservation-Priority", |
|
|
AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY, |
|
|
AVP_FLAG_VENDOR, |
|
|
AVP_TYPE_UNSIGNED32 |
|
|
}; |
|
|
CHECK_dict_new(DICT_AVP, &data, NULL, NULL); |
|
|
}; |
|
|
|
|
|
LOG_D( "Extension 'Dictionary definitions for DCCA 3GPP' initialized"); |
|
|
return 0; |
|
|
} |
|
|
|
|
|
#if 0 |
|
|
EXTENSION_ENTRY("dict_ogs_common", ogs_dict_common_entry, "dict_dcca_3gpp"); |
|
|
#endif |
|
|
|