~ubuntu-branches/ubuntu/utopic/sip-tester/utopic

« back to all changes in this revision

Viewing changes to sipp.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2010-06-13 16:15:44 UTC
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: james.westby@ubuntu.com-20100613161544-34ke9f9x5kole5p3
Tags: upstream-3.1
ImportĀ upstreamĀ versionĀ 3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#include <ctype.h>
43
43
#include <signal.h>
44
44
#include <time.h>
45
 
#include <limits.h>
46
45
#include <vector>
47
46
#include <string>
48
47
#include <map>
68
67
#include "socketowner.hpp"
69
68
#include "call.hpp"
70
69
#include "comp.h"
71
 
#include "variables.hpp"
72
70
#include "stat.hpp"
73
71
#include "actions.hpp"
 
72
#include "variables.hpp"
74
73
#include "infile.hpp"
75
 
#include "opentask.hpp"
76
 
#include "reporttask.hpp"
77
 
#include "watchdog.hpp"
78
74
/* Open SSL stuff */
79
75
#ifdef _USE_OPENSSL
80
76
#include "sslcommon.h" 
188
184
extern bool               rate_quit               _DEFVAL(true);
189
185
extern int                users                   _DEFVAL(-1);
190
186
extern int               rate_period_ms           _DEFVAL(DEFAULT_RATE_PERIOD_MS);
191
 
extern int                sleeptime               _DEFVAL(0);
192
187
extern unsigned long      defl_recv_timeout       _DEFVAL(0);
193
188
extern unsigned long      defl_send_timeout       _DEFVAL(0);
194
189
extern unsigned long      global_timeout          _DEFVAL(0);
195
190
extern int                transport               _DEFVAL(DEFAULT_TRANSPORT);
196
191
extern bool               retrans_enabled         _DEFVAL(1);
197
 
extern int                rtcheck                 _DEFVAL(RTCHECK_FULL);
198
192
extern int                max_udp_retrans         _DEFVAL(UDP_MAX_RETRANS);
199
193
extern int                max_invite_retrans      _DEFVAL(UDP_MAX_RETRANS_INVITE_TRANSACTION);
200
194
extern int                max_non_invite_retrans  _DEFVAL(UDP_MAX_RETRANS_NON_INVITE_TRANSACTION);
201
195
extern unsigned long      default_behaviors       _DEFVAL(DEFAULT_BEHAVIOR_ALL);
202
196
extern unsigned long      deadcall_wait           _DEFVAL(DEFAULT_DEADCALL_WAIT);
203
197
extern bool               pause_msg_ign           _DEFVAL(0);
204
 
extern bool               auto_answer             _DEFVAL(false);
 
198
extern int                auto_answer             _DEFVAL(0);
205
199
extern int                multisocket             _DEFVAL(0);
206
200
extern int                compression             _DEFVAL(0);
207
201
extern int                peripsocket             _DEFVAL(0);
208
202
extern int                peripfield              _DEFVAL(0);
209
 
extern bool               bind_local              _DEFVAL(false);
 
203
extern int                bind_local              _DEFVAL(0);
210
204
extern void             * monosocket_comp_state   _DEFVAL(0);
211
205
extern char             * service                 _DEFVAL(DEFAULT_SERVICE);
212
206
extern char             * auth_password           _DEFVAL(DEFAULT_AUTH_PASSWORD);
217
211
extern char             * stat_delimiter          _DEFVAL(";");
218
212
 
219
213
extern bool               timeout_exit            _DEFVAL(false);
220
 
extern bool               timeout_error           _DEFVAL(false);
221
214
 
222
215
extern unsigned long      report_freq_dumpRtt     _DEFVAL
223
216
                                                (DEFAULT_FREQ_DUMP_RTT);
224
217
 
225
 
extern int                max_multi_socket        _DEFVAL
 
218
extern unsigned int       max_multi_socket        _DEFVAL
226
219
                                                (DEFAULT_MAX_MULTI_SOCKET);
227
220
extern bool               skip_rlimit             _DEFVAL(false);
228
221
 
252
245
extern char               remote_ip_escaped[42];
253
246
extern int                remote_port             _DEFVAL(DEFAULT_PORT);
254
247
extern unsigned int       pid                     _DEFVAL(0);
255
 
extern bool               print_all_responses     _DEFVAL(false);
 
248
extern int                print_all_responses     _DEFVAL(0);
256
249
extern unsigned long      stop_after              _DEFVAL(0xffffffff);
257
250
extern int                quitting                _DEFVAL(0);
258
251
extern int                interrupt               _DEFVAL(0);
259
 
extern bool               paused                  _DEFVAL(false);
 
252
extern int                paused                  _DEFVAL(0);
260
253
extern int                lose_packets            _DEFVAL(0);
261
254
extern double             global_lost             _DEFVAL(0.0);
262
255
extern char               remote_host[255]; 
304
297
typedef std::map<string, FileContents *> file_map;
305
298
extern file_map inFiles;
306
299
typedef std::map<string, str_int_map *> file_index;
 
300
extern file_index infIndex;
307
301
extern char *ip_file _DEFVAL(NULL);
308
302
extern char *default_file _DEFVAL(NULL);
309
303
 
359
353
extern int           last_woken_calls             _DEFVAL(0);
360
354
extern int           last_paused_calls            _DEFVAL(0);
361
355
extern unsigned int  open_calls_allowed           _DEFVAL(0);
 
356
extern unsigned long last_rate_change_time        _DEFVAL(0);
362
357
extern unsigned long last_report_time             _DEFVAL(0);
363
358
extern unsigned long last_dump_time               _DEFVAL(0);
364
359
 
368
363
extern unsigned long scheduling_loops             _DEFVAL(0);
369
364
extern unsigned long last_timer_cycle             _DEFVAL(0);
370
365
 
371
 
extern unsigned long watchdog_interval            _DEFVAL(400);
372
 
extern unsigned long watchdog_minor_threshold     _DEFVAL(500);
373
 
extern unsigned long watchdog_minor_maxtriggers   _DEFVAL(120);
374
 
extern unsigned long watchdog_major_threshold     _DEFVAL(3000);
375
 
extern unsigned long watchdog_major_maxtriggers   _DEFVAL(10);
376
 
extern unsigned long watchdog_reset               _DEFVAL(600000);
377
 
 
378
 
 
379
 
/********************* dynamic Id ************************* */
380
 
extern  int maxDynamicId    _DEFVAL(12000);  // max value for dynamicId; this value is reached 
381
 
extern  int startDynamicId  _DEFVAL(10000);  // offset for first dynamicId  FIXME:in CmdLine
382
 
extern  int stepDynamicId   _DEFVAL(4);      // step of increment for dynamicId
383
 
 
384
 
 
385
 
 
386
366
#define GET_TIME(clock)       \
387
367
{                             \
388
368
  struct timezone tzp;        \
391
371
 
392
372
/*********************** Global Sockets  **********************/
393
373
 
394
 
extern struct sipp_socket *main_socket            _DEFVAL(NULL);
395
 
extern struct sipp_socket *main_remote_socket     _DEFVAL(NULL);
396
 
extern struct sipp_socket *tcp_multiplex          _DEFVAL(NULL);
 
374
extern struct sipp_socket *main_socket            _DEFVAL(0);
 
375
extern struct sipp_socket *tcp_multiplex          _DEFVAL(0);
397
376
extern int           media_socket                 _DEFVAL(0);
398
377
extern int           media_socket_video           _DEFVAL(0);
399
378
 
404
383
extern bool          is_ipv6                      _DEFVAL(false);
405
384
 
406
385
extern int           reset_number                 _DEFVAL(0);
407
 
extern bool          reset_close                  _DEFVAL(true);
 
386
extern int           reset_close                  _DEFVAL(1);
408
387
extern int           reset_sleep                  _DEFVAL(1000);
409
388
extern bool          sendbuffer_warn              _DEFVAL(false);
410
389
/* A list of sockets pending reset. */
448
427
/************************** Trace Files ***********************/
449
428
 
450
429
extern FILE * screenf                             _DEFVAL(0);
 
430
extern FILE * logfile                             _DEFVAL(0);
 
431
extern FILE * messagef                            _DEFVAL(0);
 
432
extern FILE * shortmessagef                       _DEFVAL(0);
451
433
extern FILE * countf                              _DEFVAL(0);
452
434
// extern FILE * timeoutf                            _DEFVAL(0);
453
435
extern bool   useMessagef                         _DEFVAL(0);
454
 
extern bool   useCallDebugf                       _DEFVAL(0);
455
436
extern bool   useShortMessagef                    _DEFVAL(0);
456
437
extern bool   useScreenf                          _DEFVAL(0);
457
438
extern bool   useLogf                             _DEFVAL(0);
 
439
// should we overwrite the existing files?
 
440
extern bool   messagef_overwrite                  _DEFVAL(true);
 
441
extern bool   shortmessagef_overwrite             _DEFVAL(true);
 
442
extern bool   errorf_overwrite                    _DEFVAL(true);
 
443
extern bool   logfile_overwrite                   _DEFVAL(true);
458
444
//extern bool   useTimeoutf                         _DEFVAL(0);
459
445
extern bool   dumpInFile                          _DEFVAL(0);
460
446
extern bool   dumpInRtt                           _DEFVAL(0);
468
454
 
469
455
extern char   screen_last_error[32768];
470
456
extern char   screen_logfile[MAX_PATH]            _DEFVAL("");
471
 
 
472
 
/* Log Rotation Functions. */
473
 
struct logfile_id {
474
 
  time_t start;
475
 
  int n;
476
 
};
477
 
 
478
 
struct logfile_info {
479
 
        char *name;
480
 
        bool check;
481
 
        FILE *fptr;
482
 
        int nfiles;
483
 
        struct logfile_id *ftimes;
484
 
        char file_name[MAX_PATH];
485
 
        bool overwrite;
486
 
        bool fixedname;
487
 
        time_t starttime;
488
 
        unsigned int count;
489
 
};
490
 
 
491
 
#ifdef GLOBALS_FULL_DEFINITION
492
 
#define LOGFILE(name, s, check) \
493
 
        struct logfile_info name = { s, check, NULL, 0, NULL, "", true, false, 0, 0};
494
 
#else
495
 
#define LOGFILE(name, s, check) \
496
 
        extern struct logfile_info name;
497
 
#endif
498
 
LOGFILE(calldebug_lfi, "calldebug", true);
499
 
LOGFILE(message_lfi, "messages", true);
500
 
LOGFILE(shortmessage_lfi, "shortmessages", true);
501
 
LOGFILE(log_lfi, "logs", true);
502
 
LOGFILE(error_lfi, "errors", false);
503
 
 
 
457
extern FILE   * screen_errorf                     _DEFVAL(NULL);
 
458
 
 
459
void rotate_messagef();
 
460
void rotate_shortmessagef();
 
461
void rotate_logfile();
504
462
void rotate_errorf();
505
463
 
506
 
/* Screen/Statistics Printing Functions. */
507
 
void print_statistics(int last);
508
 
void print_count_file(FILE *f, int header);
509
 
 
510
 
 
511
464
/********************* Mini-Parser Routines *******************/
512
465
 
513
466
int get_method(char *msg);
548
501
        bool ss_ipv6;
549
502
        bool ss_control; /* Is this a control socket? */
550
503
        bool ss_call_socket; /* Is this a call socket? */
551
 
        bool ss_changed_dest; /* Has the destination changed from default. */
552
504
 
553
505
        int ss_fd;      /* The underlying file descriptor for this socket. */
554
506
        void *ss_comp_state; /* The compression state. */
631
583
extern "C" {
632
584
#endif
633
585
int TRACE_MSG(char *fmt, ...);
634
 
int TRACE_CALLDEBUG(char *fmt, ...);
635
586
int TRACE_SHORTMSG(char *fmt, ...);
636
587
int LOG_MSG(char *fmt, ...);
637
588
#ifdef __cplusplus