blob: 690598b96e256ea1e0d4c0e7b9a71723f6ac5292 [file] [log] [blame]
Tristan Matthews0a329cc2013-07-17 13:20:14 -04001/* $Id$ */
2/*
3 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __TEST_H__
21#define __TEST_H__
22
23#include <pjsip/sip_types.h>
24
25extern pjsip_endpoint *endpt;
26extern pj_caching_pool caching_pool;
27
28#define TEST_UDP_PORT 15060
29#define TEST_UDP_PORT_STR "15060"
30
31/**
32 * Memory size to use in caching pool.
33 * Default: 2MB
34 */
35#ifndef PJSIP_TEST_MEM_SIZE
36# define PJSIP_TEST_MEM_SIZE (2*1024*1024)
37#endif
38
39
40
41#define INCLUDE_MESSAGING_GROUP 1
42#define INCLUDE_TRANSPORT_GROUP 1
43#define INCLUDE_TSX_GROUP 1
44#define INCLUDE_INV_GROUP 1
45#define INCLUDE_REGC_GROUP 1
46
47#define INCLUDE_BENCHMARKS 1
48
49/*
50 * Include tests that normally would fail under certain gcc
51 * optimization levels.
52 */
53#ifndef INCLUDE_GCC_TEST
54# define INCLUDE_GCC_TEST 0
55#endif
56
57
58#define INCLUDE_URI_TEST INCLUDE_MESSAGING_GROUP
59#define INCLUDE_MSG_TEST INCLUDE_MESSAGING_GROUP
60#define INCLUDE_MULTIPART_TEST INCLUDE_MESSAGING_GROUP
61#define INCLUDE_TXDATA_TEST INCLUDE_MESSAGING_GROUP
62#define INCLUDE_TSX_BENCH INCLUDE_MESSAGING_GROUP
63#define INCLUDE_UDP_TEST INCLUDE_TRANSPORT_GROUP
64#define INCLUDE_LOOP_TEST INCLUDE_TRANSPORT_GROUP
65#define INCLUDE_TCP_TEST INCLUDE_TRANSPORT_GROUP
66#define INCLUDE_RESOLVE_TEST INCLUDE_TRANSPORT_GROUP
67#define INCLUDE_TSX_TEST INCLUDE_TSX_GROUP
68#define INCLUDE_TSX_DESTROY_TEST INCLUDE_TSX_GROUP
69#define INCLUDE_INV_OA_TEST INCLUDE_INV_GROUP
70#define INCLUDE_REGC_TEST INCLUDE_REGC_GROUP
71
72
73/* The tests */
74int uri_test(void);
75int msg_test(void);
76int msg_err_test(void);
77int multipart_test(void);
78int txdata_test(void);
79int tsx_bench(void);
80int tsx_destroy_test(void);
81int transport_udp_test(void);
82int transport_loop_test(void);
83int transport_tcp_test(void);
84int resolve_test(void);
85int regc_test(void);
86
87struct tsx_test_param
88{
89 int type;
90 int port;
91 char *tp_type;
92};
93
94int tsx_basic_test(struct tsx_test_param *param);
95int tsx_uac_test(struct tsx_test_param *param);
96int tsx_uas_test(struct tsx_test_param *param);
97
98/* Transport test helpers (transport_test.c). */
99int generic_transport_test(pjsip_transport *tp);
100int transport_send_recv_test( pjsip_transport_type_e tp_type,
101 pjsip_transport *ref_tp,
102 char *target_url,
103 int *p_usec_rtt);
104int transport_rt_test( pjsip_transport_type_e tp_type,
105 pjsip_transport *ref_tp,
106 char *target_url,
107 int *pkt_lost);
108int transport_load_test(char *target_url);
109
110/* Invite session */
111int inv_offer_answer_test(void);
112
113/* Test main entry */
114int test_main(void);
115
116/* Test utilities. */
117void app_perror(const char *msg, pj_status_t status);
118int init_msg_logger(void);
119int msg_logger_set_enabled(pj_bool_t enabled);
120void flush_events(unsigned duration);
121
122
123void report_ival(const char *name, int value, const char *valname, const char *desc);
124void report_sval(const char *name, const char* value, const char *valname, const char *desc);
125
126
127/* Settings. */
128extern int log_level;
129
130#endif /* __TEST_H__ */