blob: 6c6957258c22e1d763eef3790f6e6077da8f67c4 [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
59#define INCLUDE_TXDATA_TEST INCLUDE_MESSAGING_GROUP
Benny Prijonoe93e2872006-06-28 16:46:49 +000060#define INCLUDE_TSX_BENCH INCLUDE_MESSAGING_GROUP
Benny Prijono02b8fd82006-06-26 15:12:55 +000061#define INCLUDE_UDP_TEST INCLUDE_TRANSPORT_GROUP
62#define INCLUDE_LOOP_TEST INCLUDE_TRANSPORT_GROUP
Benny Prijonoe93e2872006-06-28 16:46:49 +000063#define INCLUDE_TCP_TEST INCLUDE_TRANSPORT_GROUP
Benny Prijonof4721ca2007-02-17 19:40:06 +000064#define INCLUDE_RESOLVE_TEST INCLUDE_TRANSPORT_GROUP
Benny Prijono02b8fd82006-06-26 15:12:55 +000065#define INCLUDE_TSX_TEST INCLUDE_TSX_GROUP
Benny Prijono1f7767b2007-10-03 18:28:49 +000066#define INCLUDE_INV_OA_TEST INCLUDE_INV_GROUP
Benny Prijonodd742da2008-05-17 12:45:00 +000067#define INCLUDE_REGC_TEST INCLUDE_REGC_GROUP
Benny Prijono02b8fd82006-06-26 15:12:55 +000068
69
Benny Prijono0ca04b62005-12-30 23:50:15 +000070/* The tests */
71int uri_test(void);
72int msg_test(void);
Benny Prijono733c67a2006-06-23 01:03:52 +000073int msg_err_test(void);
Benny Prijono0ca04b62005-12-30 23:50:15 +000074int txdata_test(void);
Benny Prijonoe93e2872006-06-28 16:46:49 +000075int tsx_bench(void);
Benny Prijono0ca04b62005-12-30 23:50:15 +000076int transport_udp_test(void);
Benny Prijonofa73e3e2006-01-05 23:35:46 +000077int transport_loop_test(void);
Benny Prijonoe93e2872006-06-28 16:46:49 +000078int transport_tcp_test(void);
Benny Prijonofa9e5b12006-10-08 12:39:34 +000079int resolve_test(void);
Benny Prijonodd742da2008-05-17 12:45:00 +000080int regc_test(void);
Benny Prijonoe93e2872006-06-28 16:46:49 +000081
82struct tsx_test_param
83{
84 int type;
85 int port;
86 char *tp_type;
87};
88
89int tsx_basic_test(struct tsx_test_param *param);
90int tsx_uac_test(struct tsx_test_param *param);
91int tsx_uas_test(struct tsx_test_param *param);
Benny Prijono0ca04b62005-12-30 23:50:15 +000092
93/* Transport test helpers (transport_test.c). */
94int generic_transport_test(pjsip_transport *tp);
95int transport_send_recv_test( pjsip_transport_type_e tp_type,
96 pjsip_transport *ref_tp,
Benny Prijonoe93e2872006-06-28 16:46:49 +000097 char *target_url,
98 int *p_usec_rtt);
Benny Prijono0ca04b62005-12-30 23:50:15 +000099int transport_rt_test( pjsip_transport_type_e tp_type,
100 pjsip_transport *ref_tp,
Benny Prijono85598d92006-01-07 18:44:25 +0000101 char *target_url,
102 int *pkt_lost);
Benny Prijono33c9db02008-08-04 14:30:33 +0000103int transport_load_test(char *target_url);
Benny Prijono0ca04b62005-12-30 23:50:15 +0000104
Benny Prijono1f7767b2007-10-03 18:28:49 +0000105/* Invite session */
106int inv_offer_answer_test(void);
107
Benny Prijono0ca04b62005-12-30 23:50:15 +0000108/* Test main entry */
Benny Prijono5dcb38d2005-11-21 01:55:47 +0000109int test_main(void);
Benny Prijono0ca04b62005-12-30 23:50:15 +0000110
111/* Test utilities. */
Benny Prijono5dcb38d2005-11-21 01:55:47 +0000112void app_perror(const char *msg, pj_status_t status);
Benny Prijonoe93e2872006-06-28 16:46:49 +0000113int init_msg_logger(void);
114int msg_logger_set_enabled(pj_bool_t enabled);
Benny Prijono85598d92006-01-07 18:44:25 +0000115void flush_events(unsigned duration);
Benny Prijono5dcb38d2005-11-21 01:55:47 +0000116
Benny Prijonoe93e2872006-06-28 16:46:49 +0000117
118void report_ival(const char *name, int value, const char *valname, const char *desc);
119void report_sval(const char *name, const char* value, const char *valname, const char *desc);
120
121
Benny Prijono9c1d9f52006-01-07 23:01:56 +0000122/* Settings. */
123extern int log_level;
124
Benny Prijono5dcb38d2005-11-21 01:55:47 +0000125#endif /* __TEST_H__ */