renamed win32 routines to match those of netcf api calls
---
configure.ac | 4 +-
src/drv_initscripts.c | 67 ++----------------------------------------------
src/dutil.c | 18 +------------
src/dutil.h | 2 -
src/netcf.c | 37 +--------------------------
src/netcf.h | 5 ---
src/netcf_win.c | 20 +++++++-------
src/netcf_win.h | 25 +++++++++---------
8 files changed, 29 insertions(+), 149 deletions(-)
diff --git a/configure.ac b/configure.ac
index c6fe9c8..5b87eff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,8 +53,8 @@ PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES([LIBXML], [libxml-2.0])
PKG_CHECK_MODULES([LIBXSLT], [libxslt])
PKG_CHECK_MODULES([LIBEXSLT], [libexslt])
-PKG_CHECK_MODULES([LIBAUGEAS], [augeas >= 0.5.0], [], [AC_DEFINE([HAVE_LIBAUGEAS],
[0])])
-PKG_CHECK_MODULES([LIBNL], [libnl-1], [], [AC_DEFINE([HAVE_LIBNL], [0])])
+PKG_CHECK_MODULES([LIBAUGEAS], [augeas >= 0.5.0])
+PKG_CHECK_MODULES([LIBNL], [libnl-1])
NETCF_CHECK_READLINE
diff --git a/src/drv_initscripts.c b/src/drv_initscripts.c
index 47825c3..5ca4a86 100644
--- a/src/drv_initscripts.c
+++ b/src/drv_initscripts.c
@@ -22,11 +22,7 @@
#include <config.h>
#include <internal.h>
-
-#ifdef HAVE_LIBAUGEAS
#include <augeas.h>
-#endif
-
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
@@ -38,9 +34,7 @@
#include "ref.h"
#include "list.h"
#include "dutil.h"
-#ifndef WIN32
#include "dutil_linux.h"
-#endif
#include <libxml/parser.h>
#include <libxml/relaxng.h>
@@ -168,9 +162,7 @@ static char *find_ifcfg_path_by_hwaddr(struct netcf *ncf, const char
*mac) {
int match = -1;
for (int i=0; i < nhwaddr; i++) {
const char *addr;
-#ifdef HAVE_LIBAUGEAS
r = aug_get(aug, hwaddr[i], &addr);
-#endif
ERR_COND_BAIL(r != 1, ncf, EOTHER);
if (STRCASEEQ(addr, mac))
match = i;
@@ -191,20 +183,16 @@ static char *find_ifcfg_path_by_hwaddr(struct netcf *ncf, const char
*mac) {
* interface by checking for an entry 'DEVICE=NAME'
*/
static char *find_ifcfg_path_by_device(struct netcf *ncf, const char *name) {
-#ifdef HAVE_LIBAUGEAS
struct augeas *aug = NULL;
-#endif
int ndevs = 0;
char **devs = NULL;
-#ifdef HAVE_LIBAUGEAS
aug = get_augeas(ncf);
ERR_BAIL(ncf);
ndevs = aug_fmt_match(ncf, &devs, "%s[DEVICE = '%s']",
ifcfg_path, name);
ERR_COND_BAIL(ndevs < 0, ncf, EOTHER);
-#endif
if (ndevs == 0)
return NULL;
@@ -222,7 +210,6 @@ static char *find_ifcfg_path_by_device(struct netcf *ncf, const char
*name) {
return NULL;
}
-#ifndef WIN32
/* Find the path to the ifcfg file that has the configuration for
* the device NAME. The logic follows the need_config function
* in /etc/sysconfig/network-scripts/network-functions
@@ -339,11 +326,9 @@ static int list_ifcfg_paths(struct netcf *ncf, char ***intf) {
free_matches(ndevs, &devs);
return -1;
}
-#endif
static int list_interfaces(struct netcf *ncf, char ***intf) {
int nint = 0, result = 0;
-#ifdef HAVE_LIBAUGEAS
struct augeas *aug = NULL;
aug = get_augeas(ncf);
@@ -352,7 +337,6 @@ static int list_interfaces(struct netcf *ncf, char ***intf) {
/* Look in augeas for all interfaces */
nint = list_ifcfg_paths(ncf, intf);
ERR_BAIL(ncf);
-#elif WIN32
result = nint;
/* Filter out the interfaces that are slaves/subordinate */
@@ -366,7 +350,6 @@ static int list_interfaces(struct netcf *ncf, char ***intf) {
i += 1;
}
}
-#endif
return result;
error:
free_matches(nint, intf);
@@ -505,13 +488,10 @@ int drv_init(struct netcf *ncf) {
ncf->driver->ioctl_fd = -1;
-#ifdef HAVE_LIBAUGEAS
r = add_augeas_xfm_table(ncf, &augeas_xfm_common);
if (r < 0)
goto error;
-#endif /* LIBAUGEAS */
-#ifndef WIN32
// FIXME: Check for errors
xsltInit();
exsltStrRegister();
@@ -522,16 +502,13 @@ int drv_init(struct netcf *ncf) {
bridge_physdevs(ncf);
ERR_BAIL(ncf);
-#endif /* WIN32 */
/* open a socket for interface ioctls */
ncf->driver->ioctl_fd = init_ioctl_fd(ncf);
if (ncf->driver->ioctl_fd < 0)
goto error;
-#ifdef HAVE_LIBNL
if (netlink_init(ncf) < 0)
goto error;
-#endif /* LIBNL */
return 0;
error:
@@ -545,15 +522,11 @@ void drv_close(struct netcf *ncf) {
xsltFreeStylesheet(ncf->driver->get);
xsltFreeStylesheet(ncf->driver->put);
xmlRelaxNGFree(ncf->driver->rng);
-#ifdef HAVE_LIBNL
netlink_close(ncf);
-#endif /* LIBNL */
if (ncf->driver->ioctl_fd >= 0)
close(ncf->driver->ioctl_fd);
-#ifdef HAVE_LIBAUGEAS
aug_close(ncf->driver->augeas);
FREE(ncf->driver->augeas_xfm_tables);
-#endif /* LIBAUGEAS */
FREE(ncf->driver);
}
@@ -567,12 +540,10 @@ static int list_interface_ids(struct netcf *ncf,
const char *id_attr) {
int nint = 0, nmatches = 0, nqualified = 0, result = 0, r;
char **intf = NULL, **matches = NULL;
-#ifdef HAVE_LIBAUGEAS
struct augeas *aug = NULL;
aug = get_augeas(ncf);
ERR_BAIL(ncf);
-#endif
nint = list_interfaces(ncf, &intf);
ERR_BAIL(ncf);
if (!names) {
@@ -587,10 +558,8 @@ static int list_interface_ids(struct netcf *ncf,
int is_qualified = ((flags & (NETCF_IFACE_ACTIVE|NETCF_IFACE_INACTIVE))
== (NETCF_IFACE_ACTIVE|NETCF_IFACE_INACTIVE));
-#ifdef HAVE_LIBAUGEAS
r = aug_get(aug, matches[nmatches-1], &name);
ERR_COND_BAIL(r < 0, ncf, EOTHER);
-#endif /* LIBAUGEAS */
if (!is_qualified) {
int is_active = if_is_active(ncf, name);
if ((is_active && (flags & NETCF_IFACE_ACTIVE))
@@ -631,7 +600,6 @@ struct netcf_if *drv_lookup_by_name(struct netcf *ncf, const char
*name) {
struct netcf_if *nif = NULL;
char *pathx = NULL;
char *name_dup = NULL;
-#ifdef HAVE_LIBAUGEAS
struct augeas *aug;
aug = get_augeas(ncf);
@@ -639,7 +607,6 @@ struct netcf_if *drv_lookup_by_name(struct netcf *ncf, const char
*name) {
pathx = find_ifcfg_path(ncf, name);
ERR_BAIL(ncf);
-#endif /* LIBAUGEAS */
if (pathx == NULL || is_slave(ncf, pathx))
goto done;
@@ -659,7 +626,6 @@ struct netcf_if *drv_lookup_by_name(struct netcf *ncf, const char
*name) {
return nif;
}
-#ifndef WIN32
/* Get an XML desription of the interfaces (just paths, really) in INTF.
* The format is a very simple representation of the Augeas tree (see
* xml/augeas.rng)
@@ -839,7 +805,6 @@ char *drv_xml_state(struct netcf_if *nif) {
result = 0;
goto done;
}
-#endif /* WIN32 */
/* Report various status info about the interface as bits in
* "flags". Returns 0 on success, -1 on failure
@@ -911,7 +876,6 @@ static bool is_bond(struct netcf *ncf, const char *name) {
return nmatches > 0;
}
-#ifndef WIN32
/* The device NAME is a bridge if it has an entry TYPE=Bridge */
static bool is_bridge(struct netcf *ncf, const char *name) {
int nmatches = 0;
@@ -947,14 +911,12 @@ static int bridge_slaves(struct netcf *ncf, const char *name, char
***slaves) {
free_matches(nslaves, slaves);
return -1;
}
-#endif /* WIN32 */
/* For an interface NAME, remove the ifcfg-* files for that interface and
* all its slaves. */
static void rm_interface(struct netcf *ncf, const char *name) {
int r;
char *path = NULL;
-#ifdef HAVE_LIBAUGEAS
struct augeas *aug = NULL;
aug = get_augeas(ncf);
@@ -970,9 +932,7 @@ static void rm_interface(struct netcf *ncf, const char *name) {
r = aug_rm(aug, path);
ERR_COND_BAIL(r < 0, ncf, EOTHER);
-#elif WIN32
goto error;
-#endif
error:
FREE(path);
}
@@ -1009,7 +969,6 @@ static void rm_all_interfaces(struct netcf *ncf, xmlDocPtr ncf_xml)
{
xmlXPathFreeContext(context);
}
-#ifndef WIN32
/* Dig through interface NAME and all its subinterfaces for bonds
* and either add aliases in modprobe.conf for it (ALIAS == true), or
* remove such aliases (ALIAS == false)
@@ -1044,14 +1003,13 @@ static void bond_setup(struct netcf *ncf, const char *name, bool
alias) {
free_matches(nslaves, &slaves);
return;
}
-#endif
struct netcf_if *drv_define(struct netcf *ncf, const char *xml_str) {
xmlDocPtr ncf_xml = NULL, aug_xml = NULL;
char *name = NULL;
struct netcf_if *result = NULL;
int r;
-#ifdef HAVE_LIBAUGEAS
+
struct augeas *aug = get_augeas(ncf);
ncf_xml = parse_xml(ncf, xml_str);
@@ -1081,7 +1039,6 @@ struct netcf_if *drv_define(struct netcf *ncf, const char *xml_str)
{
aug_print(aug, stderr, "/augeas//error");
}
ERR_THROW(r < 0, ncf, EOTHER, "aug_save failed");
-#endif /* LIBAUGEAS */
result = make_netcf_if(ncf, name);
ERR_BAIL(ncf);
@@ -1097,7 +1054,6 @@ struct netcf_if *drv_define(struct netcf *ncf, const char *xml_str)
{
int drv_undefine(struct netcf_if *nif) {
struct netcf *ncf = nif->ncf;
-#ifdef HAVE_LIBAUGEAS
int r;
struct augeas *aug = NULL;
@@ -1106,14 +1062,13 @@ int drv_undefine(struct netcf_if *nif) {
bond_setup(ncf, nif->name, false);
ERR_BAIL(ncf);
-#endif
+
rm_interface(ncf, nif->name);
ERR_BAIL(ncf);
-#ifdef HAVE_LIBAUGEAS
r = aug_save(aug);
ERR_COND_BAIL(r < 0, ncf, EOTHER);
-#endif
+
return 0;
error:
return -1;
@@ -1128,7 +1083,6 @@ int drv_lookup_by_mac_string(struct netcf *ncf, const char *mac,
char **matches = NULL;
int r;
int result = -1;
-#ifdef HAVE_LIBAUGEAS
struct augeas *aug = NULL;
MEMZERO(ifaces, maxifaces);
@@ -1164,9 +1118,6 @@ int drv_lookup_by_mac_string(struct netcf *ncf, const char *mac,
ERR_BAIL(ncf);
}
result = cnt;
-#elif WIN32
- goto done;
-#endif
goto done;
error:
@@ -1186,10 +1137,8 @@ const char *drv_mac_string(struct netcf_if *nif) {
char *path = NULL;
int r;
-#ifdef HAVE_LIBAUGEAS
r = aug_get_mac(ncf, nif->name, &mac);
ERR_THROW(r < 0, ncf, EOTHER, "could not lookup MAC of %s",
nif->name);
-#endif
if (mac != NULL) {
if (nif->mac == NULL || STRNEQ(nif->mac, mac)) {
@@ -1217,7 +1166,6 @@ int drv_if_up(struct netcf_if *nif) {
int nslaves = 0;
int result = -1;
-#ifdef HAVE_LIBAUGEAS
if (is_bridge(ncf, nif->name)) {
/* Bring up bridge slaves before the bridge */
nslaves = bridge_slaves(ncf, nif->name, &slaves);
@@ -1230,9 +1178,6 @@ int drv_if_up(struct netcf_if *nif) {
}
run1(ncf, ifup, nif->name);
ERR_BAIL(ncf);
-#elif WIN32
- goto error;
-#endif
result = 0;
error:
free_matches(nslaves, &slaves);
@@ -1246,7 +1191,6 @@ int drv_if_down(struct netcf_if *nif) {
int nslaves = 0;
int result = -1;
-#ifdef HAVE_LIBAUGEAS
run1(ncf, ifdown, nif->name);
ERR_BAIL(ncf);
if (is_bridge(ncf, nif->name)) {
@@ -1259,16 +1203,12 @@ int drv_if_down(struct netcf_if *nif) {
ERR_BAIL(ncf);
}
}
-#elif WIN32
- goto error;
-#endif
result = 0;
error:
free_matches(nslaves, &slaves);
return result;
}
-#ifdef HAVE_LIBAUGEAS
/*
* Test interface
*/
@@ -1282,7 +1222,6 @@ int drv_put_aug(struct netcf *ncf, const char *aug_xml, char
**ncf_xml) {
/* Use utility implementation */
return dutil_put_aug(ncf, aug_xml, ncf_xml);
}
-#endif
/*
* Local variables:
diff --git a/src/dutil.c b/src/dutil.c
index d4f20a2..4d428e8 100644
--- a/src/dutil.c
+++ b/src/dutil.c
@@ -22,11 +22,7 @@
#include <config.h>
#include <internal.h>
-
-#ifdef HAVE_LIBAUGEAS
#include <augeas.h>
-#endif
-
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
@@ -51,14 +47,12 @@
#include "netcf.h"
#include "dutil.h"
-#ifdef HAVE_LIBNL
#include <netlink/socket.h>
#include <netlink/cache.h>
#include <netlink/route/addr.h>
#include <netlink/route/link.h>
/* For some reason, the headers for libnl vlan functions aren't installed */
extern int rtnl_link_vlan_get_id(struct rtnl_link *link);
-#endif
#include <dirent.h>
@@ -83,7 +77,6 @@ int xasprintf(char **strp, const char *format, ...) {
return result;
}
-#ifdef HAVE_LIBAUGEAS
int add_augeas_xfm_table(struct netcf *ncf,
const struct augeas_xfm_table *xfm) {
int slot, r;
@@ -253,7 +246,6 @@ int aug_fmt_match(struct netcf *ncf, char ***matches, const char *fmt,
...) {
free(path);
return -1;
}
-#endif /* LIBAUGEAS */
void free_matches(int nint, char ***intf) {
if (*intf != NULL) {
@@ -494,14 +486,12 @@ int init_ioctl_fd(struct netcf *ncf) {
ioctl_fd = socket(AF_INET, SOCK_STREAM, 0);
ERR_THROW(ioctl_fd < 0, ncf, EINTERNAL, "failed to open socket for interface
ioctl");
-#ifndef WIN32
/* None of the needed file descriptor routines available in gnulib */
flags = fcntl(ioctl_fd, F_GETFD);
ERR_THROW(flags < 0, ncf, EINTERNAL, "failed to get flags for ioctl
socket");
flags = fcntl(ioctl_fd, F_SETFD, flags | FD_CLOEXEC);
ERR_THROW(flags < 0, ncf, EINTERNAL, "failed to set FD_CLOEXEC flag on ioctl
socket");
-#endif /* WIN32 */
return ioctl_fd;
error:
@@ -510,7 +500,6 @@ error:
return -1;
}
-#ifdef HAVE_LIBNL
int netlink_init(struct netcf *ncf) {
ncf->driver->nl_sock = nl_handle_alloc();
@@ -559,7 +548,6 @@ int netlink_close(struct netcf *ncf) {
}
return 0;
}
-#endif /* LIBNL */
int if_is_active(struct netcf *ncf, const char *intf) {
#ifdef WIN32
@@ -692,7 +680,6 @@ struct netcf_if *make_netcf_if(struct netcf *ncf, char *name) {
return result;
}
-#ifdef HAVE_LIBAUGEAS
/*
* Test interface
*/
@@ -735,7 +722,6 @@ int dutil_put_aug(struct netcf *ncf, const char *aug_xml, char
**ncf_xml) {
xmlFreeDoc(aug_doc);
return result;
}
-#endif /* LIBNL */
static void add_type_specific_info(struct netcf *ncf,
const char *ifname, int ifindex,
@@ -835,9 +821,7 @@ static void add_ip_info_cb(struct nl_object *obj, void *arg) {
error:
return;
}
-#endif /* WIN32 */
-#ifdef HAVE_LIBNL
static void add_ip_info(struct netcf *ncf,
const char *ifname ATTRIBUTE_UNUSED, int ifindex,
xmlDocPtr doc, xmlNodePtr root) {
@@ -1164,7 +1148,7 @@ void add_state_to_xml_doc(struct netcf_if *nif, xmlDocPtr doc) {
error:
return;
}
-#endif /* LIBNL */
+
/*
* Bringing interfaces up/down
*/
diff --git a/src/dutil.h b/src/dutil.h
index 32de8b2..444bc11 100644
--- a/src/dutil.h
+++ b/src/dutil.h
@@ -25,9 +25,7 @@
#include <libxml/relaxng.h>
#include <libxslt/xsltInternals.h>
-#ifndef HAVE_LIBNL
#include <netlink/netlink.h>
-#endif
struct driver {
struct augeas *augeas;
diff --git a/src/netcf.c b/src/netcf.c
index ad26290..dcc6e45 100644
--- a/src/netcf.c
+++ b/src/netcf.c
@@ -119,10 +119,9 @@ int ncf_close(struct netcf *ncf) {
ERR_COND_BAIL(ncf->ref > 1, ncf, EINUSE);
-#ifndef WIN32
*ncf = NULL;
ncf->driver = NULL;
-#endif
+
drv_close(ncf);
unref(ncf, netcf);
return 0;
@@ -138,9 +137,6 @@ int ncf_close(struct netcf *ncf) {
*/
int ncf_num_of_interfaces(struct netcf *ncf, unsigned int flags) {
API_ENTRY(ncf);
-#ifdef WIN32
- return w32_num_of_interfaces(ncf, flags);
-#endif
return drv_num_of_interfaces(ncf, flags);
}
@@ -149,11 +145,7 @@ int ncf_list_interfaces(struct netcf *ncf, int maxnames, char
**names, unsigned
API_ENTRY(ncf);
MEMZERO(names, maxnames);
-#ifdef WIN32
- result = w32_list_interfaces(ncf, maxnames, names, flags);
-#else
result = drv_list_interfaces(ncf, maxnames, names, flags);
-#endif
if (result < 0)
for (int i=0; i < maxnames; i++)
FREE(names[i]);
@@ -162,9 +154,6 @@ int ncf_list_interfaces(struct netcf *ncf, int maxnames, char **names,
unsigned
struct netcf_if * ncf_lookup_by_name(struct netcf *ncf, const char *name) {
API_ENTRY(ncf);
-#ifdef WIN32
- return w32_lookup_by_name(ncf, name);
-#endif
return drv_lookup_by_name(ncf, name);
}
@@ -193,9 +182,6 @@ const char *ncf_if_name(struct netcf_if *nif) {
const char *ncf_if_mac_string(struct netcf_if *nif) {
API_ENTRY(nif->ncf);
-#ifdef WIN32
- return w32_mac_string(nif);
-#endif
return drv_mac_string(nif);
}
@@ -209,9 +195,6 @@ int ncf_if_undefine(struct netcf_if *nif) {
int ncf_if_up(struct netcf_if *nif) {
/* I'm a bit concerned that this assumes nif (and nif->ncf) is non-NULL) */
API_ENTRY(nif->ncf);
-#ifdef WIN32
- return w32_if_up(nif);
-#endif
return drv_if_up(nif);
}
@@ -219,13 +202,9 @@ int ncf_if_up(struct netcf_if *nif) {
int ncf_if_down(struct netcf_if *nif) {
/* I'm a bit concerned that this assumes nif (and nif->ncf) is non-NULL) */
API_ENTRY(nif->ncf);
-#ifdef WIN32
- return w32_if_down(nif);
-#endif
return drv_if_down(nif);
}
-#ifndef WIN32
/* Produce an XML description for the interface, in the same format that
* NCF_DEFINE expects
*/
@@ -243,7 +222,6 @@ char *ncf_if_xml_state(struct netcf_if *nif) {
API_ENTRY(nif->ncf);
return drv_xml_state(nif);
}
-#endif
/* Report various status info about the interface as bits in
* "flags". Returns 0 on success, -1 on failure
@@ -253,17 +231,6 @@ int ncf_if_status(struct netcf_if *nif, unsigned int *flags) {
return drv_if_status(nif, flags);
}
-#ifdef WIN32
-/* Show ip addresses of active interfaces
- * Returns 0 on success, -1 on failure
- */
-int ncf_if_ipaddresses(struct netcf_if *nif) {
- const char *ipBuf;
- API_ENTRY(nif->ncf);
- return w32_if_ipaddresses(nif, ipBuf);
-}
-#endif
-
/* Release any resources used by this NETCF_IF; the pointer is invalid
* after this call
*/
@@ -286,7 +253,6 @@ int ncf_error(struct netcf *ncf, const char **errmsg, const char
**details) {
return errcode;
}
-#ifdef HAVE_LIBAUGEAS
/*
* Test interface
*/
@@ -301,7 +267,6 @@ int ncf_put_aug(struct netcf *ncf, const char *aug_xml, char
**ncf_xml) {
return drv_put_aug(ncf, aug_xml, ncf_xml);
}
-#endif /* LIBAUGEAS */
/*
* Internal helpers
diff --git a/src/netcf.h b/src/netcf.h
index c1380b5..af4812b 100644
--- a/src/netcf.h
+++ b/src/netcf.h
@@ -169,11 +169,6 @@ char *ncf_if_xml_state(struct netcf_if *);
*/
int ncf_if_status(struct netcf_if *nif, unsigned int *flags);
-/* List ip addresses for each active interface
- * Returns 0 on success, -1 on failure
- */
-int ncf_if_ipaddresses(struct netcf_if *nif);
-
/* Release any resources used by this NETCF_IF; the pointer is invalid
* after this call
*/
diff --git a/src/netcf_win.c b/src/netcf_win.c
index db8fea3..b00f512 100644
--- a/src/netcf_win.c
+++ b/src/netcf_win.c
@@ -76,7 +76,7 @@ PIP_ADAPTER_ADDRESSES _get_ip_adapter_info(PIP_ADAPTER_ADDRESSES
addrList) {
FREE(addrList);
}
-int w32_list_interface_ids(struct netcf *ncf ATTRIBUTE_UNUSED,
+int drv_list_interface_ids(struct netcf *ncf ATTRIBUTE_UNUSED,
int maxnames ATTRIBUTE_UNUSED,
char **names, unsigned int flags ATTRIBUTE_UNUSED,
const char *id_attr ATTRIBUTE_UNUSED) {
@@ -100,7 +100,7 @@ int w32_list_interface_ids(struct netcf *ncf ATTRIBUTE_UNUSED,
return -1;
}
-int w32_list_interfaces(struct netcf *ncf,
+int drv_list_interfaces(struct netcf *ncf,
int maxnames ATTRIBUTE_UNUSED, char **names,
unsigned int flags ATTRIBUTE_UNUSED) {
return w32_list_interface_ids(ncf, 0, names, 0, NULL);
@@ -112,7 +112,7 @@ int w32_num_of_interfaces(struct netcf *ncf, unsigned int flags
ATTRIBUTE_UNUSED
}
-struct netcf_if *w32_lookup_by_name(struct netcf *ncf, const char *name) {
+struct netcf_if *drv_lookup_by_name(struct netcf *ncf, const char *name) {
struct netcf_if *nif = NULL;
char *name_dup;
unsigned int nint = 0;
@@ -138,7 +138,7 @@ struct netcf_if *w32_lookup_by_name(struct netcf *ncf, const char
*name) {
}
-const char *w32_mac_string(struct netcf_if *nif) {
+const char *drv_mac_string(struct netcf_if *nif) {
// struct netcf *ncf = nif->ncf;
char mac[256];
@@ -168,7 +168,7 @@ const char *w32_mac_string(struct netcf_if *nif) {
return nif->mac;
}
-int w32_if_down(struct netcf_if *nif) {
+int drv_if_down(struct netcf_if *nif) {
PMIB_IFTABLE intfTable = NULL;
PMIB_IFTABLE intfTableDup = NULL;
PMIB_IFROW intRow;
@@ -194,7 +194,7 @@ int w32_if_down(struct netcf_if *nif) {
return 0;
}
-int w32_if_up(struct netcf_if *nif) {
+int drv_if_up(struct netcf_if *nif) {
PMIB_IFTABLE intfTable = NULL;
PMIB_IFTABLE intfTableDup = NULL;
PMIB_IFROW intRow;
@@ -220,7 +220,7 @@ int w32_if_up(struct netcf_if *nif) {
return 0;
}
-int w32_if_ipaddresses(struct netcf_if *nif, const char *ipBuf) {
+int drv_if_ipaddresses(struct netcf_if *nif, const char *ipBuf) {
PIP_ADAPTER_ADDRESSES addrList = NULL;
PIP_ADAPTER_ADDRESSES adapterp = NULL;
PMIB_IPADDRTABLE ipAddrTable = NULL;
@@ -260,7 +260,7 @@ int w32_if_ipaddresses(struct netcf_if *nif, const char *ipBuf) {
return -1;
}
-int w32_add_ip_address(struct netcf_if *nif, char *ipAddr, char *netmask) {
+int drv_add_ip_address(struct netcf_if *nif, char *ipAddr, char *netmask) {
IN_ADDR addr;
PIP_ADAPTER_ADDRESSES addrList = NULL;
PIP_ADAPTER_ADDRESSES adapterp = NULL;
@@ -338,11 +338,11 @@ int w32_list_dns_server(struct netcf_if *nif, char *ip_str) {
}
/* NOT IMPLEMENTED
-int w32_add_dns_server(struct netcf_if *nif, const char *dnsAddr) {
+int drv_add_dns_server(struct netcf_if *nif, const char *dnsAddr) {
return -1;
}
-int w32_rm_dns_server(struct netcf_if *nif) {
+int drv_rm_dns_server(struct netcf_if *nif) {
return -1;
}
*/
diff --git a/src/netcf_win.h b/src/netcf_win.h
index f98b0a1..7f691e8 100644
--- a/src/netcf_win.h
+++ b/src/netcf_win.h
@@ -44,41 +44,40 @@ PIP_ADAPTER_ADDRESSES _get_ip_adapter_info(PIP_ADAPTER_ADDRESSES
addrList);
PMIB_IPADDRTABLE _get_ip_addr_table(PMIB_IPADDRTABLE ipAddrTable);
/* return num of interfaces enabled */
-int w32_num_of_interfaces(struct netcf *ncf, unsigned int flags);
+int drv_num_of_interfaces(struct netcf *ncf, unsigned int flags);
/* helper for providing number of interfaces and associated names */
-int w32_list_interface_ids(struct netcf *ncf, int maxnames,
+int drv_list_interface_ids(struct netcf *ncf, int maxnames,
char **names, unsigned int flags,
const char *id_attr);
/* list interface names */
-int w32_list_interfaces(struct netcf *ncf,
+int drv_list_interfaces(struct netcf *ncf,
int maxnames, char **names,
unsigned int flags);
/* lookup interface by name */
-struct netcf_if *w32_lookup_by_name(struct netcf *ncf,
- const char *name);
+struct netcf_if *drv_lookup_by_name(struct netcf *ncf, const char *name);
/* obtain hardware address of interface */
-const char *w32_mac_string(struct netcf_if *nif);
+const char *drv_mac_string(struct netcf_if *nif);
/* bring interface down */
-int w32_if_down(struct netcf_if *nif);
+int drv_if_down(struct netcf_if *nif);
/* bring interface up */
-int w32_if_up(struct netcf_if *nif);
+int drv_if_up(struct netcf_if *nif);
/* Reports ip addresses */
-int w32_if_ipaddresses(struct netcf_if *nif, const char *ipBuf);
+int drv_if_ipaddresses(struct netcf_if *nif, const char *ipBuf);
/* add ip address to device */
-int w32_add_ip_address(struct netcf_if *nif, char *ipAddr,
+int drv_add_ip_address(struct netcf_if *nif, char *ipAddr,
char *netmask);
/* remove ip address from device */
-int w32_rm_ip_address(struct netcf_if *nif, ULONG NTEContext);
+int drv_rm_ip_address(struct netcf_if *nif, ULONG NTEContext);
/* add dns server to device */
-int w32_add_dns_server(struct netcf_if *nif, ULONG NTEContext);
+int drv_add_dns_server(struct netcf_if *nif, ULONG NTEContext);
/* rm dns server from device */
-int w32_rm_dns_server(struct netcf_if *nif);
+int drv_rm_dns_server(struct netcf_if *nif);
#endif /* NETCF_WIN_H */
--
1.7.2.2