2 * driver.h: description of the set of interfaces provided by a
3 * entry point to the virtualization engine
5 * Copyright (C) 2006-2014 Red Hat, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library. If not, see
19 * <http://www.gnu.org/licenses/>.
27 #include "libvirt_internal.h"
31 /* Status codes returned from driver open call. */
33 /* Opened successfully. */
34 VIR_DRV_OPEN_SUCCESS
= 0,
36 /* 'name' is not for us. */
37 VIR_DRV_OPEN_DECLINED
= -1,
39 /* 'name' is for us, but there was some error. virConnectOpen will
40 * return an error rather than continue probing the other drivers.
42 VIR_DRV_OPEN_ERROR
= -2,
46 /* Internal feature-detection macro. Don't call drv->supports_feature
47 * directly if you don't have to, because it may be NULL, use this macro
52 * >0 Feature is supported.
53 * 0 Feature is not supported.
55 #define VIR_DRV_SUPPORTS_FEATURE(drv, conn, feature) \
56 ((drv)->connectSupportsFeature ? \
57 (drv)->connectSupportsFeature((conn), (feature)) : 0)
60 #define __VIR_DRIVER_H_INCLUDES___
62 #include "driver-hypervisor.h"
63 #include "driver-interface.h"
64 #include "driver-network.h"
65 #include "driver-nodedev.h"
66 #include "driver-nwfilter.h"
67 #include "driver-secret.h"
68 #include "driver-state.h"
69 #include "driver-stream.h"
70 #include "driver-storage.h"
72 #undef __VIR_DRIVER_H_INCLUDES___
74 typedef struct _virConnectDriver virConnectDriver
;
75 struct _virConnectDriver
{
76 /* Whether driver permits a server in the URI */
78 /* Whether driver needs a server in the URI */
80 /* Whether driver can be used in embedded mode */
83 * NULL terminated list of supported URI schemes.
84 * - Single element { NULL } list indicates no supported schemes
85 * - NULL list indicates wildcard supporting all schemes
87 const char **uriSchemes
;
88 virHypervisorDriver
*hypervisorDriver
;
89 virInterfaceDriver
*interfaceDriver
;
90 virNetworkDriver
*networkDriver
;
91 virNodeDeviceDriver
*nodeDeviceDriver
;
92 virNWFilterDriver
*nwfilterDriver
;
93 virSecretDriver
*secretDriver
;
94 virStorageDriver
*storageDriver
;
97 int virRegisterConnectDriver(virConnectDriver
*driver
,
98 bool setSharedDrivers
) G_GNUC_WARN_UNUSED_RESULT
;
99 int virRegisterStateDriver(virStateDriver
*driver
) G_GNUC_WARN_UNUSED_RESULT
;
101 int virSetSharedInterfaceDriver(virInterfaceDriver
*driver
) G_GNUC_WARN_UNUSED_RESULT
;
102 int virSetSharedNetworkDriver(virNetworkDriver
*driver
) G_GNUC_WARN_UNUSED_RESULT
;
103 int virSetSharedNodeDeviceDriver(virNodeDeviceDriver
*driver
) G_GNUC_WARN_UNUSED_RESULT
;
104 int virSetSharedNWFilterDriver(virNWFilterDriver
*driver
) G_GNUC_WARN_UNUSED_RESULT
;
105 int virSetSharedSecretDriver(virSecretDriver
*driver
) G_GNUC_WARN_UNUSED_RESULT
;
106 int virSetSharedStorageDriver(virStorageDriver
*driver
) G_GNUC_WARN_UNUSED_RESULT
;
108 bool virHasDriverForURIScheme(const char *scheme
);
110 int virDriverLoadModule(const char *name
,
114 int virDriverShouldAutostart(const char *name
,
117 virConnectPtr
virGetConnectInterface(void);
118 virConnectPtr
virGetConnectNetwork(void);
119 virConnectPtr
virGetConnectNWFilter(void);
120 virConnectPtr
virGetConnectNodeDev(void);
121 virConnectPtr
virGetConnectSecret(void);
122 virConnectPtr
virGetConnectStorage(void);
124 int virSetConnectInterface(virConnectPtr conn
);
125 int virSetConnectNetwork(virConnectPtr conn
);
126 int virSetConnectNWFilter(virConnectPtr conn
);
127 int virSetConnectNodeDev(virConnectPtr conn
);
128 int virSetConnectSecret(virConnectPtr conn
);
129 int virSetConnectStorage(virConnectPtr conn
);
131 bool virConnectValidateURIPath(const char *uriPath
,
132 const char *entityName
,
135 bool virDriverFeatureIsGlobal(virDrvFeature feat
,