Commit 3a534b7c authored by Pekka Pessi's avatar Pekka Pessi

test_nta.c: removed dead code

darcs-hash:20071121164642-65a35-9db359bf8bb81c77d22176f97b87ee5eaddb7739.gz
parent 11b7a385
......@@ -1877,360 +1877,6 @@ int test_resolv(agent_t *ag, char const *resolv_conf)
url->url_params = NULL;
}
#if 0
/* Test 0.1.1
* Send a message from Bob to Alice using SIGCOMP and TCP
*/
if (tcp_comp) {
url_t url[1];
sip_payload_t *pl;
usize_t size = 1024;
*url = *ag->ag_aliases->m_url;
url->url_user = "alice";
if (url->url_params)
url->url_params = su_sprintf(NULL, "%s;transport=tcp", url->url_params);
else
url->url_params = "transport=tcp";
TEST_1(pl = test_payload(ag->ag_home, size));
ag->ag_expect_leg = ag->ag_server_leg;
TEST_1(ag->ag_orq =
nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ag,
ag->ag_obp,
SIP_METHOD_MESSAGE,
(url_string_t *)url,
SIPTAG_SUBJECT_STR("Test 0.1.1"),
SIPTAG_FROM(ag->ag_bob),
SIPTAG_TO(ag->ag_alice),
SIPTAG_CONTACT(ag->ag_m_bob),
SIPTAG_PAYLOAD(pl),
TAG_END()));
su_free(ag->ag_home, pl);
nta_test_run(ag);
TEST(ag->ag_status, 200);
TEST(ag->ag_orq, NULL);
TEST(ag->ag_latest_leg, ag->ag_server_leg);
}
/* Test 0.2
* Send a message from Bob to Alice
* This time specify a TCP URI, and include a large payload
* of 512 kB
*/
if (tcp) {
url_t url[1];
sip_payload_t *pl;
usize_t size = 512 * 1024;
*url = *ag->ag_aliases->m_url;
url->url_user = "alice";
#if 0
if (url->url_params)
url->url_params = su_sprintf(NULL, "%s;transport=tcp", url->url_params);
else
#endif
url->url_params = "transport=tcp";
TEST_1(pl = test_payload(ag->ag_home, size));
ag->ag_expect_leg = ag->ag_server_leg;
TEST_1(ag->ag_orq =
nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ag,
ag->ag_obp,
SIP_METHOD_MESSAGE,
(url_string_t *)url,
SIPTAG_SUBJECT_STR("Test 0.2"),
SIPTAG_FROM(ag->ag_bob),
SIPTAG_TO(ag->ag_alice),
SIPTAG_CONTACT(ag->ag_m_bob),
SIPTAG_PAYLOAD(pl),
TAG_END()));
su_free(ag->ag_home, pl);
nta_test_run(ag);
TEST(ag->ag_status, 200);
TEST(ag->ag_orq, NULL);
TEST(ag->ag_latest_leg, ag->ag_server_leg);
}
/* Test 0.3
* Send a message from Bob to Alice
* This time include a large payload of 512 kB, let NTA choose transport.
*/
if (tcp) {
url_t url[1];
sip_payload_t *pl;
usize_t size = 512 * 1024;
*url = *ag->ag_aliases->m_url;
url->url_user = "alice";
TEST_1(pl = test_payload(ag->ag_home, size));
ag->ag_expect_leg = ag->ag_server_leg;
TEST_1(ag->ag_orq =
nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ag,
ag->ag_obp,
SIP_METHOD_MESSAGE,
(url_string_t *)url,
SIPTAG_SUBJECT_STR("Test 0.3"),
SIPTAG_FROM(ag->ag_bob),
SIPTAG_TO(ag->ag_alice),
SIPTAG_CONTACT(ag->ag_m_bob),
SIPTAG_PAYLOAD(pl),
TAG_END()));
su_free(ag->ag_home, pl);
nta_test_run(ag);
TEST(ag->ag_status, 200);
TEST(ag->ag_orq, NULL);
TEST(ag->ag_latest_leg, ag->ag_server_leg);
}
/* Test 0.4:
* Send a message from Bob to Alice
* This time include a payload of 2 kB, let NTA choose transport.
*/
{
url_t url[1];
sip_payload_t *pl;
usize_t size = 2 * 1024;
*url = *ag->ag_aliases->m_url;
url->url_user = "alice";
TEST_1(pl = test_payload(ag->ag_home, size));
su_free(ag->ag_home, (void *)ag->ag_out_via), ag->ag_out_via = NULL;
ag->ag_expect_leg = ag->ag_server_leg;
TEST_1(ag->ag_orq =
nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ag,
ag->ag_obp,
SIP_METHOD_MESSAGE,
(url_string_t *)url,
SIPTAG_SUBJECT_STR("Test 0.4"),
SIPTAG_FROM(ag->ag_bob),
SIPTAG_TO(ag->ag_alice),
SIPTAG_CONTACT(ag->ag_m_bob),
SIPTAG_PAYLOAD(pl),
TAG_END()));
su_free(ag->ag_home, pl);
nta_test_run(ag);
TEST(ag->ag_status, 200);
TEST(ag->ag_orq, NULL);
TEST(ag->ag_latest_leg, ag->ag_server_leg);
TEST_1(ag->ag_out_via);
TEST_1(strcasecmp(ag->ag_out_via->v_protocol, "SIP/2.0/TCP") == 0 ||
strcasecmp(ag->ag_out_via->v_protocol, "SIP/2.0/SCTP") == 0);
}
/* Test 0.5:
* Send a message from Bob to Alice
* This time include a payload of 2 kB, try to use UDP.
*/
if (udp) {
url_t url[1];
sip_payload_t *pl;
usize_t size = 2 * 1024;
*url = *ag->ag_aliases->m_url;
url->url_user = "alice";
TEST_1(pl = test_payload(ag->ag_home, size));
su_free(ag->ag_home, (void *)ag->ag_out_via), ag->ag_out_via = NULL;
ag->ag_expect_leg = ag->ag_server_leg;
TEST_1(ag->ag_orq =
nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ag,
ag->ag_obp,
SIP_METHOD_MESSAGE,
(url_string_t *)url,
SIPTAG_SUBJECT_STR("Test 0.5"),
SIPTAG_FROM(ag->ag_bob),
SIPTAG_TO(ag->ag_alice),
SIPTAG_CONTACT(ag->ag_m_bob),
SIPTAG_PAYLOAD(pl),
TPTAG_MTU(0xffffffff),
TAG_END()));
su_free(ag->ag_home, pl);
nta_test_run(ag);
TEST(ag->ag_status, 200);
TEST(ag->ag_orq, NULL);
TEST(ag->ag_latest_leg, ag->ag_server_leg);
TEST_1(ag->ag_out_via);
TEST_S(ag->ag_out_via->v_protocol, "SIP/2.0/UDP");
}
if (udp) {
/* Send a message from default leg to server leg
* using a prefilled Via header
*/
sip_via_t via[1];
sip_via_init(via);
via->v_protocol = sip_transport_udp;
via->v_host = ag->ag_contact->m_url->url_host;
via->v_port = ag->ag_contact->m_url->url_port;
sip_via_add_param(ag->ag_home, via, "branch=MagicalBranch");
nta_agent_set_params(ag->ag_agent,
NTATAG_USER_VIA(1),
TAG_END());
ag->ag_expect_leg = ag->ag_server_leg;
TEST_1(ag->ag_orq =
nta_outgoing_tcreate(ag->ag_default_leg,
magic_callback, ag,
ag->ag_obp,
SIP_METHOD_MESSAGE,
(url_string_t *)url,
SIPTAG_SUBJECT_STR("Test 0.6"),
SIPTAG_FROM(ag->ag_alice),
SIPTAG_TO(ag->ag_bob),
SIPTAG_CONTACT(ag->ag_m_alice),
SIPTAG_VIA(via),
TAG_END()));
nta_test_run(ag);
TEST(ag->ag_status, 200);
TEST(ag->ag_orq, NULL);
TEST(ag->ag_latest_leg, ag->ag_server_leg);
nta_agent_set_params(ag->ag_agent,
NTATAG_USER_VIA(0),
TAG_END());
}
/* Test 0.7
* Send a message from Bob to Alice using SCTP
*/
if (sctp) {
url_t url[1];
sip_payload_t *pl;
usize_t size = 16 * 1024;
*url = *ag->ag_aliases->m_url;
url->url_user = "alice";
#if 0
if (url->url_params)
url->url_params = su_sprintf(NULL, "%s;transport=sctp", url->url_params);
else
#endif
url->url_params = "transport=sctp";
TEST_1(pl = test_payload(ag->ag_home, size));
ag->ag_expect_leg = ag->ag_server_leg;
TEST_1(ag->ag_orq =
nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ag,
ag->ag_obp,
SIP_METHOD_MESSAGE,
(url_string_t *)url,
SIPTAG_SUBJECT_STR("Test 0.7"),
SIPTAG_FROM(ag->ag_bob),
SIPTAG_TO(ag->ag_alice),
SIPTAG_CONTACT(ag->ag_m_bob),
SIPTAG_PAYLOAD(pl),
TAG_END()));
su_free(ag->ag_home, pl);
nta_test_run(ag);
TEST(ag->ag_status, 200);
TEST(ag->ag_orq, NULL);
TEST(ag->ag_latest_leg, ag->ag_server_leg);
}
/* Test 0.8: Send a too large message */
if (tcp) {
url_t url[1];
sip_payload_t *pl;
usize_t size = 128 * 1024;
nta_agent_set_params(ag->ag_agent,
NTATAG_MAXSIZE(65536),
TAG_END());
*url = *ag->ag_aliases->m_url;
url->url_user = "alice";
TEST_1(pl = test_payload(ag->ag_home, size));
ag->ag_expect_leg = ag->ag_server_leg;
ag->ag_latest_leg = NULL;
TEST_1(ag->ag_orq =
nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ag,
ag->ag_obp,
SIP_METHOD_MESSAGE,
(url_string_t *)url,
SIPTAG_SUBJECT_STR("Test 0.8"),
SIPTAG_FROM(ag->ag_bob),
SIPTAG_TO(ag->ag_alice),
SIPTAG_CONTACT(ag->ag_m_bob),
SIPTAG_PAYLOAD(pl),
TAG_END()));
su_free(ag->ag_home, pl);
nta_test_run(ag);
TEST(ag->ag_status, 413);
TEST(ag->ag_orq, NULL);
TEST(ag->ag_latest_leg, NULL);
nta_agent_set_params(ag->ag_agent,
NTATAG_MAXSIZE(2 * 1024 * 1024),
TAG_END());
}
/* Test 0.9: Timeout */
{
url_t url[1];
printf("%s: starting MESSAGE timeout test, test will complete in 4 seconds\n",
name);
nta_agent_set_params(ag->ag_agent,
NTATAG_TIMEOUT_408(1),
NTATAG_SIP_T1(25),
NTATAG_SIP_T1X64(64 * 25),
TAG_END());
*url = *ag->ag_aliases->m_url;
url->url_user = "timeout";
url->url_port = ag->ag_sink_port;
ag->ag_expect_leg = ag->ag_server_leg;
ag->ag_latest_leg = NULL;
TEST_1(ag->ag_orq =
nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ag,
ag->ag_obp,
SIP_METHOD_MESSAGE,
(url_string_t *)url,
SIPTAG_SUBJECT_STR("Test 0.9"),
SIPTAG_FROM(ag->ag_bob),
SIPTAG_TO(ag->ag_alice),
SIPTAG_CONTACT(ag->ag_m_bob),
TAG_END()));
nta_test_run(ag);
TEST(ag->ag_status, 408);
TEST(ag->ag_orq, NULL);
TEST(ag->ag_latest_leg, NULL);
nta_agent_set_params(ag->ag_agent,
NTATAG_SIP_T1(500),
NTATAG_SIP_T1X64(64 * 500),
TAG_END());
}
#endif
nta_agent_set_params(ag->ag_agent,
NTATAG_SIP_T1(500),
NTATAG_SIP_T1X64(64 * 500),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment