Navigation


Changeset 769:99136ec7d9d4 in freeDiameter for libfdproto


Ignore:
Timestamp:
Oct 26, 2011, 4:48:52 AM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Fixed fd_dict_getlistof function, added a simple test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdproto/dictionary.c

    r764 r769  
    18411841All returned list must be accessed like this:
    18421842
    1843   for (li = sentinel->next; li=li->next; li != sentinel) {
     1843  for (li = sentinel->next; li != sentinel; li=li->next) {
    18441844        struct dict_object * obj = li->o;
    18451845        ...
     
    18541854     You must resolve them separatly with dict_search.
    18551855               
    1856 TYPE_BY_NAME : (parent = dictionary) returns list of types ordered by name
    1857 ENUMVAL_BY_NAME : (parent = type object) return list of constants for this type ordered by name
     1856TYPE_BY_NAME : (parent = dictionary) returns list of types ordered by name (osstring order)
     1857ENUMVAL_BY_NAME : (parent = type object) return list of constants for this type ordered by name (osstring order)
    18581858ENUMVAL_BY_VALUE : (parent = type object) return list of constants for this type ordered by values
    1859 AVP_BY_NAME : (parent = vendor object) return list of AVP for this vendor ordered by name
     1859AVP_BY_NAME : (parent = vendor object) return list of AVP for this vendor ordered by name (osstring order)
    18601860AVP_BY_CODE : (parent = vendor object) return list of AVP for this vendor ordered by code
    1861 CMD_BY_NAME : (parent = dictionary) returns list of commands ordered by name
     1861CMD_BY_NAME : (parent = dictionary) returns list of commands ordered by name (osstring order)
    18621862CMD_BY_CODE_R : (parent = dictionary) returns list of commands ordered by code
    18631863RULE_BY_AVP_AND_PARENT: (parent = command or grouped AVP object) return list of rules for this object ordered by AVP vendor/code
     
    18651865All other criteria are rejected.
    18661866 */
    1867 int fd_dict_getlistof(int criteria, void * parent, struct fd_list * sentinel)
     1867int fd_dict_getlistof(int criteria, void * parent, struct fd_list ** sentinel)
    18681868{
    18691869        struct dictionary * dict = parent;
     
    18771877                case VENDOR_BY_ID: /* parent must be the dictionary */
    18781878                        CHECK_PARAMS(dict->dict_eyec == DICT_EYECATCHER);
    1879                         sentinel = &dict->dict_vendors.list[0];
     1879                        *sentinel = &dict->dict_vendors.list[0];
    18801880                        break;
    18811881                       
    18821882                case APPLICATION_BY_ID: /* parent must be the dictionary */
    18831883                        CHECK_PARAMS(dict->dict_eyec == DICT_EYECATCHER);
    1884                         sentinel = &dict->dict_applications.list[0];
     1884                        *sentinel = &dict->dict_applications.list[0];
    18851885                        break;
    18861886                       
    18871887                case TYPE_BY_NAME: /* parent must be the dictionary */
    18881888                        CHECK_PARAMS(dict->dict_eyec == DICT_EYECATCHER);
    1889                         sentinel = &dict->dict_types;
     1889                        *sentinel = &dict->dict_types;
    18901890                        break;
    18911891                       
    18921892                case ENUMVAL_BY_NAME: /* parent must be a type object */
    18931893                        CHECK_PARAMS(verify_object(obj_parent) && (obj_parent->type == DICT_TYPE));
    1894                         sentinel = &obj_parent->list[1];
     1894                        *sentinel = &obj_parent->list[1];
    18951895                        break;
    18961896                       
    18971897                case ENUMVAL_BY_VALUE: /* parent must be a type object */
    18981898                        CHECK_PARAMS(verify_object(obj_parent) && (obj_parent->type == DICT_TYPE));
    1899                         sentinel = &obj_parent->list[2];
    1900                         break;
    1901                        
    1902                 case AVP_BY_NAME: /* parent must be a AVP object */
    1903                         CHECK_PARAMS(verify_object(obj_parent) && (obj_parent->type == DICT_AVP));
    1904                         sentinel = &obj_parent->list[2];
    1905                         break;
    1906                        
    1907                 case AVP_BY_CODE: /* parent must be a AVP object */
    1908                         CHECK_PARAMS(verify_object(obj_parent) && (obj_parent->type == DICT_AVP));
    1909                         sentinel = &obj_parent->list[1];
     1899                        *sentinel = &obj_parent->list[2];
     1900                        break;
     1901                       
     1902                case AVP_BY_NAME: /* parent must be a VENDOR object */
     1903                        CHECK_PARAMS(verify_object(obj_parent) && (obj_parent->type == DICT_VENDOR));
     1904                        *sentinel = &obj_parent->list[2];
     1905                        break;
     1906                       
     1907                case AVP_BY_CODE: /* parent must be a VENDOR object */
     1908                        CHECK_PARAMS(verify_object(obj_parent) && (obj_parent->type == DICT_VENDOR));
     1909                        *sentinel = &obj_parent->list[1];
    19101910                        break;
    19111911                       
    19121912                case CMD_BY_NAME: /* parent must be the dictionary */
    19131913                        CHECK_PARAMS(dict->dict_eyec == DICT_EYECATCHER);
    1914                         sentinel = &dict->dict_cmd_name;
     1914                        *sentinel = &dict->dict_cmd_name;
    19151915                        break;
    19161916                       
    19171917                case CMD_BY_CODE_R: /* parent must be the dictionary */
    19181918                        CHECK_PARAMS(dict->dict_eyec == DICT_EYECATCHER);
    1919                         sentinel = &dict->dict_cmd_code;
     1919                        *sentinel = &dict->dict_cmd_code;
    19201920                        break;
    19211921                       
     
    19251925                                        ((obj_parent->type == DICT_AVP)
    19261926                                          && (obj_parent->data.avp.avp_basetype == AVP_TYPE_GROUPED)) );
    1927                         sentinel = &obj_parent->list[2];
     1927                        *sentinel = &obj_parent->list[2];
    19281928                        break;
    19291929                       
Note: See TracChangeset for help on using the changeset viewer.