本文整理汇总了C++中usrloc_api_t::assert_identity方法的典型用法代码示例。如果您正苦于以下问题:C++ usrloc_api_t::assert_identity方法的具体用法?C++ usrloc_api_t::assert_identity怎么用?C++ usrloc_api_t::assert_identity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类usrloc_api_t
的用法示例。
在下文中一共展示了usrloc_api_t::assert_identity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert_identity
/**
* checked if passed identity is an asserted identity
*/
int assert_identity(struct sip_msg* _m, udomain_t* _d, str identity) {
// Public identities of this contact
struct ppublic * p;
//remove <> braces if there are
if(identity.s[0]=='<' && identity.s[identity.len-1]=='>') {
identity.s++;
identity.len -= 2;
}
LM_DBG("Identity to assert: %.*s\n", identity.len, identity.s);
if (getContactP(_m, _d, PCONTACT_REGISTERED|PCONTACT_REG_PENDING_AAR|PCONTACT_REG_PENDING, 0, 0) != NULL) {
for (p = c->head; p; p = p->next) {
LM_DBG("Public identity: %.*s\n", p->public_identity.len, p->public_identity.s);
/* Check length: */
if (identity.len == p->public_identity.len) {
/* Check contents: */
if (strncasecmp(identity.s, p->public_identity.s, identity.len) == 0) {
LM_DBG("Match!\n");
return 1;
}
} else LM_DBG("Length does not match.\n");
}
}
LM_INFO("Contact not found based on Contact, trying IP/Port/Proto\n");
str received_host = {0, 0};
char srcip[50];
received_host.len = ip_addr2sbuf(&_m->rcv.src_ip, srcip, sizeof(srcip));
received_host.s = srcip;
if (ul.assert_identity(_d, &received_host, _m->rcv.src_port, _m->rcv.proto, &identity) == 0)
return -1;
else
return 1;
}
示例2: assert_identity
/**
* Add proper asserted identies based on registration
*/
int assert_identity(struct sip_msg* _m, udomain_t* _d, str identity) {
str received_host = {0, 0};
char srcip[50];
received_host.len = ip_addr2sbuf(&_m->rcv.src_ip, srcip, sizeof(srcip));
received_host.s = srcip;
if (ul.assert_identity(_d, &received_host, _m->rcv.src_port, _m->rcv.proto, &identity) == 0)
return -1;
else
return 1;
}