igmp_proto.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /**
  2. * @file igmp_proto.h
  3. * @author Ambroz Bizjak <ambrop7@gmail.com>
  4. *
  5. * @section LICENSE
  6. *
  7. * This file is part of BadVPN.
  8. *
  9. * BadVPN is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2
  11. * as published by the Free Software Foundation.
  12. *
  13. * BadVPN is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along
  19. * with this program; if not, write to the Free Software Foundation, Inc.,
  20. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. *
  22. * @section DESCRIPTION
  23. *
  24. * Definitions for the IGMP protocol.
  25. */
  26. #ifndef BADVPN_MISC_IGMP_PROTO_H
  27. #define BADVPN_MISC_IGMP_PROTO_H
  28. #include <stdint.h>
  29. #define IGMP_TYPE_MEMBERSHIP_QUERY 0x11
  30. #define IGMP_TYPE_V1_MEMBERSHIP_REPORT 0x12
  31. #define IGMP_TYPE_V2_MEMBERSHIP_REPORT 0x16
  32. #define IGMP_TYPE_V3_MEMBERSHIP_REPORT 0x22
  33. #define IGMP_TYPE_V2_LEAVE_GROUP 0x17
  34. #define IGMP_RECORD_TYPE_MODE_IS_INCLUDE 1
  35. #define IGMP_RECORD_TYPE_MODE_IS_EXCLUDE 2
  36. #define IGMP_RECORD_TYPE_CHANGE_TO_INCLUDE_MODE 3
  37. #define IGMP_RECORD_TYPE_CHANGE_TO_EXCLUDE_MODE 4
  38. struct igmp_source {
  39. uint32_t addr;
  40. } __attribute__((packed));
  41. struct igmp_base {
  42. uint8_t type;
  43. uint8_t max_resp_code;
  44. uint16_t checksum;
  45. } __attribute__((packed));
  46. struct igmp_v3_query_extra {
  47. uint32_t group;
  48. uint8_t reserved4_suppress1_qrv3;
  49. uint8_t qqic;
  50. uint16_t number_of_sources;
  51. } __attribute__((packed));
  52. struct igmp_v3_report_extra {
  53. uint16_t reserved;
  54. uint16_t number_of_group_records;
  55. } __attribute__((packed));
  56. struct igmp_v3_report_record {
  57. uint8_t type;
  58. uint8_t aux_data_len;
  59. uint16_t number_of_sources;
  60. uint32_t group;
  61. } __attribute__((packed));
  62. struct igmp_v2_extra {
  63. uint32_t group;
  64. } __attribute__((packed));
  65. #endif