📄 sipp.hpp
字号:
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * Author : Richard GAYRAUD - 04 Nov 2003 * From Hewlett Packard Company. */#ifndef __SIPP__#define __SIPP__/* Std C includes */#include <stdio.h>#include <stdlib.h>#include <string.h>#include <pthread.h>#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <netinet/tcp.h>#include <sys/time.h>#include <sys/poll.h>#include <sys/resource.h>#include <fcntl.h>#include <unistd.h>#include <arpa/inet.h>#include <errno.h>#include <netdb.h>#include <ctype.h>#include <signal.h>#include <time.h>#include <vector>#include <string>#include <math.h>#if defined(__HPUX) || defined(__SUNOS)#include <alloca.h>#endif/* Sipp includes */#include "xp_parser.h"#include "scenario.hpp"#include "screen.hpp"#include "call.hpp"#include "comp.h"#include "stat.hpp"#include "actions.hpp"#include "variables.hpp"/* Open SSL stuff */#ifdef _USE_OPENSSL#include "sslcommon.h" #endif#ifndef __CYGWIN#ifndef FD_SETSIZE#define FD_SETSIZE 65000#endif#else#ifndef FD_SETSIZE#define FD_SETSIZE 1024#endif#endif/* * If this files is included in the Main, then extern definitions * are removed, and the _DEFAULT macro becomes '= value;'. Else * extern definition does not contain default values assignment */#ifdef GLOBALS_FULL_DEFINITION#define extern#define _DEFVAL(value) = value#else#define _DEFVAL(value)#endif/************************** Constants **************************/#define SIPP_VERSION 20061124#define T_UDP 0#define T_TCP 1#ifdef _USE_OPENSSL#define T_TLS 2#define DEFAULT_TLS_CERT ((char *)"cacert.pem")#define DEFAULT_TLS_KEY ((char *)"cakey.pem")#define DEFAULT_TLS_CRL ((char *)"")#endif#define TRANSPORT_TO_STRING(p) ((p==1) ? "TCP" : ((p==2)? "TLS" :"UDP"))#define SIPP_MAXFDS 65536#define SIPP_MAX_MSG_SIZE 65536#define MSG_RETRANS_FIRST 0#define MSG_RETRANS_RETRANSMISSION 1#define MSG_RETRANS_NEVER 2#define DISPLAY_STAT_SCREEN 1#define DISPLAY_REPARTITION_SCREEN 2#define DISPLAY_SCENARIO_SCREEN 3#define DISPLAY_VARIABLE_SCREEN 4#define DISPLAY_TDM_MAP_SCREEN 5#define DISPLAY_SECONDARY_REPARTITION_SCREEN 6#define MAX_RECV_LOOPS_PER_CYCLE 1000#define NB_UPDATE_PER_CYCLE 1#define MAX_PATH 250/******************** Default parameters ***********************/#define DEFAULT_RATE 10.0#define DEFAULT_RATE_PERIOD_S 1.0#define DEFAULT_TRANSPORT T_UDP#define DEFAULT_PORT 5060 #define DEFAULT_MEDIA_PORT 6000#ifdef __3PCC__#define DEFAULT_3PCC_PORT 6060#endif#define DEFAULT_SERVICE ((char *)"service")#define DEFAULT_AUTH_PASSWORD ((char *)"password")#define DEFAULT_REPORT_FREQ 1000#define DEFAULT_REPORT_FREQ_DUMP_LOG 60000#define DEFAULT_TIMER_RESOLUTION 10#define DEFAULT_FREQ_DUMP_RTT 200#define DEFAULT_MAX_MULTI_SOCKET 50000#define DEFAULT_CTRL_SOCKET_PORT 8888/************ User controls and command line options ***********/extern int duration _DEFVAL(0);extern double rate _DEFVAL(DEFAULT_RATE);extern int rate_increase _DEFVAL(0);extern int rate_max _DEFVAL(0);extern int users _DEFVAL(0);extern double rate_period_s _DEFVAL(DEFAULT_RATE_PERIOD_S);extern unsigned long defl_recv_timeout _DEFVAL(0);extern unsigned long global_timeout _DEFVAL(0);extern int transport _DEFVAL(DEFAULT_TRANSPORT);extern bool retrans_enabled _DEFVAL(1);extern int max_udp_retrans _DEFVAL(UDP_MAX_RETRANS);extern int max_invite_retrans _DEFVAL(UDP_MAX_RETRANS_INVITE_TRANSACTION);extern int max_non_invite_retrans _DEFVAL(UDP_MAX_RETRANS_NON_INVITE_TRANSACTION);extern bool default_behavior _DEFVAL(1);extern bool pause_msg_ign _DEFVAL(0);extern int auto_answer _DEFVAL(0);extern int multisocket _DEFVAL(0);extern int compression _DEFVAL(0);extern int peripsocket _DEFVAL(0);extern int peripfield _DEFVAL(0);extern int bind_local _DEFVAL(0);extern void * monosocket_comp_state _DEFVAL(0);extern char * service _DEFVAL(DEFAULT_SERVICE);extern char * auth_password _DEFVAL(DEFAULT_AUTH_PASSWORD);extern unsigned long report_freq _DEFVAL(DEFAULT_REPORT_FREQ);extern unsigned long report_freq_dumpLog _DEFVAL (DEFAULT_REPORT_FREQ_DUMP_LOG);extern char * stat_delimiter _DEFVAL(";");extern bool timeout_exit _DEFVAL(false);extern unsigned long report_freq_dumpRtt _DEFVAL (DEFAULT_FREQ_DUMP_RTT);extern int max_multi_socket _DEFVAL (DEFAULT_MAX_MULTI_SOCKET);extern int timer_resolution _DEFVAL(DEFAULT_TIMER_RESOLUTION);extern int max_recv_loops _DEFVAL(MAX_RECV_LOOPS_PER_CYCLE);extern int update_nb _DEFVAL(NB_UPDATE_PER_CYCLE); extern char local_ip[40];extern char local_ip_escaped[42];extern bool local_ip_is_ipv6; extern int local_port _DEFVAL(0);extern int buff_size _DEFVAL(65535);extern int tcp_readsize _DEFVAL(4096);#ifdef PCAPPLAYextern int hasMedia _DEFVAL(0);#endifextern bool rtp_echo_enabled _DEFVAL(0);extern char media_ip[40];extern char media_ip_escaped[42];extern int user_media_port _DEFVAL(0);extern int media_port _DEFVAL(0);extern size_t media_bufsize _DEFVAL(2048);extern bool media_ip_is_ipv6; extern char remote_ip[40];extern char remote_ip_escaped[42];extern int remote_port _DEFVAL(DEFAULT_PORT);extern unsigned int pid _DEFVAL(0);extern int print_all_responses _DEFVAL(0);extern unsigned long stop_after _DEFVAL(0xffffffff);extern int quitting _DEFVAL(0);extern int interrupt _DEFVAL(0);extern int paused _DEFVAL(0);extern int lose_packets _DEFVAL(0);extern char remote_host[255]; #ifdef __3PCC__extern char twinSippHost[255];extern char twinSippIp[40];extern int twinSippPort _DEFVAL(DEFAULT_3PCC_PORT);extern bool twinSippMode _DEFVAL(false);#endifextern bool backgroundMode _DEFVAL(false); extern bool signalDump _DEFVAL(false); extern bool ctrlEW _DEFVAL(false);extern int currentScreenToDisplay _DEFVAL
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -