4 * Copyright (C) 2009 iptelorg GmbH
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 * tcp_ev.h - tcp events
24 * 2009-04-09 initial version (andrei)
36 /** a connect attempt got a RST from the peer
37 * Note: the RST might be for the connect() itself (SYN), for the first
38 * send() attempt on the connection (unlikely) or received immediately after
39 * the connect() succeeded (unlikely, the remote host would have a very small
40 * window after accepting a connection to send a RST before it receives
43 * @param err - if 0 it should be ignored (no corresp. libc error), if non-0
44 * it will contain the errno.
45 * @param lip - pointer to an ip_addr containing the local ip
46 * or 0 if dynamic (WARNING can be 0).
47 * @param lport - pointer to an ip_addr containing the local port or 0
49 * @param dst - pointer to a sockaddr_union containing the destination.
50 * @param proto - protocol used
52 #define TCP_EV_CONNECT_RST(err, lip, lport, dst, proto) \
53 LOG(L_ERR, "connect %s failed (RST) %s\n", \
54 su2a(dst, sizeof(*(dst))), (err)?strerror(err):"")
56 /** a connect failed because the remote host/network is unreachable. */
57 #define TCP_EV_CONNECT_UNREACHABLE(err, lip, lport, dst, proto) \
58 LOG(L_ERR, "connect %s failed (unreachable) %s\n", \
59 su2a(dst, sizeof(*(dst))), (err)?strerror(err):"")
61 /** a connect attempt did timeout. */
62 #define TCP_EV_CONNECT_TIMEOUT(err, lip, lport, dst, proto) \
63 LOG(L_ERR, "connect %s failed (timeout) %s\n", \
64 su2a(dst, sizeof(*(dst))), (err)?strerror(err):"")
66 /** a connect attempt failed because the local ports are exhausted. */
67 #define TCP_EV_CONNECT_NO_MORE_PORTS(err, lip, lport, dst, proto) \
68 LOG(L_ERR, "connect %s failed (no more ports) %s\n", \
69 su2a(dst, sizeof(*(dst))), (err)?strerror(err):"")
71 /** a connect attempt failed for some unknown reason. */
72 #define TCP_EV_CONNECT_ERR(err, lip, lport, dst, proto) \
73 LOG(L_ERR, "connect %s failed %s\n", \
74 su2a(dst, sizeof(*(dst))), (err)?strerror(err):"")
77 /** send failed due to timeout.
78 * @param err - if 0 it should be ignored (no corresp. libc error), if non-0
79 * it will contain the errno.
80 * @param rcv - pointer to rcv_info structure
83 #define TCP_EV_SEND_TIMEOUT(err, rcv)
85 /** send failed due to buffering capacity being exceeded.
86 * (only in async mode) */
87 #define TCP_EV_SENDQ_FULL(err, rcv)
89 /** established connection closed for being idle too long. */
90 #define TCP_EV_IDLE_CONN_CLOSED(err, rcv)
97 /* vi: set ts=4 sw=4 tw=79:ai:cindent: */