本文整理汇总了C++中usrloc_api_t::get_pcontact_by_src方法的典型用法代码示例。如果您正苦于以下问题:C++ usrloc_api_t::get_pcontact_by_src方法的具体用法?C++ usrloc_api_t::get_pcontact_by_src怎么用?C++ usrloc_api_t::get_pcontact_by_src使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类usrloc_api_t
的用法示例。
在下文中一共展示了usrloc_api_t::get_pcontact_by_src方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
pcontact_t * getContactP_from_via(struct sip_msg* _m, udomain_t* _d) {
ppublic_t * p;
struct via_body *vb;
vb = cscf_get_ue_via(_m);
if (!vb) {
LM_WARN("no via header.....strange!\n");
return NULL;
}
if (vb->port == 0)
vb->port = 5060;
if (_m->id != current_msg_id) {
current_msg_id = _m->id;
c = NULL;
LM_DBG("Looking for <%d://%.*s:%d>\n", vb->proto, vb->host.len, vb->host.s, vb->port);
if (ul.get_pcontact_by_src(_d, &vb->host, vb->port, vb->proto, &c) == 1)
LM_WARN("No entry in usrloc for %.*s:%i (Proto %i) found!\n", vb->host.len, vb->host.s, vb->port, vb->proto);
}
asserted_identity = NULL;
if (c) {
p = c->head;
while (p) {
if (p->is_default == 1)
asserted_identity = &p->public_identity;
p = p->next;
}
}
return c;
}
示例2: getContactP
/**
* get PContact-Structure for message
* (search only once per Request)
*/
pcontact_t * getContactP(struct sip_msg* _m, udomain_t* _d) {
ppublic_t * p;
str received_host = {0, 0};
char srcip[50];
if (_m->id != current_msg_id) {
current_msg_id = _m->id;
c = NULL;
received_host.len = ip_addr2sbuf(&_m->rcv.src_ip, srcip, sizeof(srcip));
received_host.s = srcip;
if (ul.get_pcontact_by_src(_d, &received_host, _m->rcv.src_port, _m->rcv.proto, &c) == 1)
LM_WARN("No entry in usrloc for %.*s:%i (Proto %i) found!\n", received_host.len, received_host.s, _m->rcv.src_port, _m->rcv.proto);
}
asserted_identity = NULL;
if (c) {
p = c->head;
while (p) {
if (p->is_default == 1)
asserted_identity = &p->public_identity;
p = p->next;
}
}
return c;
}
示例3: getContactP
/**
* get PContact-Structure for message
* (search only once per Request)
*/
pcontact_t * getContactP(struct sip_msg* _m, udomain_t* _d) {
ppublic_t * p;
contact_body_t *b = 0;
str received_host = {0, 0};
contact_t *ct;
char srcip[50];
int security_server_port = -1;
if (_m->id != current_msg_id) {
current_msg_id = _m->id;
c = NULL;
b = cscf_parse_contacts(_m);
if (b && b->contacts) {
for (ct = b->contacts; ct; ct = ct->next) {
if (ul.get_pcontact(_d, &ct->uri, &c) == 0) {
if (c->security) {
switch (c->security->type) {
case SECURITY_IPSEC:
security_server_port = c->security->data.ipsec->port_uc;
break;
case SECURITY_TLS:
case SECURITY_NONE:
break;
}
} else if (c->security_temp) {
switch (c->security->type) {
case SECURITY_IPSEC:
security_server_port = c->security->data.ipsec->port_uc;
break;
case SECURITY_TLS:
case SECURITY_NONE:
break;
}
}
if ((c->reg_state == PCONTACT_REGISTERED) && ((c->received_port == _m->rcv.src_port) || (security_server_port == _m->rcv.src_port)) && (c->received_proto == _m->rcv.proto)) {
received_host.len = ip_addr2sbuf(&_m->rcv.src_ip, srcip, sizeof(srcip));
received_host.s = srcip;
LM_DBG("Received host len %d (search %d)\n", c->received_host.len, received_host.len);
// Then check the length:
if (c->received_host.len == received_host.len) {
LM_DBG("Received host %.*s (search %.*s)\n",
c->received_host.len, c->received_host.s,
received_host.len, received_host.s);
// Finally really compare the "received_host"
if (!memcmp(c->received_host.s, received_host.s, received_host.len))
break;
c = NULL;
}
} else {
c = NULL;
}
}
}
} else {
LM_WARN("No contact-header found\n");
}
if ((c == NULL) && (is_registered_fallback2ip > 0)) {
LM_WARN("Contact not found based on Contact-header, trying IP/Port/Proto\n");
received_host.len = ip_addr2sbuf(&_m->rcv.src_ip, srcip, sizeof(srcip));
received_host.s = srcip;
if (ul.get_pcontact_by_src(_d, &received_host, _m->rcv.src_port, _m->rcv.proto, &c) == 1)
LM_DBG("No entry in usrloc for %.*s:%i (Proto %i) found!\n", received_host.len, received_host.s, _m->rcv.src_port, _m->rcv.proto);
}
}
asserted_identity = NULL;
if (c) {
p = c->head;
while (p) {
if (p->is_default == 1)
asserted_identity = &p->public_identity;
p = p->next;
}
}
return c;
}
示例4: getContactP
/**
* get PContact-Structure for message
* (search only once per Request)
*/
pcontact_t * getContactP(struct sip_msg* _m, udomain_t* _d) {
ppublic_t * p;
contact_body_t *b = 0;
contact_t *ct;
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 (_m->id != current_msg_id) {
current_msg_id = _m->id;
c = NULL;
if (is_registered_fallback2ip == 2) {
LM_DBG("Searching in usrloc for %.*s:%i (Proto %i)\n",
received_host.len, received_host.s,
_m->rcv.src_port, _m->rcv.proto);
if (ul.get_pcontact_by_src(_d, &received_host, _m->rcv.src_port, _m->rcv.proto, &c) == 1) {
LM_DBG("No entry in usrloc for %.*s:%i (Proto %i) found!\n", received_host.len, received_host.s, _m->rcv.src_port, _m->rcv.proto);
} else {
if (checkcontact(_m, c) != 0) {
c = NULL;
}
}
}
if (c == NULL) {
b = cscf_parse_contacts(_m);
if (b && b->contacts) {
for (ct = b->contacts; ct; ct = ct->next) {
if (ul.get_pcontact(_d, &ct->uri, &received_host, _m->rcv.src_port, &c) == 0) {
if (checkcontact(_m, c) != 0) {
c = NULL;
} else {
break;
}
}
}
} else {
LM_WARN("No contact-header found?!?\n");
}
}
if ((c == NULL) && (is_registered_fallback2ip == 1)) {
LM_INFO("Contact not found based on Contact-header, trying IP/Port/Proto\n");
received_host.len = ip_addr2sbuf(&_m->rcv.src_ip, srcip, sizeof(srcip));
received_host.s = srcip;
if (ul.get_pcontact_by_src(_d, &received_host, _m->rcv.src_port, _m->rcv.proto, &c) == 1) {
LM_DBG("No entry in usrloc for %.*s:%i (Proto %i) found!\n", received_host.len, received_host.s, _m->rcv.src_port, _m->rcv.proto);
} else {
if (checkcontact(_m, c) != 0) {
c = NULL;
}
}
}
}
asserted_identity = NULL;
registration_contact = NULL;
if (c) {
registration_contact = &c->contact_user;
p = c->head;
while (p) {
if (p->is_default == 1)
asserted_identity = &p->public_identity;
p = p->next;
}
}
return c;
}