File: tcp_ev.h

package info (click to toggle)
kamailio 4.2.0-2%2Bdeb8u3
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 56,276 kB
  • sloc: ansic: 552,836; xml: 166,484; sh: 8,659; makefile: 7,676; sql: 6,235; perl: 3,487; yacc: 3,428; python: 1,457; cpp: 1,219; php: 1,047; java: 449; pascal: 194; cs: 40; awk: 27
file content (97 lines) | stat: -rw-r--r-- 3,420 bytes parent folder | download | duplicates (2)
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
95
96
97
/* 
 * $Id$
 * 
 * Copyright (C) 2009 iptelorg GmbH
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */
/*
 * tcp_ev.h - tcp events
 */
/*
 * History:
 * --------
 *  2009-04-09  initial version (andrei)
*/

#ifndef __tcp_ev_h
#define __tcp_ev_h

#include <errno.h>
#include <string.h>

#include "ip_addr.h"


/** a connect attempt got a RST from the peer
 * Note: the RST might be for the connect() itself (SYN), for the first
 *  send() attempt on the connection (unlikely) or received immediately after
 * the connect() succeeded (unlikely, the remote host would have a very small
 *  window after accepting a connection to send a RST before it receives
 * any data).
 *
 * @param err - if 0 it should be ignored (no corresp. libc error), if non-0
 *                it will contain the errno.
 * @param lip   - pointer to an ip_addr containing the local ip
 *                   or 0 if dynamic (WARNING can be 0).
 * @param lport - pointer to an ip_addr containing the local port or 0
 *                   if unknown/dynamic.
 * @param dst   - pointer to a sockaddr_union containing the destination.
 * @param proto - protocol used
 */
#define TCP_EV_CONNECT_RST(err, lip, lport, dst, proto) \
	LM_ERR("connect %s failed (RST) %s\n", \
			su2a(dst, sizeof(*(dst))), (err)?strerror(err):"")

/** a connect failed because the remote host/network is unreachable. */
#define TCP_EV_CONNECT_UNREACHABLE(err, lip, lport, dst, proto) \
	LM_ERR("connect %s failed (unreachable) %s\n", \
			su2a(dst, sizeof(*(dst))), (err)?strerror(err):"")

/** a connect attempt did timeout. */
#define TCP_EV_CONNECT_TIMEOUT(err, lip, lport, dst, proto) \
	LM_ERR("connect %s failed (timeout) %s\n", \
			su2a(dst, sizeof(*(dst))), (err)?strerror(err):"")

/** a connect attempt failed because the local ports are exhausted. */
#define TCP_EV_CONNECT_NO_MORE_PORTS(err, lip, lport, dst, proto) \
	LM_ERR("connect %s failed (no more ports) %s\n", \
			su2a(dst, sizeof(*(dst))), (err)?strerror(err):"")

/** a connect attempt failed for some unknown reason.  */
#define TCP_EV_CONNECT_ERR(err, lip, lport, dst, proto) \
	LM_ERR("connect %s failed %s\n", \
			su2a(dst, sizeof(*(dst))), (err)?strerror(err):"")


/** send failed due to timeout.
 * @param err   - if 0 it should be ignored (no corresp. libc error), if non-0
 *                it will contain the errno.
 * @param rcv   - pointer to rcv_info structure
 * 
 */
#define TCP_EV_SEND_TIMEOUT(err, rcv)

/** send failed due to buffering capacity being exceeded.
  * (only in async mode) */
#define TCP_EV_SENDQ_FULL(err, rcv)

/** established connection closed for being idle too long. */
#define TCP_EV_IDLE_CONN_CLOSED(err, rcv)




#endif /*__tcp_ev_h*/

/* vi: set ts=4 sw=4 tw=79:ai:cindent: */