Navigation


Changeset 1499:71cc2c59e7dc in freeDiameter for extensions/dict_dcca_starent


Ignore:
Timestamp:
Apr 3, 2020, 10:11:11 AM (4 years ago)
Author:
Luke Mewburn <luke@mewburn.net>
Branch:
default
Phase:
public
committer:
Luke Mewburn <luke@mewburn.net> 1585876483 -39600
Message:

move generated AVPs into separate source files

Refactor dict_dcca_3gpp and dict_dcca_starent so
the generated source is in a separate add_avps.c.
Easier to maintain, and also compiles faster.

Improve the error logging for DICT_RULE failure.

Location:
extensions/dict_dcca_starent
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/dict_dcca_starent/CMakeLists.txt

    r962 r1499  
    33
    44# Compile as a module
    5 FD_ADD_EXTENSION(dict_dcca_starent dict_dcca_starent.c)
     5FD_ADD_EXTENSION(dict_dcca_starent dict_dcca_starent.c add_avps.c)
    66
    77
  • extensions/dict_dcca_starent/dict_dcca_starent.c

    r1470 r1499  
    66
    77/* The content of this file follows the same structure as dict_base_proto.c */
    8 
    9 #define CHECK_dict_new( _type, _data, _parent, _ref )   \
    10         CHECK_FCT(  fd_dict_new( fd_g_config->cnf_dict, (_type), (_data), (_parent), (_ref))  );
    118
    129#define CHECK_dict_search( _type, _criteria, _what, _result )   \
     
    3936                        &__data.rule_avp, 0 ) );                                                        \
    4037                if ( !__data.rule_avp ) {                                                               \
    41                         TRACE_DEBUG(INFO, "AVP Not found: '%s'", (_rulearray)[__ar].avp_name );         \
     38                        LOG_E( "AVP Not found: '%s'", (_rulearray)[__ar].avp_name );                    \
    4239                        return ENOENT;                                                                  \
    4340                }                                                                                       \
    4441                CHECK_FCT_DO( fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &__data, _parent, NULL),   \
    4542                        {                                                                               \
    46                                 TRACE_DEBUG(INFO, "Error on rule with AVP '%s'",                        \
     43                                LOG_E( "Error on rule with AVP '%s'",                                   \
    4744                                         (_rulearray)[__ar].avp_name );                                 \
    4845                                return EINVAL;                                                          \
     
    7067        }
    7168       
    72 
    73         struct dict_object * Address_type;
    74         struct dict_object * DiameterIdentity_type;
    75         struct dict_object * DiameterURI_type;
    76         struct dict_object * IPFilterRule_type;
    77         struct dict_object * Time_type;
    78         struct dict_object * UTF8String_type;
    79 
    80         CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Address", &Address_type);
    81         CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "DiameterIdentity", &DiameterIdentity_type);
    82         CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "DiameterURI", &DiameterURI_type);
    83         CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "IPFilterRule", &IPFilterRule_type);
    84         CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Time", &Time_type);                               
    85         CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "UTF8String", &UTF8String_type);
    86 
    87         /*==================================================================*/
    88         /* Start of generated data.                                         */
    89         /*                                                                  */
    90         /* The following is created automatically with:                     */
    91         /*     csv_to_fd -p fdc dict_dcca_starent.csv                       */
    92         /* Changes will be lost during the next update.                     */
    93         /* Do not modify; modify the source .csv file instead.              */
    94         /*==================================================================*/
    95 
    96         /*==================================================================*/
    97         /* Cisco ASR 5000 Series AAA Interface                              */
    98         /* Administration and Reference                                     */
    99         /* Release 8.x and 9.0                                              */
    100         /* Last Updated June 30, 2010                                       */
    101         /* updated using v15 docs from Jan 2014                             */
    102         /* www.cisco.com/c/dam/en/us/td/docs/wireless/asr_5000/15-0/15-0-AAA-Reference.pdf */
    103         /*==================================================================*/
    104 
    105         /* SN-Volume-Quota-Threshold, Unsigned32, code 501                  */
    106         {
    107                 struct dict_avp_data data = {
    108                         501,    /* Code */
    109                         8164,   /* Vendor */
    110                         "SN-Volume-Quota-Threshold",    /* Name */
    111                         AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY,    /* Fixed flags */
    112                         AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY,    /* Fixed flag values */
    113                         AVP_TYPE_UNSIGNED32     /* base type of data */
    114                 };
    115                 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
    116         };
    117 
    118         /* SN-Unit-Quota-Threshold, Unsigned32, code 502                    */
    119         {
    120                 struct dict_avp_data data = {
    121                         502,    /* Code */
    122                         8164,   /* Vendor */
    123                         "SN-Unit-Quota-Threshold",      /* Name */
    124                         AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY,    /* Fixed flags */
    125                         AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY,    /* Fixed flag values */
    126                         AVP_TYPE_UNSIGNED32     /* base type of data */
    127                 };
    128                 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
    129         };
    130 
    131         /* SN-Time-Quota-Threshold, Unsigned32, code 503                    */
    132         {
    133                 struct dict_avp_data data = {
    134                         503,    /* Code */
    135                         8164,   /* Vendor */
    136                         "SN-Time-Quota-Threshold",      /* Name */
    137                         AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY,    /* Fixed flags */
    138                         AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY,    /* Fixed flag values */
    139                         AVP_TYPE_UNSIGNED32     /* base type of data */
    140                 };
    141                 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
    142         };
    143 
    144         /* SN-Total-Used-Service-Unit, Grouped, code 504                    */
    145         {
    146                 struct dict_avp_data data = {
    147                         504,    /* Code */
    148                         8164,   /* Vendor */
    149                         "SN-Total-Used-Service-Unit",   /* Name */
    150                         AVP_FLAG_VENDOR,        /* Fixed flags */
    151                         AVP_FLAG_VENDOR,        /* Fixed flag values */
    152                         AVP_TYPE_GROUPED        /* base type of data */
    153                 };
    154                 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
    155         };
    156 
    157         /* SN-Absolute-Validity-Time, Time, code 505                        */
    158         {
    159                 struct dict_avp_data data = {
    160                         505,    /* Code */
    161                         8164,   /* Vendor */
    162                         "SN-Absolute-Validity-Time",    /* Name */
    163                         AVP_FLAG_VENDOR,        /* Fixed flags */
    164                         AVP_FLAG_VENDOR,        /* Fixed flag values */
    165                         AVP_TYPE_OCTETSTRING    /* base type of data */
    166                 };
    167                 CHECK_dict_new(DICT_AVP, &data, Time_type, NULL);
    168         };
    169 
    170         /* SN-Bandwidth-Control, Enumerated, code 512                       */
    171         {
    172                 struct dict_avp_data data = {
    173                         512,    /* Code */
    174                         8164,   /* Vendor */
    175                         "SN-Bandwidth-Control", /* Name */
    176                         AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY,    /* Fixed flags */
    177                         AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY,    /* Fixed flag values */
    178                         AVP_TYPE_INTEGER32      /* base type of data */
    179                 };
    180                 struct dict_object      *type;
    181                 struct dict_type_data    tdata = { AVP_TYPE_INTEGER32, "Enumerated(Starent/SN-Bandwidth-Control)", NULL, NULL, NULL };
    182                 CHECK_dict_new(DICT_TYPE, &tdata, NULL, &type);
    183                 CHECK_dict_new(DICT_AVP, &data, type, NULL);
    184         };
    185 
    186         /* SN-Transparent-Data, OctetString, code 513                       */
    187         {
    188                 struct dict_avp_data data = {
    189                         513,    /* Code */
    190                         8164,   /* Vendor */
    191                         "SN-Transparent-Data",  /* Name */
    192                         AVP_FLAG_VENDOR,        /* Fixed flags */
    193                         AVP_FLAG_VENDOR,        /* Fixed flag values */
    194                         AVP_TYPE_OCTETSTRING    /* base type of data */
    195                 };
    196                 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
    197         };
    198 
    199         /* SN-Traffic-Policy, UTF8String, code 514                          */
    200         {
    201                 struct dict_avp_data data = {
    202                         514,    /* Code */
    203                         8164,   /* Vendor */
    204                         "SN-Traffic-Policy",    /* Name */
    205                         AVP_FLAG_VENDOR,        /* Fixed flags */
    206                         AVP_FLAG_VENDOR,        /* Fixed flag values */
    207                         AVP_TYPE_OCTETSTRING    /* base type of data */
    208                 };
    209                 CHECK_dict_new(DICT_AVP, &data, UTF8String_type, NULL);
    210         };
    211 
    212         /* SN-Firewall-Policy, UTF8String, code 515                         */
    213         {
    214                 struct dict_avp_data data = {
    215                         515,    /* Code */
    216                         8164,   /* Vendor */
    217                         "SN-Firewall-Policy",   /* Name */
    218                         AVP_FLAG_VENDOR,        /* Fixed flags */
    219                         AVP_FLAG_VENDOR,        /* Fixed flag values */
    220                         AVP_TYPE_OCTETSTRING    /* base type of data */
    221                 };
    222                 CHECK_dict_new(DICT_AVP, &data, UTF8String_type, NULL);
    223         };
    224 
    225         /* SN-Usage-Monitoring-Control, Grouped, code 517                   */
    226         {
    227                 struct dict_avp_data data = {
    228                         517,    /* Code */
    229                         8164,   /* Vendor */
    230                         "SN-Usage-Monitoring-Control",  /* Name */
    231                         AVP_FLAG_VENDOR,        /* Fixed flags */
    232                         AVP_FLAG_VENDOR,        /* Fixed flag values */
    233                         AVP_TYPE_GROUPED        /* base type of data */
    234                 };
    235                 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
    236         };
    237 
    238         /* SN-Monitoring-Key, Unsigned32, code 518                          */
    239         {
    240                 struct dict_avp_data data = {
    241                         518,    /* Code */
    242                         8164,   /* Vendor */
    243                         "SN-Monitoring-Key",    /* Name */
    244                         AVP_FLAG_VENDOR,        /* Fixed flags */
    245                         AVP_FLAG_VENDOR,        /* Fixed flag values */
    246                         AVP_TYPE_UNSIGNED32     /* base type of data */
    247                 };
    248                 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
    249         };
    250 
    251         /* SN-Usage-Volume, Unsigned64, code 519                            */
    252         {
    253                 struct dict_avp_data data = {
    254                         519,    /* Code */
    255                         8164,   /* Vendor */
    256                         "SN-Usage-Volume",      /* Name */
    257                         AVP_FLAG_VENDOR,        /* Fixed flags */
    258                         AVP_FLAG_VENDOR,        /* Fixed flag values */
    259                         AVP_TYPE_UNSIGNED64     /* base type of data */
    260                 };
    261                 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
    262         };
    263 
    264         /* SN-Service-Flow-Detection, Enumerated, code 520                  */
    265         {
    266                 struct dict_avp_data data = {
    267                         520,    /* Code */
    268                         8164,   /* Vendor */
    269                         "SN-Service-Flow-Detection",    /* Name */
    270                         AVP_FLAG_VENDOR,        /* Fixed flags */
    271                         AVP_FLAG_VENDOR,        /* Fixed flag values */
    272                         AVP_TYPE_INTEGER32      /* base type of data */
    273                 };
    274                 struct dict_object      *type;
    275                 struct dict_type_data    tdata = { AVP_TYPE_INTEGER32, "Enumerated(Starent/SN-Service-Flow-Detection)", NULL, NULL, NULL };
    276                 CHECK_dict_new(DICT_TYPE, &tdata, NULL, &type);
    277                 CHECK_dict_new(DICT_AVP, &data, type, NULL);
    278         };
    279 
    280         /* SN-Usage-Monitoring, Enumerated, code 521                        */
    281         {
    282                 struct dict_avp_data data = {
    283                         521,    /* Code */
    284                         8164,   /* Vendor */
    285                         "SN-Usage-Monitoring",  /* Name */
    286                         AVP_FLAG_VENDOR,        /* Fixed flags */
    287                         AVP_FLAG_VENDOR,        /* Fixed flag values */
    288                         AVP_TYPE_INTEGER32      /* base type of data */
    289                 };
    290                 struct dict_object      *type;
    291                 struct dict_type_data    tdata = { AVP_TYPE_INTEGER32, "Enumerated(Starent/SN-Usage-Monitoring)", NULL, NULL, NULL };
    292                 CHECK_dict_new(DICT_TYPE, &tdata, NULL, &type);
    293                 CHECK_dict_new(DICT_AVP, &data, type, NULL);
    294         };
    295 
    296         /* SN-Session-Start-Indicator, OctetString, code 522                */
    297         {
    298                 struct dict_avp_data data = {
    299                         522,    /* Code */
    300                         8164,   /* Vendor */
    301                         "SN-Session-Start-Indicator",   /* Name */
    302                         AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY,    /* Fixed flags */
    303                         AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY,    /* Fixed flag values */
    304                         AVP_TYPE_OCTETSTRING    /* base type of data */
    305                 };
    306                 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
    307         };
    308 
    309         /* SN-Phase0-PSAPName, UTF8String, code 523                         */
    310         {
    311                 struct dict_avp_data data = {
    312                         523,    /* Code */
    313                         8164,   /* Vendor */
    314                         "SN-Phase0-PSAPName",   /* Name */
    315                         AVP_FLAG_VENDOR,        /* Fixed flags */
    316                         AVP_FLAG_VENDOR,        /* Fixed flag values */
    317                         AVP_TYPE_OCTETSTRING    /* base type of data */
    318                 };
    319                 CHECK_dict_new(DICT_AVP, &data, UTF8String_type, NULL);
    320         };
    321 
    322         /* SN-Charging-Id, OctetString, code 525                            */
    323         {
    324                 struct dict_avp_data data = {
    325                         525,    /* Code */
    326                         8164,   /* Vendor */
    327                         "SN-Charging-Id",       /* Name */
    328                         AVP_FLAG_VENDOR,        /* Fixed flags */
    329                         AVP_FLAG_VENDOR,        /* Fixed flag values */
    330                         AVP_TYPE_OCTETSTRING    /* base type of data */
    331                 };
    332                 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
    333         };
    334 
    335         /* SN-Remaining-Service-Unit, Grouped, code 526                     */
    336         {
    337                 struct dict_avp_data data = {
    338                         526,    /* Code */
    339                         8164,   /* Vendor */
    340                         "SN-Remaining-Service-Unit",    /* Name */
    341                         AVP_FLAG_VENDOR,        /* Fixed flags */
    342                         AVP_FLAG_VENDOR,        /* Fixed flag values */
    343                         AVP_TYPE_GROUPED        /* base type of data */
    344                 };
    345                 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
    346         };
    347 
    348         /* SN-Service-Start-Timestamp, Time, code 527                       */
    349         {
    350                 struct dict_avp_data data = {
    351                         527,    /* Code */
    352                         8164,   /* Vendor */
    353                         "SN-Service-Start-Timestamp",   /* Name */
    354                         AVP_FLAG_VENDOR,        /* Fixed flags */
    355                         AVP_FLAG_VENDOR,        /* Fixed flag values */
    356                         AVP_TYPE_OCTETSTRING    /* base type of data */
    357                 };
    358                 CHECK_dict_new(DICT_AVP, &data, Time_type, NULL);
    359         };
    360 
    361         /* SN-Rulebase-Id, UTF8String, code 528                             */
    362         {
    363                 struct dict_avp_data data = {
    364                         528,    /* Code */
    365                         8164,   /* Vendor */
    366                         "SN-Rulebase-Id",       /* Name */
    367                         AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY,    /* Fixed flags */
    368                         AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY,    /* Fixed flag values */
    369                         AVP_TYPE_OCTETSTRING    /* base type of data */
    370                 };
    371                 CHECK_dict_new(DICT_AVP, &data, UTF8String_type, NULL);
    372         };
    373 
    374         /* SN-CF-Policy-ID, Unsigned32, code 529                            */
    375         {
    376                 struct dict_avp_data data = {
    377                         529,    /* Code */
    378                         8164,   /* Vendor */
    379                         "SN-CF-Policy-ID",      /* Name */
    380                         AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY,    /* Fixed flags */
    381                         AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY,    /* Fixed flag values */
    382                         AVP_TYPE_UNSIGNED32     /* base type of data */
    383                 };
    384                 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
    385         };
    386 
    387         /* SN-Charging-Collection-Function-Name, UTF8String, code 530       */
    388         {
    389                 struct dict_avp_data data = {
    390                         530,    /* Code */
    391                         8164,   /* Vendor */
    392                         "SN-Charging-Collection-Function-Name", /* Name */
    393                         AVP_FLAG_VENDOR,        /* Fixed flags */
    394                         AVP_FLAG_VENDOR,        /* Fixed flag values */
    395                         AVP_TYPE_OCTETSTRING    /* base type of data */
    396                 };
    397                 CHECK_dict_new(DICT_AVP, &data, UTF8String_type, NULL);
    398         };
    399 
    400         /* SN-Fast-Reauth-Username, OctetString, code 11010                 */
    401         {
    402                 struct dict_avp_data data = {
    403                         11010,  /* Code */
    404                         8164,   /* Vendor */
    405                         "SN-Fast-Reauth-Username",      /* Name */
    406                         AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY,    /* Fixed flags */
    407                         AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY,    /* Fixed flag values */
    408                         AVP_TYPE_OCTETSTRING    /* base type of data */
    409                 };
    410                 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
    411         };
    412 
    413         /* SN-Pseudonym-Username, OctetString, code 11011                   */
    414         {
    415                 struct dict_avp_data data = {
    416                         11011,  /* Code */
    417                         8164,   /* Vendor */
    418                         "SN-Pseudonym-Username",        /* Name */
    419                         AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY,    /* Fixed flags */
    420                         AVP_FLAG_VENDOR |AVP_FLAG_MANDATORY,    /* Fixed flag values */
    421                         AVP_TYPE_OCTETSTRING    /* base type of data */
    422                 };
    423                 CHECK_dict_new(DICT_AVP, &data, NULL, NULL);
    424         };
    425 
    426         /*==================================================================*/
    427         /* End of generated data.                                           */
    428         /*==================================================================*/
     69        extern int add_avps();
     70        CHECK_FCT( add_avps() );
    42971
    43072        /* Rules section */
Note: See TracChangeset for help on using the changeset viewer.