igmp.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /* Copyright (C) 1997-2020 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <https://www.gnu.org/licenses/>. */
  14. #ifndef _NETINET_IGMP_H
  15. #define _NETINET_IGMP_H 1
  16. #include <sys/cdefs.h>
  17. #include <sys/types.h>
  18. #ifdef __USE_MISC
  19. #include <netinet/in.h>
  20. __BEGIN_DECLS
  21. /*
  22. * Copyright (c) 1988 Stephen Deering.
  23. * Copyright (c) 1992, 1993
  24. * The Regents of the University of California. All rights reserved.
  25. *
  26. * This code is derived from software contributed to Berkeley by
  27. * Stephen Deering of Stanford University.
  28. *
  29. * Redistribution and use in source and binary forms, with or without
  30. * modification, are permitted provided that the following conditions
  31. * are met:
  32. * 1. Redistributions of source code must retain the above copyright
  33. * notice, this list of conditions and the following disclaimer.
  34. * 2. Redistributions in binary form must reproduce the above copyright
  35. * notice, this list of conditions and the following disclaimer in the
  36. * documentation and/or other materials provided with the distribution.
  37. * 4. Neither the name of the University nor the names of its contributors
  38. * may be used to endorse or promote products derived from this software
  39. * without specific prior written permission.
  40. *
  41. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  42. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  43. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  44. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  45. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  46. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  47. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  48. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  49. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  50. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  51. * SUCH DAMAGE.
  52. *
  53. * @(#)igmp.h 8.1 (Berkeley) 6/10/93
  54. * $FreeBSD$
  55. */
  56. struct igmp {
  57. uint8_t igmp_type; /* IGMP type */
  58. uint8_t igmp_code; /* routing code */
  59. uint16_t igmp_cksum; /* checksum */
  60. struct in_addr igmp_group; /* group address */
  61. };
  62. #define IGMP_MINLEN 8
  63. /*
  64. * Message types, including version number.
  65. */
  66. #define IGMP_MEMBERSHIP_QUERY 0x11 /* membership query */
  67. #define IGMP_V1_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */
  68. #define IGMP_V2_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */
  69. #define IGMP_V2_LEAVE_GROUP 0x17 /* Leave-group message */
  70. #define IGMP_DVMRP 0x13 /* DVMRP routing message */
  71. #define IGMP_PIM 0x14 /* PIM routing message */
  72. #define IGMP_TRACE 0x15
  73. #define IGMP_MTRACE_RESP 0x1e /* traceroute resp.(to sender)*/
  74. #define IGMP_MTRACE 0x1f /* mcast traceroute messages */
  75. #define IGMP_MRDISC_ADV 0x30 /* From RFC4286. */
  76. #define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */
  77. /* query (in seconds) according */
  78. /* to RFC1112 */
  79. #define IGMP_TIMER_SCALE 10 /* denotes that the igmp code field */
  80. /* specifies time in 10th of seconds*/
  81. /*
  82. * States for the IGMP v2 state table.
  83. */
  84. #define IGMP_DELAYING_MEMBER 1
  85. #define IGMP_IDLE_MEMBER 2
  86. #define IGMP_LAZY_MEMBER 3
  87. #define IGMP_SLEEPING_MEMBER 4
  88. #define IGMP_AWAKENING_MEMBER 5
  89. /*
  90. * States for IGMP router version cache.
  91. */
  92. #define IGMP_v1_ROUTER 1
  93. #define IGMP_v2_ROUTER 2
  94. /*
  95. * The following four defininitions are for backwards compatibility.
  96. * They should be removed as soon as all applications are updated to
  97. * use the new constant names.
  98. */
  99. #define IGMP_HOST_MEMBERSHIP_QUERY IGMP_MEMBERSHIP_QUERY
  100. #define IGMP_HOST_MEMBERSHIP_REPORT IGMP_V1_MEMBERSHIP_REPORT
  101. #define IGMP_HOST_NEW_MEMBERSHIP_REPORT IGMP_V2_MEMBERSHIP_REPORT
  102. #define IGMP_HOST_LEAVE_MESSAGE IGMP_V2_LEAVE_GROUP
  103. __END_DECLS
  104. #endif
  105. #endif /* netinet/igmp.h */