Navigation


Changeset 1424:c8057892e56b in freeDiameter for contrib


Ignore:
Timestamp:
Feb 19, 2020, 8:24:13 AM (4 years ago)
Author:
Luke Mewburn <luke@mewburn.net>
Branch:
default
Phase:
public
Message:

adapt extensions to fd_msg_search_avp(struct avp)

Remove now-unnecessary fd_avp_search_avp() implementations
now that fd_msg_search_avp() can be used.

TODO: rt_rewrite.fdx still uses own version because that does
extra validation and logging (that may or may not be necessary).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • contrib/test_Gx/main_gx.c

    r1271 r1424  
    701701
    702702}
    703 /* Search a given AVP model in an AVP (extracted from libfreediameter/message.c ) */
    704 int fd_avp_search_avp ( struct avp * groupedavp, struct dict_object * what, struct avp ** avp )
    705 {
    706        struct avp * nextavp;
    707        struct avp_hdr * nextavphdr;
    708        struct dict_avp_data    dictdata;
    709        
    710        
    711        TRACE_ENTRY("%p %p %p", groupedavp, what, avp);
    712        
    713        CHECK_FCT(  fd_dict_getval(what, &dictdata)  );
    714        
    715        // Loop only in the group AVP
    716        CHECK_FCT(  fd_msg_browse(groupedavp, MSG_BRW_FIRST_CHILD, (void *)&nextavp, NULL)  );
    717        CHECK_FCT( fd_msg_avp_hdr( nextavp, &nextavphdr )  );
    718        
    719        while (nextavphdr) {
    720                
    721                if ( (nextavphdr->avp_code   == dictdata.avp_code) && (nextavphdr->avp_vendor == dictdata.avp_vendor) ) // always 0 if no Vendor flag
    722                {
    723                        break;
    724                }
    725                
    726                // Otherwise move to next AVP in the grouped AVP
    727                CHECK_FCT( fd_msg_browse(nextavp, MSG_BRW_NEXT, (void *)&nextavp, NULL) );
    728                
    729                if(nextavp!=NULL)
    730                {
    731                        CHECK_FCT( fd_msg_avp_hdr( nextavp, &nextavphdr )  );
    732                }
    733                else
    734                        nextavphdr=NULL;
    735        }
    736        if (avp)
    737                *avp = nextavp;
    738        
    739        if (avp && nextavp) {
    740                struct dictionary * dict;
    741                CHECK_FCT( fd_dict_getdict( what, &dict) );
    742                CHECK_FCT_DO( fd_msg_parse_dict( nextavp, dict, NULL ),  );
    743        }
    744        
    745        if (avp || nextavp)
    746                return 0;
    747        else
    748                return ENOENT;
    749 }
    750703
    751704static int cca_cb( struct msg ** msg,
     
    785738
    786739        CHECK_FCT(fd_msg_search_avp ( *msg, chrg_rule_grp, &g_avp ));
    787         CHECK_FCT(fd_avp_search_avp(g_avp, chrg_rule_name, &avp));
     740        CHECK_FCT(fd_msg_search_avp(g_avp, chrg_rule_name, &avp));
    788741
    789742        if(avp) {
Note: See TracChangeset for help on using the changeset viewer.