diff options
| author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-07-27 22:11:24 +0000 |
|---|---|---|
| committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-07-27 22:11:24 +0000 |
| commit | ce6a36c7f7c88e7ca0fda816f9282237bb86829d (patch) | |
| tree | 611bf9beb2281d34260ca87fc189a0ddc864819a /libdde-linux26/libdde_linux26/include/dde26_net.h | |
| parent | bb9d6cd642f9189b8102d566c8c46a6de1d2c5f7 (diff) | |
| parent | 4fbe7358c7747a9165f776eb19addbb9baf7def2 (diff) | |
Merge branch 'upstream-merged'
Diffstat (limited to 'libdde-linux26/libdde_linux26/include/dde26_net.h')
| -rw-r--r-- | libdde-linux26/libdde_linux26/include/dde26_net.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/libdde-linux26/libdde_linux26/include/dde26_net.h b/libdde-linux26/libdde_linux26/include/dde26_net.h new file mode 100644 index 00000000..204f37dd --- /dev/null +++ b/libdde-linux26/libdde_linux26/include/dde26_net.h @@ -0,0 +1,40 @@ +#ifndef __DDE_26_NET_H +#define __DDE_26_NET_H + +#include <linux/skbuff.h> +#include <linux/netdevice.h> + +/** rx callback function */ +typedef int (*linux_rx_callback)(char *, int, struct net_device *); + +extern linux_rx_callback l4dde26_rx_callback; + +/** Register rx callback function. + * + * This registers a function to be a rx callback. Whenever an ethernet packet + * arrives and is processed by a driver or a softirq, it will end up in either + * netif_rx() or netif_receive_skb(). Both will finally try to hand this to + * a DDE user using a previously registered callback. + * + * \param cb new callback function + * \return old callback function pointer + */ +linux_rx_callback l4dde26_register_rx_callback(linux_rx_callback cb); + + +/** Run callback function. + */ +static inline int l4dde26_do_rx_callback(struct sk_buff *s) +{ + if (l4dde26_rx_callback != NULL) { + int ret; + skb_push(s, s->dev->hard_header_len); + ret = l4dde26_rx_callback(s->data, s->len, s->dev); + dev_kfree_skb_any(s); + return ret; + } + + return 0; +} + +#endif |
