Navigation


Changeset 706:4ffbc9f1e922 in freeDiameter for libfdproto/dictionary.c


Ignore:
Timestamp:
Feb 9, 2011, 3:26:58 PM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Large UNTESTED commit with the following changes:

  • Improved DiameterIdentity? handling (esp. interationalization issues), and improve efficiency of some string operations in peers, sessions, and dictionary modules (closes #7)
  • Cleanup in the session module to free only unreferenced sessions (#16)
  • Removed fd_cpu_flush_cache(), replaced by more robust alternatives.
  • Improved peer state machine algorithm to counter SCTP multistream race condition.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdproto/dictionary.c

    r687 r706  
    6363       
    6464        union {
    65                 struct dict_vendor_data         vendor;
    66                 struct dict_application_data    application;
    67                 struct dict_type_data           type;
    68                 struct dict_enumval_data        enumval;
    69                 struct dict_avp_data            avp;
    70                 struct dict_cmd_data            cmd;
    71                 struct dict_rule_data           rule;
     65                struct dict_vendor_data         vendor;         /* datastr_len = strlen(vendor_name) */
     66                struct dict_application_data    application;    /* datastr_len = strlen(application_name) */
     67                struct dict_type_data           type;           /* datastr_len = strlen(type_name) */
     68                struct dict_enumval_data        enumval;        /* datastr_len = strlen(enum_name) */
     69                struct dict_avp_data            avp;            /* datastr_len = strlen(avp_name) */
     70                struct dict_cmd_data            cmd;            /* datastr_len = strlen(cmd_name) */
     71                struct dict_rule_data           rule;           /* datastr_len = 0 */
    7272        } data;                         /* The data of this object */
     73       
     74        size_t                  datastr_len; /* cached length of the string inside the data. Saved when the object is created. */
    7375       
    7476        struct dict_object *    parent; /* The parent of this object, if any */
     
    8890         list[0]: list of the vendors, ordered by their id. The sentinel is g_dict_vendors (vendor with id 0)
    8991         list[1]: sentinel for the list of AVPs from this vendor, ordered by AVP code.
    90          list[2]: sentinel for the list of AVPs from this vendor, ordered by AVP name.
     92         list[2]: sentinel for the list of AVPs from this vendor, ordered by AVP name (fd_os_cmp).
    9193         
    9294         => APPLICATIONS:
     
    9799         => TYPES:
    98100         list[0]: list of the types, ordered by their names. The sentinel is g_list_types.
    99          list[1]: sentinel for the type_enum list of this type, ordered by their constant name.
     101         list[1]: sentinel for the type_enum list of this type, ordered by their constant name (fd_os_cmp).
    100102         list[2]: sentinel for the type_enum list of this type, ordered by their constant value.
    101103         
    102104         => TYPE_ENUMS:
    103          list[0]: list of the contants for a given type, ordered by the constant name. Sentinel is a (list[1]) element of a TYPE object.
     105         list[0]: list of the contants for a given type, ordered by the constant name (fd_os_cmp). Sentinel is a (list[1]) element of a TYPE object.
    104106         list[1]: list of the contants for a given type, ordered by the constant value. Sentinel is a (list[2]) element of a TYPE object.
    105107         list[2]: not used
     
    107109         => AVPS:
    108110         list[0]: list of the AVP from a given vendor, ordered by avp code. Sentinel is a list[1] element of a VENDOR object.
    109          list[1]: list of the AVP from a given vendor, ordered by avp name. Sentinel is a list[2] element of a VENDOR object.
     111         list[1]: list of the AVP from a given vendor, ordered by avp name (fd_os_cmp). Sentinel is a list[2] element of a VENDOR object.
    110112         list[2]: sentinel for the rule list that apply to this AVP.
    111113         
    112114         => COMMANDS:
    113          list[0]: list of the commands, ordered by their names. The sentinel is g_list_cmd_name.
     115         list[0]: list of the commands, ordered by their names (fd_os_cmp). The sentinel is g_list_cmd_name.
    114116         list[1]: list of the commands, ordered by their command code and 'R' flag. The sentinel is g_list_cmd_code.
    115117         list[2]: sentinel for the rule list that apply to this command.
    116118         
    117119         => RULES:
    118          list[0]: list of the rules for a given (grouped) AVP or Command, ordered by the AVP name to which they refer. sentinel is list[2] of a command or (grouped) avp.
     120         list[0]: list of the rules for a given (grouped) AVP or Command, ordered by the AVP vendor & code to which they refer. sentinel is list[2] of a command or (grouped) avp.
    119121         list[1]: not used
    120122         list[2]: not used.
     
    223225/* Functions to manage the objects creation and destruction. */
    224226
    225 /* Duplicate a string inplace */
    226 #define DUP_string( str ) {                             \
    227         char * __str = (str);                           \
    228         CHECK_MALLOC( (str) = strdup(__str) );          \
     227/* Duplicate a string inplace, save its length */
     228#define DUP_string_len( str, plen ) {           \
     229        *(plen) = strlen((str));                \
     230        str = os0dup( str, *(plen));            \
    229231}
    230232       
     
    259261
    260262/* Initialize the "data" part of an object */
    261 static int init_object_data(void * dest, void * source, enum dict_object_type type)
     263static int init_object_data(struct dict_object * dest, void * source, enum dict_object_type type)
    262264{
    263265        TRACE_ENTRY("%p %p %d", dest, source, type);
     
    265267       
    266268        /* Generic: copy the full data structure */     
    267         memcpy( dest, source, dict_obj_info[type].datasize );
     269        memcpy( &dest->data, source, dict_obj_info[type].datasize );
    268270       
    269271        /* Then strings must be duplicated, not copied */
     
    271273        switch (type) {
    272274                case DICT_VENDOR:
    273                         DUP_string( ((struct dict_vendor_data *)dest)->vendor_name );
     275                        DUP_string_len( dest->data.vendor.vendor_name, &dest->datastr_len );
    274276                        break;
    275277               
    276278                case DICT_APPLICATION:
    277                         DUP_string( ((struct dict_application_data *)dest)->application_name );
     279                        DUP_string_len( dest->data.application.application_name, &dest->datastr_len );
    278280                        break;
    279281                       
    280282                case DICT_TYPE:
    281                         DUP_string( ((struct dict_type_data *)dest)->type_name );
     283                        DUP_string_len( dest->data.type.type_name, &dest->datastr_len );
    282284                        break;
    283285                       
    284286                case DICT_ENUMVAL:
    285                         DUP_string( ((struct dict_enumval_data *)dest)->enum_name );
     287                        DUP_string_len( dest->data.enumval.enum_name, &dest->datastr_len );
    286288                        break;
    287289
    288290                case DICT_AVP:
    289                         DUP_string( ((struct dict_avp_data *)dest)->avp_name );
     291                        DUP_string_len( dest->data.avp.avp_name, &dest->datastr_len );
    290292                        break;
    291293                       
    292294                case DICT_COMMAND:
    293                         DUP_string( ((struct dict_cmd_data *)dest)->cmd_name );
     295                        DUP_string_len( dest->data.cmd.cmd_name, &dest->datastr_len );
    294296                        break;
    295297               
     
    456458        TRACE_ENTRY("%p %p", o1, o2);
    457459       
    458         return strcmp( o1->data.type.type_name, o2->data.type.type_name );
     460        return fd_os_cmp( o1->data.type.type_name, o1->datastr_len, o2->data.type.type_name, o2->datastr_len );
    459461}
    460462
     
    464466        TRACE_ENTRY("%p %p", o1, o2);
    465467       
    466         return strcmp( o1->data.enumval.enum_name, o2->data.enumval.enum_name );
     468        return fd_os_cmp( o1->data.enumval.enum_name, o1->datastr_len, o2->data.enumval.enum_name, o2->datastr_len );
    467469}
    468470
     
    470472static int order_enum_by_val  ( struct dict_object *o1, struct dict_object *o2 )
    471473{
    472         size_t oslen;
    473         int cmp = 0;
    474        
    475474        TRACE_ENTRY("%p %p", o1, o2);
    476475       
     
    478477        switch ( o1->parent->data.type.type_base ) {
    479478                case AVP_TYPE_OCTETSTRING:
    480                         oslen = o1->data.enumval.enum_value.os.len;
    481                         if (o2->data.enumval.enum_value.os.len < oslen)
    482                                 oslen = o2->data.enumval.enum_value.os.len;
    483                         cmp = memcmp(o1->data.enumval.enum_value.os.data, o2->data.enumval.enum_value.os.data, oslen );
    484                         return (cmp ? cmp : ORDER_scalar(o1->data.enumval.enum_value.os.len,o2->data.enumval.enum_value.os.len));
     479                        return fd_os_cmp( o1->data.enumval.enum_value.os.data, o1->data.enumval.enum_value.os.len,
     480                                          o2->data.enumval.enum_value.os.data, o2->data.enumval.enum_value.os.len);
    485481               
    486482                case AVP_TYPE_INTEGER32:
     
    522518        TRACE_ENTRY("%p %p", o1, o2);
    523519       
    524         return strcmp( o1->data.avp.avp_name, o2->data.avp.avp_name );
     520        return fd_os_cmp( o1->data.avp.avp_name, o1->datastr_len, o2->data.avp.avp_name, o2->datastr_len );
    525521}
    526522
     
    530526        TRACE_ENTRY("%p %p", o1, o2);
    531527       
    532         return strcmp( o1->data.cmd.cmd_name, o2->data.cmd.cmd_name );
     528        return fd_os_cmp( o1->data.cmd.cmd_name, o1->datastr_len, o2->data.cmd.cmd_name, o2->datastr_len );
    533529}
    534530
     
    555551
    556552/* Compare two rule object by the AVP vendor & code that they refer (checks already performed) */
    557 static int order_rule_by_avpn ( struct dict_object *o1, struct dict_object *o2 )
     553static int order_rule_by_avpvc ( struct dict_object *o1, struct dict_object *o2 )
    558554{
    559555        TRACE_ENTRY("%p %p", o1, o2);
     
    590586
    591587/* For search of strings in lists. isindex= 1 if the string is the ordering key of the list */
    592 #define SEARCH_string( str, sentinel, datafield, isindex ) {                    \
    593         char * __str = (char *) str;                                            \
     588/* it is expected that object->datastr_len is the length of the datafield parameter */
     589#define SEARCH_os0_l( str, len, sentinel, datafield, isindex ) {                \
     590        char *  __str = (char *) (str);                                         \
     591        size_t __strlen = (size_t)(len);                                        \
    594592        int __cmp;                                                              \
    595593        struct fd_list * __li;                                                  \
    596594        ret = 0;                                                                \
    597595        for  (__li = (sentinel)->next; __li != (sentinel); __li = __li->next) { \
    598                 __cmp = strcmp(__str, _O(__li->o)->data. datafield );           \
     596                __cmp = fd_os_cmp(__str, __strlen,                              \
     597                        _O(__li->o)->data. datafield, _O(__li->o)->datastr_len);\
    599598                if (__cmp == 0) {                                               \
    600599                        if (result)                                             \
     
    611610}
    612611
    613 /* For search of octetstrings in lists (not \0 terminated). */
    614 #define SEARCH_ocstring( ostr, length, sentinel, osdatafield, isindex ) {       \
    615         unsigned char * __ostr = (unsigned char *) ostr;                        \
     612/* When len is not provided */
     613#define SEARCH_os0( str, sentinel, datafield, isindex ) {                       \
     614        char *  _str = (char *) (str);                                          \
     615        size_t  _strlen = strlen(_str);                                         \
     616        SEARCH_os0_l( _str, _strlen, sentinel, datafield, isindex );            \
     617}
     618
     619
     620/* For search of octetstrings in lists. */
     621#define SEARCH_os(  str, strlen, sentinel, osdatafield, isindex ) {             \
     622        uint8_t * __str = (uint8_t *) (str);                                    \
     623        size_t __strlen = (size_t)(strlen);                                     \
    616624        int __cmp;                                                              \
    617         size_t __len;                                                           \
    618625        struct fd_list * __li;                                                  \
    619626        ret = 0;                                                                \
    620         for  (__li = (sentinel); __li->next != (sentinel); __li = __li->next) { \
    621                 __len = _O(__li->next->o)->data. osdatafield .len;              \
    622                 if ( __len > (length) )                                         \
    623                         __len = (length);                                       \
    624                 __cmp = memcmp(__ostr,                                          \
    625                                 _O(__li->next->o)->data. osdatafield .data,     \
    626                                 __len);                                         \
    627                 if (! __cmp) {                                                  \
    628                         __cmp = ORDER_scalar( length,                           \
    629                                 _O(__li->next->o)->data. osdatafield .len);     \
    630                 }                                                               \
     627        for  (__li = (sentinel)->next; __li != (sentinel); __li = __li->next) { \
     628                __cmp = fd_os_cmp(__str, __strlen,                              \
     629                        _O(__li->o)->data. osdatafield .data,                   \
     630                        _O(__li->o)->data. osdatafield .len);                   \
    631631                if (__cmp == 0) {                                               \
    632632                        if (result)                                             \
    633                                 *result = _O(__li->next->o);                    \
     633                                *result = _O(__li->o);                          \
    634634                        goto end;                                               \
    635635                }                                                               \
     
    644644
    645645/* For search of AVP name in rule lists. */
    646 #define SEARCH_ruleavpname( str, sentinel ) {                                   \
    647         char * __str = (char *) str;                                            \
     646#define SEARCH_ruleavpname( str, strlen, sentinel ) {                           \
     647        char * __str = (char *) (str);                                          \
     648        size_t __strlen = (size_t) (strlen);                                    \
    648649        int __cmp;                                                              \
    649650        struct fd_list * __li;                                                  \
    650651        ret = 0;                                                                \
    651         for  (__li = (sentinel); __li->next != (sentinel); __li = __li->next) { \
    652                 __cmp = strcmp(__str,                                           \
    653                   _O(__li->next->o)->data.rule.rule_avp->data.avp.avp_name);\
     652        for  (__li = (sentinel)->next; __li != (sentinel); __li = __li->next) { \
     653                __cmp = fd_os_cmp(__str, __strlen,                              \
     654                        _O(__li->o)->data.rule.rule_avp->data.avp.avp_name,     \
     655                        _O(__li->o)->data.rule.rule_avp->datastr_len);          \
    654656                if (__cmp == 0) {                                               \
    655657                        if (result)                                             \
    656                                 *result = _O(__li->next->o);                    \
     658                                *result = _O(__li->o);                          \
    657659                        goto end;                                               \
    658660                }                                                               \
     
    677679                goto end;                                                       \
    678680        }                                                                       \
    679         for  (__li = (sentinel); __li->next != (sentinel); __li = __li->next) { \
    680                 __cmp= ORDER_scalar(value, _O(__li->next->o)->data. datafield );\
     681        for  (__li = (sentinel)->next; __li != (sentinel); __li = __li->next) { \
     682                __cmp= ORDER_scalar(value, _O(__li->o)->data. datafield );      \
    681683                if (__cmp == 0) {                                               \
    682684                        if (result)                                             \
    683                                 *result = _O(__li->next->o);                    \
     685                                *result = _O(__li->o);                          \
    684686                        goto end;                                               \
    685687                }                                                               \
     
    698700        struct fd_list * __li;                                                  \
    699701        ret = 0;                                                                \
    700         for  (    __li = (sentinel);                                            \
    701                   __li->next != (sentinel);                                     \
    702                   __li = __li->next) {                                          \
     702        for  (__li = (sentinel)->next; __li != (sentinel); __li = __li->next) { \
    703703                __cmp = ORDER_scalar(value,                                     \
    704                                 _O(__li->next->o)->data.cmd.cmd_code );         \
     704                                _O(__li->o)->data.cmd.cmd_code );               \
    705705                if (__cmp == 0) {                                               \
    706706                        uint8_t __mask, __val;                                  \
    707                         __mask = _O(__li->next->o)->data.cmd.cmd_flag_mask;     \
    708                         __val  = _O(__li->next->o)->data.cmd.cmd_flag_val;      \
     707                        __mask = _O(__li->o)->data.cmd.cmd_flag_mask;           \
     708                        __val  = _O(__li->o)->data.cmd.cmd_flag_val;            \
    709709                        if ( ! (__mask & CMD_FLAG_REQUEST) )                    \
    710710                                continue;                                       \
     
    712712                                continue;                                       \
    713713                        if (result)                                             \
    714                                 *result = _O(__li->next->o);                    \
     714                                *result = _O(__li->o);                          \
    715715                        goto end;                                               \
    716716                }                                                               \
     
    739739                case VENDOR_BY_NAME:
    740740                        /* "what" is a vendor name */
    741                         SEARCH_string( what, &dict->dict_vendors.list[0], vendor.vendor_name, 0);
     741                        SEARCH_os0( what, &dict->dict_vendors.list[0], vendor.vendor_name, 0);
    742742                        break;
    743743                       
     
    771771                case APPLICATION_BY_NAME:
    772772                        /* "what" is an application name */
    773                         SEARCH_string( what, &dict->dict_applications.list[0], application.application_name, 0);
     773                        SEARCH_os0( what, &dict->dict_applications.list[0], application.application_name, 0);
    774774                        break;
    775775                       
     
    801801                case TYPE_BY_NAME:
    802802                        /* "what" is a type name */
    803                         SEARCH_string( what, &dict->dict_types, type.type_name, 1);
     803                        SEARCH_os0( what, &dict->dict_types, type.type_name, 1);
    804804                        break;
    805805                       
     
    850850                                if ( _what->search.enum_name != NULL ) {
    851851                                        /* We are looking for this string */
    852                                         SEARCH_string(  _what->search.enum_name, &parent->list[1], enumval.enum_name, 1 );
     852                                        SEARCH_os0(  _what->search.enum_name, &parent->list[1], enumval.enum_name, 1 );
    853853                                } else {
    854854                                        /* We are looking for the value in enum_value */
    855855                                        switch (parent->data.type.type_base) {
    856856                                                case AVP_TYPE_OCTETSTRING:
    857                                                         SEARCH_ocstring( _what->search.enum_value.os.data,
     857                                                        SEARCH_os(      _what->search.enum_value.os.data,
    858858                                                                         _what->search.enum_value.os.len,
    859859                                                                         &parent->list[2],
     
    946946                case AVP_BY_NAME:
    947947                        /* "what" is the AVP name, vendor 0 */
    948                         SEARCH_string( what, &dict->dict_vendors.list[2], avp.avp_name, 1);
     948                        SEARCH_os0( what, &dict->dict_vendors.list[2], avp.avp_name, 1);
    949949                        break;
    950950                       
     
    969969                                /* We now have our vendor = head of the appropriate avp list */
    970970                                if (criteria == AVP_BY_NAME_AND_VENDOR) {
    971                                         SEARCH_string( _what->avp_name, &vendor->list[2], avp.avp_name, 1);
     971                                        SEARCH_os0( _what->avp_name, &vendor->list[2], avp.avp_name, 1);
    972972                                } else {
    973973                                        /* AVP_BY_CODE_AND_VENDOR */
    974                                         SEARCH_scalar( _what->avp_code, &vendor->list[1],  avp.avp_code, 1, (struct dict_object *)NULL );
     974                                        SEARCH_scalar( _what->avp_code, &vendor->list[1], avp.avp_code, 1, (struct dict_object *)NULL );
    975975                                }
    976976                        }
     
    980980                        {
    981981                                struct fd_list * li;
     982                                size_t wl = strlen((char *)what);
    982983                               
    983984                                /* First, search for vendor 0 */
    984                                 SEARCH_string( what, &dict->dict_vendors.list[2], avp.avp_name, 1);
     985                                SEARCH_os0_l( what, wl, &dict->dict_vendors.list[2], avp.avp_name, 1);
    985986                               
    986987                                /* If not found, loop for all vendors, until found */
    987988                                for (li = dict->dict_vendors.list[0].next; li != &dict->dict_vendors.list[0]; li = li->next) {
    988                                         SEARCH_string( what, &_O(li->o)->list[2], avp.avp_name, 1);
     989                                        SEARCH_os0_l( what, wl, &_O(li->o)->list[2], avp.avp_name, 1);
    989990                                }
    990991                        }
     
    10081009                case CMD_BY_NAME:
    10091010                        /* "what" is a command name */
    1010                         SEARCH_string( what, &dict->dict_cmd_name, cmd.cmd_name, 1);
     1011                        SEARCH_os0( what, &dict->dict_cmd_name, cmd.cmd_name, 1);
    10111012                        break;
    10121013                       
     
    10961097                               
    10971098                                /* Perform the search */
    1098                                 SEARCH_ruleavpname( avp->data.avp.avp_name, &parent->list[2]);
     1099                                SEARCH_ruleavpname( avp->data.avp.avp_name, avp->datastr_len, &parent->list[2]);
    10991100                               
    11001101                        }
     
    12741275        dump_object( &dict->dict_vendors, 0, 3, 0 );
    12751276       
    1276         fd_log_debug("###### Dumping applications #######\n");
     1277        fd_log_debug("######          Dumping applications          #######\n");
    12771278
    12781279        dump_object( &dict->dict_applications, 0, 1, 0 );
    12791280       
    1280         fd_log_debug("###### Dumping types #######\n");
     1281        fd_log_debug("######             Dumping types              #######\n");
    12811282
    12821283        dump_list( &dict->dict_types, 0, 2, 0 );
    12831284       
    1284         fd_log_debug("###### Dumping commands per name #######\n");
     1285        fd_log_debug("######      Dumping commands per name          #######\n");
    12851286
    12861287        dump_list( &dict->dict_cmd_name, 0, 2, 0 );
    12871288       
    1288         fd_log_debug("###### Dumping commands per code and flags #######\n");
     1289        fd_log_debug("######   Dumping commands per code and flags  #######\n");
    12891290
    12901291        dump_list( &dict->dict_cmd_code, 0, 0, 0 );
    12911292       
    1292         fd_log_debug("###### Statistics #######\n");
     1293        fd_log_debug("######             Statistics                  #######\n");
    12931294
    12941295        for (i=1; i<=DICT_TYPE_MAX; i++)
     
    15611562        /* Initialize the data of the new object */
    15621563        init_object(new, type);
    1563         init_object_data(&new->data, data, type);
     1564        init_object_data(new, data, type);
    15641565        new->dico = dict;
    15651566        new->parent = parent;
     
    16321633                case DICT_RULE:
    16331634                        /* A rule object is linked in list[2] of its parent command or AVP by the name of the AVP it refers */
    1634                         ret = fd_list_insert_ordered ( &parent->list[2], &new->list[0], (int (*)(void*, void *))order_rule_by_avpn, (void **)&locref );
     1635                        ret = fd_list_insert_ordered ( &parent->list[2], &new->list[0], (int (*)(void*, void *))order_rule_by_avpvc, (void **)&locref );
    16351636                        if (ret)
    16361637                                goto error_unlock;
     
    16591660                switch (type) {
    16601661                        case DICT_VENDOR:
    1661                                 /* if we are here, it meas the two vendor id are identical */
    1662                                 if (strcmp(locref->data.vendor.vendor_name, new->data.vendor.vendor_name)) {
     1662                                /* if we are here, it means the two vendors id are identical */
     1663                                if (fd_os_cmp(locref->data.vendor.vendor_name, locref->datastr_len,
     1664                                                new->data.vendor.vendor_name, new->datastr_len)) {
    16631665                                        TRACE_DEBUG(FULL, "Conflicting vendor name");
    16641666                                        break;
     
    16701672                        case DICT_APPLICATION:
    16711673                                /* got same id */
    1672                                 if (strcmp(locref->data.application.application_name, new->data.application.application_name)) {
     1674                                if (fd_os_cmp(locref->data.application.application_name, locref->datastr_len,
     1675                                                new->data.application.application_name, new->datastr_len)) {
    16731676                                        TRACE_DEBUG(FULL, "Conflicting application name");
    16741677                                        break;
     
    17631766
    17641767                        case DICT_RULE:
    1765                                 /* Both rules point to the same AVPs */
     1768                                /* Both rules point to the same AVPs (code & vendor) */
    17661769                                if (locref->data.rule.rule_position != new->data.rule.rule_position) {
    17671770                                        TRACE_DEBUG(FULL, "Conflicting rule position");
     
    18471850        struct dictionary * new = NULL;
    18481851       
    1849         TRACE_ENTRY("");
     1852        TRACE_ENTRY("%p", dict);
    18501853       
    18511854        /* Sanity checks */
     
    18651868        /* Initialize the sentinel for vendors and AVP lists */
    18661869        init_object( &new->dict_vendors, DICT_VENDOR );
    1867         new->dict_vendors.data.vendor.vendor_name = "(no vendor)";
     1870        #define NO_VENDOR_NAME  "(no vendor)"
     1871        new->dict_vendors.data.vendor.vendor_name = NO_VENDOR_NAME;
     1872        new->dict_vendors.datastr_len = CONSTSTRLEN(NO_VENDOR_NAME);
    18681873        new->dict_vendors.list[0].o = NULL; /* overwrite since element is also sentinel for this list. */
    18691874        new->dict_vendors.dico = new;
     
    18711876        /* Initialize the sentinel for applications */
    18721877        init_object( &new->dict_applications, DICT_APPLICATION );
    1873         new->dict_applications.data.application.application_name = "Diameter Common Messages";
     1878        #define APPLICATION_0_NAME      "Diameter Common Messages"
     1879        new->dict_applications.data.application.application_name = APPLICATION_0_NAME;
     1880        new->dict_applications.datastr_len = CONSTSTRLEN(APPLICATION_0_NAME);
    18741881        new->dict_applications.list[0].o = NULL; /* overwrite since since element is also sentinel for this list. */
    18751882        new->dict_applications.dico = new;
     
    18841891        /* Initialize the error command object */
    18851892        init_object( &new->dict_cmd_error, DICT_COMMAND );
    1886         new->dict_cmd_error.data.cmd.cmd_name="(generic error format)";
     1893        #define GENERIC_ERROR_NAME      "(generic error format)"
     1894        new->dict_cmd_error.data.cmd.cmd_name = GENERIC_ERROR_NAME;
     1895        new->dict_cmd_error.datastr_len = CONSTSTRLEN(GENERIC_ERROR_NAME);
    18871896        new->dict_cmd_error.data.cmd.cmd_flag_mask=CMD_FLAG_ERROR | CMD_FLAG_REQUEST | CMD_FLAG_RETRANSMIT;
    18881897        new->dict_cmd_error.data.cmd.cmd_flag_val =CMD_FLAG_ERROR;
Note: See TracChangeset for help on using the changeset viewer.