Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/in6_var.h
Show First 20 Lines • Show All 596 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* IPv6 multicast PCB-layer group filter descriptor. | * IPv6 multicast PCB-layer group filter descriptor. | ||||
*/ | */ | ||||
struct in6_mfilter { | struct in6_mfilter { | ||||
struct ip6_msource_tree im6f_sources; /* source list for (S,G) */ | struct ip6_msource_tree im6f_sources; /* source list for (S,G) */ | ||||
u_long im6f_nsrc; /* # of source entries */ | u_long im6f_nsrc; /* # of source entries */ | ||||
uint8_t im6f_st[2]; /* state before/at commit */ | uint8_t im6f_st[2]; /* state before/at commit */ | ||||
struct in6_multi *im6f_in6m; /* associated multicast address */ | |||||
STAILQ_ENTRY(in6_mfilter) im6f_entry; /* list entry */ | |||||
}; | }; | ||||
/* | |||||
* Helper types and functions for IPv4 multicast filters. | |||||
*/ | |||||
typedef STAILQ_HEAD(, in6_mfilter) ip6_mfilter_head_t; | |||||
struct in6_mfilter * ip6_alloc_mfilter(int mflags, int st0, int st1); | |||||
void ip6_free_mfilter(struct in6_mfilter *); | |||||
static inline void | |||||
ip6_init_mfilter(ip6_mfilter_head_t *head) | |||||
{ | |||||
STAILQ_INIT(head); | |||||
} | |||||
static inline struct in6_mfilter * | |||||
ip6_first_mfilter(const ip6_mfilter_head_t *head) | |||||
{ | |||||
return (STAILQ_FIRST(head)); | |||||
} | |||||
static inline void | |||||
ip6_insert_mfilter(ip6_mfilter_head_t *head, struct in6_mfilter *imf) | |||||
{ | |||||
STAILQ_INSERT_TAIL(head, imf, im6f_entry); | |||||
} | |||||
static inline void | |||||
ip6_remove_mfilter(ip6_mfilter_head_t *head, struct in6_mfilter *imf) | |||||
{ | |||||
STAILQ_REMOVE(head, imf, in6_mfilter, im6f_entry); | |||||
} | |||||
#define IP6_FOREACH_MFILTER(imf, head) \ | |||||
markj: Should be IP6_MFILTER_FOREACH. | |||||
STAILQ_FOREACH(imf, head, im6f_entry) | |||||
static inline size_t | |||||
ip6_count_mfilter(ip6_mfilter_head_t *head) | |||||
Done Inline ActionsI think it would be a bit simpler to just store a count of the filters in the moptions structure. markj: I think it would be a bit simpler to just store a count of the filters in the moptions… | |||||
Done Inline ActionsThe STAILQ() is already traversed several times, so there is no real benefit of keeping a separate counter. Can this change be made separately later on? hselasky: The STAILQ() is already traversed several times, so there is no real benefit of keeping a… | |||||
{ | |||||
struct in6_mfilter *imf; | |||||
size_t num = 0; | |||||
STAILQ_FOREACH(imf, head, im6f_entry) | |||||
num++; | |||||
return (num); | |||||
} | |||||
/* | /* | ||||
* Legacy KAME IPv6 multicast membership descriptor. | * Legacy KAME IPv6 multicast membership descriptor. | ||||
*/ | */ | ||||
struct in6_multi_mship { | struct in6_multi_mship { | ||||
struct in6_multi *i6mm_maddr; | struct in6_multi *i6mm_maddr; | ||||
LIST_ENTRY(in6_multi_mship) i6mm_chain; | LIST_ENTRY(in6_multi_mship) i6mm_chain; | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 263 Lines • Show Last 20 Lines |
Should be IP6_MFILTER_FOREACH.