Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
network.go | 1 +
network_compat.h | 10 -------
network_events_wrapper.go | 10 +++++++
network_events_wrapper.h | 8 ++++++
network_compat.go => network_wrapper.go | 11 +-------
network_wrapper.h | 37 +++++++++++++++++++++++++
6 files changed, 57 insertions(+), 20 deletions(-)
rename network_compat.go => network_wrapper.go (86%)
create mode 100644 network_wrapper.h
diff --git a/network.go b/network.go
index fe54bf1..26bf24e 100644
--- a/network.go
+++ b/network.go
@@ -32,6 +32,7 @@ package libvirt
#include <libvirt/virterror.h>
#include <stdlib.h>
#include "network_compat.h"
+#include "network_wrapper.h"
*/
import "C"
diff --git a/network_compat.h b/network_compat.h
index 97c8ad5..08f0778 100644
--- a/network_compat.h
+++ b/network_compat.h
@@ -56,9 +56,6 @@ typedef void (*virConnectNetworkEventGenericCallback)(virConnectPtr
conn,
void *opaque);
#endif
-int virConnectNetworkEventDeregisterAnyWrapper(virConnectPtr conn,
- int callbackID);
-
/* 1.2.5 */
@@ -86,11 +83,4 @@ struct _virNetworkDHCPLease {
};
#endif
-void virNetworkDHCPLeaseFreeWrapper(virNetworkDHCPLeasePtr lease);
-
-int virNetworkGetDHCPLeasesWrapper(virNetworkPtr network,
- const char *mac,
- virNetworkDHCPLeasePtr **leases,
- unsigned int flags);
-
#endif /* LIBVIRT_GO_NETWORK_COMPAT_H__ */
diff --git a/network_events_wrapper.go b/network_events_wrapper.go
index ea892cf..27bf555 100644
--- a/network_events_wrapper.go
+++ b/network_events_wrapper.go
@@ -54,5 +54,15 @@ int virConnectNetworkEventRegisterAnyWrapper(virConnectPtr c,
virNetworkPtr d,
#endif
}
+int virConnectNetworkEventDeregisterAnyWrapper(virConnectPtr conn,
+ int callbackID)
+{
+#if LIBVIR_VERSION_NUMBER < 1002001
+ assert(0); // Caller should have checked version
+#else
+ return virConnectNetworkEventDeregisterAny(conn, callbackID);
+#endif
+}
+
*/
import "C"
diff --git a/network_events_wrapper.h b/network_events_wrapper.h
index 1b73369..8388467 100644
--- a/network_events_wrapper.h
+++ b/network_events_wrapper.h
@@ -34,5 +34,13 @@ int virConnectNetworkEventRegisterAnyWrapper(virConnectPtr c,
virNetworkPtr d,
int eventID,
virConnectNetworkEventGenericCallback cb,
long goCallbackId);
+int virConnectNetworkEventRegisterAnyWrapper(virConnectPtr c,
+ virNetworkPtr d,
+ int eventID,
+ virConnectNetworkEventGenericCallback cb,
+ long goCallbackId);
+int virConnectNetworkEventDeregisterAnyWrapper(virConnectPtr conn,
+ int callbackID);
+
#endif /* LIBVIRT_GO_NETWORK_EVENTS_WRAPPER_H__ */
diff --git a/network_compat.go b/network_wrapper.go
similarity index 86%
rename from network_compat.go
rename to network_wrapper.go
index 56e9749..bd58754 100644
--- a/network_compat.go
+++ b/network_wrapper.go
@@ -31,16 +31,7 @@ package libvirt
#include <libvirt/libvirt.h>
#include <assert.h>
#include "network_compat.h"
-
-int virConnectNetworkEventDeregisterAnyWrapper(virConnectPtr conn,
- int callbackID)
-{
-#if LIBVIR_VERSION_NUMBER < 1002001
- assert(0); // Caller should have checked version
-#else
- return virConnectNetworkEventDeregisterAny(conn, callbackID);
-#endif
-}
+#include "network_wrapper.h"
void virNetworkDHCPLeaseFreeWrapper(virNetworkDHCPLeasePtr lease)
{
diff --git a/network_wrapper.h b/network_wrapper.h
new file mode 100644
index 0000000..762fe3b
--- /dev/null
+++ b/network_wrapper.h
@@ -0,0 +1,37 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_NETWORK_WRAPPER_H__
+#define LIBVIRT_GO_NETWORK_WRAPPER_H__
+
+void virNetworkDHCPLeaseFreeWrapper(virNetworkDHCPLeasePtr lease);
+
+int virNetworkGetDHCPLeasesWrapper(virNetworkPtr network,
+ const char *mac,
+ virNetworkDHCPLeasePtr **leases,
+ unsigned int flags);
+
+#endif /* LIBVIRT_GO_NETWORK_WRAPPER_H__ */
--
2.17.1