Navigation


Changeset 1423:67c263056d78 in freeDiameter for libfdproto


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

fd_msg_search_avp: search msg_or_avp, not just msg

Change fd_msg_search_avp() to support searching
struct msg or struct avp, and not just struct msg.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdproto/messages.c

    r1405 r1423  
    597597}
    598598
    599 /* Search a given AVP model in a message */
    600 int fd_msg_search_avp ( struct msg * msg, struct dict_object * what, struct avp ** avp )
     599/* Search a given AVP model in a message or AVP */
     600int fd_msg_search_avp ( msg_or_avp * reference, struct dict_object * what, struct avp ** avp )
    601601{
    602602        struct avp * nextavp;
     
    604604        enum dict_object_type   dicttype;
    605605       
    606         TRACE_ENTRY("%p %p %p", msg, what, avp);
    607        
    608         CHECK_PARAMS( CHECK_MSG(msg) && what );
     606        TRACE_ENTRY("%p %p %p", reference, what, avp);
     607       
     608        CHECK_PARAMS( VALIDATE_OBJ(reference) && what );
    609609       
    610610        CHECK_PARAMS( (fd_dict_gettype(what, &dicttype) == 0) && (dicttype == DICT_AVP) );
    611611        CHECK_FCT(  fd_dict_getval(what, &dictdata)  );
    612612       
    613         /* Loop on all top AVPs */
    614         CHECK_FCT(  fd_msg_browse(msg, MSG_BRW_FIRST_CHILD, (void *)&nextavp, NULL)  );
     613        /* Loop on all top AVPs in message or AVP */
     614        CHECK_FCT(  fd_msg_browse(reference, MSG_BRW_FIRST_CHILD, (void *)&nextavp, NULL)  );
    615615        while (nextavp) {
    616616               
     
    619619                        break;
    620620               
    621                 /* Otherwise move to next AVP in the message */
     621                /* Otherwise move to next AVP in the message or AVP */
    622622                CHECK_FCT( fd_msg_browse(nextavp, MSG_BRW_NEXT, (void *)&nextavp, NULL) );
    623623        }
Note: See TracChangeset for help on using the changeset viewer.