summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2013-08-24 10:13:59 +0000
committerandre <andre@FreeBSD.org>2013-08-24 10:13:59 +0000
commit5630e57e48c003966005f869d05ab9526a49e940 (patch)
tree2e9bdc8f47bf5c3510ce64eec26660d5a7cb1f5b /sys/net
parent7b3e1df40ac9ce8daaa5d38c3a682c2da612b045 (diff)
downloadFreeBSD-src-5630e57e48c003966005f869d05ab9526a49e940.zip
FreeBSD-src-5630e57e48c003966005f869d05ab9526a49e940.tar.gz
Introduce typedef for pfil hook callback function and replace all
spelled out occurrences with it. Reviewed by: eri
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/pfil.c10
-rw-r--r--sys/net/pfil.h12
2 files changed, 9 insertions, 13 deletions
diff --git a/sys/net/pfil.c b/sys/net/pfil.c
index 9939d72..e8c7d11 100644
--- a/sys/net/pfil.c
+++ b/sys/net/pfil.c
@@ -225,8 +225,7 @@ pfil_head_get(int type, u_long val)
* PFIL_WAITOK OK to call malloc with M_WAITOK.
*/
int
-pfil_add_hook(int (*func)(void *, struct mbuf **, struct ifnet *, int,
- struct inpcb *), void *arg, int flags, struct pfil_head *ph)
+pfil_add_hook(pfil_func_t func, void *arg, int flags, struct pfil_head *ph)
{
struct packet_filter_hook *pfh1 = NULL;
struct packet_filter_hook *pfh2 = NULL;
@@ -285,8 +284,7 @@ error:
* list.
*/
int
-pfil_remove_hook(int (*func)(void *, struct mbuf **, struct ifnet *, int,
- struct inpcb *), void *arg, int flags, struct pfil_head *ph)
+pfil_remove_hook(pfil_func_t func, void *arg, int flags, struct pfil_head *ph)
{
int err = 0;
@@ -334,9 +332,7 @@ pfil_list_add(pfil_list_t *list, struct packet_filter_hook *pfh1, int flags)
* specified list.
*/
static int
-pfil_list_remove(pfil_list_t *list,
- int (*func)(void *, struct mbuf **, struct ifnet *, int, struct inpcb *),
- void *arg)
+pfil_list_remove(pfil_list_t *list, pfil_func_t func, void *arg)
{
struct packet_filter_hook *pfh;
diff --git a/sys/net/pfil.h b/sys/net/pfil.h
index 9cdb422..b91328f 100644
--- a/sys/net/pfil.h
+++ b/sys/net/pfil.h
@@ -43,14 +43,16 @@ struct mbuf;
struct ifnet;
struct inpcb;
+typedef int (*pfil_func_t)(void *, struct mbuf **, struct ifnet *, int,
+ struct inpcb *);
+
/*
* The packet filter hooks are designed for anything to call them to
* possibly intercept the packet.
*/
struct packet_filter_hook {
TAILQ_ENTRY(packet_filter_hook) pfil_link;
- int (*pfil_func)(void *, struct mbuf **, struct ifnet *, int,
- struct inpcb *);
+ pfil_func_t pfil_func;
void *pfil_arg;
};
@@ -87,10 +89,8 @@ struct pfil_head {
LIST_ENTRY(pfil_head) ph_list;
};
-int pfil_add_hook(int (*func)(void *, struct mbuf **, struct ifnet *,
- int, struct inpcb *), void *, int, struct pfil_head *);
-int pfil_remove_hook(int (*func)(void *, struct mbuf **, struct ifnet *,
- int, struct inpcb *), void *, int, struct pfil_head *);
+int pfil_add_hook(pfil_func_t, void *, int, struct pfil_head *);
+int pfil_remove_hook(pfil_func_t, void *, int, struct pfil_head *);
int pfil_run_hooks(struct pfil_head *, struct mbuf **, struct ifnet *,
int, struct inpcb *inp);
OpenPOWER on IntegriCloud