forked from sipwise/sipsak
-
Notifications
You must be signed in to change notification settings - Fork 1
/
transport.h
94 lines (81 loc) · 2.19 KB
/
transport.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
* $Id:$
*
* Copyright (C) 2005 Nils Ohlmeier
*
* This file belongs to sipsak, a free sip testing tool.
*
* sipsak 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.
*
* sipsak 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.
*/
#ifndef SIPSAK_TRANSPORT_H
#define SIPSAK_TRANSPORT_H
#include "sipsak.h"
#include "shoot.h"
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif /* TIME_WITH_SYS_TIME */
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
struct sipsak_sr_time {
struct timeval sendtime;
struct timeval recvtime;
struct timeval firstsendt;
struct timeval starttime;
struct timeval delaytime;
};
struct sipsak_con_data {
union {
struct sockaddr adr;
struct sockaddr_in in_adr;
struct sockaddr_in6 in6_adr;
};
int csock;
int usock;
int dontsend;
int dontrecv;
int connected;
char *buf_tmp;
int buf_tmp_size;
};
struct sipsak_counter {
int send_counter;
int retrans_r_c;
int retrans_s_c;
int randretrys;
int run;
};
struct sipsak_delay {
int retryAfter;
double big_delay;
double small_delay;
double all_delay;
};
void create_sockets(struct sipsak_con_data *cd);
void send_message(char* mes, struct sipsak_con_data *cd,
struct sipsak_counter *sc, struct sipsak_sr_time *srt);
void check_socket_error(int socket, int size);
int check_for_message(char *recv, int size, struct sipsak_con_data *cd,
struct sipsak_sr_time *srt, struct sipsak_counter *count,
struct sipsak_delay *sd);
int recv_message(char *buf, int size, int inv_trans,
struct sipsak_delay *sd, struct sipsak_sr_time *srt,
struct sipsak_counter *count, struct sipsak_con_data *cd,
struct sipsak_regexp *reg);
int set_target(struct sockaddr *adr, ip_addr_t target, int port, int socket, int connected);
#endif