diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2011-04-10 19:09:21 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-04-12 09:54:56 +0200 |
commit | c75ab7876339bbe9c3987bc426cf60ff9b2d03f0 (patch) | |
tree | 88d1083ad07c6f1f3fcd9666b93ff8d0006ca3a2 /include/net.h | |
parent | dcf5df122fe20daecbd7c2ba1640e9064d73fa4b (diff) | |
download | barebox-c75ab7876339bbe9c3987bc426cf60ff9b2d03f0.tar.gz barebox-c75ab7876339bbe9c3987bc426cf60ff9b2d03f0.tar.xz |
net: add a context to the packet handler
This is not yet used, but with this the different network
commands can get rid of their global data.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/net.h')
-rw-r--r-- | include/net.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/net.h b/include/net.h index 33d8a32f83..31bf6a23fc 100644 --- a/include/net.h +++ b/include/net.h @@ -363,7 +363,7 @@ static inline int is_valid_ether_addr(const u8 *addr) return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr); } -typedef void rx_handler_f(char *packet, unsigned int len); +typedef void rx_handler_f(void *ctx, char *packet, unsigned int len); void eth_set_current(struct eth_device *eth); struct eth_device *eth_get_current(void); @@ -388,6 +388,7 @@ struct net_connection { struct list_head list; rx_handler_f *handler; int proto; + void *priv; }; static inline char *net_alloc_packet(void) @@ -396,9 +397,10 @@ static inline char *net_alloc_packet(void) } struct net_connection *net_udp_new(IPaddr_t dest, uint16_t dport, - rx_handler_f *handler); + rx_handler_f *handler, void *ctx); -struct net_connection *net_icmp_new(IPaddr_t dest, rx_handler_f *handler); +struct net_connection *net_icmp_new(IPaddr_t dest, rx_handler_f *handler, + void *ctx); void net_unregister(struct net_connection *con); |