提交 0c141d9b authored 作者: Michael Jerris's avatar Michael Jerris

Tue Feb 10 07:17:20 CST 2009 Pekka Pessi <first.last@nokia.com>

  * check_nua: moved s2_fast_forward() to s2 library



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11879 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 8d3480b0
......@@ -52,7 +52,10 @@ check_nua_SOURCES = check_nua.c check_nua.h \
check_etsi.c check_simple.c \
test_s2.h test_s2.c
check_nua_LDADD = $(nua_libs) @CHECK_LIBS@
check_nua_LDADD = $(nua_libs) ${top_builddir}/s2check/libs2.a \
@CHECK_LIBS@
check_nua_CFLAGS = $(CFLAGS) -I$(top_srcdir)/s2check
nua_libs = libnua.la \
../iptsec/libiptsec.la \
......
......@@ -244,22 +244,22 @@ START_TEST(SIP_CC_OE_CE_TI_008)
fail_unless(s2_check_callstate(nua_callstate_terminated));
fail_unless(s2_check_request(SIP_METHOD_ACK));
s2_fast_forward(5);
s2_fast_forward(5, s2->root);;
s2_respond_to(invite, d1, SIP_404_NOT_FOUND, TAG_END());
fail_unless(s2_check_request(SIP_METHOD_ACK));
s2_fast_forward(5);
s2_fast_forward(5, s2->root);;
s2_respond_to(invite, d1, SIP_404_NOT_FOUND, TAG_END());
fail_unless(s2_check_request(SIP_METHOD_ACK));
s2_fast_forward(21);
s2_fast_forward(21, s2->root);;
s2_respond_to(invite, d1, SIP_404_NOT_FOUND, TAG_END());
fail_unless(s2_check_request(SIP_METHOD_ACK));
s2_fast_forward(1);
s2_fast_forward(1, s2->root);;
s2_respond_to(invite, d1, SIP_404_NOT_FOUND, TAG_END());
s2_free_message(invite);
......@@ -294,19 +294,19 @@ START_TEST(SIP_CC_OE_CE_TI_011_012)
fail_unless(s2_check_callstate(nua_callstate_ready));
fail_unless(s2_check_request(SIP_METHOD_ACK));
s2_fast_forward(5);
s2_fast_forward(5, s2->root);;
respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
fail_unless(s2_check_request(SIP_METHOD_ACK));
s2_fast_forward(5);
s2_fast_forward(5, s2->root);;
respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
fail_unless(s2_check_request(SIP_METHOD_ACK));
s2_fast_forward(21);
s2_fast_forward(21, s2->root);;
respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
fail_unless(s2_check_request(SIP_METHOD_ACK));
s2_fast_forward(1);
s2_fast_forward(1, s2->root);;
respond_with_sdp(invite, d1, SIP_200_OK, TAG_END());
s2_free_message(invite);
fail_if(s2_check_request_timeout(SIP_METHOD_ACK, 500));
......
......@@ -335,7 +335,7 @@ START_TEST(register_1_2_2_2)
s2_free_message(m);
su_root_step(s2->root, 20); su_root_step(s2->root, 20);
s2_fast_forward(120); /* Default keepalive interval */
s2_fast_forward(120, s2->root);; /* Default keepalive interval */
mark_point();
m = s2_wait_for_request(SIP_METHOD_OPTIONS);
......@@ -346,7 +346,7 @@ START_TEST(register_1_2_2_2)
s2_free_message(m);
su_root_step(s2->root, 20); su_root_step(s2->root, 20);
s2_fast_forward(120); /* Default keepalive interval */
s2_fast_forward(120, s2->root);; /* Default keepalive interval */
mark_point();
receive_natted = "received=4.255.255.10";
......@@ -400,7 +400,7 @@ START_TEST(register_1_2_2_3)
receive_natted = "received=4.255.255.10";
s2_fast_forward(3600);
s2_fast_forward(3600, s2->root);;
mark_point();
m = s2_wait_for_request(SIP_METHOD_REGISTER);
......@@ -637,7 +637,7 @@ START_TEST(register_1_3_3_1)
if (!tport_is_udp(m->tport)) /* Drop UDP */
break;
s2_free_message(m);
s2_fast_forward(4);
s2_fast_forward(4, s2->root);;
}
tcp = tport_ref(m->tport);
......@@ -695,7 +695,7 @@ START_TEST(register_1_3_3_1)
su_root_step(s2->root, 5);
su_root_step(s2->root, 5);
su_root_step(s2->root, 5);
s2_fast_forward(5);
s2_fast_forward(5, s2->root);;
}
}
......
......@@ -1054,11 +1054,11 @@ START_TEST(call_2_3_1)
SIPTAG_REQUIRE_STR("timer"),
TAG_END());
s2_fast_forward(300);
s2_fast_forward(300, s2->root);;
ack = invite_timer_round(nh, "300;refresher=uac", rr);
fail_if(ack->sip->sip_route &&
su_strmatch(ack->sip->sip_route->r_url->url_user, "record"));
s2_fast_forward(300);
s2_fast_forward(300, s2->root);;
invite_timer_round(nh, "300;refresher=uac", NULL);
bye_by_nua(nh, TAG_END());
......@@ -1082,9 +1082,9 @@ START_TEST(call_2_3_2)
SIPTAG_REQUIRE_STR("timer"),
TAG_END());
s2_fast_forward(300);
s2_fast_forward(300, s2->root);;
invite_timer_round(nh, "300", NULL);
s2_fast_forward(300);
s2_fast_forward(300, s2->root);;
invite_timer_round(nh, "300", NULL);
bye_by_nua(nh, TAG_END());
......@@ -1551,7 +1551,7 @@ START_TEST(call_2_6_2)
/* We get nua_r_invite with 100 trying (and 500 in sip->sip_status) */
fail_unless(s2_check_event(nua_r_invite, 100));
s2_fast_forward(10);
s2_fast_forward(10, s2->root);;
fail_unless(s2_check_callstate(nua_callstate_calling));
......@@ -1605,7 +1605,7 @@ START_TEST(call_2_6_3)
fail_unless(s2_check_event(nua_i_ack, 200));
fail_unless(s2_check_callstate(nua_callstate_ready));
s2_fast_forward(10);
s2_fast_forward(10, s2->root);;
nua_set_hparams(nh, NUTAG_REFRESH_WITHOUT_SDP(1), TAG_END());
fail_unless(s2_check_event(nua_r_set_params, 200));
......@@ -1752,7 +1752,7 @@ START_TEST(call_3_1_2)
if (i == 3)
break;
fail_unless(s2_check_event(nua_r_invite, 100));
s2_fast_forward(5);
s2_fast_forward(5, s2->root);;
}
fail_unless(s2_check_event(nua_r_invite, 500));
......@@ -1822,7 +1822,7 @@ START_TEST(call_3_2_2)
if (i == 3)
break;
fail_unless(s2_check_event(nua_r_invite, 100));
s2_fast_forward(5);
s2_fast_forward(5, s2->root);;
}
fail_unless(s2_check_event(nua_r_invite, 500));
......@@ -2344,7 +2344,7 @@ START_TEST(bye_4_2_1)
SIPTAG_REQUIRE_STR("timer"),
TAG_END());
s2_fast_forward(300);
s2_fast_forward(300, s2->root);;
invite_timer_round(nh, "300", NULL);
nua_bye(nh, TAG_END());
......@@ -2357,7 +2357,7 @@ START_TEST(bye_4_2_1)
s2_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 407));
s2_fast_forward(300);
s2_fast_forward(300, s2->root);;
nua_authenticate(nh, NUTAG_AUTH("Digest:\"s2test\":abc:abc"), TAG_END());
bye = s2_wait_for_request(SIP_METHOD_BYE);
......@@ -2388,10 +2388,10 @@ START_TEST(bye_4_2_2)
SIPTAG_REQUIRE_STR("timer"),
TAG_END());
s2_fast_forward(300);
s2_fast_forward(300, s2->root);;
invite_timer_round(nh, "300", NULL);
s2_fast_forward(140);
s2_fast_forward(140, s2->root);;
nua_bye(nh, TAG_END());
......@@ -2403,7 +2403,7 @@ START_TEST(bye_4_2_2)
s2_free_message(bye);
fail_unless(s2_check_event(nua_r_bye, 407));
s2_fast_forward(160);
s2_fast_forward(160, s2->root);;
nua_authenticate(nh, NUTAG_AUTH(s2_auth_credentials), TAG_END());
bye = s2_wait_for_request(SIP_METHOD_BYE);
......
......@@ -290,7 +290,7 @@ START_TEST(subscribe_6_1_2)
s2_free_event(notify);
/* Wait for refresh */
s2_fast_forward(600);
s2_fast_forward(600, s2->root);;
subscribe = s2_wait_for_request(SIP_METHOD_SUBSCRIBE);
s2_respond_to(subscribe, dialog, SIP_200_OK,
SIPTAG_EXPIRES_STR("600"),
......@@ -377,7 +377,7 @@ START_TEST(subscribe_6_1_4)
su_home_unref((void *)dialog), dialog = su_home_new(sizeof *dialog); fail_if(!dialog);
s2_fast_forward(5);
s2_fast_forward(5, s2->root);;
/* nua re-establishes the subscription */
notify = subscription_by_nua(nh, nua_substate_embryonic, TAG_END());
s2_free_event(notify);
......@@ -460,7 +460,7 @@ START_TEST(fetch_6_2_3)
fail_unless(s2_check_substate(event, nua_substate_embryonic));
s2_free_event(event);
s2_fast_forward(600);
s2_fast_forward(600, s2->root);;
event = s2_wait_for_event(nua_i_notify, 408); fail_if(!event);
fail_unless(s2_check_substate(event, nua_substate_terminated));
......
......@@ -108,27 +108,6 @@ char const s2_auth3_credentials[] = "Digest:\"s2test3\":abc:abc";
int s2_nua_thread = 0;
/* -- Delay scenarios --------------------------------------------------- */
static unsigned long time_offset;
extern void (*_su_time)(su_time_t *tv);
static void _su_time_fast_forwarder(su_time_t *tv)
{
tv->tv_sec += time_offset;
}
void s2_fast_forward(unsigned long seconds)
{
if (_su_time == NULL)
_su_time = _su_time_fast_forwarder;
time_offset += seconds;
su_root_step(s2->root, 0);
}
/* -- NUA events -------------------------------------------------------- */
struct event *s2_remove_event(struct event *e)
......
......@@ -32,6 +32,8 @@
#include <sofia-sip/tport.h>
#include <sofia-sip/nua.h>
#include "s2util.h"
struct tester
{
su_home_t home[1];
......@@ -119,8 +121,6 @@ extern char const s2_auth3_credentials[];
extern int s2_nua_thread;
void s2_fast_forward(unsigned long seconds);
void s2_case(char const *tag,
char const *title,
char const *description);
......
差异被折叠。
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2009 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef S2DNS_H
/** Defined when <s2dns.h> has been included. */
#define S2DNS_H
/**@internal @file s2dns.h
*
* @brief Internal DNS server for testing
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
*/
#include <sofia-sip/su_wait.h>
SOFIA_BEGIN_DECLS
void s2_dns_setup(su_root_t *root);
void s2_dns_teardown(void);
char const *s2_dns_default(char const *domain);
extern uint32_t s2_dns_ttl;
void s2_dns_domain(char const *domain, int use_naptr,
/* char *prefix, int priority, url_t const *uri, */
...);
void s2_dns_record(char const *domain, unsigned qtype,
/* unsigned atype, domain, */
...);
SOFIA_END_DECLS
#endif /* S2DNS_H */
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2009 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#include "config.h"
#include "s2util.h"
/* -- Delay scenarios --------------------------------------------------- */
static unsigned long time_offset;
extern void (*_su_time)(su_time_t *tv);
static void _su_time_fast_forwarder(su_time_t *tv)
{
tv->tv_sec += time_offset;
}
void s2_fast_forward(unsigned long seconds,
su_root_t *root)
{
if (_su_time == NULL)
_su_time = _su_time_fast_forwarder;
time_offset += seconds;
if (root)
su_root_step(root, 0);
}
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2009 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef S2UTIL_H
/** Defined when <s2util.h> has been included. */
#define S2UTIL_H
/**@internal @file s2util.h
*
* @brief Miscellaneous testing utilities
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
*/
#include <sofia-sip/su_wait.h>
SOFIA_BEGIN_DECLS
void s2_fast_forward(unsigned long seconds, su_root_t *root);
SOFIA_END_DECLS
#endif /* S2UTIL_H */
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论