summaryrefslogtreecommitdiffstats
path: root/include/net.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-04-10 19:09:21 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2011-04-12 09:54:56 +0200
commitc75ab7876339bbe9c3987bc426cf60ff9b2d03f0 (patch)
tree88d1083ad07c6f1f3fcd9666b93ff8d0006ca3a2 /include/net.h
parentdcf5df122fe20daecbd7c2ba1640e9064d73fa4b (diff)
downloadbarebox-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.h8
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);