Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
0002 /*
0003  *  Linux NET3: Internet Group Management Protocol  [IGMP]
0004  *
0005  *  Authors:
0006  *      Alan Cox <alan@lxorguk.ukuu.org.uk>
0007  *
0008  *  Extended to talk the BSD extended IGMP protocol of mrouted 3.6
0009  *
0010  *
0011  *  This program is free software; you can redistribute it and/or
0012  *  modify it under the terms of the GNU General Public License
0013  *  as published by the Free Software Foundation; either version
0014  *  2 of the License, or (at your option) any later version.
0015  */
0016 
0017 #ifndef _UAPI_LINUX_IGMP_H
0018 #define _UAPI_LINUX_IGMP_H
0019 
0020 #include <linux/types.h>
0021 #include <asm/byteorder.h>
0022 
0023 /*
0024  *  IGMP protocol structures
0025  */
0026 
0027 /*
0028  *  Header in on cable format
0029  */
0030 
0031 struct igmphdr {
0032     __u8 type;
0033     __u8 code;      /* For newer IGMP */
0034     __sum16 csum;
0035     __be32 group;
0036 };
0037 
0038 /* V3 group record types [grec_type] */
0039 #define IGMPV3_MODE_IS_INCLUDE      1
0040 #define IGMPV3_MODE_IS_EXCLUDE      2
0041 #define IGMPV3_CHANGE_TO_INCLUDE    3
0042 #define IGMPV3_CHANGE_TO_EXCLUDE    4
0043 #define IGMPV3_ALLOW_NEW_SOURCES    5
0044 #define IGMPV3_BLOCK_OLD_SOURCES    6
0045 
0046 struct igmpv3_grec {
0047     __u8    grec_type;
0048     __u8    grec_auxwords;
0049     __be16  grec_nsrcs;
0050     __be32  grec_mca;
0051     __be32  grec_src[];
0052 };
0053 
0054 struct igmpv3_report {
0055     __u8 type;
0056     __u8 resv1;
0057     __sum16 csum;
0058     __be16 resv2;
0059     __be16 ngrec;
0060     struct igmpv3_grec grec[];
0061 };
0062 
0063 struct igmpv3_query {
0064     __u8 type;
0065     __u8 code;
0066     __sum16 csum;
0067     __be32 group;
0068 #if defined(__LITTLE_ENDIAN_BITFIELD)
0069     __u8 qrv:3,
0070          suppress:1,
0071          resv:4;
0072 #elif defined(__BIG_ENDIAN_BITFIELD)
0073     __u8 resv:4,
0074          suppress:1,
0075          qrv:3;
0076 #else
0077 #error "Please fix <asm/byteorder.h>"
0078 #endif
0079     __u8 qqic;
0080     __be16 nsrcs;
0081     __be32 srcs[];
0082 };
0083 
0084 #define IGMP_HOST_MEMBERSHIP_QUERY  0x11    /* From RFC1112 */
0085 #define IGMP_HOST_MEMBERSHIP_REPORT 0x12    /* Ditto */
0086 #define IGMP_DVMRP          0x13    /* DVMRP routing */
0087 #define IGMP_PIM            0x14    /* PIM routing */
0088 #define IGMP_TRACE          0x15
0089 #define IGMPV2_HOST_MEMBERSHIP_REPORT   0x16    /* V2 version of 0x12 */
0090 #define IGMP_HOST_LEAVE_MESSAGE     0x17
0091 #define IGMPV3_HOST_MEMBERSHIP_REPORT   0x22    /* V3 version of 0x12 */
0092 
0093 #define IGMP_MTRACE_RESP        0x1e
0094 #define IGMP_MTRACE         0x1f
0095 
0096 #define IGMP_MRDISC_ADV         0x30    /* From RFC4286 */
0097 
0098 /*
0099  *  Use the BSD names for these for compatibility
0100  */
0101 
0102 #define IGMP_DELAYING_MEMBER        0x01
0103 #define IGMP_IDLE_MEMBER        0x02
0104 #define IGMP_LAZY_MEMBER        0x03
0105 #define IGMP_SLEEPING_MEMBER        0x04
0106 #define IGMP_AWAKENING_MEMBER       0x05
0107 
0108 #define IGMP_MINLEN         8
0109 
0110 #define IGMP_MAX_HOST_REPORT_DELAY  10  /* max delay for response to */
0111                         /* query (in seconds)   */
0112 
0113 #define IGMP_TIMER_SCALE        10  /* denotes that the igmphdr->timer field */
0114                         /* specifies time in 10th of seconds     */
0115 
0116 #define IGMP_AGE_THRESHOLD      400 /* If this host don't hear any IGMP V1  */
0117                         /* message in this period of time,  */
0118                         /* revert to IGMP v2 router.        */
0119 
0120 #define IGMP_ALL_HOSTS      htonl(0xE0000001L)
0121 #define IGMP_ALL_ROUTER     htonl(0xE0000002L)
0122 #define IGMPV3_ALL_MCR      htonl(0xE0000016L)
0123 #define IGMP_LOCAL_GROUP    htonl(0xE0000000L)
0124 #define IGMP_LOCAL_GROUP_MASK   htonl(0xFFFFFF00L)
0125 
0126 /*
0127  * struct for keeping the multicast list in
0128  */
0129 
0130 #endif /* _UAPI_LINUX_IGMP_H */