merge whitespace fixes from sofia-sip tree

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10802 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris
2008-12-16 18:05:22 +00:00
parent 940dbe85c0
commit d8c4d22d40
489 changed files with 10298 additions and 10301 deletions
+1 -1
View File
@@ -38,7 +38,7 @@
#include <stdlib.h>
/* Globals used by <sofia-sip/tstdef.h> */
int tstflags;
int tstflags;
char const name[] = "check_sofia";
int main(int argc, char *argv[])
+23 -23
View File
@@ -106,7 +106,7 @@ int accept_pracked2(CONDITION_PARAMS)
RESPOND(ep, call, nh, SIP_180_RINGING,
TAG_IF(call->sdp, SOATAG_USER_SDP_STR(call->sdp)),
TAG_END());
RESPOND(ep, call, nh, SIP_200_OK,
RESPOND(ep, call, nh, SIP_200_OK,
NUTAG_INCLUDE_EXTRA_SDP(1),
TAG_END());
return 0;
@@ -283,7 +283,7 @@ int test_180rel(struct context *ctx)
if (print_headings)
printf("TEST NUA-10.1.2: PASSED\n");
END();
}
@@ -395,7 +395,7 @@ int test_prack_auth(struct context *ctx)
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 407);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(au = sip->sip_proxy_authenticate);
TEST_1(au = sip->sip_proxy_authenticate);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_calling); /* CALLING */
@@ -499,7 +499,7 @@ int test_prack_auth(struct context *ctx)
if (print_headings)
printf("TEST NUA-10.1.4: PASSED\n");
END();
}
@@ -607,12 +607,12 @@ int test_183rel(struct context *ctx)
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
TEST_1(!is_offer_answer_done(e->data->e_tags));
if (!ep) {
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
TEST(e->data->e_status, 200);
}
ei = event_by_type(e->next, nua_r_invite);
ep = event_by_type(e->next, nua_r_prack);
if (!ep) {
@@ -696,7 +696,7 @@ int test_183rel(struct context *ctx)
/* Client transitions:
INIT -(C1)-> CALLING: nua_invite(), nua_i_state
CALLING -(C2)-> TERMINATING: nua_r_invite, nua_i_state,
CALLING -(C2)-> TERMINATING: nua_r_invite, nua_i_state,
nua_r_prack, nua_i_state
TERMINATING -(T1)-> TERMINATED: nua_r_invite, nua_i_state
*/
@@ -722,7 +722,7 @@ int test_183rel(struct context *ctx)
int bye = 1, cancel = 1, invite = 1, state = 1;
while (bye || cancel || invite || state) {
TEST_1(e = e->next);
TEST_1(e = e->next);
if (e->data->e_event == nua_r_bye) {
TEST_E(e->data->e_event, nua_r_bye);
TEST(e->data->e_status, 200);
@@ -778,9 +778,9 @@ int test_183rel(struct context *ctx)
/* 183 is PRACKed, PRACK is responded with 483 */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_prack);
/* Client terminates the call
- we may (it is received before BYE) or may not (received after BYE)
get CANCEL request
/* Client terminates the call
- we may (it is received before BYE) or may not (received after BYE)
get CANCEL request
*/
TEST_1(e = e->next);
if (e->data->e_event == nua_i_cancel) {
@@ -1116,7 +1116,7 @@ int test_preconditions(struct context *ctx)
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_update);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
TEST_1(!is_offer_sent(e->data->e_tags));
TEST_1(!is_offer_sent(e->data->e_tags));
TEST_1(is_offer_recv(e->data->e_tags));
TEST_1(is_answer_sent(e->data->e_tags));
TEST_1(!is_answer_recv(e->data->e_tags));
@@ -1281,9 +1281,9 @@ int test_preconditions2(struct context *ctx)
|-------200 OK-------|
| |
Note that the boxed responses above can be re-ordered
Note that the boxed responses above can be re-ordered
(180 or 200 OK to INVITE is received before 200 OK to UPDATE).
ACK, however, is sent only after 200 OK to both UPDATE and INVITE.
ACK, however, is sent only after 200 OK to both UPDATE and INVITE.
*/
a_call->sdp = "m=audio 5008 RTP/AVP 8";
@@ -1513,7 +1513,7 @@ int ringing_updated2(CONDITION_PARAMS)
return 0;
case nua_r_update:
if (200 <= status && status < 300) {
RESPOND(ep, call, nh, SIP_180_RINGING,
RESPOND(ep, call, nh, SIP_180_RINGING,
SIPTAG_REQUIRE_STR("100rel"),
TAG_END());
ep->next_condition = accept_pracked;
@@ -1741,7 +1741,7 @@ int test_update_by_uas(struct context *ctx)
do {
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
TEST_1(is_offer_sent(e->data->e_tags));
TEST_1(is_offer_sent(e->data->e_tags));
TEST_1(!is_offer_recv(e->data->e_tags));
TEST_1(!is_answer_sent(e->data->e_tags));
TEST_1(!is_answer_recv(e->data->e_tags));
@@ -2035,7 +2035,7 @@ int test_update_failure(struct context *ctx)
#endif
END();
}
int cancel_when_pracked(CONDITION_PARAMS);
int alert_call(CONDITION_PARAMS);
@@ -2129,7 +2129,7 @@ int test_180rel_cancel1(struct context *ctx)
Option B:
EARLY -(S3b)-> COMPLETED: nua_respond(), nua_i_state
COMPLETED -(S4)-> READY: nua_i_ack, nua_i_state
READY -(T1)-> TERMINATED: nua_i_bye, nua_i_state
READY -(T1)-> TERMINATED: nua_i_bye, nua_i_state
*/
TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
@@ -2157,7 +2157,7 @@ int test_180rel_cancel1(struct context *ctx)
if (print_headings)
printf("TEST NUA-10.6: PASSED\n");
END();
}
@@ -2298,7 +2298,7 @@ int test_180rel_cancel2(struct context *ctx)
Option B:
EARLY -(S3b)-> COMPLETED: nua_respond(), nua_i_state
COMPLETED -(S4)-> READY: nua_i_ack, nua_i_state
READY -(T1)-> TERMINATED: nua_i_bye, nua_i_state
READY -(T1)-> TERMINATED: nua_i_bye, nua_i_state
*/
TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
@@ -2343,7 +2343,7 @@ int test_180rel_cancel2(struct context *ctx)
if (print_headings)
printf("TEST NUA-10.7: PASSED\n");
END();
}
@@ -2561,7 +2561,7 @@ int test_180rel_redirected(struct context *ctx)
if (print_headings)
printf("TEST NUA-10.8.2: PASSED\n");
END();
}
@@ -2575,7 +2575,7 @@ int redirect_pracked(CONDITION_PARAMS)
if (event == nua_i_prack) {
if (!ep->flags.bit0) {
sip_contact_t m[1];
ep->flags.bit0 = 1;
*m = *ep->contact;
+36 -36
View File
@@ -75,7 +75,7 @@ int accept_call(CONDITION_PARAMS)
switch (callstate(tags)) {
case nua_callstate_received:
RESPOND(ep, call, nh, SIP_180_RINGING,
RESPOND(ep, call, nh, SIP_180_RINGING,
TAG_END());
return 0;
case nua_callstate_early:
@@ -115,7 +115,7 @@ int accept_call_with_early_sdp(CONDITION_PARAMS)
switch (callstate(tags)) {
case nua_callstate_received:
RESPOND(ep, call, nh, SIP_180_RINGING,
RESPOND(ep, call, nh, SIP_180_RINGING,
TAG_IF(call->sdp, SOATAG_USER_SDP_STR(call->sdp)),
NUTAG_M_DISPLAY("Bob"),
NUTAG_M_USERNAME("b+b"),
@@ -212,8 +212,8 @@ int test_basic_call_1(struct context *ctx)
printf("TEST NUA-3.1: Basic call\n");
/* Disable session timer from proxy */
test_proxy_get_session_timer(ctx->p, &se, &min_se);
test_proxy_set_session_timer(ctx->p, 0, 0);
test_proxy_get_session_timer(ctx->p, &se, &min_se);
test_proxy_set_session_timer(ctx->p, 0, 0);
a_call->sdp = "m=audio 5008 RTP/AVP 8";
b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
@@ -357,7 +357,7 @@ int test_basic_call_1(struct context *ctx)
nua_handle_destroy(a_call->nh), a_call->nh = NULL;
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
test_proxy_set_session_timer(ctx->p, se, min_se);
test_proxy_set_session_timer(ctx->p, se, min_se);
if (print_headings)
printf("TEST NUA-3.1: PASSED\n");
@@ -422,7 +422,7 @@ int test_basic_call_2(struct context *ctx)
a_call->sdp = "m=audio 5008 RTP/AVP 8";
b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
TEST_1(a_call->nh = nua_handle(a->nua, a_call,
TEST_1(a_call->nh = nua_handle(a->nua, a_call,
SIPTAG_TO_STR("<sip:b@x.org>"),
TAG_END()));
@@ -453,7 +453,7 @@ int test_basic_call_2(struct context *ctx)
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(sip->sip_content_type);
TEST_1(sip->sip_content_type);
TEST_S(sip->sip_content_type->c_type, "application/sdp");
TEST_1(sip->sip_payload); /* there is sdp in 200 OK */
TEST_1(sip->sip_contact);
@@ -533,7 +533,7 @@ int test_basic_call_2(struct context *ctx)
TEST_1(sip->sip_subscription_state);
TEST_S(sip->sip_subscription_state->ss_substate, "terminated");
TEST_1(tl_find(e->data->e_tags, nutag_substate));
TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
nua_substate_terminated);
TEST_1(!e->next);
@@ -615,7 +615,7 @@ int accept_call_no_media(CONDITION_PARAMS)
switch (callstate(tags)) {
case nua_callstate_received:
RESPOND(ep, call, nh, SIP_180_RINGING,
RESPOND(ep, call, nh, SIP_180_RINGING,
NUTAG_MEDIA_ENABLE(0),
TAG_END());
return 0;
@@ -655,7 +655,7 @@ int test_basic_call_3(struct context *ctx)
"t=0 0\r\n"
"m=audio 5008 RTP/AVP 8\r\n";
b_call->sdp =
b_call->sdp =
"v=0\r\n"
"o=- 2 1 IN IP4 127.0.0.1\r\n"
"s=-\r\n"
@@ -663,7 +663,7 @@ int test_basic_call_3(struct context *ctx)
"t=0 0\r\n"
"m=audio 5010 RTP/AVP 0 8\r\n";
TEST_1(a_call->nh = nua_handle(a->nua, a_call,
TEST_1(a_call->nh = nua_handle(a->nua, a_call,
SIPTAG_TO_STR("<sip:b@x.org>"),
TAG_END()));
@@ -695,7 +695,7 @@ int test_basic_call_3(struct context *ctx)
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(sip->sip_content_type);
TEST_1(sip->sip_content_type);
TEST_S(sip->sip_content_type->c_type, "application/sdp");
TEST_1(sip->sip_payload); /* there is sdp in 200 OK */
TEST_1(sip->sip_contact);
@@ -780,7 +780,7 @@ int ack_when_completing_no_media(CONDITION_PARAMS)
switch (callstate(tags)) {
case nua_callstate_completing:
ACK(ep, call, nh,
ACK(ep, call, nh,
TAG_IF(call->sdp, SIPTAG_CONTENT_TYPE_STR("application/sdp")),
TAG_IF(call->sdp, SIPTAG_PAYLOAD_STR(call->sdp)),
TAG_END());
@@ -805,7 +805,7 @@ int accept_call_no_media2(CONDITION_PARAMS)
switch (callstate(tags)) {
case nua_callstate_received:
RESPOND(ep, call, nh, SIP_180_RINGING,
RESPOND(ep, call, nh, SIP_180_RINGING,
NUTAG_MEDIA_ENABLE(0),
TAG_IF(call->sdp, SIPTAG_CONTENT_TYPE_STR("application/sdp")),
TAG_IF(call->sdp, SIPTAG_PAYLOAD_STR(call->sdp)),
@@ -848,7 +848,7 @@ int test_basic_call_4(struct context *ctx)
"t=0 0\r\n"
"m=audio 5008 RTP/AVP 8\r\n";
b_call->sdp =
b_call->sdp =
"v=0\r\n"
"o=- 2 1 IN IP4 127.0.0.1\r\n"
"s=-\r\n"
@@ -856,7 +856,7 @@ int test_basic_call_4(struct context *ctx)
"t=0 0\r\n"
"m=audio 5010 RTP/AVP 0 8\r\n";
TEST_1(a_call->nh = nua_handle(a->nua, a_call,
TEST_1(a_call->nh = nua_handle(a->nua, a_call,
SIPTAG_TO_STR("<sip:b@x.org>"),
TAG_END()));
@@ -889,7 +889,7 @@ int test_basic_call_4(struct context *ctx)
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(sip->sip_content_type);
TEST_1(sip->sip_content_type);
TEST_S(sip->sip_content_type->c_type, "application/sdp");
TEST_1(sip->sip_payload); /* there is sdp in 200 OK */
TEST_1(sip->sip_contact);
@@ -996,8 +996,8 @@ int change_uri_in_ack(CONDITION_PARAMS)
}
/* Test changing from/to within dialog */
/* Test that a proper Contact gets selected in response
* regardless of the To URI.
/* Test that a proper Contact gets selected in response
* regardless of the To URI.
*/
int test_basic_call_5(struct context *ctx)
{
@@ -1014,7 +1014,7 @@ int test_basic_call_5(struct context *ctx)
a_call->sdp = "m=audio 5008 RTP/AVP 8";
b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
TEST_1(a_call->nh = nua_handle(a->nua, a_call,
TEST_1(a_call->nh = nua_handle(a->nua, a_call,
SIPTAG_TO_STR("<sips:b@x.org>"),
TAG_END()));
@@ -1073,8 +1073,8 @@ int test_basic_call_5(struct context *ctx)
TEST(callstate(e->data->e_tags), nua_callstate_completed); /* COMPLETED */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_ack);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_S(sip->sip_to->a_url->url_user, "anonymous");
TEST_S(sip->sip_from->a_url->url_user, "anonymous");
TEST_S(sip->sip_to->a_url->url_user, "anonymous");
TEST_S(sip->sip_from->a_url->url_user, "anonymous");
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
TEST_1(!e->next);
@@ -1177,8 +1177,8 @@ int test_video_call_1(struct context *ctx)
printf("TEST NUA-3.6: Basic call\n");
/* Disable session timer from proxy */
test_proxy_get_session_timer(ctx->p, &se, &min_se);
test_proxy_set_session_timer(ctx->p, 0, 0);
test_proxy_get_session_timer(ctx->p, &se, &min_se);
test_proxy_set_session_timer(ctx->p, 0, 0);
a_call->sdp = "m=audio 5008 RTP/AVP 8";
b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
@@ -1256,8 +1256,8 @@ int test_video_call_1(struct context *ctx)
a_call->sdp =
"m=audio 5008 RTP/AVP 8\n"
"m=video 5014 RTP/AVP 34 31\n";
m = memset(b_video, 0, sizeof b_video);
m = memset(b_video, 0, sizeof b_video);
m->m_size = sizeof *m;
m->m_session = b_sdp;
m->m_type = sdp_media_video, m->m_type_name = "video";
@@ -1265,7 +1265,7 @@ int test_video_call_1(struct context *ctx)
m->m_proto = sdp_proto_rtp; m->m_proto_name = "RTP/AVP";
m->m_rtpmaps = memset(rm = b_h261, 0, sizeof b_h261);
rm->rm_size = sizeof *rm;
rm->rm_pt = 31; rm->rm_encoding = "h261"; rm->rm_rate = 90000;
rm->rm_pt = 31; rm->rm_encoding = "h261"; rm->rm_rate = 90000;
b_sdp->sdp_media->m_next = m;
@@ -1336,7 +1336,7 @@ int test_video_call_1(struct context *ctx)
nua_handle_destroy(a_call->nh), a_call->nh = NULL;
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
test_proxy_set_session_timer(ctx->p, se, min_se);
test_proxy_set_session_timer(ctx->p, se, min_se);
if (print_headings)
printf("TEST NUA-3.6: PASSED\n");
@@ -1421,7 +1421,7 @@ int accept_call_with_contact(CONDITION_PARAMS)
switch (callstate(tags)) {
case nua_callstate_received:
RESPOND(ep, call, nh, SIP_180_RINGING,
RESPOND(ep, call, nh, SIP_180_RINGING,
TAG_IF(call->sdp, SOATAG_USER_SDP_STR(call->sdp)),
SIPTAG_CONTACT(contact_for_b),
TAG_END());
@@ -1475,11 +1475,11 @@ int test_basic_call_6(struct context *ctx)
mb->m_url->url_user = "b++b";
contact_for_b = mb;
sip_route_init(rb)->r_url[0] = b->contact->m_url[0];
rb->r_url->url_user = "bob+0";
url_param_add(nua_handle_home(a_call->nh), rb->r_url, "lr");
INVITE(a, a_call, a_call->nh,
NUTAG_URL("sip:bob@example.org"), /* Expanded by proxy */
SIPTAG_ROUTE_STR("B2 <sip:bob+2@example.org>;bar=foo"), /* Last in list */
@@ -1582,7 +1582,7 @@ int test_basic_call_6(struct context *ctx)
TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 200);
TEST_1(sip = sip_object(e->data->e_msg));
@@ -1773,7 +1773,7 @@ int test_basic_call_7(struct context *ctx)
free_events_in_list(ctx, b->events);
/* Make B to process HUMPPA at application level */
nua_set_hparams(b_call->nh, NUTAG_APPL_METHOD("HUMPPA"),
nua_set_hparams(b_call->nh, NUTAG_APPL_METHOD("HUMPPA"),
NUTAG_ALLOW("HUMPPA"),
TAG_END());
run_b_until(ctx, nua_r_set_params, until_final_response);
@@ -1898,7 +1898,7 @@ int test_basic_call_7(struct context *ctx)
/* Let A allow INFO */
nua_set_params(a->nua, NUTAG_ALLOW("INFO"), TAG_END());
/* Make B to process INFO at application level */
nua_set_hparams(b_call->nh, NUTAG_APPL_METHOD("INFO"),
nua_set_hparams(b_call->nh, NUTAG_APPL_METHOD("INFO"),
NUTAG_ALLOW("INFO"),
TAG_END());
run_ab_until(ctx, nua_r_set_params, NULL, nua_r_set_params, NULL);
@@ -1955,7 +1955,7 @@ int reject_method(CONDITION_PARAMS)
save_event_in_list(ctx, event, ep, call);
if (event == nua_i_method) {
RESPOND(ep, call, nh,
RESPOND(ep, call, nh,
SIP_604_DOES_NOT_EXIST_ANYWHERE,
NUTAG_WITH(current),
TAG_END());
@@ -1974,7 +1974,7 @@ int reject_info(CONDITION_PARAMS)
save_event_in_list(ctx, event, ep, call);
if (event == nua_i_info) {
RESPOND(ep, call, nh,
RESPOND(ep, call, nh,
SIP_480_TEMPORARILY_UNAVAILABLE,
NUTAG_WITH(current),
TAG_END());
+15 -15
View File
@@ -524,7 +524,7 @@ int test_call_hold(struct context *ctx)
TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
TEST_1(!e->next);
free_events_in_list(ctx, b->events);
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_ack);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
@@ -618,7 +618,7 @@ int test_call_hold(struct context *ctx)
TEST_1(!e->next);
#endif
free_events_in_list(ctx, b->events);
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_ack);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
@@ -632,7 +632,7 @@ int test_call_hold(struct context *ctx)
if (print_headings)
printf("TEST NUA-7.6.2: PASSED\n");
}
/* ---------------------------------------------------------------------- */
/*
@@ -742,7 +742,7 @@ int until_complete(CONDITION_PARAMS)
static size_t remove_first_ack(void *_once, void *message, size_t len)
{
int *once = _once;
if (*once)
return len;
@@ -792,8 +792,8 @@ int test_reinvite(struct context *ctx)
a_call->sdp = "m=audio 5008 RTP/AVP 0 8\n";
b_call->sdp = "m=audio 5010 RTP/AVP 8\n";
TEST_1(a_call->nh =
nua_handle(a->nua, a_call,
TEST_1(a_call->nh =
nua_handle(a->nua, a_call,
SIPTAG_FROM_STR("Alice <sip:alice@example.com>"),
SIPTAG_TO(b->to),
NUTAG_AUTOANSWER(0),
@@ -823,12 +823,12 @@ int test_reinvite(struct context *ctx)
*/
/* re-INVITE A, send BYE after receiving 180 */
INVITE(b, b_call, b_call->nh,
INVITE(b, b_call, b_call->nh,
SIPTAG_SUBJECT_STR("re-INVITE"),
TAG_END());
/* Run until both a and b has terminated their call */
run_ab_until(ctx, -1, ringing_until_terminated, -1, bye_when_ringing);
#if notyet
struct event *e;
@@ -849,8 +849,8 @@ int test_reinvite(struct context *ctx)
TEST(callstate(e->data->e_tags), nua_callstate_terminating); /* READY */
/* Now we can receive events, in any possible order */
/* XXX */
TEST_1(e = e->next);
TEST_1(e = e->next);
TEST_1(!nua_handle_has_active_call(a_call->nh));
/*
@@ -890,7 +890,7 @@ int test_reinvite(struct context *ctx)
}
/*
Accept INVITE
Accept INVITE
X
| |
|-------INVITE------>|
@@ -998,8 +998,8 @@ int test_reinvite2(struct context *ctx)
a_call->sdp = "m=audio 5008 RTP/AVP 0 8\n";
b_call->sdp = "m=audio 5010 RTP/AVP 8\n";
TEST_1(a_call->nh =
nua_handle(a->nua, a_call,
TEST_1(a_call->nh =
nua_handle(a->nua, a_call,
SIPTAG_FROM_STR("Alice <sip:alice@example.com>"),
SIPTAG_TO(b->to),
TAG_END()));
@@ -1098,7 +1098,7 @@ int accept_and_attempt_reinvite(CONDITION_PARAMS)
}
else switch (callstate(tags)) {
case nua_callstate_received:
RESPOND(ep, call, nh, SIP_180_RINGING,
RESPOND(ep, call, nh, SIP_180_RINGING,
SIPTAG_REQUIRE_STR("100rel"),
TAG_END());
return 0;
@@ -1166,7 +1166,7 @@ int test_reinvites(struct context *ctx)
printf("TEST NUA-7: Test call hold and re-INVITEs\n");
retval = test_call_hold(ctx);
if (retval == 0)
retval = test_reinvite(ctx);
+13 -13
View File
@@ -128,7 +128,7 @@ int test_reject_a(struct context *ctx)
TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
TEST(e->data->e_status, 100);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(sip->sip_contact); TEST_1(!sip->sip_contact->m_next);
TEST_1(sip->sip_contact); TEST_1(!sip->sip_contact->m_next);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
@@ -1042,7 +1042,7 @@ int test_reject_401_bad(struct context *ctx)
TEST(e->data->e_status, 904);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
@@ -1263,7 +1263,7 @@ size_t filter_ACK(void *arg, void *message, size_t len)
{
(void)arg;
if (len >= 7 && strncasecmp(message, "ACK sip", 7) == 0)
if (len >= 7 && strncasecmp(message, "ACK sip", 7) == 0)
return 0;
return len;
}
@@ -1297,7 +1297,7 @@ int test_call_timeouts(struct context *ctx)
TEST_1(f = test_nat_add_filter(ctx->nat, filter_200_OK, NULL, nat_inbound));
TEST_1(f2 = test_nat_add_filter(ctx->nat, filter_200_OK,
NULL, nat_outbound));
INVITE(a, a_call, a_call->nh,
TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
SIPTAG_SUBJECT_STR("NUA-4.7.1"),
@@ -1383,7 +1383,7 @@ int test_call_timeouts(struct context *ctx)
TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
TEST_1(f = test_nat_add_filter(ctx->nat, filter_ACK, NULL, nat_outbound));
INVITE(a, a_call, a_call->nh,
TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
SIPTAG_SUBJECT_STR("NUA-4.7.2"),
@@ -1421,14 +1421,14 @@ int test_call_timeouts(struct context *ctx)
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 180);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_bye);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated);
TEST(callstate(e->data->e_tags), nua_callstate_terminated);
TEST_1(!e->next);
/*
@@ -1503,7 +1503,7 @@ int test_call_timeouts(struct context *ctx)
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 180);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
@@ -1513,7 +1513,7 @@ int test_call_timeouts(struct context *ctx)
TEST(callstate(e->data->e_tags), nua_callstate_terminating);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_bye);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated);
TEST(callstate(e->data->e_tags), nua_callstate_terminated);
TEST_1(!e->next);
/*
@@ -1559,7 +1559,7 @@ int test_call_timeouts(struct context *ctx)
TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
TEST_1(f = test_nat_add_filter(ctx->nat, filter_ACK, NULL, nat_outbound));
INVITE(a, a_call, a_call->nh,
TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
SIPTAG_SUBJECT_STR("NUA-4.7.4"),
@@ -1599,14 +1599,14 @@ int test_call_timeouts(struct context *ctx)
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 180);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_bye);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated);
TEST(callstate(e->data->e_tags), nua_callstate_terminated);
TEST_1(!e->next);
/*
@@ -1626,7 +1626,7 @@ int test_call_timeouts(struct context *ctx)
TEST_1(is_answer_sent(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_error);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminating);
TEST(callstate(e->data->e_tags), nua_callstate_terminating);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_bye);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
+22 -22
View File
@@ -288,7 +288,7 @@ int test_call_cancel(struct context *ctx)
printf("TEST NUA-5.1.2: PASSED\n");
/* ----------------------------------------------------------------------- */
if (print_headings)
printf("TEST NUA-5.2.1: cancel call when ringing\n");
@@ -687,7 +687,7 @@ int test_call_destroy_3(struct context *ctx)
TEST_1(is_offer_recv(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
TEST_1(!e->next);
TEST_1(!e->next);
free_events_in_list(ctx, b->events);
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
@@ -757,7 +757,7 @@ int test_call_destroy_4(struct context *ctx)
TEST(e->data->e_status, 180);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding); /* PROCEEDING */
TEST_1(e = e->next);
TEST_1(e = e->next);
}
if (e->data->e_event == nua_r_invite) {
TEST_E(e->data->e_event, nua_r_invite);
@@ -765,7 +765,7 @@ int test_call_destroy_4(struct context *ctx)
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_completing); /* COMPLETING */
TEST_1(is_answer_recv(e->data->e_tags));
TEST_1(e = e->next);
TEST_1(e = e->next);
}
TEST_E(e->data->e_event, nua_i_bye);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
@@ -790,7 +790,7 @@ int test_call_destroy_4(struct context *ctx)
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_completed); /* COMPLETED */
TEST_1(is_answer_sent(e->data->e_tags));
TEST_1(!e->next);
TEST_1(!e->next);
free_events_in_list(ctx, b->events);
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
@@ -866,7 +866,7 @@ int test_call_destroy_5(struct context *ctx)
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_completed); /* COMPLETED */
TEST_1(is_answer_sent(e->data->e_tags));
TEST_1(!e->next);
TEST_1(!e->next);
free_events_in_list(ctx, b->events);
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
@@ -885,7 +885,7 @@ int test_call_destroy(struct context *ctx)
a_call->sdp = "m=audio 5008 RTP/AVP 8";
b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
return
return
test_call_destroy_1(ctx) ||
test_call_destroy_2(ctx) ||
test_call_destroy_3(ctx) ||
@@ -1108,12 +1108,12 @@ int test_bye_before_ack(struct context *ctx)
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 180);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_completing);
TEST(callstate(e->data->e_tags), nua_callstate_completing);
TEST_1(e = e->next);
TEST_E(e->data->e_event, nua_r_bye); TEST(e->data->e_status, 200);
@@ -1212,7 +1212,7 @@ int test_bye_after_receiving_401(struct context *ctx)
free_events_in_list(ctx, b->events);
/* re-INVITE A. */
INVITE(b, b_call, b_call->nh,
INVITE(b, b_call, b_call->nh,
SIPTAG_SUBJECT_STR("NUA-6.3 re-INVITE"),
TAG_END());
run_ab_until(ctx, -1, reject_reinvite_401, -1, save_until_final_response);
@@ -1224,7 +1224,7 @@ int test_bye_after_receiving_401(struct context *ctx)
free_events_in_list(ctx, b->events);
BYE(b, b_call, b_call->nh, TAG_END());
run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
free_events_in_list(ctx, a->events);
@@ -1287,7 +1287,7 @@ int test_bye_after_sending_401(struct context *ctx)
free_events_in_list(ctx, b->events);
/* re-INVITE A. */
INVITE(b, b_call, b_call->nh,
INVITE(b, b_call, b_call->nh,
SIPTAG_SUBJECT_STR("NUA-6.4.1 re-INVITE"),
TAG_END());
run_ab_until(ctx, -1, reject_reinvite_401, -1, save_until_final_response);
@@ -1299,7 +1299,7 @@ int test_bye_after_sending_401(struct context *ctx)
free_events_in_list(ctx, b->events);
BYE(a, a_call, a_call->nh, TAG_END());
run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
free_events_in_list(ctx, a->events);
@@ -1362,7 +1362,7 @@ int test_bye_after_receiving_401_to_update(struct context *ctx)
free_events_in_list(ctx, b->events);
/* UPDATE A. */
UPDATE(b, b_call, b_call->nh,
UPDATE(b, b_call, b_call->nh,
SIPTAG_SUBJECT_STR("NUA-6.4.2 UPDATE"),
TAG_END());
BYE(b, b_call, b_call->nh, TAG_END()); /* Queued until nua_authenticate */
@@ -1375,7 +1375,7 @@ int test_bye_after_receiving_401_to_update(struct context *ctx)
free_events_in_list(ctx, b->events);
AUTHENTICATE(b, b_call, b_call->nh, TAG_END());
run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
free_events_in_list(ctx, a->events);
@@ -1472,7 +1472,7 @@ int test_bye_with_407(struct context *ctx)
TEST_1(e = c->events->head); TEST_E(e->data->e_event, nua_i_invite);
free_events_in_list(ctx, c->events);
BYE(c, c_call, c_call->nh,
BYE(c, c_call, c_call->nh,
TAG_END());
run_c_until(ctx, -1, save_until_final_response);
@@ -1482,9 +1482,9 @@ int test_bye_with_407(struct context *ctx)
free_events_in_list(ctx, a->events);
free_events_in_list(ctx, c->events);
AUTHENTICATE(c, c_call, c_call->nh,
AUTHENTICATE(c, c_call, c_call->nh,
NUTAG_AUTH("Digest:\"test-proxy\":charlie:secret"), TAG_END());
run_abc_until(ctx, -1, until_terminated, -1, NULL, -1, until_terminated);
free_events_in_list(ctx, a->events);
@@ -1556,12 +1556,12 @@ int test_bye_to_invalid_contact(struct context *ctx)
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 180);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_ready);
TEST(callstate(e->data->e_tags), nua_callstate_ready);
TEST_1(!e->next);
/*
@@ -1588,7 +1588,7 @@ int test_bye_to_invalid_contact(struct context *ctx)
free_events_in_list(ctx, b->events);
BYE(b, b_call, b_call->nh, TAG_END());
run_b_until(ctx, -1, until_terminated);
/* B transitions:
@@ -1651,7 +1651,7 @@ int test_bye_to_invalid_contact(struct context *ctx)
int test_early_bye(struct context *ctx)
{
return
return
test_bye_with_407(ctx) ||
test_bye_before_200(ctx) ||
test_bye_before_ack(ctx) ||
+1 -1
View File
@@ -75,7 +75,7 @@ int test_extension(struct context *ctx)
sip_t const *sip;
/* Test for EXTENSION
/* Test for EXTENSION
A B
|------EXTENSION---->|
+5 -5
View File
@@ -23,7 +23,7 @@
*/
/**@CFILE test_init.c
* @brief Init nua test context
* @brief Init nua test context
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
* @author Martti Mela <Martti Mela@nokia.com>
@@ -114,7 +114,7 @@ int test_nua_init(struct context *ctx,
TAG_END());
if (ctx->p) {
ctx->a.domain =
ctx->a.domain =
test_proxy_add_domain(ctx->p,
URL_STRING_MAKE("sip:example.com")->us_url,
AUTHTAG_METHOD("Digest"),
@@ -126,7 +126,7 @@ int test_nua_init(struct context *ctx,
AUTHTAG_NEXT_EXPIRES(60),
TAG_END());
ctx->b.domain =
ctx->b.domain =
test_proxy_add_domain(ctx->p,
URL_STRING_MAKE("sip:example.org")->us_url,
AUTHTAG_METHOD("Digest"),
@@ -140,7 +140,7 @@ int test_nua_init(struct context *ctx,
test_proxy_domain_set_outbound(ctx->b.domain, 1);
ctx->c.domain =
ctx->c.domain =
test_proxy_add_domain(ctx->p,
URL_STRING_MAKE("sip:example.net")->us_url,
AUTHTAG_METHOD("Digest"),
@@ -379,7 +379,7 @@ int test_nua_init(struct context *ctx,
NUTAG_APPL_METHOD_REF(appl_method),
SIPTAG_SUPPORTED_REF(supported),
TAG_END());
TEST(err, 4); TEST_1(m);
TEST_1(ctx->c.contact = sip_contact_dup(ctx->home, m));
TEST_1(ctx->c.allow = sip_allow_dup(ctx->home, allow));
+13 -13
View File
@@ -128,7 +128,7 @@ struct binding
static struct binding *nat_binding_new(struct nat *nat,
char const *protoname,
int socktype, int protocol,
int socktype, int protocol,
int connected,
su_socket_t in_socket,
su_sockaddr_t *from,
@@ -178,7 +178,7 @@ test_nat_init(su_root_t *root, struct nat *nat)
nat->root = root;
nat->udp_socket = INVALID_SOCKET, nat->tcp_socket = INVALID_SOCKET;
tl_gets(nat->tags,
tl_gets(nat->tags,
TESTNATTAG_SYMMETRIC_REF(nat->symmetric),
TESTNATTAG_LOGGING_REF(nat->logging),
TAG_END());
@@ -427,7 +427,7 @@ int test_nat_flush(struct nat *nat)
if (nat == NULL)
return su_seterrno(EFAULT);
return su_task_execute(su_clone_task(nat->clone),
return su_task_execute(su_clone_task(nat->clone),
invalidate_bindings, nat, NULL);
}
@@ -485,10 +485,10 @@ static int binding_init(struct binding *b,
su_wakeup_f in_to_out, out_to_in;
if (b->socktype == SOCK_STREAM)
in_to_out = tcp_in_to_out, out_to_in = tcp_out_to_in;
in_to_out = tcp_in_to_out, out_to_in = tcp_out_to_in;
else
in_to_out = udp_in_to_out, out_to_in = udp_out_to_in;
in_to_out = udp_in_to_out, out_to_in = udp_out_to_in;
if (b->in_socket == INVALID_SOCKET) {
int in_socket;
@@ -549,7 +549,7 @@ static int binding_init(struct binding *b,
b->in_register = su_root_register(nat->root, wait, in_to_out, b, 0);
if (b->in_register < 0) {
su_perror("nat_binding_new: su_root_register");
su_wait_destroy(wait);
su_wait_destroy(wait);
return -1;
}
@@ -610,13 +610,13 @@ static int invalidate_bindings(void *arg)
#if 0
static struct binding *nat_binding_find(struct nat *nat,
su_sockaddr_t *from,
su_sockaddr_t *from,
int fromlen)
{
char name[64], ipname[64];
size_t namelen;
struct binding *b;
su_inet_ntop(from->su_family, SU_ADDR(from), ipname, sizeof ipname);
snprintf(name, sizeof name,
from->su_family == AF_INET6 ? "[%s]:%u" : "%s:%u",
@@ -629,7 +629,7 @@ static struct binding *nat_binding_find(struct nat *nat,
}
if (b == NULL)
b = nat_binding_new(nat, "UDP", SOCK_DGRAM, IPPROTO_UDP, nat->symmetric,
b = nat_binding_new(nat, "UDP", SOCK_DGRAM, IPPROTO_UDP, nat->symmetric,
INVALID_SOCKET, from, fromlen);
return b;
@@ -659,7 +659,7 @@ static int new_udp(struct nat *nat, su_wait_t *wait, struct binding *dummy)
return 0;
}
b = nat_binding_new(nat, "UDP", SOCK_DGRAM, IPPROTO_UDP, nat->symmetric,
b = nat_binding_new(nat, "UDP", SOCK_DGRAM, IPPROTO_UDP, nat->symmetric,
INVALID_SOCKET, from, fromlen);
if (b == NULL)
return 0;
@@ -667,7 +667,7 @@ static int new_udp(struct nat *nat, su_wait_t *wait, struct binding *dummy)
if (nat->symmetric)
m = su_send(b->out_socket, nat->buffer, n, 0);
else
m = su_sendto(b->out_socket, nat->buffer, n, 0,
m = su_sendto(b->out_socket, nat->buffer, n, 0,
nat->out_address, nat->out_addrlen);
if (nat->logging)
@@ -989,7 +989,7 @@ int test_nat_remove_filter(struct nat *nat,
a->nat = nat;
a->f = filter;
if (su_task_execute(su_clone_task(nat->clone),
execute_nat_filter_remove, a, NULL) < 0)
return -1;
+1 -1
View File
@@ -33,7 +33,7 @@ SOFIA_BEGIN_DECLS
struct nat;
struct nat_filter;
struct nat *test_nat_create(su_root_t *, int family,
struct nat *test_nat_create(su_root_t *, int family,
tag_type_t, tag_value_t, ...);
void test_nat_destroy(struct nat *);
+3 -3
View File
@@ -74,7 +74,7 @@ static RETSIGTYPE sig_alarm(int s)
static char const options_usage[] =
" -v | --verbose be verbose\n"
" -q | --quiet be quiet\n"
" -a | --abort abort on error\n"
" -a | --abort abort on error\n"
" -s use only single thread\n"
" -l level set logging level (0 by default)\n"
" -e | --events print nua events\n"
@@ -122,7 +122,7 @@ int main(int argc, char *argv[])
#if HAVE_OPEN_C
dup2(1, 2);
#endif
if (getenv("EXPENSIVE_CHECKS"))
o_expensive = 1;
@@ -331,7 +331,7 @@ int main(int argc, char *argv[])
ctx->a.printer = o_events_init ? print_event : NULL;
retval |= test_nua_api_errors(ctx); SINGLE_FAILURE_CHECK();
retval |= test_tag_filter(); SINGLE_FAILURE_CHECK();
retval |= test_nua_params(ctx); SINGLE_FAILURE_CHECK();
+2 -2
View File
@@ -111,7 +111,7 @@ struct eventlist
struct event *head, **tail;
};
struct event
struct event
{
struct event *next, **prev;
struct call *call;
@@ -267,7 +267,7 @@ int run_a_until(struct context *, nua_event_t, condition_function *);
int run_b_until(struct context *, nua_event_t, condition_function *);
int run_c_until(struct context *, nua_event_t, condition_function *);
typedef int operation_f(struct endpoint *ep, struct call *call,
typedef int operation_f(struct endpoint *ep, struct call *call,
nua_handle_t *nh, tag_type_t tag, tag_value_t value,
...);
+7 -7
View File
@@ -160,7 +160,7 @@ void destroy_callback(nua_event_t event,
int test_nua_destroy(struct context *ctx)
{
BEGIN();
struct endpoint *a = &ctx->a;
TEST_1(ctx->root = su_root_create(NULL));
@@ -307,7 +307,7 @@ int test_unregister_without_register(struct context *ctx)
if (print_headings)
printf("TEST NUA-1.2.4: PASSED\n");
END();
}
@@ -384,7 +384,7 @@ int test_register_503(struct context *ctx)
A
|------REGISTER--\
|<-------503-----/
|
|
*/
@@ -393,7 +393,7 @@ int test_register_503(struct context *ctx)
TEST_1(a_reg->nh = nua_handle(a->nua, a_reg, TAG_END()));
REGISTER(a, a_reg, a_reg->nh,
REGISTER(a, a_reg, a_reg->nh,
NUTAG_REGISTRAR(URL_STRING_MAKE("sip:bad.domain")),
SIPTAG_TO_STR("sip:lissu@bad.domain"),
TAG_END());
@@ -407,7 +407,7 @@ int test_register_503(struct context *ctx)
TEST_1(a_reg->nh = nua_handle(a->nua, a_reg, TAG_END()));
REGISTER(a, a_reg, a_reg->nh,
REGISTER(a, a_reg, a_reg->nh,
NUTAG_REGISTRAR(URL_STRING_MAKE("sip:bad.domain")),
SIPTAG_TO_STR("sip:lissu@bad.domain"),
TAG_END());
@@ -447,13 +447,13 @@ int test_stack_errors(struct context *ctx)
nua_shutdown(a->nua);
run_a_until(ctx, -1, until_final_response);
TEST_VOID(nua_destroy(a->nua));
a->nua = NULL;
su_root_destroy(ctx->root), ctx->root = NULL;
if (print_headings)
printf("TEST NUA-1.2: PASSED\n");
+4 -4
View File
@@ -155,7 +155,7 @@ int test_nua_params(struct context *ctx)
SIPTAG_USER_AGENT_STR("test_nua/1.0"),
SIPTAG_ORGANIZATION_STR("Open Laboratory"),
NUTAG_M_DISPLAY("XXX"),
NUTAG_M_USERNAME("xxx"),
NUTAG_M_PARAMS("user=ip"),
@@ -310,7 +310,7 @@ int test_nua_params(struct context *ctx)
char const *m_params = "NONE";
char const *m_features = "NONE";
char const *instance = "NONE";
url_string_t const *registrar = NONE;
unsigned keepalive = (unsigned)-1, keepalive_stream = (unsigned)-1;
@@ -424,10 +424,10 @@ int test_nua_params(struct context *ctx)
TEST_S(sip_header_as_string(tmphome, (void *)allow), "OPTIONS, INFO, ACK");
TEST_S(allow_str, "OPTIONS, INFO, ACK");
TEST_S(appl_method, "INVITE, REGISTER, PUBLISH, SUBSCRIBE, NOTIFY");
TEST_S(sip_header_as_string(tmphome, (void *)allow_events),
TEST_S(sip_header_as_string(tmphome, (void *)allow_events),
"reg, presence, presence.winfo");
TEST_S(allow_events_str, "reg, presence, presence.winfo");
TEST_S(sip_header_as_string(tmphome, (void *)supported),
TEST_S(sip_header_as_string(tmphome, (void *)supported),
"foo, bar, baz");
TEST_S(supported_str, "foo, bar, baz");
TEST_S(sip_header_as_string(tmphome, (void *)user_agent), "test_nua");
+10 -10
View File
@@ -66,7 +66,7 @@
<--nua_i_state---| |
Client transitions:
INIT -(C1)-> CALLING -(C2a)-> PROCEEDING -(C3+C4)->
INIT -(C1)-> CALLING -(C2a)-> PROCEEDING -(C3+C4)->
TERMINATING -> TERMINATED
Server transitions:
INIT -(S1)-> RECEIVED -(S2a)-> EARLY -(S3b)-> COMPLETED -(S4)-> READY
@@ -113,8 +113,8 @@ int test_no_answer_1(struct context *ctx)
/* Client transitions:
INIT -(C1)-> CALLING: nua_invite(), nua_i_state
CALLING -(C3)-> PROCEEDING: nua_r_invite, nua_i_state
PROCEEDING -(C3a+C5)-> TERMINATING: nua_r_invite, nua_i_state
CALLING -(C3)-> PROCEEDING: nua_r_invite, nua_i_state
PROCEEDING -(C3a+C5)-> TERMINATING: nua_r_invite, nua_i_state
TERMINATING -(C12)-> TERMINATED: nua_r_bye, nua_i_state
*/
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_state);
@@ -198,7 +198,7 @@ int no_media_terminated(CONDITION_PARAMS)
switch (callstate(tags)) {
case nua_callstate_received:
RESPOND(ep, call, nh, SIP_180_RINGING,
RESPOND(ep, call, nh, SIP_180_RINGING,
NUTAG_MEDIA_ENABLE(0),
TAG_END());
return 0;
@@ -238,7 +238,7 @@ int test_no_answer_2(struct context *ctx)
"t=0 0\r\n"
"m=audio 5008 RTP/AVP 8\r\n";
b_call->sdp =
b_call->sdp =
"v=0\r\n"
"o=- 2 1 IN IP4 127.0.0.1\r\n"
"s=-\r\n"
@@ -246,7 +246,7 @@ int test_no_answer_2(struct context *ctx)
"t=0 0\r\n"
"m=audio 5010 RTP/AVP 0 8\r\n";
TEST_1(a_call->nh = nua_handle(a->nua, a_call,
TEST_1(a_call->nh = nua_handle(a->nua, a_call,
SIPTAG_TO_STR("<sip:b@x.org>"),
TAG_END()));
@@ -279,7 +279,7 @@ int test_no_answer_2(struct context *ctx)
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(e->data->e_status, 200);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(sip->sip_content_type);
TEST_1(sip->sip_content_type);
TEST_S(sip->sip_content_type->c_type, "application/sdp");
TEST_1(sip->sip_payload); /* there is sdp in 200 OK */
TEST_1(sip->sip_contact);
@@ -344,7 +344,7 @@ int accept_call_until_terminated(CONDITION_PARAMS)
switch (callstate(tags)) {
case nua_callstate_received:
RESPOND(ep, call, nh, SIP_180_RINGING,
RESPOND(ep, call, nh, SIP_180_RINGING,
TAG_END());
return 0;
case nua_callstate_early:
@@ -387,7 +387,7 @@ int test_missing_user_sdp(struct context *ctx)
nua_set_params(b->nua, NUTAG_MEDIA_ENABLE(0), TAG_END());
run_b_until(ctx, nua_r_set_params, until_final_response);
TEST_1(a_call->nh = nua_handle(a->nua, a_call,
TEST_1(a_call->nh = nua_handle(a->nua, a_call,
SIPTAG_TO_STR("<sip:b@x.org>"),
TAG_END()));
@@ -456,7 +456,7 @@ int test_missing_user_sdp(struct context *ctx)
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
nua_set_params(b->nua,
NUTAG_MEDIA_ENABLE(1),
NUTAG_MEDIA_ENABLE(1),
SOATAG_USER_SDP_STR("m=audio 5006 RTP/AVP 8 0"),
TAG_END());
run_b_until(ctx, nua_r_set_params, until_final_response);
+5 -5
View File
@@ -48,7 +48,7 @@ int save_events(CONDITION_PARAMS)
}
int until_final_response(CONDITION_PARAMS)
{
{
return status >= 200;
}
@@ -115,7 +115,7 @@ int is_offer_answer_done(tagi_t const *tags)
{
tagi_t const *ti;
return
return
((ti = tl_find(tags, nutag_answer_recv)) && ti->t_value) ||
((ti = tl_find(tags, nutag_offer_sent)) && ti->t_value) ||
((ti = tl_find(tags, nutag_offer_recv)) && ti->t_value) ||
@@ -182,7 +182,7 @@ void print_event(nua_event_t event,
ep->name, (void *)nh, nua_event_name(event), phrase,
nua_substate_name(t ? t->t_value : 0));
}
else if ((int)event >= nua_i_bye ||
else if ((int)event >= nua_i_bye ||
event == nua_i_invite || event == nua_i_cancel ||
event == nua_i_ack) {
fprintf(stderr, "%s %s.nua(%p): event %s %03d %s\n", timestamp,
@@ -208,7 +208,7 @@ void print_event(nua_event_t event,
ep->name, (void *)nh, operation);
}
if (tags &&
if (tags &&
((tstflags & tst_verbatim) || ctx->print_tags || ep->print_tags))
tl_print(stderr, "", tags);
}
@@ -516,7 +516,7 @@ void free_event_in_list(struct context *ctx,
if (list->head == NULL)
list->tail = &list->head;
}
}
}
struct event *event_by_type(struct event *e, nua_event_t etype)
{
+57 -57
View File
@@ -98,7 +98,7 @@ struct proxy {
tagi_t *tags;
su_root_t *root;
nta_agent_t *agent;
url_t const *uri;
sip_route_t *lr;
@@ -119,7 +119,7 @@ struct proxy {
unsigned t1x64;
sip_time_t session_expires, min_se;
} prefs;
};
};
struct domain {
su_home_t home[1];
@@ -139,7 +139,7 @@ struct domain {
int outbound_tcp; /**< Use inbound TCP connection as outbound */
char const *authorize; /**< Authorization realm to use */
int record_route;
} prefs;
} prefs;
tagi_t *tags;
};
@@ -175,18 +175,18 @@ struct binding
tport_t *tport; /**< Reference to tport */
};
static struct binding *binding_new(su_home_t *home,
static struct binding *binding_new(su_home_t *home,
sip_contact_t *contact,
tport_t *tport,
sip_call_id_t const *call_id,
uint32_t cseq,
sip_time_t registered,
sip_time_t registered,
sip_time_t expires);
static void binding_destroy(su_home_t *home, struct binding *b);
static int binding_is_active(struct binding const *b)
{
return
b->expires > sip_now() &&
b->expires > sip_now() &&
(b->tport == NULL || tport_is_clear_to_send(b->tport));
}
@@ -270,21 +270,21 @@ static auth_challenger_t registrar_challenger[1];
static auth_challenger_t proxy_challenger[1];
/* Proxy entry point */
static int
static int
test_proxy_init(su_root_t *root, struct proxy *proxy)
{
struct proxy_tr *t;
struct client_tr *c;
auth_challenger_t _proxy_challenger[1] =
{{
auth_challenger_t _proxy_challenger[1] =
{{
SIP_407_PROXY_AUTH_REQUIRED,
sip_proxy_authenticate_class,
sip_proxy_authentication_info_class
}};
auth_challenger_t _registrar_challenger[1] =
{{
auth_challenger_t _registrar_challenger[1] =
{{
SIP_401_UNAUTHORIZED,
sip_www_authenticate_class,
sip_authentication_info_class
@@ -323,14 +323,14 @@ test_proxy_init(su_root_t *root, struct proxy *proxy)
NTATAG_SIP_T1X64_REF(proxy->prefs.t1x64),
TAG_END());
if (!proxy->defleg)
if (!proxy->defleg)
return -1;
/* if (!proxy->example_net || !proxy->example_org || !proxy->example_com)
return -1; */
/* Create stateless client */
t = su_zalloc(proxy->home, sizeof *t);
c = su_zalloc(proxy->home, sizeof *c);
c = su_zalloc(proxy->home, sizeof *c);
if (!t || !c)
return -1;
@@ -350,7 +350,7 @@ test_proxy_init(su_root_t *root, struct proxy *proxy)
if (!proxy->lr)
return -1;
return 0;
}
@@ -391,7 +391,7 @@ struct proxy *test_proxy_create(su_root_t *root,
ta_start(ta, tag, value);
p->tags = tl_llist(ta_tags(ta));
ta_end(ta);
if (su_clone_start(root,
p->clone,
p,
@@ -435,7 +435,7 @@ struct _set_logging {
struct proxy *p;
int logging;
};
static int _set_logging(void *_a)
{
struct _set_logging *a = _a;
@@ -451,8 +451,8 @@ void test_proxy_set_logging(struct proxy *p, int logging)
}
void test_proxy_domain_set_expiration(struct domain *d,
sip_time_t min_expires,
sip_time_t expires,
sip_time_t min_expires,
sip_time_t expires,
sip_time_t max_expires)
{
if (d) {
@@ -475,7 +475,7 @@ void test_proxy_domain_get_expiration(struct domain *d,
}
void test_proxy_set_session_timer(struct proxy *p,
sip_time_t session_expires,
sip_time_t session_expires,
sip_time_t min_se)
{
if (p) {
@@ -529,7 +529,7 @@ void test_proxy_domain_get_record_route(struct domain *d,
}
}
int test_proxy_domain_set_authorize(struct domain *d,
int test_proxy_domain_set_authorize(struct domain *d,
char const *realm)
{
if (d) {
@@ -604,14 +604,14 @@ struct domain *test_proxy_add_domain(struct proxy *p,
d->prefs.outbound_tcp = 0;
d->prefs.authorize = NULL;
if (d->uri && d->tags &&
if (d->uri && d->tags &&
!su_task_execute(su_clone_task(p->clone), _domain_init, d, &init)) {
if (init == 0)
/* OK */;
else
d = NULL;
}
else
else
su_home_unref(d->home);
}
@@ -687,7 +687,7 @@ static sip_contact_t *create_transport_contacts(struct proxy *p)
for (v = nta_agent_via(p->agent); v; v = v->v_next) {
char const *proto = v->v_protocol;
if (v->v_next &&
if (v->v_next &&
strcasecmp(v->v_host, v->v_next->v_host) == 0 &&
str0cmp(v->v_port, v->v_next->v_port) == 0 &&
((proto == sip_transport_udp &&
@@ -753,14 +753,14 @@ static int domain_request(union proxy_or_domain *pod,
{
int (*process)(struct proxy_tr *) = NULL;
sip_method_t method = sip->sip_request->rq_method;
assert(pod->domain->magic = domain_init);
if (leg == pod->domain->uleg)
process = proxy_transaction;
else if (method == sip_method_register)
process = process_register;
else if (method == sip_method_options)
else if (method == sip_method_options)
process = process_options;
if (process == NULL)
@@ -839,15 +839,15 @@ static int respond_transaction(struct proxy_tr *t,
if (t->as)
info = t->as->as_info, response = t->as->as_response;
if (nta_incoming_treply(t->server, t->status = status, phrase,
if (nta_incoming_treply(t->server, t->status = status, phrase,
SIPTAG_HEADER(info),
SIPTAG_HEADER(response),
ta_tags(ta)) < 0)
t->status = status = 500;
ta_end(ta);
return status;
}
@@ -892,8 +892,8 @@ static int validate_transaction(struct proxy_tr *t)
}
/* Remove our routes */
while (t->sip->sip_route &&
url_has_param(t->sip->sip_route->r_url, "lr") &&
while (t->sip->sip_route &&
url_has_param(t->sip->sip_route->r_url, "lr") &&
(url_cmp(t->proxy->lr->r_url, t->sip->sip_route->r_url) == 0 ||
url_cmp(t->proxy->rr_uri, t->sip->sip_route->r_url) == 0)) {
sip_route_remove(t->msg, t->sip);
@@ -902,7 +902,7 @@ static int validate_transaction(struct proxy_tr *t)
if (t->use_auth)
return challenge_transaction(t);
return 0;
}
@@ -915,7 +915,7 @@ static int session_timers(struct proxy_tr *t)
if (t->method == sip_method_invite) {
if (t->proxy->prefs.min_se) {
if (!sip->sip_min_se ||
if (!sip->sip_min_se ||
sip->sip_min_se->min_delta < t->proxy->prefs.min_se) {
min_se = sip_min_se_init(min_se0);
min_se->min_delta = t->proxy->prefs.min_se;
@@ -959,7 +959,7 @@ static int incoming_transaction(struct proxy_tr *t)
struct binding *b;
#if 0
if (sip->sip_request->rq_method == sip_method_register)
if (sip->sip_request->rq_method == sip_method_register)
return process_register(proxy, irq, sip);
#endif
@@ -968,7 +968,7 @@ static int incoming_transaction(struct proxy_tr *t)
return respond_transaction(t, SIP_404_NOT_FOUND, TAG_END());
for (b = e->bindings; b; b = b->next) {
if (binding_is_active(b))
if (binding_is_active(b))
target_transaction(t, b->contact->m_url, b->tport);
if (t->clients) /* XXX - enable forking */
@@ -1073,7 +1073,7 @@ static int challenge_transaction(struct proxy_tr *t)
msg_header_remove(t->msg, (msg_pub_t *)sip, as->as_match);
return 0;
}
}
int proxy_ack_cancel(struct proxy_tr *t,
nta_incoming_t *irq,
@@ -1083,7 +1083,7 @@ int proxy_ack_cancel(struct proxy_tr *t,
int status;
if (sip == NULL) { /* timeout */
proxy_tr_destroy(t);
proxy_tr_destroy(t);
return 0;
}
@@ -1096,7 +1096,7 @@ int proxy_ack_cancel(struct proxy_tr *t,
if (c->client && c->status < 200)
/*
* We don't care about response to CANCEL (or ACK)
* so we give NULL as callback pointer (and nta immediately
* so we give NULL as callback pointer (and nta immediately
* destroys transaction object or marks it disposable)
*/
if (nta_outgoing_tcancel(c->client, NULL, NULL, TAG_END()) == NULL)
@@ -1117,7 +1117,7 @@ int proxy_response(struct client_tr *c,
if (sip) {
msg_t *response = nta_outgoing_getresponse(client);
if (c->t->method == sip_method_invite)
final = sip->sip_status->st_status >= 300,
final = sip->sip_status->st_status >= 300,
timeout = sip->sip_status->st_status >= 200;
else
final = sip->sip_status->st_status >= 200;
@@ -1150,7 +1150,7 @@ int proxy_late_response(struct client_tr *c,
assert(c->t);
if (sip &&
sip->sip_status->st_status >= 200 &&
sip->sip_status->st_status >= 200 &&
sip->sip_status->st_status < 300) {
msg_t *response = nta_outgoing_getresponse(client);
sip_via_remove(response, sip_object(response));
@@ -1168,7 +1168,7 @@ static void proxy_tr_remove_late(su_root_magic_t *magic,
}
/** Proxy only late responses
/** Proxy only late responses
*
* Keeping the invite transactions live
*/
@@ -1219,7 +1219,7 @@ void proxy_tr_destroy(struct proxy_tr *t)
if (t->as)
su_home_unref(t->as->as_home), t->as = NULL;
while (t->clients) {
client_tr_remove(c = t->clients);
nta_outgoing_destroy(c->client), c->client = NULL;
@@ -1275,7 +1275,7 @@ int process_register(struct proxy_tr *t)
if (check_out_of_order(t))
return t->status;
return update_bindings(t);
}
@@ -1286,7 +1286,7 @@ static int check_received_contact(struct proxy_tr *t)
sip_via_t *v = sip->sip_via;
if (m && v && v->v_received && m->m_url->url_host
&& strcasecmp(v->v_received, m->m_url->url_host)
&& strcasecmp(v->v_received, m->m_url->url_host)
&& host_is_ip_address(m->m_url->url_host))
return respond_transaction(t, 406, "Unacceptable Contact", TAG_END());
@@ -1309,7 +1309,7 @@ static int validate_contacts(struct proxy_tr *t)
for (; m; m = m->m_next) {
expires = sip_contact_expires(m, ex, date, t->domain->prefs.expires, t->now);
if (expires > 0 && expires < t->domain->prefs.min_expires) {
sip_min_expires_t me[1];
@@ -1375,8 +1375,8 @@ registration_entry_new(struct domain *d, url_t const *aor)
if (d == NULL)
return NULL;
e = su_zalloc(d->home, sizeof *e);
if (!e)
e = su_zalloc(d->home, sizeof *e);
if (!e)
return NULL;
e->domain = d;
@@ -1415,16 +1415,16 @@ LIST_BODIES(static, registration_entry, struct registration_entry, next, prev);
/* Bindings */
static
struct binding *binding_new(su_home_t *home,
struct binding *binding_new(su_home_t *home,
sip_contact_t *contact,
tport_t *tport,
sip_call_id_t const *call_id,
uint32_t cseq,
sip_time_t registered,
sip_time_t registered,
sip_time_t expires)
{
struct binding *b;
b = su_zalloc(home, sizeof *b);
if (b) {
@@ -1444,7 +1444,7 @@ struct binding *binding_new(su_home_t *home,
if (b)
msg_header_remove_param(b->contact->m_common, "expires");
}
return b;
}
@@ -1472,7 +1472,7 @@ static int update_bindings(struct proxy_tr *t)
sip_date_t *date = t->sip->sip_date;
sip_time_t expires;
tport_t *tport = NULL;
sip_contact_t *contacts = NULL, **mm = &contacts;
sip_contact_t *contacts = NULL, **mm = &contacts;
void *tbf;
if (t->sip->sip_contact == NULL) {
@@ -1486,7 +1486,7 @@ static int update_bindings(struct proxy_tr *t)
if (t->entry == NULL)
return respond_transaction(t, SIP_500_INTERNAL_SERVER_ERROR, TAG_END());
if (d->prefs.outbound_tcp &&
if (d->prefs.outbound_tcp &&
str0casecmp(t->sip->sip_via->v_protocol, sip_transport_tcp) == 0)
tport = nta_incoming_transport(t->proxy->agent, t->server, NULL);
@@ -1494,7 +1494,7 @@ static int update_bindings(struct proxy_tr *t)
for (m = t->sip->sip_contact; m; m = m->m_next) {
if (m->m_url->url_type == url_any)
break;
expires = sip_contact_expires(m, ex, date, d->prefs.expires, t->now);
if (expires > d->prefs.max_expires)
@@ -1519,7 +1519,7 @@ static int update_bindings(struct proxy_tr *t)
next = old->next;
for (b = bindings; b != last; b = b->next) {
if (url_cmp_all(old->contact->m_url, b->contact->m_url) != 0)
if (url_cmp_all(old->contact->m_url, b->contact->m_url) != 0)
continue;
if (strcmp(old->call_id->i_id, b->call_id->i_id) == 0) {
@@ -1561,7 +1561,7 @@ static int update_bindings(struct proxy_tr *t)
*mm = sip_contact_copy(d->home, b->contact);
if (*mm) {
expires = su_sprintf(d->home, "expires=%u",
expires = su_sprintf(d->home, "expires=%u",
(unsigned)(b->expires - t->now));
msg_header_add_param(d->home, (*mm)->m_common, expires);
mm = &(*mm)->m_next;
@@ -1586,7 +1586,7 @@ static int close_tports(void *_proxy)
struct domain *d;
struct registration_entry *e;
struct binding *b;
/* Close all outbound transports */
for (d = p->domains; d; d = d->next) {
for (e = d->entries; e; e = e->next) {
@@ -1599,6 +1599,6 @@ static int close_tports(void *_proxy)
}
}
}
return 0;
}
+5 -5
View File
@@ -49,17 +49,17 @@ struct domain *test_proxy_add_domain(struct proxy *,
void test_proxy_set_logging(struct proxy *, int logging);
void test_proxy_domain_set_expiration(struct domain *,
sip_time_t min_expires,
sip_time_t expires,
sip_time_t min_expires,
sip_time_t expires,
sip_time_t max_expires);
void test_proxy_domain_get_expiration(struct domain *,
sip_time_t *return_min_expires,
sip_time_t *return_expires,
sip_time_t *return_min_expires,
sip_time_t *return_expires,
sip_time_t *return_max_expires);
void test_proxy_set_session_timer(struct proxy *p,
sip_time_t session_expires,
sip_time_t session_expires,
sip_time_t min_se);
void test_proxy_get_session_timer(struct proxy *p,
+7 -7
View File
@@ -239,7 +239,7 @@ int test_refer0(struct context *ctx, char const *tests,
printf("TEST %s.2: B refers A to C\n", tests);
if (b_refer != b_call)
TEST_1(b_refer->nh =
TEST_1(b_refer->nh =
nua_handle(b->nua, b_refer, SIPTAG_TO(a->to), TAG_END()));
*sip_refer_to_init(r0)->r_url = *c->contact->m_url;
@@ -356,7 +356,7 @@ int test_refer0(struct context *ctx, char const *tests,
Events in A:
nua_i_subscribe, nua_r_notify
*/
TEST_1(e = a->events->head);
TEST_1(e = a->events->head);
if (e->data->e_event == nua_r_notify)
TEST_1(e = e->next);
TEST_E(e->data->e_event, nua_i_subscribe);
@@ -371,7 +371,7 @@ int test_refer0(struct context *ctx, char const *tests,
Events in B after nua_subscribe():
nua_r_subscribe, nua_i_notify
*/
TEST_1(e = b->events->head);
TEST_1(e = b->events->head);
if (e->data->e_event == nua_i_notify) {
TEST(e->data->e_status, 200);
TEST_1(sip = sip_object(e->data->e_msg));
@@ -575,7 +575,7 @@ int test_refer0(struct context *ctx, char const *tests,
TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
/* Transitions of B:
READY -(T1)-> TERMINATED: nua_i_bye, nua_i_state
*/
@@ -685,7 +685,7 @@ int notify_until_terminated(CONDITION_PARAMS)
assert(nua_handle_has_events(r_call->nh));
pl = sip_payload_format(NULL, "SIP/2.0 %u %s\r\n",
pl = sip_payload_format(NULL, "SIP/2.0 %u %s\r\n",
st->st_status, st->st_phrase);
NOTIFY(ep, r_call, r_call->nh,
@@ -761,7 +761,7 @@ int test_challenge_refer(struct context *ctx)
TEST_1(sip->sip_refer_to);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_notify);
TEST(e->data->e_status, 200);
TEST_1(!e->next);
TEST_1(!e->next);
/*
Events in C after nua_refer():
nua_r_refer
@@ -780,7 +780,7 @@ int test_challenge_refer(struct context *ctx)
TEST(e->data->e_status, 480);
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
free_events_in_list(ctx, c->events);
+13 -13
View File
@@ -75,10 +75,10 @@ int test_clear_registrations(struct context *ctx)
printf("TEST NUA-2.3.0.1: un-REGISTER a\n");
TEST_1(a_reg->nh = nua_handle(a->nua, a_reg, TAG_END()));
UNREGISTER(a, a_reg, a_reg->nh, SIPTAG_TO(a->to),
UNREGISTER(a, a_reg, a_reg->nh, SIPTAG_TO(a->to),
SIPTAG_CONTACT_STR("*"),
TAG_END());
run_a_until(ctx, -1, until_final_response);
run_a_until(ctx, -1, until_final_response);
AUTHENTICATE(a, a_reg, a_reg->nh,
NUTAG_AUTH("Digest:\"test-proxy\":alice:secret"), TAG_END());
run_a_until(ctx, -1, until_final_response);
@@ -91,10 +91,10 @@ int test_clear_registrations(struct context *ctx)
printf("TEST NUA-2.3.0.2: un-REGISTER b\n");
TEST_1(b_reg->nh = nua_handle(b->nua, b_reg, TAG_END()));
UNREGISTER(b, b_reg, b_reg->nh, SIPTAG_TO(b->to),
UNREGISTER(b, b_reg, b_reg->nh, SIPTAG_TO(b->to),
SIPTAG_CONTACT_STR("*"),
TAG_END());
run_b_until(ctx, -1, until_final_response);
run_b_until(ctx, -1, until_final_response);
AUTHENTICATE(b, b_reg, b_reg->nh,
NUTAG_AUTH("Digest:\"test-proxy\":bob:secret"), TAG_END());
run_b_until(ctx, -1, until_final_response);
@@ -111,7 +111,7 @@ int test_clear_registrations(struct context *ctx)
SIPTAG_FROM(c->to), SIPTAG_TO(c->to),
SIPTAG_CONTACT_STR("*"),
TAG_END());
run_c_until(ctx, -1, until_final_response);
run_c_until(ctx, -1, until_final_response);
AUTHENTICATE(c, c_reg, c_reg->nh,
NUTAG_AUTH("Digest:\"test-proxy\":charlie:secret"), TAG_END());
run_c_until(ctx, -1, until_final_response);
@@ -227,7 +227,7 @@ int test_outbound_cases(struct context *ctx)
}
run_a_until(ctx, -1, a->next_condition);
for (e = a->events->head; e; e = e->next) {
TEST_E(e->data->e_event, nua_r_register);
TEST(e->data->e_status, 200);
@@ -375,7 +375,7 @@ int test_register_b(struct context *ctx)
if (ctx->p)
m->m_url->url_params = "transport=tcp";
REGISTER(b, b_reg, b_reg->nh, SIPTAG_TO(b->to),
REGISTER(b, b_reg, b_reg->nh, SIPTAG_TO(b->to),
SIPTAG_CONTACT(m),
/* Do not include credentials unless challenged */
NUTAG_AUTH_CACHE(nua_auth_cache_challenged),
@@ -440,7 +440,7 @@ int test_register_c(struct context *ctx)
NUTAG_CALLEE_CAPS(1),
SIPTAG_EXPIRES_STR("5"), /* Test 423 negotiation */
TAG_END());
run_abc_until(ctx, -1, save_events, -1, save_events,
run_abc_until(ctx, -1, save_events, -1, save_events,
-1, save_until_final_response);
TEST_1(e = c->events->head);
@@ -454,7 +454,7 @@ int test_register_c(struct context *ctx)
AUTHENTICATE(c, c_reg, c_reg->nh,
NUTAG_AUTH("Digest:\"test-proxy-0\":charlie:secret"), TAG_END());
run_abc_until(ctx, -1, save_events, -1, save_events,
run_abc_until(ctx, -1, save_events, -1, save_events,
-1, save_until_final_response);
TEST_1(e = c->events->head);
@@ -527,7 +527,7 @@ int test_register_refresh(struct context *ctx)
}
run_ab_until(ctx, -1, a->next_condition, -1, b->next_condition);
for (e = a->events->head; e; e = e->next) {
TEST_E(e->data->e_event, nua_r_register);
TEST(e->data->e_status, 200);
@@ -628,7 +628,7 @@ int test_register_to_c(struct context *ctx)
TEST_1(b_call->nh = nua_handle(b->nua, b_call, TAG_END()));
REGISTER(b, b_call, b_call->nh,
REGISTER(b, b_call, b_call->nh,
NUTAG_REGISTRAR((url_string_t *)c->contact->m_url),
SIPTAG_TO(b->to),
NUTAG_OUTBOUND(NULL),
@@ -778,7 +778,7 @@ int test_connectivity(struct context *ctx)
free_events_in_list(ctx, c->events);
/* Sneakily change the realm */
/* Sneakily change the realm */
TEST(test_proxy_domain_set_authorize(ctx->c.domain, "test-proxy"), 0);
@@ -871,7 +871,7 @@ int test_nat_timeout(struct context *ctx)
if (print_headings)
printf("TEST NUA-2.5.1: PASSED\n");
if (print_headings)
printf("TEST NUA-2.5.2: OPTIONS from B to A\n");
+2 -2
View File
@@ -82,7 +82,7 @@ int test_session_timer(struct context *ctx)
/* We negotiate session timer of 6 second */
/* Disable session timer from proxy */
test_proxy_set_session_timer(ctx->p, 0, 0);
test_proxy_set_session_timer(ctx->p, 0, 0);
nua_set_params(ctx->b.nua,
NUTAG_SESSION_REFRESHER(nua_any_refresher),
@@ -199,7 +199,7 @@ int test_session_timer(struct context *ctx)
TEST_1(f);
run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_r_bye);
free_events_in_list(ctx, a->events);
+22 -22
View File
@@ -148,7 +148,7 @@ int test_message(struct context *ctx)
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_r_message);
TEST(e->data->e_status, 202);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(sip_user_agent(sip));
TEST_1(sip_user_agent(sip));
TEST_S(sip_user_agent(sip)->g_value, "007");
TEST_1(!e->next);
@@ -229,7 +229,7 @@ int test_message(struct context *ctx)
int accept_request(CONDITION_PARAMS)
{
msg_t *with = nua_current_request(nua);
if (!(check_handle(ep, call, nh, SIP_500_INTERNAL_SERVER_ERROR)))
return 0;
@@ -265,7 +265,7 @@ int respond_with_etag(CONDITION_PARAMS)
RESPOND(ep, call, nh, SIP_412_PRECONDITION_FAILED,
NUTAG_WITH(with),
TAG_END());
}
}
else {
RESPOND(ep, call, nh, SIP_200_OK,
NUTAG_WITH(with),
@@ -433,7 +433,7 @@ int test_publish(struct context *ctx)
if (!ctx->expensive && 0)
goto skip_republish;
run_ab_until(ctx, -1, save_until_final_response, -1, respond_with_etag);
run_ab_until(ctx, -1, save_until_final_response, -1, respond_with_etag);
/* Client events: nua_r_publish
*/
@@ -445,7 +445,7 @@ int test_publish(struct context *ctx)
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
/*
Server events:
nua_i_publish
@@ -492,7 +492,7 @@ int test_publish(struct context *ctx)
TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
/* Let server close handle without responding to PUBLISH */
/* Let server close handle without responding to PUBLISH */
PUBLISH(a, a_call, a_call->nh,
TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
SIPTAG_EVENT_STR("presence"),
@@ -579,7 +579,7 @@ int accept_and_notify_twice(CONDITION_PARAMS)
switch (event) {
case nua_i_subscribe:
if (status < 200) {
NOTIFY(ep, call, nh,
NOTIFY(ep, call, nh,
SIPTAG_EVENT(sip->sip_event),
SIPTAG_CONTENT_TYPE_STR("application/pidf+xml"),
SIPTAG_PAYLOAD_STR(presence_closed),
@@ -647,7 +647,7 @@ int accept_and_notify(CONDITION_PARAMS)
SIPTAG_EXPIRES(sip->sip_expires),
TAG_END());
NOTIFY(ep, call, nh,
NOTIFY(ep, call, nh,
SIPTAG_EVENT(sip->sip_event),
SIPTAG_CONTENT_TYPE_STR("application/pidf+xml"),
SIPTAG_PAYLOAD_STR(presence_closed),
@@ -673,7 +673,7 @@ int save_and_notify(CONDITION_PARAMS)
switch (event) {
case nua_i_subscribe:
NOTIFY(ep, call, nh,
NOTIFY(ep, call, nh,
SIPTAG_EVENT(sip->sip_event),
SIPTAG_CONTENT_TYPE_STR("application/pidf+xml"),
SIPTAG_PAYLOAD_STR(presence_closed),
@@ -970,7 +970,7 @@ int test_subscribe_notify(struct context *ctx)
TEST(e->data->e_status, 200);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(tl_find(e->data->e_tags, nutag_substate));
TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
nua_substate_terminated);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_notify);
TEST_1(e->data->e_status >= 200);
@@ -1089,7 +1089,7 @@ int test_subscribe_notify_graceful(struct context *ctx)
SUBSCRIBE(a, a_call, a_call->nh, TAG_END());
run_ab_until(ctx, -1, save_until_notified_and_responded_twice,
run_ab_until(ctx, -1, save_until_notified_and_responded_twice,
-1, accept_subscription_until_terminated);
#if 0
@@ -1128,7 +1128,7 @@ int test_subscribe_notify_graceful(struct context *ctx)
TEST(e->data->e_status, 200);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(tl_find(e->data->e_tags, nutag_substate));
TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
nua_substate_terminated);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_notify);
TEST_1(e->data->e_status >= 200);
@@ -1500,7 +1500,7 @@ int test_newsub_notify(struct context *ctx)
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
/* 2nd NOTIFY using same dialog */
/* Check that server really discards the dialog */
@@ -1633,7 +1633,7 @@ int test_newsub_notify(struct context *ctx)
a->state.n = 4;
b->state.n = 4;
run_ab_until(ctx, -1, save_until_nth_final_response,
run_ab_until(ctx, -1, save_until_nth_final_response,
-1, accept_n_notifys);
/* Notifier events: nua_r_notify nua_r_notify */
@@ -1743,7 +1743,7 @@ int test_newsub_notify(struct context *ctx)
a->state.n = 3;
b->state.n = 3;
run_ab_until(ctx, -1, save_until_nth_final_response,
run_ab_until(ctx, -1, save_until_nth_final_response,
-1, accept_n_notifys);
/* Notifier events: nua_r_notify nua_r_notify */
@@ -1876,14 +1876,14 @@ int test_newsub_notify(struct context *ctx)
END();
}
/**Terminate when received notify.
/**Terminate when received notify.
* Respond to NOTIFY with 200 OK if it has not been responded.
* Save events (except nua_i_active or terminated).
*/
int accept_notify(CONDITION_PARAMS)
{
if (event == nua_i_notify && status < 200)
RESPOND(ep, call, nh, SIP_200_OK,
RESPOND(ep, call, nh, SIP_200_OK,
NUTAG_WITH_THIS(ep->nua),
TAG_END());
@@ -1898,7 +1898,7 @@ int save_until_nth_final_response(CONDITION_PARAMS)
if (nua_r_set_params <= event && event < nua_i_network_changed
&& status >= 200) {
if (ep->state.n > 0)
if (ep->state.n > 0)
ep->state.n--;
return ep->state.n == 0;
}
@@ -1911,7 +1911,7 @@ int accept_n_notifys(CONDITION_PARAMS)
tagi_t const *substate = tl_find(tags, nutag_substate);
if (event == nua_i_notify && status < 200)
RESPOND(ep, call, nh, SIP_200_OK,
RESPOND(ep, call, nh, SIP_200_OK,
NUTAG_WITH_THIS(ep->nua),
TAG_END());
@@ -1920,10 +1920,10 @@ int accept_n_notifys(CONDITION_PARAMS)
if (event != nua_i_notify)
return 0;
if (ep->state.n > 0)
if (ep->state.n > 0)
ep->state.n--;
if (ep->state.n == 0)
if (ep->state.n == 0)
return 1;
if (substate && substate->t_value == nua_substate_terminated) {
@@ -2068,7 +2068,7 @@ int accept_subscription_until_terminated(CONDITION_PARAMS)
NUTAG_WITH(with),
SIPTAG_EXPIRES_STR("360"),
TAG_END());
NOTIFY(ep, call, nh,
NOTIFY(ep, call, nh,
SIPTAG_EVENT(sip->sip_event),
SIPTAG_CONTENT_TYPE_STR("application/pidf+xml"),
SIPTAG_PAYLOAD_STR(presence_closed),
+1 -1
View File
@@ -72,7 +72,7 @@ int save_until_notified_and_responded(CONDITION_PARAMS)
NUTAG_AUTH("Digest:\"test-proxy\":charlie:secret"),
TAG_END());
}
else if (status >= 300)
else if (status >= 300)
return 1;
else if (status >= 200)
ep->flags.bit1 = 1;