mld.h (2d8ad8719591fa803b0d589ed057fa46f49b7155) mld.h (89225d1ce6af3916bf32aecbe9d83f571a098588)
1#ifndef LINUX_MLD_H
2#define LINUX_MLD_H
3
4#include <linux/in6.h>
5#include <linux/icmpv6.h>
6
7/* MLDv1 Query/Report/Done */
8struct mld_msg {

--- 49 unchanged lines hidden (view full) ---

58};
59
60#define mld2q_type mld2q_hdr.icmp6_type
61#define mld2q_code mld2q_hdr.icmp6_code
62#define mld2q_cksum mld2q_hdr.icmp6_cksum
63#define mld2q_mrc mld2q_hdr.icmp6_maxdelay
64#define mld2q_resv1 mld2q_hdr.icmp6_dataun.un_data16[1]
65
1#ifndef LINUX_MLD_H
2#define LINUX_MLD_H
3
4#include <linux/in6.h>
5#include <linux/icmpv6.h>
6
7/* MLDv1 Query/Report/Done */
8struct mld_msg {

--- 49 unchanged lines hidden (view full) ---

58};
59
60#define mld2q_type mld2q_hdr.icmp6_type
61#define mld2q_code mld2q_hdr.icmp6_code
62#define mld2q_cksum mld2q_hdr.icmp6_cksum
63#define mld2q_mrc mld2q_hdr.icmp6_maxdelay
64#define mld2q_resv1 mld2q_hdr.icmp6_dataun.un_data16[1]
65
66/* Max Response Code */
66/* Max Response Code, TODO: transform this to use the below */
67#define MLDV2_MASK(value, nb) ((nb)>=32 ? (value) : ((1<<(nb))-1) & (value))
68#define MLDV2_EXP(thresh, nbmant, nbexp, value) \
69 ((value) < (thresh) ? (value) : \
70 ((MLDV2_MASK(value, nbmant) | (1<<(nbmant))) << \
71 (MLDV2_MASK((value) >> (nbmant), nbexp) + (nbexp))))
72
73#define MLDV2_MRC(value) MLDV2_EXP(0x8000, 12, 3, value)
74
67#define MLDV2_MASK(value, nb) ((nb)>=32 ? (value) : ((1<<(nb))-1) & (value))
68#define MLDV2_EXP(thresh, nbmant, nbexp, value) \
69 ((value) < (thresh) ? (value) : \
70 ((MLDV2_MASK(value, nbmant) | (1<<(nbmant))) << \
71 (MLDV2_MASK((value) >> (nbmant), nbexp) + (nbexp))))
72
73#define MLDV2_MRC(value) MLDV2_EXP(0x8000, 12, 3, value)
74
75/* RFC3810, 5.1.3. Maximum Response Code:
76 *
77 * If Maximum Response Code >= 32768, Maximum Response Code represents a
78 * floating-point value as follows:
79 *
80 * 0 1 2 3 4 5 6 7 8 9 A B C D E F
81 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
82 * |1| exp | mant |
83 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
84 */
85#define MLDV2_MRC_EXP(value) (((value) >> 12) & 0x0007)
86#define MLDV2_MRC_MAN(value) ((value) & 0x0fff)
87
88/* RFC3810, 5.1.9. QQIC (Querier's Query Interval Code):
89 *
90 * If QQIC >= 128, QQIC represents a floating-point value as follows:
91 *
92 * 0 1 2 3 4 5 6 7
93 * +-+-+-+-+-+-+-+-+
94 * |1| exp | mant |
95 * +-+-+-+-+-+-+-+-+
96 */
97#define MLDV2_QQIC_EXP(value) (((value) >> 4) & 0x07)
98#define MLDV2_QQIC_MAN(value) ((value) & 0x0f)
99
75#endif
100#endif