diff options
author | glebius <glebius@FreeBSD.org> | 2006-01-12 22:44:04 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2006-01-12 22:44:04 +0000 |
commit | 217f2bb6ebca106f3ddfe167f981900b4b242706 (patch) | |
tree | cbe09e8334f43ef32b871c432e9547f4ddfe4cef /sys/netgraph/netgraph.h | |
parent | cac42b3b2ec057d683f9c5ded9d79c3d3cd6e837 (diff) | |
download | FreeBSD-src-217f2bb6ebca106f3ddfe167f981900b4b242706.zip FreeBSD-src-217f2bb6ebca106f3ddfe167f981900b4b242706.tar.gz |
Provide additional macros for sending netgraph items, which allow
to use non-default flags for netgraph functions. Implement current
macros via new ones.
Diffstat (limited to 'sys/netgraph/netgraph.h')
-rw-r--r-- | sys/netgraph/netgraph.h | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/sys/netgraph/netgraph.h b/sys/netgraph/netgraph.h index 5e26266..2e1802e 100644 --- a/sys/netgraph/netgraph.h +++ b/sys/netgraph/netgraph.h @@ -819,16 +819,18 @@ _ngi_hook(item_p item, char *file, int line) /* * Assuming the data is already ok, just set the new address and send */ -#define NG_FWD_ITEM_HOOK(error, item, hook) \ +#define NG_FWD_ITEM_HOOK_FLAGS(error, item, hook, flags) \ do { \ (error) = \ - ng_address_hook(NULL, (item), (hook), 0); \ + ng_address_hook(NULL, (item), (hook), NG_NOFLAGS); \ if (error == 0) { \ SAVE_LINE(item); \ - (error) = ng_snd_item((item), 0); \ + (error) = ng_snd_item((item), (flags)); \ } \ (item) = NULL; \ } while (0) +#define NG_FWD_ITEM_HOOK(error, item, hook) \ + NG_FWD_ITEM_HOOK_FLAGS(error, item, hook, NG_NOFLAGS) /* * Forward a data packet. Mbuf pointer is updated to new value. We @@ -837,29 +839,35 @@ _ngi_hook(item_p item, char *file, int line) * the mbuf. You should probably use NGI_GET_M() if you are going to use * this too. */ -#define NG_FWD_NEW_DATA(error, item, hook, m) \ +#define NG_FWD_NEW_DATA_FLAGS(error, item, hook, m, flags) \ do { \ NGI_M(item) = (m); \ (m) = NULL; \ - NG_FWD_ITEM_HOOK(error, item, hook); \ + NG_FWD_ITEM_HOOK_FLAGS(error, item, hook, flags); \ } while (0) +#define NG_FWD_NEW_DATA(error, item, hook, m) \ + NG_FWD_NEW_DATA_FLAGS(error, item, hook, m, NG_NOFLAGS) /* Send a previously unpackaged mbuf. XXX: This should be called * NG_SEND_DATA in future, but this name is kept for compatibility * reasons. */ -#define NG_SEND_DATA_ONLY(error, hook, m) \ +#define NG_SEND_DATA_FLAGS(error, hook, m, flags) \ do { \ item_p _item; \ - if ((_item = ng_package_data((m), NG_NOFLAGS))) { \ - NG_FWD_ITEM_HOOK(error, _item, hook); \ + if ((_item = ng_package_data((m), flags))) { \ + NG_FWD_ITEM_HOOK_FLAGS(error, _item, hook, flags);\ } else { \ (error) = ENOMEM; \ } \ (m) = NULL; \ } while (0) -#define NG_SEND_DATA(error, hook, m, x) NG_SEND_DATA_ONLY(error, hook, m) +#define NG_SEND_DATA_ONLY(error, hook, m) \ + NG_SEND_DATA_FLAGS(error, hook, m, NG_NOFLAGS) +/* NG_SEND_DATA() compat for meta-data times */ +#define NG_SEND_DATA(error, hook, m, x) \ + NG_SEND_DATA_FLAGS(error, hook, m, NG_NOFLAGS) #define NG_FREE_MSG(msg) \ do { \ |