igmp.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * Linux NET3: Internet Group Management Protocol [IGMP]
  3. *
  4. * Authors:
  5. * Alan Cox <alan@lxorguk.ukuu.org.uk>
  6. *
  7. * Extended to talk the BSD extended IGMP protocol of mrouted 3.6
  8. *
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * as published by the Free Software Foundation; either version
  13. * 2 of the License, or (at your option) any later version.
  14. */
  15. #ifndef _UAPI_LINUX_IGMP_H
  16. #define _UAPI_LINUX_IGMP_H
  17. #include <linux/types.h>
  18. #include <asm/byteorder.h>
  19. /*
  20. * IGMP protocol structures
  21. */
  22. /*
  23. * Header in on cable format
  24. */
  25. struct igmphdr {
  26. __u8 type;
  27. __u8 code; /* For newer IGMP */
  28. __sum16 csum;
  29. __be32 group;
  30. };
  31. /* V3 group record types [grec_type] */
  32. #define IGMPV3_MODE_IS_INCLUDE 1
  33. #define IGMPV3_MODE_IS_EXCLUDE 2
  34. #define IGMPV3_CHANGE_TO_INCLUDE 3
  35. #define IGMPV3_CHANGE_TO_EXCLUDE 4
  36. #define IGMPV3_ALLOW_NEW_SOURCES 5
  37. #define IGMPV3_BLOCK_OLD_SOURCES 6
  38. struct igmpv3_grec {
  39. __u8 grec_type;
  40. __u8 grec_auxwords;
  41. __be16 grec_nsrcs;
  42. __be32 grec_mca;
  43. __be32 grec_src[0];
  44. };
  45. struct igmpv3_report {
  46. __u8 type;
  47. __u8 resv1;
  48. __be16 csum;
  49. __be16 resv2;
  50. __be16 ngrec;
  51. struct igmpv3_grec grec[0];
  52. };
  53. struct igmpv3_query {
  54. __u8 type;
  55. __u8 code;
  56. __be16 csum;
  57. __be32 group;
  58. #if defined(__LITTLE_ENDIAN_BITFIELD)
  59. __u8 qrv:3,
  60. suppress:1,
  61. resv:4;
  62. #elif defined(__BIG_ENDIAN_BITFIELD)
  63. __u8 resv:4,
  64. suppress:1,
  65. qrv:3;
  66. #else
  67. #error "Please fix <asm/byteorder.h>"
  68. #endif
  69. __u8 qqic;
  70. __be16 nsrcs;
  71. __be32 srcs[0];
  72. };
  73. #define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */
  74. #define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */
  75. #define IGMP_DVMRP 0x13 /* DVMRP routing */
  76. #define IGMP_PIM 0x14 /* PIM routing */
  77. #define IGMP_TRACE 0x15
  78. #define IGMPV2_HOST_MEMBERSHIP_REPORT 0x16 /* V2 version of 0x12 */
  79. #define IGMP_HOST_LEAVE_MESSAGE 0x17
  80. #define IGMPV3_HOST_MEMBERSHIP_REPORT 0x22 /* V3 version of 0x12 */
  81. #define IGMP_MTRACE_RESP 0x1e
  82. #define IGMP_MTRACE 0x1f
  83. /*
  84. * Use the BSD names for these for compatibility
  85. */
  86. #define IGMP_DELAYING_MEMBER 0x01
  87. #define IGMP_IDLE_MEMBER 0x02
  88. #define IGMP_LAZY_MEMBER 0x03
  89. #define IGMP_SLEEPING_MEMBER 0x04
  90. #define IGMP_AWAKENING_MEMBER 0x05
  91. #define IGMP_MINLEN 8
  92. #define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */
  93. /* query (in seconds) */
  94. #define IGMP_TIMER_SCALE 10 /* denotes that the igmphdr->timer field */
  95. /* specifies time in 10th of seconds */
  96. #define IGMP_AGE_THRESHOLD 400 /* If this host don't hear any IGMP V1 */
  97. /* message in this period of time, */
  98. /* revert to IGMP v2 router. */
  99. #define IGMP_ALL_HOSTS htonl(0xE0000001L)
  100. #define IGMP_ALL_ROUTER htonl(0xE0000002L)
  101. #define IGMPV3_ALL_MCR htonl(0xE0000016L)
  102. #define IGMP_LOCAL_GROUP htonl(0xE0000000L)
  103. #define IGMP_LOCAL_GROUP_MASK htonl(0xFFFFFF00L)
  104. /*
  105. * struct for keeping the multicast list in
  106. */
  107. #endif /* _UAPI_LINUX_IGMP_H */