2
0

tcp_ev.h 3.3 KB

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