netfilter: introduce accessor functions for hook entries
This allows easier future refactoring. Signed-off-by: Aaron Conole <aconole@bytheb.org> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
committed by
Pablo Neira Ayuso
parent
834184b1f3
commit
0aa8c57a04
@@ -79,6 +79,33 @@ struct nf_hook_entry {
|
||||
const struct nf_hook_ops *orig_ops;
|
||||
};
|
||||
|
||||
static inline void
|
||||
nf_hook_entry_init(struct nf_hook_entry *entry, const struct nf_hook_ops *ops)
|
||||
{
|
||||
entry->next = NULL;
|
||||
entry->ops = *ops;
|
||||
entry->orig_ops = ops;
|
||||
}
|
||||
|
||||
static inline int
|
||||
nf_hook_entry_priority(const struct nf_hook_entry *entry)
|
||||
{
|
||||
return entry->ops.priority;
|
||||
}
|
||||
|
||||
static inline int
|
||||
nf_hook_entry_hookfn(const struct nf_hook_entry *entry, struct sk_buff *skb,
|
||||
struct nf_hook_state *state)
|
||||
{
|
||||
return entry->ops.hook(entry->ops.priv, skb, state);
|
||||
}
|
||||
|
||||
static inline const struct nf_hook_ops *
|
||||
nf_hook_entry_ops(const struct nf_hook_entry *entry)
|
||||
{
|
||||
return entry->orig_ops;
|
||||
}
|
||||
|
||||
static inline void nf_hook_state_init(struct nf_hook_state *p,
|
||||
unsigned int hook,
|
||||
u_int8_t pf,
|
||||
|
||||
Reference in New Issue
Block a user