Navigation


Changeset 1424:c8057892e56b in freeDiameter for extensions


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).

Location:
extensions
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/app_sip/app_sip.h

    r1088 r1424  
    110110void DigestCalcResponse(HASHHEX HA1,char * pszNonce,char * pszNonceCount,char * pszCNonce,char * pszQop,char * pszMethod,char * pszDigestUri,HASHHEX HEntity,HASHHEX Response);
    111111void DigestCalcResponseAuth(HASHHEX HA1,char * pszNonce,char * pszNonceCount,char * pszCNonce,char * pszQop,char * pszMethod,char * pszDigestUri,HASHHEX HEntity,HASHHEX Response);
    112 
    113 int fd_avp_search_avp ( struct avp * groupedavp, struct dict_object * what, struct avp ** avp );
    114112
    115113//thread procedure
  • extensions/app_sip/libapp_sip.c

    r433 r1424  
    6767}
    6868
    69 
    70 /* Search a given AVP model in an AVP (extracted from libfreediameter/message.c ) */
    71 int fd_avp_search_avp ( struct avp * groupedavp, struct dict_object * what, struct avp ** avp )
    72 {
    73         struct avp * nextavp;
    74         struct avp_hdr * nextavphdr;
    75         struct dict_avp_data    dictdata;
    76        
    77        
    78         TRACE_ENTRY("%p %p %p", groupedavp, what, avp);
    79        
    80         CHECK_FCT(  fd_dict_getval(what, &dictdata)  );
    81        
    82         // Loop only in the group AVP
    83         CHECK_FCT(  fd_msg_browse(groupedavp, MSG_BRW_FIRST_CHILD, (void *)&nextavp, NULL)  );
    84         CHECK_FCT( fd_msg_avp_hdr( nextavp, &nextavphdr )  );
    85        
    86         while (nextavphdr) {
    87                
    88                 if ( (nextavphdr->avp_code   == dictdata.avp_code) && (nextavphdr->avp_vendor == dictdata.avp_vendor) ) // always 0 if no Vendor flag
    89                 {
    90                         break;
    91                 }
    92                
    93                 // Otherwise move to next AVP in the grouped AVP
    94                 CHECK_FCT( fd_msg_browse(nextavp, MSG_BRW_NEXT, (void *)&nextavp, NULL) );
    95                
    96                 if(nextavp!=NULL)
    97                 {
    98                         CHECK_FCT( fd_msg_avp_hdr( nextavp, &nextavphdr )  );
    99                 }
    100                 else
    101                         nextavphdr=NULL;
    102         }
    103         if (avp)
    104                 *avp = nextavp;
    105        
    106         if (avp && nextavp) {
    107                 struct dictionary * dict;
    108                 CHECK_FCT( fd_dict_getdict( what, &dict) );
    109                 CHECK_FCT_DO( fd_msg_parse_dict( nextavp, dict, NULL ),  );
    110         }
    111        
    112         if (avp || nextavp)
    113                 return 0;
    114         else
    115                 return ENOENT;
    116 }
    11769struct avp_hdr *walk_digest(struct avp *avp, int avp_code)
    11870{
  • extensions/app_sip/multimediaauth.c

    r1405 r1424  
    321321                                                       
    322322                                                       
    323                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_CNonce, &a2 ));
     323                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_CNonce, &a2 ));
    324324                                                       
    325325                                                        if(a2!=NULL)
     
    458458                                                                       
    459459                                                                       
    460                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_Nonce, &a2 ));
     460                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_Nonce, &a2 ));
    461461                                                                        if(a2!=NULL)
    462462                                                                        {
     
    487487                                                                                       
    488488                                                                        }
    489                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_Response, &a2 ));
     489                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_Response, &a2 ));
    490490                                                                        if(a2!=NULL)
    491491                                                                        {
     
    501501                                                                               
    502502                                                                        }
    503                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_Realm, &a2 ));
     503                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_Realm, &a2 ));
    504504                                                                        if(a2!=NULL)
    505505                                                                        {
     
    515515                                                                        }
    516516                                                                       
    517                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_Method, &a2 ));
     517                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_Method, &a2 ));
    518518                                                                        if(a2!=NULL)
    519519                                                                        {
     
    531531                                                                                digest_method="";
    532532                                                                       
    533                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_URI, &a2 ));
     533                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_URI, &a2 ));
    534534                                                                        if(a2!=NULL)
    535535                                                                        {
     
    545545                                                                        }
    546546                                                                       
    547                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_QOP, &a2 ));
     547                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_QOP, &a2 ));
    548548                                                                        if(a2!=NULL)
    549549                                                                        {
     
    560560                                                                        else
    561561                                                                                digest_qop=NULL;
    562                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_Algorithm, &a2 ));
     562                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_Algorithm, &a2 ));
    563563                                                                        if(a2!=NULL)
    564564                                                                        {
     
    575575                                                                        else
    576576                                                                                digest_algorithm=NULL;
    577                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_CNonce, &a2 ));
     577                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_CNonce, &a2 ));
    578578                                                                        if(a2!=NULL)
    579579                                                                        {
     
    590590                                                                        else
    591591                                                                                digest_cnonce="";
    592                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_Nonce_Count, &a2 ));
     592                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_Nonce_Count, &a2 ));
    593593                                                                        if(a2!=NULL)
    594594                                                                        {
     
    605605                                                                        else
    606606                                                                                digest_noncecount="";
    607                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_Username, &a2 ));
     607                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_Username, &a2 ));
    608608                                                                        if(a2!=NULL)
    609609                                                                        {
  • extensions/rt_rewrite/rt_rewrite.c

    r1388 r1424  
    8787}
    8888
     89/* TODO: convert to fd_msg_search_avp ? */
    8990static int fd_avp_search_avp(msg_or_avp *where, struct dict_object *what, struct avp **avp)
    9091{
  • extensions/test_sip/multimediaauth.c

    r639 r1424  
    336336                                                       
    337337                                                       
    338                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_CNonce, &a2 ));
     338                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_CNonce, &a2 ));
    339339                                                       
    340340                                                        if(a2!=NULL)
     
    473473                                                                       
    474474                                                                       
    475                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_Nonce, &a2 ));
     475                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_Nonce, &a2 ));
    476476                                                                        if(a2!=NULL)
    477477                                                                        {
     
    502502                                                                                       
    503503                                                                        }
    504                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_Response, &a2 ));
     504                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_Response, &a2 ));
    505505                                                                        if(a2!=NULL)
    506506                                                                        {
     
    516516                                                                               
    517517                                                                        }
    518                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_Realm, &a2 ));
     518                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_Realm, &a2 ));
    519519                                                                        if(a2!=NULL)
    520520                                                                        {
     
    530530                                                                        }
    531531                                                                       
    532                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_Method, &a2 ));
     532                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_Method, &a2 ));
    533533                                                                        if(a2!=NULL)
    534534                                                                        {
     
    546546                                                                                digest_method="";
    547547                                                                       
    548                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_URI, &a2 ));
     548                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_URI, &a2 ));
    549549                                                                        if(a2!=NULL)
    550550                                                                        {
     
    560560                                                                        }
    561561                                                                       
    562                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_QOP, &a2 ));
     562                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_QOP, &a2 ));
    563563                                                                        if(a2!=NULL)
    564564                                                                        {
     
    575575                                                                        else
    576576                                                                                digest_qop=NULL;
    577                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_Algorithm, &a2 ));
     577                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_Algorithm, &a2 ));
    578578                                                                        if(a2!=NULL)
    579579                                                                        {
     
    590590                                                                        else
    591591                                                                                digest_algorithm=NULL;
    592                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_CNonce, &a2 ));
     592                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_CNonce, &a2 ));
    593593                                                                        if(a2!=NULL)
    594594                                                                        {
     
    605605                                                                        else
    606606                                                                                digest_cnonce="";
    607                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_Nonce_Count, &a2 ));
     607                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_Nonce_Count, &a2 ));
    608608                                                                        if(a2!=NULL)
    609609                                                                        {
     
    620620                                                                        else
    621621                                                                                digest_noncecount="";
    622                                                                         CHECK_FCT(fd_avp_search_avp (avp, sip_dict.Digest_Username, &a2 ));
     622                                                                        CHECK_FCT(fd_msg_search_avp (avp, sip_dict.Digest_Username, &a2 ));
    623623                                                                        if(a2!=NULL)
    624624                                                                        {
Note: See TracChangeset for help on using the changeset viewer.