Changeset 1424:c8057892e56b in freeDiameter
- Timestamp:
- Feb 19, 2020, 8:24:13 AM (4 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
contrib/test_Gx/main_gx.c
r1271 r1424 701 701 702 702 } 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 AVP716 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 flag722 {723 break;724 }725 726 // Otherwise move to next AVP in the grouped AVP727 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 else734 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 else748 return ENOENT;749 }750 703 751 704 static int cca_cb( struct msg ** msg, … … 785 738 786 739 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)); 788 741 789 742 if(avp) { -
extensions/app_sip/app_sip.h
r1088 r1424 110 110 void DigestCalcResponse(HASHHEX HA1,char * pszNonce,char * pszNonceCount,char * pszCNonce,char * pszQop,char * pszMethod,char * pszDigestUri,HASHHEX HEntity,HASHHEX Response); 111 111 void 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 );114 112 115 113 //thread procedure -
extensions/app_sip/libapp_sip.c
r433 r1424 67 67 } 68 68 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 AVP83 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 flag89 {90 break;91 }92 93 // Otherwise move to next AVP in the grouped AVP94 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 else101 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 else115 return ENOENT;116 }117 69 struct avp_hdr *walk_digest(struct avp *avp, int avp_code) 118 70 { -
extensions/app_sip/multimediaauth.c
r1405 r1424 321 321 322 322 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 )); 324 324 325 325 if(a2!=NULL) … … 458 458 459 459 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 )); 461 461 if(a2!=NULL) 462 462 { … … 487 487 488 488 } 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 )); 490 490 if(a2!=NULL) 491 491 { … … 501 501 502 502 } 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 )); 504 504 if(a2!=NULL) 505 505 { … … 515 515 } 516 516 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 )); 518 518 if(a2!=NULL) 519 519 { … … 531 531 digest_method=""; 532 532 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 )); 534 534 if(a2!=NULL) 535 535 { … … 545 545 } 546 546 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 )); 548 548 if(a2!=NULL) 549 549 { … … 560 560 else 561 561 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 )); 563 563 if(a2!=NULL) 564 564 { … … 575 575 else 576 576 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 )); 578 578 if(a2!=NULL) 579 579 { … … 590 590 else 591 591 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 )); 593 593 if(a2!=NULL) 594 594 { … … 605 605 else 606 606 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 )); 608 608 if(a2!=NULL) 609 609 { -
extensions/rt_rewrite/rt_rewrite.c
r1388 r1424 87 87 } 88 88 89 /* TODO: convert to fd_msg_search_avp ? */ 89 90 static int fd_avp_search_avp(msg_or_avp *where, struct dict_object *what, struct avp **avp) 90 91 { -
extensions/test_sip/multimediaauth.c
r639 r1424 336 336 337 337 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 )); 339 339 340 340 if(a2!=NULL) … … 473 473 474 474 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 )); 476 476 if(a2!=NULL) 477 477 { … … 502 502 503 503 } 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 )); 505 505 if(a2!=NULL) 506 506 { … … 516 516 517 517 } 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 )); 519 519 if(a2!=NULL) 520 520 { … … 530 530 } 531 531 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 )); 533 533 if(a2!=NULL) 534 534 { … … 546 546 digest_method=""; 547 547 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 )); 549 549 if(a2!=NULL) 550 550 { … … 560 560 } 561 561 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 )); 563 563 if(a2!=NULL) 564 564 { … … 575 575 else 576 576 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 )); 578 578 if(a2!=NULL) 579 579 { … … 590 590 else 591 591 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 )); 593 593 if(a2!=NULL) 594 594 { … … 605 605 else 606 606 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 )); 608 608 if(a2!=NULL) 609 609 { … … 620 620 else 621 621 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 )); 623 623 if(a2!=NULL) 624 624 {
Note: See TracChangeset
for help on using the changeset viewer.