src: Add DMA localagent
[barometer.git] / src / dma / vendor / github.com / libvirt / libvirt-go / network_events_wrapper.go
1 /*
2  * This file is part of the libvirt-go project
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  * THE SOFTWARE.
21  *
22  * Copyright (c) 2013 Alex Zorin
23  * Copyright (C) 2016 Red Hat, Inc.
24  *
25  */
26
27 package libvirt
28
29 /*
30 #cgo pkg-config: libvirt
31 #include <assert.h>
32 #include <stdint.h>
33 #include "network_events_wrapper.h"
34 #include "callbacks_wrapper.h"
35
36 extern void networkEventLifecycleCallback(virConnectPtr, virNetworkPtr, int, int, int);
37 void networkEventLifecycleCallbackHelper(virConnectPtr c, virNetworkPtr d,
38                                      int event, int detail, void *data)
39 {
40     networkEventLifecycleCallback(c, d, event, detail, (int)(intptr_t)data);
41 }
42
43 int
44 virConnectNetworkEventRegisterAnyWrapper(virConnectPtr c,
45                                          virNetworkPtr d,
46                                          int eventID,
47                                          virConnectNetworkEventGenericCallback cb,
48                                          long goCallbackId,
49                                          virErrorPtr err)
50 {
51     void* id = (void*)goCallbackId;
52 #if LIBVIR_VERSION_NUMBER < 1002001
53     assert(0); // Caller should have checked version
54 #else
55     int ret = virConnectNetworkEventRegisterAny(c, d, eventID, cb, id, freeGoCallbackHelper);
56     if (ret < 0) {
57         virCopyLastError(err);
58     }
59     return ret;
60 #endif
61 }
62
63 int virConnectNetworkEventDeregisterAnyWrapper(virConnectPtr conn,
64                                                int callbackID,
65                                                virErrorPtr err)
66 {
67 #if LIBVIR_VERSION_NUMBER < 1002001
68     assert(0); // Caller should have checked version
69 #else
70     int ret = virConnectNetworkEventDeregisterAny(conn, callbackID);
71     if (ret < 0) {
72         virCopyLastError(err);
73     }
74     return ret;
75 #endif
76 }
77
78 */
79 import "C"