pim_igmpv3.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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_IGMPV3_H
  19. #define PIM_IGMPV3_H
  20. #include <zebra.h>
  21. #include "if.h"
  22. #define IGMP_V3_CHECKSUM_OFFSET (2)
  23. #define IGMP_V3_REPORT_NUMGROUPS_OFFSET (6)
  24. #define IGMP_V3_REPORT_GROUPPRECORD_OFFSET (8)
  25. #define IGMP_V3_NUMSOURCES_OFFSET (10)
  26. #define IGMP_V3_SOURCES_OFFSET (12)
  27. /* GMI: Group Membership Interval */
  28. #define PIM_IGMP_GMI_MSEC(qrv,qqi,qri_dsec) ((qrv) * (1000 * (qqi)) + 100 * (qri_dsec))
  29. /* OQPI: Other Querier Present Interval */
  30. #define PIM_IGMP_OQPI_MSEC(qrv,qqi,qri_dsec) ((qrv) * (1000 * (qqi)) + 100 * ((qri_dsec) >> 1))
  31. /* SQI: Startup Query Interval */
  32. #define PIM_IGMP_SQI(qi) (((qi) < 4) ? 1 : ((qi) >> 2))
  33. /* LMQT: Last Member Query Time */
  34. #define PIM_IGMP_LMQT_MSEC(lmqi_dsec, lmqc) ((lmqc) * (100 * (lmqi_dsec)))
  35. /* OHPI: Older Host Present Interval */
  36. #define PIM_IGMP_OHPI_DSEC(qrv,qqi,qri_dsec) ((qrv) * (10 * (qqi)) + (qri_dsec))
  37. void igmp_group_reset_gmi(struct igmp_group *group);
  38. void igmp_source_reset_gmi(struct igmp_sock *igmp,
  39. struct igmp_group *group,
  40. struct igmp_source *source);
  41. void igmp_source_free(struct igmp_source *source);
  42. void igmp_source_delete(struct igmp_source *source);
  43. void igmp_source_delete_expired(struct list *source_list);
  44. int igmp_group_compat_mode(const struct igmp_sock *igmp,
  45. const struct igmp_group *group);
  46. void igmpv3_report_isin(struct igmp_sock *igmp, struct in_addr from,
  47. struct in_addr group_addr,
  48. int num_sources, struct in_addr *sources);
  49. void igmpv3_report_isex(struct igmp_sock *igmp, struct in_addr from,
  50. struct in_addr group_addr,
  51. int num_sources, struct in_addr *sources);
  52. void igmpv3_report_toin(struct igmp_sock *igmp, struct in_addr from,
  53. struct in_addr group_addr,
  54. int num_sources, struct in_addr *sources);
  55. void igmpv3_report_toex(struct igmp_sock *igmp, struct in_addr from,
  56. struct in_addr group_addr,
  57. int num_sources, struct in_addr *sources);
  58. void igmpv3_report_allow(struct igmp_sock *igmp, struct in_addr from,
  59. struct in_addr group_addr,
  60. int num_sources, struct in_addr *sources);
  61. void igmpv3_report_block(struct igmp_sock *igmp, struct in_addr from,
  62. struct in_addr group_addr,
  63. int num_sources, struct in_addr *sources);
  64. void igmp_group_timer_lower_to_lmqt(struct igmp_group *group);
  65. void igmp_source_timer_lower_to_lmqt(struct igmp_source *source);
  66. struct igmp_source *igmp_find_source_by_addr(struct igmp_group *group,
  67. struct in_addr src_addr);
  68. void pim_igmp_send_membership_query(struct igmp_group *group,
  69. int fd,
  70. const char *ifname,
  71. char *query_buf,
  72. int query_buf_size,
  73. int num_sources,
  74. struct in_addr dst_addr,
  75. struct in_addr group_addr,
  76. int query_max_response_time_dsec,
  77. uint8_t s_flag,
  78. uint8_t querier_robustness_variable,
  79. uint16_t querier_query_interval);
  80. #endif /* PIM_IGMPV3_H */