sctp_ev.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2009 iptelorg GmbH
  5. *
  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.
  9. *
  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.
  17. */
  18. /*
  19. * sctp_ev.h - sctp events
  20. */
  21. /*
  22. * History:
  23. * --------
  24. * 2009-04-28 initial version (andrei)
  25. */
  26. #ifndef __sctp_ev_h
  27. #define __sctp_ev_h
  28. #include <errno.h>
  29. #include <string.h>
  30. #ifndef USE_SCTP_EV
  31. #define SCTP_EV_ASSOC_CHANGE(lip, lport, src, reason, state)
  32. #define SCTP_EV_PEER_ADDR_CHANGE(lip, lport, src, reason, state, addr_su)
  33. #define SCTP_EV_REMOTE_ERROR(lip, lport, src, err)
  34. #define SCTP_EV_SEND_FAILED(lip, lport, src, err)
  35. #define SCTP_EV_SHUTDOWN_EVENT(lip, lport, src)
  36. #define SCTP_EV_SENDER_DRY_EVENT(lip, lport, src)
  37. #else /* USE_SCTP_EV */
  38. #include "ip_addr.h"
  39. /** an association has either been opened or closed.
  40. * called for each SCTP_ASSOC_CHANGE event.
  41. *
  42. * @param err - if 0 it should be ignored (no corresp. libc error), if non-0
  43. * it will contain the errno.
  44. * @param lip - pointer to an ip_addr containing the local ip
  45. * or 0 if dynamic (WARNING can be 0).
  46. * @param lport - pointer to an ip_addr containing the local port or 0
  47. * if unknown/dynamic.
  48. * @param src - pointer to a sockaddr_union containing the src.
  49. * @param proto - protocol used
  50. */
  51. #define SCTP_EV_ASSOC_CHANGE(lip, lport, src, reason, state) \
  52. DBG("SCTP_ASSOC_CHANGE from %s on %s:%d: %s\n", \
  53. su2a(src, sizeof(*(src))), ip_addr2a(lip), lport, reason)
  54. /** an address part of an assoc. changed state.
  55. * called for the SCTP_PEER_ADDR_CHANGE event.*/
  56. #define SCTP_EV_PEER_ADDR_CHANGE(lip, lport, src, reason, state, addr_su) \
  57. DBG("SCTP_PEER_ADDR_CHANGE from %s on %s:%d: %s\n", \
  58. su2a(src, sizeof(*(src))), ip_addr2a(lip), lport, reason)
  59. /** remote operation error from the peer.
  60. * called for the SCTP_REMOTE_ERROR event.*/
  61. #define SCTP_EV_REMOTE_ERROR(lip, lport, src, err) \
  62. DBG("SCTP_REMOTE_ERROR from %s on %s:%d: %d\n", \
  63. su2a(src, sizeof(*(src))), ip_addr2a(lip), lport, err)
  64. /** send failed.
  65. * called for the SCTP_SEND_FAILED event.*/
  66. #define SCTP_EV_SEND_FAILED(lip, lport, src, err) \
  67. DBG("SCTP_SEND_FAILED from %s on %s:%d: %d\n", \
  68. su2a(src, sizeof(*(src))), ip_addr2a(lip), lport, err)
  69. /** the peer has sent a shutdown.
  70. * called for the SCTP_SHUTDOWN_EVENT event.*/
  71. #define SCTP_EV_SHUTDOWN_EVENT(lip, lport, src) \
  72. DBG("SCTP_SHUTDOWN_EVENT from %s on %s:%d\n", \
  73. su2a(src, sizeof(*(src))), ip_addr2a(lip), lport)
  74. /** kernel has finished sending all the queued data.
  75. * called for the SCTP_SENDER_DRY_EVENT event.*/
  76. #define SCTP_EV_SENDER_DRY_EVENT(lip, lport, src) \
  77. DBG("SCTP_SENDER_DRY_EVENT from %s on %s:%d\n", \
  78. su2a(src, sizeof(*(src))), ip_addr2a(lip), lport)
  79. #endif /* USE_SCTP_EV */
  80. #endif /*__sctp_ev_h*/
  81. /* vi: set ts=4 sw=4 tw=79:ai:cindent: */