本文整理汇总了C++中TAG_END函数的典型用法代码示例。如果您正苦于以下问题:C++ TAG_END函数的具体用法?C++ TAG_END怎么用?C++ TAG_END使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TAG_END函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: subscribe_to_nua
nua_handle_t *
subscribe_to_nua(char const *event,
tag_type_t tag, tag_value_t value, ...)
{
ta_list ta;
struct event *subscribe;
struct message *response;
nua_handle_t *nh;
nua_set_params(nua, NUTAG_APPL_METHOD("SUBSCRIBE"),
SIPTAG_ALLOW_EVENTS_STR(event),
TAG_END());
fail_unless_event(nua_r_set_params, 200);
ta_start(ta, tag, value);
s2_sip_request_to(dialog, SIP_METHOD_SUBSCRIBE, NULL,
SIPTAG_EVENT_STR(event),
ta_tags(ta));
ta_end(ta);
subscribe = s2_wait_for_event(nua_i_subscribe, 100);
nh = subscribe->nh;
nua_respond(nh, SIP_202_ACCEPTED,
NUTAG_WITH_SAVED(subscribe->event),
TAG_END());
s2_free_event(subscribe);
response = s2_sip_wait_for_response(202, SIP_METHOD_SUBSCRIBE);
s2_sip_update_dialog(dialog, response);
fail_unless(response->sip->sip_expires != NULL);
s2_sip_free_message(response);
return nh;
}
示例2: mrcp_sofia_task_initialize
static void mrcp_sofia_task_initialize(apt_task_t *task)
{
mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task);
/* Initialize Sofia-SIP library and create event loop */
su_init();
sofia_agent->root = su_root_create(NULL);
/* Create a user agent instance. The stack will call the 'event_callback()'
* callback when events such as succesful registration to network,
* an incoming call, etc, occur.
*/
sofia_agent->nua = nua_create(
sofia_agent->root, /* Event loop */
mrcp_sofia_event_callback, /* Callback for processing events */
sofia_agent, /* Additional data to pass to callback */
NUTAG_URL(sofia_agent->sip_bind_str), /* Address to bind to */
TAG_END()); /* Last tag should always finish the sequence */
if(sofia_agent->nua) {
nua_set_params(
sofia_agent->nua,
NUTAG_AUTOANSWER(0),
NUTAG_APPL_METHOD("OPTIONS"),
SIPTAG_USER_AGENT_STR(sofia_agent->config->user_agent_name),
TAG_END());
}
}
示例3: START_TEST
END_TEST
START_TEST(client_2_0_1)
{
nta_outgoing_t *orq;
struct message *request;
struct event *response;
S2_CASE("client-2.0.1", "Send MESSAGE",
"Basic non-INVITE transaction with "
"numeric per-transaction outbound proxy");
orq = nta_outgoing_tcreate(s2->default_leg,
s2_nta_orq_callback, NULL,
(url_string_t *)s2sip->contact->m_url,
SIP_METHOD_MESSAGE,
URL_STRING_MAKE("sip:test2.0.example.org"),
SIPTAG_FROM_STR("<sip:[email protected]>"),
TAG_END());
fail_unless(orq != NULL);
request = s2_sip_wait_for_request(SIP_METHOD_MESSAGE);
fail_unless(request != NULL);
s2_sip_respond_to(request, NULL, 200, "OK 2.0.1", TAG_END());
response = s2_nta_wait_for(wait_for_orq, orq,
wait_for_status, 200,
0);
s2_sip_free_message(request);
s2_nta_free_event(response);
nta_outgoing_destroy(orq);
}
示例4: nth_authentication_result
static void nth_authentication_result(void *ai0, auth_status_t *as)
{
struct auth_info *ai = ai0;
nth_request_t *req = ai->req;
int status;
if (as->as_status != 0) {
assert(as->as_status >= 300);
nth_request_treply(req, status = as->as_status, as->as_phrase,
HTTPTAG_HEADER((http_header_t *)as->as_response),
TAG_END());
}
else {
req->req_in_callback = 1;
status = ai->site->site_callback(ai->site->site_magic,
ai->site,
ai->req,
ai->http,
ai->path);
req->req_in_callback = 0;
if (status != 0 && (status < 100 || status >= 600))
status = 500;
if (status != 0 && req->req_status < 200) {
nth_request_treply(req, status, NULL, TAG_END());
}
}
if (status >= 200 || req->req_destroyed)
nth_request_destroy(req);
}
示例5: START_TEST
END_TEST
START_TEST(subscribe_6_1_3)
{
nua_handle_t *nh;
struct message *response;
struct event *notify, *event;
S2_CASE("6.1.3", "Subscription terminated by notifier",
"NUA sends SUBSCRIBE, waits for NOTIFY, "
"gets NOTIFY terminating the subscription,");
nh = nua_handle(nua, NULL, SIPTAG_TO(s2sip->aor), TAG_END());
nua_subscribe(nh, SIPTAG_EVENT_STR(event_type), TAG_END());
notify = subscription_by_nua(nh, nua_substate_embryonic, TAG_END());
s2_free_event(notify);
fail_if(s2_sip_request_to(dialog, SIP_METHOD_NOTIFY, NULL,
SIPTAG_EVENT_STR(event_type),
SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"),
TAG_END()));
event = s2_wait_for_event(nua_i_notify, 200);
fail_if(!event);
fail_unless(s2_check_substate(event, nua_substate_terminated));
s2_free_event(event);
response = s2_sip_wait_for_response(200, SIP_METHOD_NOTIFY);
fail_if(!response);
s2_sip_free_message(response);
nua_handle_destroy(nh);
}
示例6: unsubscribe_by_nua
static void
unsubscribe_by_nua(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...)
{
struct message *subscribe, *response;
struct event *event;
nua_unsubscribe(nh, TAG_END());
subscribe = s2_sip_wait_for_request(SIP_METHOD_SUBSCRIBE);
s2_sip_respond_to(subscribe, dialog, SIP_200_OK, SIPTAG_EXPIRES_STR("0"), TAG_END());
event = s2_wait_for_event(nua_r_unsubscribe, 200);
fail_if(!event);
fail_unless(s2_check_substate(event, nua_substate_active));
s2_free_event(event);
fail_if(s2_sip_request_to(dialog, SIP_METHOD_NOTIFY, NULL,
SIPTAG_EVENT(subscribe->sip->sip_event),
SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=timeout"),
SIPTAG_CONTENT_TYPE_STR(event_mime_type),
SIPTAG_PAYLOAD_STR(event_state),
TAG_END()));
event = s2_wait_for_event(nua_i_notify, 200);
fail_if(!event);
fail_unless(s2_check_substate(event, nua_substate_terminated));
s2_free_event(event);
response = s2_sip_wait_for_response(200, SIP_METHOD_NOTIFY);
fail_if(!response);
s2_sip_free_message(response);
s2_sip_free_message(subscribe);
}
示例7: s2_register_setup
/** Register NUA user.
*
* <pre>
* A B
* |-----REGISTER---->|
* |<-----200 OK------|
* | |
* </pre>
*/
void s2_register_setup(void)
{
nua_handle_t *nh;
struct message *m;
assert(s2 && s2->nua);
assert(!s2->registration->nh);
nh = nua_handle(s2->nua, NULL, TAG_END());
nua_register(nh, TAG_END());
m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
assert(m);
s2_save_register(m);
s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
TAG_END());
s2_sip_free_message(m);
assert(s2->registration->contact != NULL);
fail_unless_event(nua_r_register, 200);
s2->registration->nh = nh;
}
示例8: START_TEST
END_TEST
START_TEST(register_1_3_2_2)
{
nua_handle_t *nh = nua_handle(nua, NULL, TAG_END());
struct message *m;
S2_CASE("1.3.2.2", "Register behind NAT with TCP",
"Detect NAT over TCP using rport. "
"Authenticate, detect NAT, "
"close TCP at server, wait for re-REGISTERs.");
nua_set_params(nua, NTATAG_TCP_RPORT(1), TAG_END());
fail_unless_event(nua_r_set_params, 200);
mark_point();
s2->registration->nh = nh;
make_auth_natted_register(
nh, NUTAG_PROXY(s2sip->tcp.contact->m_url),
NUTAG_OUTBOUND("no-options-keepalive, no-validate"),
TAG_END());
fail_if(!tport_is_tcp(s2->registration->tport));
tport_shutdown(s2->registration->tport, 2);
m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m); fail_if(!m->sip->sip_authorization);
s2_save_register(m);
s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
SIPTAG_VIA(natted_via(m, receive_natted)),
TAG_END());
s2_sip_free_message(m);
/* The "NAT binding" changed when new TCP connection is established */
/* => NUA re-REGISTERs with newly detected contact */
fail_unless_event(nua_r_register, 100);
m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m); fail_if(!m->sip->sip_authorization);
fail_if(!m->sip->sip_contact || !m->sip->sip_contact->m_next);
s2_save_register(m);
s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
SIPTAG_VIA(natted_via(m, receive_natted)),
TAG_END());
s2_sip_free_message(m);
fail_unless_event(nua_r_register, 200);
fail_unless(s2->registration->contact != NULL);
fail_if(s2->registration->contact->m_next != NULL);
s2_register_teardown();
}
示例9: client_setup
static void
client_setup(void)
{
s2_nta_setup("NTA", NULL, TAG_END());
s2_nta_agent_setup(URL_STRING_MAKE("sip:0.0.0.0:*"), NULL, NULL,
NTATAG_DEFAULT_PROXY("sip:example.org"),
TAG_END());
}
示例10: pingpong_setup
static void pingpong_setup(void)
{
nua = s2_nua_setup("register with pingpong",
TPTAG_PINGPONG(20000),
TPTAG_KEEPALIVE(10000),
TAG_END());
tport_set_params(s2sip->tcp.tport, TPTAG_PONG2PING(1), TAG_END());
}
示例11: START_TEST
END_TEST
START_TEST(register_1_2_2_3)
{
nua_handle_t *nh = nua_handle(nua, NULL, TAG_END());
struct message *m;
S2_CASE("1.2.2.3", "Register behind NAT",
"Authenticate, outbound activated, "
"detect NAT binding change when re-REGISTERing");
mark_point();
make_auth_natted_register(nh,
NUTAG_OUTBOUND("no-options-keepalive, no-validate"),
TAG_END());
s2->registration->nh = nh;
s2_nua_fast_forward(3600, s2base->root);
mark_point();
m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m);
fail_if(!m->sip->sip_authorization);
s2_save_register(m);
s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
SIPTAG_VIA(natted_via(m, receive_natted2)),
TAG_END());
s2_sip_free_message(m);
fail_unless_event(nua_r_register, 100);
m = s2_sip_wait_for_request(SIP_METHOD_REGISTER);
fail_if(!m);
fail_if(!m->sip->sip_authorization);
fail_if(!m->sip->sip_contact || !m->sip->sip_contact->m_next);
s2_save_register(m);
s2_sip_respond_to(m, NULL,
SIP_200_OK,
SIPTAG_CONTACT(s2->registration->contact),
SIPTAG_VIA(natted_via(m, receive_natted2)),
TAG_END());
s2_sip_free_message(m);
fail_unless(s2->registration->contact != NULL);
fail_if(s2->registration->contact->m_next != NULL);
fail_unless_event(nua_r_register, 200);
s2_register_teardown();
}
示例12: nta_agent_set_uas
/** Set UAS flag value.
*
* The function nta_agent_set_uas() is used to set or clear User Agent
* Server flag.
*
* Currently, the flag determines how the agent handles 2XX replies to an
* incoming INVITE request. If flag is set, the agent resends the 2XX final
* responses to an INVITE.
*
* @deprecated Use nta_agent_set_params() and NTATAG_UA() instead.
*/
int nta_agent_set_uas(nta_agent_t *agent, int value)
{
int retval = 1;
nta_agent_set_params(agent, NTATAG_UA(value != 0), TAG_END());
nta_agent_get_params(agent, NTATAG_UA_REF(retval), TAG_END());
return retval;
}
示例13: client_setup_tcp_only_server
static void
client_setup_tcp_only_server(void)
{
char const * const transports[] = { "tcp", NULL };
s2_nta_setup("NTA", transports, TAG_END());
s2_nta_agent_setup(URL_STRING_MAKE("sip:0.0.0.0:*"), NULL, NULL,
NTATAG_DEFAULT_PROXY(s2sip->contact->m_url),
TAG_END());
}
示例14: nta_agent_set_branch
/** Set branch key.
*
* @deprecated Use nta_agent_set_params() and NTATAG_BRANCH_KEY() instead.
*/
msg_param_t nta_agent_set_branch(nta_agent_t *agent,
msg_param_t branch)
{
msg_param_t retval = "";
nta_agent_set_params(agent, NTATAG_BRANCH_KEY(branch), TAG_END());
nta_agent_get_params(agent, NTATAG_BRANCH_KEY_REF(retval), TAG_END());
return retval;
}
示例15: assert
/** @internal Create a handle for processing incoming request */
nua_handle_t *nua_stack_incoming_handle(nua_t *nua,
nta_incoming_t *irq,
sip_t const *sip,
int create_dialog)
{
nua_handle_t *nh;
url_t const *url;
sip_to_t to[1];
sip_from_t from[1];
assert(sip && sip->sip_from && sip->sip_to);
if (sip->sip_contact)
url = sip->sip_contact->m_url;
else
url = sip->sip_from->a_url;
/* Strip away parameters */
sip_from_init(from)->a_display = sip->sip_to->a_display;
*from->a_url = *sip->sip_to->a_url;
sip_to_init(to)->a_display = sip->sip_from->a_display;
*to->a_url = *sip->sip_from->a_url;
nh = nh_create(nua,
NUTAG_URL((url_string_t *)url), /* Remote target */
SIPTAG_TO(to), /* Local AoR */
SIPTAG_FROM(from), /* Remote AoR */
TAG_END());
if (nh && nua_stack_init_handle(nua, nh, NULL) < 0)
nh_destroy(nua, nh), nh = NULL;
if (nh && create_dialog) {
struct nua_dialog_state *ds = nh->nh_ds;
nua_dialog_store_peer_info(nh, ds, sip);
ds->ds_leg = nta_leg_tcreate(nua->nua_nta, nua_stack_process_request, nh,
SIPTAG_CALL_ID(sip->sip_call_id),
SIPTAG_FROM(sip->sip_to),
SIPTAG_TO(sip->sip_from),
NTATAG_REMOTE_CSEQ(sip->sip_cseq->cs_seq),
TAG_END());
if (!ds->ds_leg || !nta_leg_tag(ds->ds_leg, nta_incoming_tag(irq, NULL)))
nh_destroy(nua, nh), nh = NULL;
}
if (nh)
nua_dialog_uas_route(nh, nh->nh_ds, sip, 1);
return nh;
}