pim_pim.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. PIM for Quagga
  3. Copyright (C) 2008 Everton da Silva Marques
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; see the file COPYING; if not, write to the
  14. Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
  15. MA 02110-1301 USA
  16. $QuaggaId: $Format:%an, %ai, %h$ $
  17. */
  18. #ifndef PIM_PIM_H
  19. #define PIM_PIM_H
  20. #include <zebra.h>
  21. #include "if.h"
  22. #define PIM_PIM_BUFSIZE_READ (20000)
  23. #define PIM_PIM_BUFSIZE_WRITE (20000)
  24. #define PIM_NEXTHOP_IFINDEX_TAB_SIZE (20)
  25. #define PIM_DEFAULT_HELLO_PERIOD (30) /* seconds, RFC 4601: 4.11 */
  26. #define PIM_DEFAULT_TRIGGERED_HELLO_DELAY (5) /* seconds, RFC 4601: 4.11 */
  27. #define PIM_DEFAULT_DR_PRIORITY (1) /* RFC 4601: 4.3.1 */
  28. #define PIM_DEFAULT_PROPAGATION_DELAY_MSEC (500) /* RFC 4601: 4.11. Timer Values */
  29. #define PIM_DEFAULT_OVERRIDE_INTERVAL_MSEC (2500) /* RFC 4601: 4.11. Timer Values */
  30. #define PIM_DEFAULT_CAN_DISABLE_JOIN_SUPPRESSION (0) /* boolean */
  31. #define PIM_DEFAULT_T_PERIODIC (60) /* RFC 4601: 4.11. Timer Values */
  32. #define PIM_MSG_TYPE_HELLO (0)
  33. #define PIM_MSG_TYPE_REGISTER (1)
  34. #define PIM_MSG_TYPE_REG_STOP (2)
  35. #define PIM_MSG_TYPE_JOIN_PRUNE (3)
  36. #define PIM_MSG_TYPE_BOOTSTRAP (4)
  37. #define PIM_MSG_TYPE_ASSERT (5)
  38. #define PIM_MSG_TYPE_GRAFT (6)
  39. #define PIM_MSG_TYPE_GRAFT_ACK (7)
  40. #define PIM_MSG_TYPE_CANDIDATE (8)
  41. #define PIM_MSG_HDR_OFFSET_VERSION(pim_msg) (pim_msg)
  42. #define PIM_MSG_HDR_OFFSET_TYPE(pim_msg) (pim_msg)
  43. #define PIM_MSG_HDR_OFFSET_RESERVED(pim_msg) (((char *)(pim_msg)) + 1)
  44. #define PIM_MSG_HDR_OFFSET_CHECKSUM(pim_msg) (((char *)(pim_msg)) + 2)
  45. #define PIM_MSG_HDR_GET_VERSION(pim_msg) ((*(uint8_t*) PIM_MSG_HDR_OFFSET_VERSION(pim_msg)) >> 4)
  46. #define PIM_MSG_HDR_GET_TYPE(pim_msg) ((*(uint8_t*) PIM_MSG_HDR_OFFSET_TYPE(pim_msg)) & 0xF)
  47. #define PIM_MSG_HDR_GET_CHECKSUM(pim_msg) (*(uint16_t*) PIM_MSG_HDR_OFFSET_CHECKSUM(pim_msg))
  48. void pim_ifstat_reset(struct interface *ifp);
  49. void pim_sock_reset(struct interface *ifp);
  50. int pim_sock_add(struct interface *ifp);
  51. void pim_sock_delete(struct interface *ifp, const char *delete_message);
  52. void pim_hello_restart_now(struct interface *ifp);
  53. void pim_hello_restart_triggered(struct interface *ifp);
  54. int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len);
  55. int pim_msg_send(int fd,
  56. struct in_addr dst,
  57. uint8_t *pim_msg,
  58. int pim_msg_size,
  59. const char *ifname);
  60. #endif /* PIM_PIM_H */