[tools] / trunk / publicdemo / sipp / sipp.hpp Repository:
ViewVC logotype

View of /trunk/publicdemo/sipp/sipp.hpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 70 - (download) (annotate)
Thu May 5 20:35:33 2011 UTC (2 years, 1 month ago) by jhermanski
File size: 21629 byte(s)
Package all media, etc. needed for Public demo system into one tree
    1 /*
    2 
    3  *  This program is free software; you can redistribute it and/or modify
    4  *  it under the terms of the GNU General Public License as published by
    5  *  the Free Software Foundation; either version 2 of the License, or
    6  *  (at your option) any later version.
    7  *
    8  *  This program is distributed in the hope that it will be useful,
    9  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   10  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   11  *  GNU General Public License for more details.
   12  *
   13  *  You should have received a copy of the GNU General Public License
   14  *  along with this program; if not, write to the Free Software
   15  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA
   16  *
   17  *  Author : Richard GAYRAUD - 04 Nov 2003
   18  *           From Hewlett Packard Company.
   19  */
   20 
   21 #ifndef __SIPP__
   22 #define __SIPP__
   23 
   24 /* Std C includes */
   25 
   26 #include <stdio.h>
   27 #include <stdlib.h>
   28 #include <string.h>
   29 #include <pthread.h>
   30 #include <sys/types.h>
   31 #include <sys/socket.h>
   32 #include <netinet/in.h>
   33 #include <netinet/tcp.h>
   34 #include <sys/time.h>
   35 #include <sys/poll.h>
   36 #include <sys/resource.h>
   37 #include <fcntl.h>
   38 #include <unistd.h>
   39 #include <arpa/inet.h>
   40 #include <errno.h>
   41 #include <netdb.h>
   42 #include <ctype.h>
   43 #include <signal.h>
   44 #include <time.h>
   45 #include <vector>
   46 #include <string>
   47 #include <map>
   48 #include <math.h>
   49 
   50 #if defined(__HPUX) || defined(__SUNOS)
   51 #include <alloca.h>
   52 #endif
   53 
   54 /* Sipp includes */
   55 
   56 #include "xp_parser.h"
   57 #include "scenario.hpp"
   58 #include "screen.hpp"
   59 #include "call.hpp"
   60 #include "comp.h"
   61 #include "stat.hpp"
   62 #include "actions.hpp"
   63 #include "variables.hpp"
   64 #include "infile.hpp"
   65 /* Open SSL stuff */
   66 #ifdef _USE_OPENSSL
   67 #include "sslcommon.h"
   68 #endif
   69 
   70 
   71 #ifndef __CYGWIN
   72 #ifndef FD_SETSIZE
   73 #define FD_SETSIZE 65000
   74 #endif
   75 #else
   76 #ifndef FD_SETSIZE
   77 #define FD_SETSIZE 1024
   78 #endif
   79 #endif
   80 
   81 /*
   82  * If this files is included in the Main, then extern definitions
   83  * are removed, and the _DEFAULT macro becomes '= value;'. Else
   84  * extern definition does not contain default values assignment
   85  */
   86 
   87 #ifdef GLOBALS_FULL_DEFINITION
   88 #define extern
   89 #define _DEFVAL(value) = value
   90 #else
   91 #define _DEFVAL(value)
   92 #endif
   93 
   94 /************************** Constants **************************/
   95 
   96 #define SIPP_VERSION               20071128
   97 #define T_UDP                      0
   98 #define T_TCP                      1
   99 #define T_TLS                      2
  100 
  101 #ifdef _USE_OPENSSL
  102 #define DEFAULT_TLS_CERT           ((char *)"cacert.pem")
  103 #define DEFAULT_TLS_KEY            ((char *)"cakey.pem")
  104 #define DEFAULT_TLS_CRL            ((char *)"")
  105 #endif
  106 
  107 #define TRANSPORT_TO_STRING(p)     ((p==T_TCP) ? "TCP" : ((p==T_TLS)? "TLS" :"UDP"))
  108 
  109 #define SIPP_MAXFDS                65536
  110 #define SIPP_MAX_MSG_SIZE          65536
  111 
  112 #define MSG_RETRANS_FIRST          0
  113 #define MSG_RETRANS_RETRANSMISSION 1
  114 #define MSG_RETRANS_NEVER          2
  115 
  116 #define DISPLAY_STAT_SCREEN        1
  117 #define DISPLAY_REPARTITION_SCREEN 2
  118 #define DISPLAY_SCENARIO_SCREEN    3
  119 #define DISPLAY_VARIABLE_SCREEN    4
  120 #define DISPLAY_TDM_MAP_SCREEN     5
  121 #define DISPLAY_SECONDARY_REPARTITION_SCREEN 6
  122 
  123 #define MAX_RECV_LOOPS_PER_CYCLE   1000
  124 #define MAX_SCHED_LOOPS_PER_CYCLE  1000
  125 #define NB_UPDATE_PER_CYCLE        1
  126 
  127 #define MAX_PATH                   250
  128 
  129 #define MAX_PEER_SIZE              4096  /* 3pcc extended mode: max size of peer names */
  130 #define MAX_LOCAL_TWIN_SOCKETS     10    /*3pcc extended mode:max number of peers from which
  131                                            cmd messages are received */
  132 
  133 /******************** Default parameters ***********************/
  134 
  135 #define DEFAULT_RATE                 10.0
  136 #define DEFAULT_RATE_PERIOD_MS       1000
  137 #define DEFAULT_TRANSPORT            T_UDP
  138 #define DEFAULT_PORT                 5060
  139 #define DEFAULT_MEDIA_PORT           6000
  140 #ifdef __3PCC__
  141 #define DEFAULT_3PCC_PORT            6060
  142 #endif
  143 #define DEFAULT_SERVICE              ((char *)"service")
  144 #define DEFAULT_AUTH_PASSWORD        ((char *)"password")
  145 #define DEFAULT_REPORT_FREQ          1000
  146 #define DEFAULT_REPORT_FREQ_DUMP_LOG 60000
  147 #define DEFAULT_TIMER_RESOLUTION     1
  148 #define DEFAULT_FREQ_DUMP_RTT        200
  149 #define DEFAULT_MAX_MULTI_SOCKET     50000
  150 #define DEFAULT_CTRL_SOCKET_PORT     8888
  151 
  152 /************ User controls and command line options ***********/
  153 
  154 extern int                duration                _DEFVAL(0);
  155 extern double             rate                    _DEFVAL(DEFAULT_RATE);
  156 extern int            rate_increase           _DEFVAL(0);
  157 extern int            rate_max            _DEFVAL(0);
  158 extern int                users                   _DEFVAL(0);
  159 extern int               rate_period_ms           _DEFVAL(DEFAULT_RATE_PERIOD_MS);
  160 extern unsigned long      defl_recv_timeout       _DEFVAL(0);
  161 extern unsigned long      defl_send_timeout       _DEFVAL(0);
  162 extern unsigned long      global_timeout          _DEFVAL(0);
  163 extern int                transport               _DEFVAL(DEFAULT_TRANSPORT);
  164 extern bool               retrans_enabled         _DEFVAL(1);
  165 extern int                max_udp_retrans         _DEFVAL(UDP_MAX_RETRANS);
  166 extern int                max_invite_retrans      _DEFVAL(UDP_MAX_RETRANS_INVITE_TRANSACTION);
  167 extern int                max_non_invite_retrans  _DEFVAL(UDP_MAX_RETRANS_NON_INVITE_TRANSACTION);
  168 extern bool               default_behavior        _DEFVAL(1);
  169 extern bool               pause_msg_ign           _DEFVAL(0);
  170 extern int                auto_answer             _DEFVAL(0);
  171 extern int                multisocket             _DEFVAL(0);
  172 extern int                compression             _DEFVAL(0);
  173 extern int                peripsocket             _DEFVAL(0);
  174 extern int                peripfield              _DEFVAL(0);
  175 extern int                bind_local              _DEFVAL(0);
  176 extern void             * monosocket_comp_state   _DEFVAL(0);
  177 extern char             * service                 _DEFVAL(DEFAULT_SERVICE);
  178 extern char             * auth_password           _DEFVAL(DEFAULT_AUTH_PASSWORD);
  179 extern unsigned long      report_freq             _DEFVAL(DEFAULT_REPORT_FREQ);
  180 extern unsigned long      report_freq_dumpLog     _DEFVAL
  181                                                 (DEFAULT_REPORT_FREQ_DUMP_LOG);
  182 extern char   * stat_delimiter          _DEFVAL(";");
  183 
  184 extern bool               timeout_exit            _DEFVAL(false);
  185 
  186 extern unsigned long      report_freq_dumpRtt     _DEFVAL
  187                                                 (DEFAULT_FREQ_DUMP_RTT);
  188 
  189 extern unsigned int       max_multi_socket        _DEFVAL
  190                                                 (DEFAULT_MAX_MULTI_SOCKET);
  191 
  192 extern unsigned int       timer_resolution        _DEFVAL(DEFAULT_TIMER_RESOLUTION);
  193 extern int                max_recv_loops          _DEFVAL(MAX_RECV_LOOPS_PER_CYCLE);
  194 extern int                max_sched_loops         _DEFVAL(MAX_SCHED_LOOPS_PER_CYCLE);
  195 
  196 extern char               local_ip[40];
  197 extern char               local_ip_escaped[42];
  198 extern bool               local_ip_is_ipv6;
  199 extern int                local_port              _DEFVAL(0);
  200 extern int                control_port            _DEFVAL(0);
  201 extern int                buff_size               _DEFVAL(65535);
  202 extern int                tcp_readsize            _DEFVAL(65535);
  203 #ifdef PCAPPLAY
  204 extern int                hasMedia                _DEFVAL(0);
  205 #endif
  206 extern bool               rtp_echo_enabled        _DEFVAL(0);
  207 extern char               media_ip[40];
  208 extern char               media_ip_escaped[42];
  209 extern int                user_media_port         _DEFVAL(0);
  210 extern int                media_port              _DEFVAL(0);
  211 extern size_t             media_bufsize           _DEFVAL(2048);
  212 extern bool               media_ip_is_ipv6;
  213 extern char               remote_ip[40];
  214 extern char               remote_ip_escaped[42];
  215 extern int                remote_port             _DEFVAL(DEFAULT_PORT);
  216 extern unsigned int       pid                     _DEFVAL(0);
  217 extern int                print_all_responses     _DEFVAL(0);
  218 extern unsigned long      stop_after              _DEFVAL(0xffffffff);
  219 extern int                quitting                _DEFVAL(0);
  220 extern int                interrupt               _DEFVAL(0);
  221 extern int                paused                  _DEFVAL(0);
  222 extern int                lose_packets            _DEFVAL(0);
  223 extern double             global_lost             _DEFVAL(0.0);
  224 extern char               remote_host[255];
  225 #ifdef __3PCC__
  226 extern char               twinSippHost[255];
  227 extern char               twinSippIp[40];
  228 extern char             * master_name;
  229 extern char             * slave_number;
  230 extern int                twinSippPort            _DEFVAL(DEFAULT_3PCC_PORT);
  231 extern bool               twinSippMode            _DEFVAL(false);
  232 extern bool               extendedTwinSippMode    _DEFVAL(false);
  233 #endif
  234 
  235 extern bool               backgroundMode          _DEFVAL(false);
  236 extern bool               signalDump              _DEFVAL(false);
  237 
  238 extern int                currentScreenToDisplay  _DEFVAL
  239                                                   (DISPLAY_SCENARIO_SCREEN);
  240 extern int                currentRepartitionToDisplay  _DEFVAL(1);
  241 extern unsigned int       base_cseq               _DEFVAL(0);
  242 extern char             * auth_uri                _DEFVAL(0);
  243 extern char             * call_id_string          _DEFVAL("%u-%p@%s");
  244 extern char             **generic[100];
  245 
  246 /* TDM map */
  247 extern bool               use_tdmmap              _DEFVAL(false);
  248 extern unsigned int       tdm_map_a               _DEFVAL(0);
  249 extern unsigned int       tdm_map_b               _DEFVAL(0);
  250 extern unsigned int       tdm_map_c               _DEFVAL(0);
  251 extern unsigned int       tdm_map_x               _DEFVAL(0);
  252 extern unsigned int       tdm_map_y               _DEFVAL(0);
  253 extern unsigned int       tdm_map_z               _DEFVAL(0);
  254 extern unsigned int       tdm_map_h               _DEFVAL(0);
  255 extern bool               tdm_map[1024];
  256 
  257 #ifdef _USE_OPENSSL
  258 extern BIO                  *twinSipp_bio ;
  259 extern SSL                  *twinSipp_ssl ;
  260 extern char                 *tls_cert_name     _DEFVAL(DEFAULT_TLS_CERT) ;
  261 extern char                 *tls_key_name      _DEFVAL(DEFAULT_TLS_KEY)  ;
  262 extern char                 *tls_crl_name      _DEFVAL(DEFAULT_TLS_CRL)  ;
  263 
  264 #endif
  265 
  266 // extern field file management
  267 typedef std::map<string, FileContents *> file_map;
  268 extern file_map inFiles;
  269 extern char *ip_file _DEFVAL(NULL);
  270 extern char *default_file _DEFVAL(NULL);
  271 
  272 // free user id list
  273 extern list<int> freeUsers;
  274 
  275 //extern int      new_socket(bool P_use_ipv6, int P_type_socket, int * P_status);
  276 extern struct   sipp_socket *new_sipp_socket(bool use_ipv6, int transport);
  277 struct sipp_socket *new_sipp_call_socket(bool use_ipv6, int transport, bool *existing);
  278 struct sipp_socket *sipp_accept_socket(struct sipp_socket *accept_socket);
  279 extern int  sipp_bind_socket(struct sipp_socket *socket, struct sockaddr_storage *saddr, int *port);
  280 extern int  sipp_connect_socket(struct sipp_socket *socket, struct sockaddr_storage *dest);
  281 extern void sipp_customize_socket(struct sipp_socket *socket);
  282 extern int      delete_socket(int P_socket);
  283 extern int      min_socket          _DEFVAL(65535);
  284 extern int      select_socket       _DEFVAL(0);
  285 extern bool     socket_close        _DEFVAL(true);
  286 extern bool     test_socket         _DEFVAL(true);
  287 extern bool     maxSocketPresent    _DEFVAL(false);
  288 
  289 extern unsigned long getmilliseconds();
  290 extern unsigned long long getmicroseconds();
  291 
  292 /************************ Statistics **************************/
  293 
  294 extern unsigned long total_calls                  _DEFVAL(0);
  295 extern unsigned long last_report_calls            _DEFVAL(0);
  296 extern unsigned long nb_net_send_errors           _DEFVAL(0);
  297 extern unsigned long nb_net_cong                  _DEFVAL(0);
  298 extern unsigned long nb_net_recv_errors           _DEFVAL(0);
  299 extern bool          cpu_max                      _DEFVAL(false);
  300 extern bool          outbound_congestion          _DEFVAL(false);
  301 extern unsigned int  open_calls_peak              _DEFVAL(0);
  302 extern unsigned long open_calls_peak_time         _DEFVAL(0);
  303 extern int           open_calls_user_setting      _DEFVAL(0);
  304 extern int           nb_out_of_the_blue           _DEFVAL(0);
  305 extern int           resynch_send                 _DEFVAL(0);
  306 extern int           resynch_recv                 _DEFVAL(0);
  307 extern unsigned long rtp_pckts                    _DEFVAL(0);
  308 extern unsigned long rtp_bytes                    _DEFVAL(0);
  309 extern unsigned long rtp_pckts_pcap               _DEFVAL(0);
  310 extern unsigned long rtp_bytes_pcap               _DEFVAL(0);
  311 extern unsigned long rtp2_pckts                   _DEFVAL(0);
  312 extern unsigned long rtp2_bytes                   _DEFVAL(0);
  313 extern unsigned long rtp2_pckts_pcap              _DEFVAL(0);
  314 extern unsigned long rtp2_bytes_pcap              _DEFVAL(0);
  315 
  316 /************* Rate Control & Contexts variables **************/
  317 
  318 extern unsigned int  open_calls                   _DEFVAL(0);
  319 extern int           last_running_calls           _DEFVAL(0);
  320 extern int           last_woken_calls             _DEFVAL(0);
  321 extern int           last_paused_calls            _DEFVAL(0);
  322 extern unsigned int  open_calls_allowed           _DEFVAL(0);
  323 extern unsigned long last_rate_change_time        _DEFVAL(0);
  324 extern unsigned long last_report_time             _DEFVAL(0);
  325 extern unsigned long last_dump_time               _DEFVAL(0);
  326 extern unsigned long calls_since_last_rate_change _DEFVAL(0);
  327 
  328 /********************** Clock variables ***********************/
  329 
  330 extern unsigned long clock_tick                   _DEFVAL(0);
  331 extern unsigned long scheduling_loops             _DEFVAL(0);
  332 extern unsigned long last_timer_cycle             _DEFVAL(0);
  333 
  334 #define GET_TIME(clock)       \
  335 {                             \
  336   struct timezone tzp;        \
  337   gettimeofday (clock, &tzp); \
  338 }
  339 
  340 /*********************** Global Sockets  **********************/
  341 
  342 extern struct sipp_socket *main_socket            _DEFVAL(0);
  343 extern struct sipp_socket *tcp_multiplex          _DEFVAL(0);
  344 extern int           media_socket                 _DEFVAL(0);
  345 extern int           media_socket_video           _DEFVAL(0);
  346 
  347 extern struct        sockaddr_storage   local_sockaddr;
  348 extern struct        sockaddr_storage   localTwin_sockaddr;
  349 extern int           user_port                    _DEFVAL(0);
  350 extern char          hostname[80];
  351 extern bool          is_ipv6                      _DEFVAL(false);
  352 extern int           start_calls                  _DEFVAL(0);
  353 extern int           reset_number                 _DEFVAL(0);
  354 extern int       reset_close                  _DEFVAL(1);
  355 extern int       reset_sleep                  _DEFVAL(1000);
  356 
  357 extern struct        addrinfo * local_addr_storage;
  358 
  359 extern struct sipp_socket *twinSippSocket         _DEFVAL(NULL);
  360 extern struct sipp_socket *localTwinSippSocket    _DEFVAL(NULL);
  361 extern struct sockaddr_storage twinSipp_sockaddr;
  362 
  363 /* 3pcc extended mode */
  364 typedef struct _T_peer_infos {
  365                char                       peer_host[40];
  366                int                        peer_port;
  367                struct sockaddr_storage    peer_sockaddr;
  368                char                       peer_ip[40];
  369                struct sipp_socket         *peer_socket ;
  370                } T_peer_infos;
  371 
  372 typedef std::map<std::string, char * > peer_addr_map;
  373 extern peer_addr_map peer_addrs;
  374 typedef std::map<std::string, T_peer_infos> peer_map;
  375 extern peer_map      peers;
  376 typedef std::map<struct sipp_socket *, std::string > peer_socket_map;
  377 extern peer_socket_map peer_sockets;
  378 extern struct sipp_socket *local_sockets[MAX_LOCAL_TWIN_SOCKETS];
  379 extern int           local_nb                    _DEFVAL(0);
  380 extern int           peers_connected             _DEFVAL(0);
  381 
  382 extern struct      sockaddr_storage remote_sockaddr;
  383 extern short         use_remote_sending_addr      _DEFVAL(0);
  384 extern struct        sockaddr_storage remote_sending_sockaddr;
  385 
  386 enum E_Alter_YesNo
  387   {
  388     E_ALTER_YES=0,
  389     E_ALTER_NO
  390   };
  391 
  392 /************************** Trace Files ***********************/
  393 
  394 extern FILE * screenf                             _DEFVAL(0);
  395 extern FILE * logfile                             _DEFVAL(0);
  396 extern FILE * messagef                            _DEFVAL(0);
  397 extern FILE * shortmessagef                       _DEFVAL(0);
  398 // extern FILE * timeoutf                            _DEFVAL(0);
  399 extern bool   useMessagef                         _DEFVAL(0);
  400 extern bool   useShortMessagef                    _DEFVAL(0);
  401 extern bool   useScreenf                          _DEFVAL(0);
  402 extern bool   useLogf                             _DEFVAL(0);
  403 //extern bool   useTimeoutf                         _DEFVAL(0);
  404 extern bool   dumpInFile                          _DEFVAL(0);
  405 extern bool   dumpInRtt                           _DEFVAL(0);
  406 extern char * scenario_file;
  407 extern char * slave_cfg_file;
  408 
  409 #define TRACE_MSG(arg)      \
  410 {                           \
  411   if(messagef) {            \
  412     FILE * s = messagef;    \
  413     fprintf arg;            \
  414     fflush(messagef);       \
  415   }                         \
  416 }
  417 
  418 #define TRACE_SHORTMSG(arg)  \
  419 {                            \
  420   if(shortmessagef) {        \
  421     FILE * s = shortmessagef;\
  422     fprintf arg;             \
  423     fflush(shortmessagef);   \
  424   }                          \
  425 }
  426 
  427 #define LOG_MSG(arg)        \
  428 {                           \
  429   if(logfile) {             \
  430     FILE * s = logfile;     \
  431     fprintf arg;            \
  432     fflush(logfile);        \
  433   }                         \
  434 }
  435 
  436 // TODO: finish the -trace_timeout option implementation
  437 
  438 /* #define TRACE_TIMEOUT(arg)  \
  439 {                           \
  440   if(timeoutf) {            \
  441     FILE * s = timeoutf;    \
  442     fprintf arg;            \
  443     fflush(timeoutf);       \
  444   }                         \
  445 } */
  446 
  447 /********************* Mini-Parser Routines *******************/
  448 
  449 int get_method(char *msg);
  450 char * get_peer_tag(char *msg);
  451 unsigned long int get_cseq_value(char *msg);
  452 unsigned long get_reply_code(char *msg);
  453 
  454 /********************** Network Interfaces ********************/
  455 
  456 int send_message(int s, void ** comp_state, char * msg);
  457 #ifdef _USE_OPENSSL
  458 int send_message_tls(SSL *s, void ** comp_state, char * msg);
  459 #endif
  460 
  461 /* Socket Buffer Management. */
  462 #define NO_COPY 0
  463 #define DO_COPY 1
  464 struct socketbuf *alloc_socketbuf(char *buffer, size_t size, int copy);
  465 void free_socketbuf(struct socketbuf *socketbuf);
  466 
  467 /* These buffers lets us read past the end of the message, and then split it if
  468  * required.  This eliminates the need for reading a message octet by octet and
  469  * performing a second read for the content length. */
  470 struct socketbuf {
  471   char *buf;
  472   size_t len;
  473   size_t offset;
  474   struct socketbuf *next;
  475 };
  476 
  477 /* This is an abstraction of a socket, which provides buffers for input and
  478  * output. */
  479 struct sipp_socket {
  480   int  ss_count; /* How many users are there of this socket? */
  481 
  482   int ss_transport; /* T_TCP, T_UDP, or T_TLS. */
  483   bool ss_ipv6;
  484   bool ss_control; /* Is this a control socket? */
  485   bool ss_call_socket; /* Is this a call socket? */
  486 
  487   int ss_fd;  /* The underlying file descriptor for this socket. */
  488   void *ss_comp_state; /* The compression state. */
  489 #ifdef _USE_OPENSSL
  490   SSL *ss_ssl;  /* The underlying SSL descriptor for this socket. */
  491   BIO *ss_bio;  /* The underlying BIO descriptor for this socket. */
  492 #endif
  493   struct sockaddr_storage ss_remote_sockaddr; /* Who we are talking to. */
  494 
  495 
  496   int ss_pollidx; /* The index of this socket in our poll structures. */
  497   bool ss_congested; /* Is this socket congested? */
  498   bool ss_invalid; /* Has this socket been closed remotely? */
  499 
  500   struct socketbuf *ss_in; /* Buffered input. */
  501   size_t ss_msglen; /* Is there a complete SIP message waiting, and if so how big? */
  502   struct socketbuf *ss_out; /* Buffered output. */
  503 };
  504 
  505 /* Write data to a socket. */
  506 int write_socket(struct sipp_socket *socket, char *buffer, ssize_t len, int flags);
  507 /* Mark a socket as "bad". */
  508 void sipp_socket_invalidate(struct sipp_socket *socket);
  509 /* Actually free the socket. */
  510 void sipp_close_socket(struct sipp_socket *socket);
  511 
  512 #define WS_EAGAIN 1 /* Return EAGAIN if there is no room for writing the message. */
  513 #define WS_BUFFER 2 /* Buffer the message if there is no room for writing the message. */
  514 
  515 
  516 #if defined (__hpux) || defined (__alpha) && !defined (__FreeBSD__)
  517 #define sipp_socklen_t  int
  518 #else
  519 #define sipp_socklen_t  socklen_t
  520 #endif
  521 
  522 #define SOCK_ADDR_SIZE(a) \
  523   (((a)->ss_family == AF_INET) ? sizeof(struct sockaddr_in) \
  524                                : sizeof(struct sockaddr_in6))
  525 
  526 #if defined(__cplusplus) && defined (__hpux)
  527 #define _RCAST(type, val) (reinterpret_cast<type> (val))
  528 #else
  529 #define _RCAST(type, val) ((type)(val))
  530 #endif
  531 
  532 /********************* Utilities functions  *******************/
  533 
  534 char *strcasestr2 ( char *__haystack, char *__needle);
  535 char *get_peer_addr(char *);
  536 int get_decimal_from_hex(char hex);
  537 
  538 int reset_connections() ;
  539 int close_calls();
  540 int close_calls(struct sipp_socket *);
  541 int close_connections();
  542 int open_connections();
  543 void timeout_alarm(int);
  544 
  545 /* extended 3PCC mode */
  546 struct sipp_socket **get_peer_socket(char *);
  547 bool is_a_peer_socket(struct sipp_socket *);
  548 bool is_a_local_socket(struct sipp_socket *);
  549 void connect_to_peer (char *, int , sockaddr_storage *, char *, struct sipp_socket **);
  550 void connect_to_all_peers ();
  551 void connect_local_twin_socket(char *);
  552 void close_peer_sockets();
  553 void close_local_sockets();
  554 void free_peer_addr_map();
  555 
  556 /********************* Reset global kludge  *******************/
  557 
  558 #ifdef GLOBALS_FULL_DEFINITION
  559 #undef extern
  560 #endif
  561 
  562 #endif // __SIPP__

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.8