blob: 18d28b75c59b37f803ad6a173131b280ebb9741a [file] [log] [blame]
Benny Prijono5dcb38d2005-11-21 01:55:47 +00001/* $Id$ */
2/*
Benny Prijono844653c2008-12-23 17:27:53 +00003 * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
Benny Prijono32177c02008-06-20 22:44:47 +00004 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
Benny Prijono5dcb38d2005-11-21 01:55:47 +00005 *
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;
26
Benny Prijonofa73e3e2006-01-05 23:35:46 +000027#define TEST_UDP_PORT 15060
28#define TEST_UDP_PORT_STR "15060"
Benny Prijono5dcb38d2005-11-21 01:55:47 +000029
Benny Prijono95c63482006-07-06 14:28:45 +000030/**
31 * Memory size to use in caching pool.
32 * Default: 2MB
33 */
34#ifndef PJSIP_TEST_MEM_SIZE
35# define PJSIP_TEST_MEM_SIZE (2*1024*1024)
36#endif
37
38
Benny Prijono02b8fd82006-06-26 15:12:55 +000039
Benny Prijonof4721ca2007-02-17 19:40:06 +000040#define INCLUDE_MESSAGING_GROUP 1
41#define INCLUDE_TRANSPORT_GROUP 1
42#define INCLUDE_TSX_GROUP 1
Benny Prijono1f7767b2007-10-03 18:28:49 +000043#define INCLUDE_INV_GROUP 1
Benny Prijonodd742da2008-05-17 12:45:00 +000044#define INCLUDE_REGC_GROUP 1
Benny Prijono02b8fd82006-06-26 15:12:55 +000045
Benny Prijonod0bd4982007-12-02 15:40:52 +000046#define INCLUDE_BENCHMARKS 1
47
Benny Prijonoe93e2872006-06-28 16:46:49 +000048/*
49 * Include tests that normally would fail under certain gcc
50 * optimization levels.
51 */
52#ifndef INCLUDE_GCC_TEST
53# define INCLUDE_GCC_TEST 0
54#endif
Benny Prijono02b8fd82006-06-26 15:12:55 +000055
56
57#define INCLUDE_URI_TEST INCLUDE_MESSAGING_GROUP
58#define INCLUDE_MSG_TEST INCLUDE_MESSAGING_GROUP
Benny Prijono1c1d7342010-08-01 09:48:51 +000059#define INCLUDE_MULTIPART_TEST INCLUDE_MESSAGING_GROUP
Benny Prijono02b8fd82006-06-26 15:12:55 +000060#define INCLUDE_TXDATA_TEST INCLUDE_MESSAGING_GROUP
Benny Prijonoe93e2872006-06-28 16:46:49 +000061#define INCLUDE_TSX_BENCH INCLUDE_MESSAGING_GROUP
Benny Prijono02b8fd82006-06-26 15:12:55 +000062#define INCLUDE_UDP_TEST INCLUDE_TRANSPORT_GROUP
63#define INCLUDE_LOOP_TEST INCLUDE_TRANSPORT_GROUP
Benny Prijonoe93e2872006-06-28 16:46:49 +000064#define INCLUDE_TCP_TEST INCLUDE_TRANSPORT_GROUP
Benny Prijonof4721ca2007-02-17 19:40:06 +000065#define INCLUDE_RESOLVE_TEST INCLUDE_TRANSPORT_GROUP
Benny Prijono02b8fd82006-06-26 15:12:55 +000066#define INCLUDE_TSX_TEST INCLUDE_TSX_GROUP
Benny Prijono1f7767b2007-10-03 18:28:49 +000067#define INCLUDE_INV_OA_TEST INCLUDE_INV_GROUP
Benny Prijonodd742da2008-05-17 12:45:00 +000068#define INCLUDE_REGC_TEST INCLUDE_REGC_GROUP
Benny Prijono02b8fd82006-06-26 15:12:55 +000069
70
Benny Prijono0ca04b62005-12-30 23:50:15 +000071/* The tests */
72int uri_test(void);
73int msg_test(void);
Benny Prijono733c67a2006-06-23 01:03:52 +000074int msg_err_test(void);
Benny Prijono1c1d7342010-08-01 09:48:51 +000075int multipart_test(void);
Benny Prijono0ca04b62005-12-30 23:50:15 +000076int txdata_test(void);
Benny Prijonoe93e2872006-06-28 16:46:49 +000077int tsx_bench(void);
Benny Prijono0ca04b62005-12-30 23:50:15 +000078int transport_udp_test(void);
Benny Prijonofa73e3e2006-01-05 23:35:46 +000079int transport_loop_test(void);
Benny Prijonoe93e2872006-06-28 16:46:49 +000080int transport_tcp_test(void);
Benny Prijonofa9e5b12006-10-08 12:39:34 +000081int resolve_test(void);
Benny Prijonodd742da2008-05-17 12:45:00 +000082int regc_test(void);
Benny Prijonoe93e2872006-06-28 16:46:49 +000083
84struct tsx_test_param
85{
86 int type;
87 int port;
88 char *tp_type;
89};
90
91int tsx_basic_test(struct tsx_test_param *param);
92int tsx_uac_test(struct tsx_test_param *param);
93int tsx_uas_test(struct tsx_test_param *param);
Benny Prijono0ca04b62005-12-30 23:50:15 +000094
95/* Transport test helpers (transport_test.c). */
96int generic_transport_test(pjsip_transport *tp);
97int transport_send_recv_test( pjsip_transport_type_e tp_type,
98 pjsip_transport *ref_tp,
Benny Prijonoe93e2872006-06-28 16:46:49 +000099 char *target_url,
100 int *p_usec_rtt);
Benny Prijono0ca04b62005-12-30 23:50:15 +0000101int transport_rt_test( pjsip_transport_type_e tp_type,
102 pjsip_transport *ref_tp,
Benny Prijono85598d92006-01-07 18:44:25 +0000103 char *target_url,
104 int *pkt_lost);
Benny Prijono33c9db02008-08-04 14:30:33 +0000105int transport_load_test(char *target_url);
Benny Prijono0ca04b62005-12-30 23:50:15 +0000106
Benny Prijono1f7767b2007-10-03 18:28:49 +0000107/* Invite session */
108int inv_offer_answer_test(void);
109
Benny Prijono0ca04b62005-12-30 23:50:15 +0000110/* Test main entry */
Benny Prijono5dcb38d2005-11-21 01:55:47 +0000111int test_main(void);
Benny Prijono0ca04b62005-12-30 23:50:15 +0000112
113/* Test utilities. */
Benny Prijono5dcb38d2005-11-21 01:55:47 +0000114void app_perror(const char *msg, pj_status_t status);
Benny Prijonoe93e2872006-06-28 16:46:49 +0000115int init_msg_logger(void);
116int msg_logger_set_enabled(pj_bool_t enabled);
Benny Prijono85598d92006-01-07 18:44:25 +0000117void flush_events(unsigned duration);
Benny Prijono5dcb38d2005-11-21 01:55:47 +0000118
Benny Prijonoe93e2872006-06-28 16:46:49 +0000119
120void report_ival(const char *name, int value, const char *valname, const char *desc);
121void report_sval(const char *name, const char* value, const char *valname, const char *desc);
122
123
Benny Prijono9c1d9f52006-01-07 23:01:56 +0000124/* Settings. */
125extern int log_level;
126
Benny Prijono5dcb38d2005-11-21 01:55:47 +0000127#endif /* __TEST_H__ */