#include "list.h"
#include "shash.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct arg {
char *key;
char *value;
* implementations. */
struct netdev_dev {
char *name; /* Name of network device. */
- const struct netdev_class *class; /* Functions to control this device. */
+ const struct netdev_class *netdev_class; /* Functions to control
+ this device. */
int ref_cnt; /* Times this devices was opened. */
struct shash_node *node; /* Pointer to element in global map. */
struct arg *args; /* Argument list from last config. */
struct shash *device_list);
static inline void netdev_dev_assert_class(const struct netdev_dev *netdev_dev,
- const struct netdev_class *class)
+ const struct netdev_class *class_)
{
- assert(netdev_dev->class == class);
+ assert(netdev_dev->netdev_class == class_);
}
/* A instance of an open network device.
struct netdev_dev *netdev_get_dev(const struct netdev *);
static inline void netdev_assert_class(const struct netdev *netdev,
- const struct netdev_class *class)
+ const struct netdev_class *netdev_class)
{
- netdev_dev_assert_class(netdev_get_dev(netdev), class);
+ netdev_dev_assert_class(netdev_get_dev(netdev), netdev_class);
}
/* A network device notifier.
* the system. */
const char *type;
- /* Called only once, at program startup. Returning an error from this
- * function will prevent any network device in this class from being
- * opened.
+ /* Called when the netdev provider is registered, typically at program
+ * startup. Returning an error from this function will prevent any network
+ * device in this class from being opened.
*
* This function may be set to null if a network device class needs no
- * initialization at program startup. */
+ * initialization at registration time. */
int (*init)(void);
/* Performs periodic work needed by netdevs of this class. May be null if
extern const struct netdev_class netdev_tap_class;
extern const struct netdev_class netdev_gre_class;
+#ifdef __cplusplus
+}
+#endif
+
#endif /* netdev.h */