From d24b80acf292266680d9b04836269734602ec054 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 10 Jan 2007 01:55:07 +0000 Subject: Added network interface management commands --- src/include/gpxe/netdevice.h | 15 ++++++++++++++- src/include/usr/ifmgmt.h | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/include/usr/ifmgmt.h (limited to 'src/include') diff --git a/src/include/gpxe/netdevice.h b/src/include/gpxe/netdevice.h index 90d03fcf1..e1dddd63f 100644 --- a/src/include/gpxe/netdevice.h +++ b/src/include/gpxe/netdevice.h @@ -224,6 +224,8 @@ struct net_device { /** Declare a network-layer protocol */ #define __net_protocol __table ( net_protocols, 01 ) +extern struct list_head net_devices; + /** * Get printable network device hardware address * @@ -234,6 +236,18 @@ static inline const char * netdev_hwaddr ( struct net_device *netdev ) { return netdev->ll_protocol->ntoa ( netdev->ll_addr ); } +/** Iterate over all network devices */ +#define for_each_netdev( netdev ) \ + list_for_each_entry ( (netdev), &net_devices, list ) + +/** There exist some network devices + * + * @ret existence Existence of network devices + */ +static inline int have_netdevs ( void ) { + return ( ! list_empty ( &net_devices ) ); +} + extern int netdev_tx ( struct net_device *netdev, struct pk_buff *pkb ); void netdev_tx_complete ( struct net_device *netdev, struct pk_buff *pkb ); void netdev_tx_complete_next ( struct net_device *netdev ); @@ -247,7 +261,6 @@ extern void netdev_close ( struct net_device *netdev ); extern void unregister_netdev ( struct net_device *netdev ); extern void free_netdev ( struct net_device *netdev ); struct net_device * find_netdev ( const char *name ); -extern struct net_device * next_netdev ( void ); extern int net_tx ( struct pk_buff *pkb, struct net_device *netdev, struct net_protocol *net_protocol, const void *ll_dest ); extern int net_rx ( struct pk_buff *pkb, struct net_device *netdev, diff --git a/src/include/usr/ifmgmt.h b/src/include/usr/ifmgmt.h new file mode 100644 index 000000000..c7d35da88 --- /dev/null +++ b/src/include/usr/ifmgmt.h @@ -0,0 +1,16 @@ +#ifndef _USR_IFMGMT_H +#define _USR_IFMGMT_H + +/** @file + * + * Network interface management + * + */ + +struct net_device; + +extern int ifopen ( struct net_device *netdev ); +extern void ifclose ( struct net_device *netdev ); +extern void ifstat ( struct net_device *netdev ); + +#endif /* _USR_IFMGMT_H */ -- cgit v1.2.3-55-g7522