driver.h 45.8 KB
Newer Older
1
/*
2
 * driver.h: description of the set of interfaces provided by a
3 4 5 6
 *           entry point to the virtualization engine
 */

#ifndef __VIR_DRIVER_H__
7
# define __VIR_DRIVER_H__
8

9
# include "config.h"
10

11
# include <libxml/uri.h>
12

13
# include "internal.h"
14 15 16 17
/*
 * List of registered drivers numbers
 */
typedef enum {
18 19 20
    VIR_DRV_XEN_UNIFIED = 1,
    VIR_DRV_TEST = 2,
    VIR_DRV_QEMU = 3,
21
    VIR_DRV_REMOTE = 4,
22
    VIR_DRV_OPENVZ = 5,
23 24
    VIR_DRV_LXC = 6,
    VIR_DRV_UML = 7,
25
    VIR_DRV_VBOX = 8,
D
Daniel Veillard 已提交
26
    VIR_DRV_ONE = 9,
27
    VIR_DRV_ESX = 10,
28
    VIR_DRV_PHYP = 11,
29 30
    VIR_DRV_XENAPI = 12,
    VIR_DRV_VMWARE = 13
31 32 33
} virDrvNo;


34 35 36 37 38 39 40 41 42 43 44 45 46 47
/* Status codes returned from driver open call. */
typedef enum {
    /* Opened successfully. */
    VIR_DRV_OPEN_SUCCESS = 0,

    /* 'name' is not for us. */
    VIR_DRV_OPEN_DECLINED = -1,

    /* 'name' is for us, but there was some error.  virConnectOpen will
     * return an error rather than continue probing the other drivers.
     */
    VIR_DRV_OPEN_ERROR = -2,
} virDrvOpenStatus;

D
Daniel Veillard 已提交
48

49
/* Internal feature-detection macro.  Don't call drv->supports_feature
50 51
 * directly if you don't have to, because it may be NULL, use this macro
 * instead.
52
 *
53 54 55
 * Note that this treats a possible error returned by drv->supports_feature
 * the same as not supported. If you care about the error, call
 * drv->supports_feature directly.
56 57
 *
 * Returns:
58
 *   != 0  Feature is supported.
59 60
 *   0     Feature is not supported.
 */
61 62 63
# define VIR_DRV_SUPPORTS_FEATURE(drv,conn,feature)                         \
    ((drv)->supports_feature ?                                              \
        (drv)->supports_feature((conn), (feature)) > 0 : 0)
64

65
typedef virDrvOpenStatus
66
        (*virDrvOpen)			(virConnectPtr conn,
67 68
                             virConnectAuthPtr auth,
                             int flags);
69
typedef int
70
        (*virDrvClose)			(virConnectPtr conn);
71
typedef int
D
Daniel P. Berrange 已提交
72
    (*virDrvDrvSupportsFeature) (virConnectPtr conn, int feature);
73
typedef const char *
74
        (*virDrvGetType)		(virConnectPtr conn);
75
typedef int
76 77
        (*virDrvGetVersion)		(virConnectPtr conn,
                                         unsigned long *hvVer);
78 79 80
typedef int
        (*virDrvGetLibVersion)      (virConnectPtr conn,
                                     unsigned long *libVer);
81 82 83 84
typedef char *
    (*virDrvGetHostname)    (virConnectPtr conn);
typedef char *
    (*virDrvGetURI)         (virConnectPtr conn);
E
Eric Blake 已提交
85 86 87
typedef char *
    (*virDrvGetSysinfo)     (virConnectPtr conn,
                             unsigned int flags);
88
typedef int
89 90
        (*virDrvGetMaxVcpus)		(virConnectPtr conn,
                                         const char *type);
91
typedef int
92 93
        (*virDrvNodeGetInfo)		(virConnectPtr conn,
                                         virNodeInfoPtr info);
94
typedef char *
95
        (*virDrvGetCapabilities) (virConnectPtr conn);
96
typedef int
97 98 99
        (*virDrvListDomains)		(virConnectPtr conn,
                                         int *ids,
                                         int maxids);
100
typedef int
101
        (*virDrvNumOfDomains)		(virConnectPtr conn);
102
typedef virDomainPtr
103
        (*virDrvDomainCreateXML)	(virConnectPtr conn,
104 105
                                         const char *xmlDesc,
                                         unsigned int flags);
106
typedef virDomainPtr
107 108
        (*virDrvDomainLookupByID)	(virConnectPtr conn,
                                         int id);
109
typedef virDomainPtr
110 111
        (*virDrvDomainLookupByUUID)	(virConnectPtr conn,
                                         const unsigned char *uuid);
112
typedef virDomainPtr
113 114
        (*virDrvDomainLookupByName)	(virConnectPtr conn,
                                         const char *name);
115
typedef int
116
        (*virDrvDomainSuspend)		(virDomainPtr domain);
117
typedef int
118
        (*virDrvDomainResume)		(virDomainPtr domain);
119
typedef int
120
        (*virDrvDomainShutdown)		(virDomainPtr domain);
121
typedef int
122 123
        (*virDrvDomainReboot)		(virDomainPtr domain,
                                         unsigned int flags);
124
typedef int
125
        (*virDrvDomainDestroy)		(virDomainPtr domain);
126
typedef char *
127
        (*virDrvDomainGetOSType)	(virDomainPtr domain);
128
typedef unsigned long
129
        (*virDrvDomainGetMaxMemory)	(virDomainPtr domain);
130
typedef int
131 132
        (*virDrvDomainSetMaxMemory)	(virDomainPtr domain,
                                         unsigned long memory);
133
typedef int
134 135
        (*virDrvDomainSetMemory)	(virDomainPtr domain,
                                         unsigned long memory);
136 137 138 139
typedef int
        (*virDrvDomainSetMemoryFlags)	(virDomainPtr domain,
                                         unsigned long memory,
                                         unsigned int flags);
140 141 142 143 144 145 146 147 148 149 150 151
typedef int
        (*virDrvDomainSetMemoryParameters)
                                        (virDomainPtr domain,
                                         virMemoryParameterPtr params,
                                         int nparams,
                                         unsigned int flags);
typedef int
        (*virDrvDomainGetMemoryParameters)
                                        (virDomainPtr domain,
                                         virMemoryParameterPtr params,
                                         int *nparams,
                                         unsigned int flags);
152 153 154 155 156 157 158 159 160 161 162 163
typedef int
        (*virDrvDomainSetBlkioParameters)
                                        (virDomainPtr domain,
                                         virBlkioParameterPtr params,
                                         int nparams,
                                         unsigned int flags);
typedef int
        (*virDrvDomainGetBlkioParameters)
                                        (virDomainPtr domain,
                                         virBlkioParameterPtr params,
                                         int *nparams,
                                         unsigned int flags);
164
typedef int
165 166
        (*virDrvDomainGetInfo)		(virDomainPtr domain,
                                         virDomainInfoPtr info);
167
typedef int
168 169
        (*virDrvDomainSave)		(virDomainPtr domain,
                                         const char *to);
170
typedef int
171 172
        (*virDrvDomainRestore)		(virConnectPtr conn,
                                         const char *from);
D
Daniel Veillard 已提交
173
typedef int
174 175 176
        (*virDrvDomainCoreDump)		(virDomainPtr domain,
                                         const char *to,
                                         int flags);
177
typedef char *
178 179
        (*virDrvDomainDumpXML)		(virDomainPtr dom,
                                         int flags);
180 181 182 183 184 185 186 187 188 189
typedef char *
        (*virDrvConnectDomainXMLFromNative) (virConnectPtr conn,
                                             const char *nativeFormat,
                                             const char *nativeConfig,
                                             unsigned int flags);
typedef char *
        (*virDrvConnectDomainXMLToNative) (virConnectPtr conn,
                                           const char *nativeFormat,
                                           const char *domainXml,
                                           unsigned int flags);
190
typedef int
191 192 193
        (*virDrvListDefinedDomains)	(virConnectPtr conn,
                                         char **const names,
                                         int maxnames);
194
typedef int
195
        (*virDrvNumOfDefinedDomains)	(virConnectPtr conn);
196
typedef int
197
        (*virDrvDomainCreate)		(virDomainPtr dom);
198 199 200
typedef int
        (*virDrvDomainCreateWithFlags)	(virDomainPtr dom,
                                         unsigned int flags);
201
typedef virDomainPtr
202 203
        (*virDrvDomainDefineXML)	(virConnectPtr conn,
                                         const char *xml);
204
typedef int
205
        (*virDrvDomainUndefine)		(virDomainPtr dom);
206
typedef int
207 208
        (*virDrvDomainSetVcpus)		(virDomainPtr domain,
                                         unsigned int nvcpus);
E
Eric Blake 已提交
209 210 211 212 213 214 215
typedef int
        (*virDrvDomainSetVcpusFlags)	(virDomainPtr domain,
                                         unsigned int nvcpus,
                                         unsigned int flags);
typedef int
        (*virDrvDomainGetVcpusFlags)	(virDomainPtr domain,
                                         unsigned int flags);
216
typedef int
217 218 219 220
        (*virDrvDomainPinVcpu)		(virDomainPtr domain,
                                         unsigned int vcpu,
                                         unsigned char *cpumap,
                                         int maplen);
221
typedef int
222 223 224 225 226
        (*virDrvDomainGetVcpus)		(virDomainPtr domain,
                                         virVcpuInfoPtr info,
                                         int maxinfo,
                                         unsigned char *cpumaps,
                                         int maplen);
227
typedef int
228
        (*virDrvDomainGetMaxVcpus)	(virDomainPtr domain);
229 230 231 232 233 234 235

typedef int
        (*virDrvDomainGetSecurityLabel)	(virDomainPtr domain,
                                         virSecurityLabelPtr seclabel);
typedef int
        (*virDrvNodeGetSecurityModel)	(virConnectPtr conn,
                                         virSecurityModelPtr secmodel);
236
typedef int
237 238
        (*virDrvDomainAttachDevice)	(virDomainPtr domain,
                                         const char *xml);
J
Jim Fehlig 已提交
239 240 241 242
typedef int
        (*virDrvDomainAttachDeviceFlags) (virDomainPtr domain,
                                          const char *xml,
                                          unsigned int flags);
243
typedef int
244 245
        (*virDrvDomainDetachDevice)	(virDomainPtr domain,
                                         const char *xml);
J
Jim Fehlig 已提交
246 247 248 249
typedef int
        (*virDrvDomainDetachDeviceFlags) (virDomainPtr domain,
                                          const char *xml,
                                          unsigned int flags);
250 251 252 253
typedef int
        (*virDrvDomainUpdateDeviceFlags) (virDomainPtr domain,
                                          const char *xml,
                                          unsigned int flags);
254
typedef int
255 256
        (*virDrvDomainGetAutostart)	(virDomainPtr domain,
                                         int *autostart);
257
typedef int
258 259
        (*virDrvDomainSetAutostart)	(virDomainPtr domain,
                                         int autostart);
260

261
typedef char *
262 263
        (*virDrvDomainGetSchedulerType)	(virDomainPtr domain,
                                         int *nparams);
264

265
typedef int
266 267 268 269
        (*virDrvDomainGetSchedulerParameters)
                                        (virDomainPtr domain,
                                         virSchedParameterPtr params,
                                         int *nparams);
270 271

typedef int
272 273 274 275
        (*virDrvDomainSetSchedulerParameters)
                                        (virDomainPtr domain,
                                         virSchedParameterPtr params,
                                         int nparams);
276

277 278 279 280 281 282 283 284 285 286 287
typedef int
    (*virDrvDomainBlockStats)
                    (virDomainPtr domain,
                     const char *path,
                     struct _virDomainBlockStats *stats);
typedef int
    (*virDrvDomainInterfaceStats)
                    (virDomainPtr domain,
                     const char *path,
                     struct _virDomainInterfaceStats *stats);

288 289 290 291 292 293
typedef int
    (*virDrvDomainMemoryStats)
                    (virDomainPtr domain,
                     struct _virDomainMemoryStat *stats,
                     unsigned int nr_stats);

R
Richard W.M. Jones 已提交
294 295 296 297 298
typedef int
    (*virDrvDomainBlockPeek)
                    (virDomainPtr domain,
                     const char *path,
                     unsigned long long offset, size_t size,
299 300
                     void *buffer,
                     unsigned int flags);
R
Richard W.M. Jones 已提交
301

R
Richard W.M. Jones 已提交
302 303 304 305 306 307
typedef int
    (*virDrvDomainMemoryPeek)
                    (virDomainPtr domain,
                     unsigned long long start, size_t size,
                     void *buffer,
                     unsigned int flags);
308 309 310 311 312 313
typedef int
    (*virDrvDomainGetBlockInfo)
                    (virDomainPtr domain,
                     const char *path,
                     virDomainBlockInfoPtr info,
                     unsigned int flags);
R
Richard W.M. Jones 已提交
314

315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
typedef int
    (*virDrvDomainMigratePrepare)
                    (virConnectPtr dconn,
                     char **cookie,
                     int *cookielen,
                     const char *uri_in,
                     char **uri_out,
                     unsigned long flags,
                     const char *dname,
                     unsigned long resource);

typedef int
    (*virDrvDomainMigratePerform)
                    (virDomainPtr domain,
                     const char *cookie,
                     int cookielen,
                     const char *uri,
                     unsigned long flags,
                     const char *dname,
                     unsigned long resource);

typedef virDomainPtr
    (*virDrvDomainMigrateFinish)
                    (virConnectPtr dconn,
                     const char *dname,
                     const char *cookie,
                     int cookielen,
                     const char *uri,
                     unsigned long flags);

345 346 347
typedef struct _virDriver virDriver;
typedef virDriver *virDriverPtr;

348 349 350 351 352 353 354
typedef int
    (*virDrvNodeGetCellsFreeMemory)
                    (virConnectPtr conn,
                     unsigned long long *freeMems,
                     int startCell,
                     int maxCells);

355 356
typedef unsigned long long
    (*virDrvNodeGetFreeMemory)
357
                    (virConnectPtr conn);
358

359 360 361
typedef int
    (*virDrvDomainEventRegister)
                    (virConnectPtr conn,
362
                     virConnectDomainEventCallback cb,
363 364
                     void *opaque,
                     virFreeCallback freecb);
365 366 367 368

typedef int
    (*virDrvDomainEventDeregister)
                    (virConnectPtr conn,
369
                     virConnectDomainEventCallback cb);
370

D
Daniel Veillard 已提交
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392
typedef int
    (*virDrvDomainMigratePrepare2)
                    (virConnectPtr dconn,
                     char **cookie,
                     int *cookielen,
                     const char *uri_in,
                     char **uri_out,
                     unsigned long flags,
                     const char *dname,
                     unsigned long resource,
                     const char *dom_xml);

typedef virDomainPtr
    (*virDrvDomainMigrateFinish2)
                    (virConnectPtr dconn,
                     const char *dname,
                     const char *cookie,
                     int cookielen,
                     const char *uri,
                     unsigned long flags,
                     int retcode);

393 394 395 396 397 398 399 400 401 402
typedef int
    (*virDrvNodeDeviceDettach)
                    (virNodeDevicePtr dev);
typedef int
    (*virDrvNodeDeviceReAttach)
                    (virNodeDevicePtr dev);
typedef int
    (*virDrvNodeDeviceReset)
                    (virNodeDevicePtr dev);

C
Chris Lalancette 已提交
403 404 405 406 407 408 409 410 411
typedef int
    (*virDrvDomainMigratePrepareTunnel)
                    (virConnectPtr conn,
                     virStreamPtr st,
                     unsigned long flags,
                     const char *dname,
                     unsigned long resource,
                     const char *dom_xml);

412 413 414 415 416 417 418 419
typedef int
    (*virDrvConnectIsEncrypted)(virConnectPtr conn);
typedef int
    (*virDrvConnectIsSecure)(virConnectPtr conn);
typedef int
    (*virDrvDomainIsActive)(virDomainPtr dom);
typedef int
    (*virDrvDomainIsPersistent)(virDomainPtr dom);
O
Osier Yang 已提交
420 421
typedef int
    (*virDrvDomainIsUpdated)(virDomainPtr dom);
422

J
Jiri Denemark 已提交
423 424 425 426
typedef int
    (*virDrvCPUCompare)(virConnectPtr conn,
                        const char *cpu,
                        unsigned int flags);
427 428 429 430 431
typedef char *
    (*virDrvCPUBaseline)(virConnectPtr conn,
                         const char **xmlCPUs,
                         unsigned int ncpus,
                         unsigned int flags);
J
Jiri Denemark 已提交
432

433 434 435 436
typedef int
    (*virDrvDomainGetJobInfo)(virDomainPtr domain,
                              virDomainJobInfoPtr info);

437 438 439
typedef int
    (*virDrvDomainAbortJob)(virDomainPtr domain);

440 441 442 443 444
typedef int
    (*virDrvDomainMigrateSetMaxDowntime)(virDomainPtr domain,
                                         unsigned long long downtime,
                                         unsigned int flags);

445 446 447 448 449 450 451 452 453 454 455 456
typedef int
    (*virDrvDomainEventRegisterAny)(virConnectPtr conn,
                                    virDomainPtr dom,
                                    int eventID,
                                    virConnectDomainEventGenericCallback cb,
                                    void *opaque,
                                    virFreeCallback freecb);

typedef int
    (*virDrvDomainEventDeregisterAny)(virConnectPtr conn,
                                      int callbackID);

457 458 459 460 461 462 463 464 465
typedef int
    (*virDrvDomainManagedSave)(virDomainPtr domain, unsigned int flags);

typedef int
    (*virDrvDomainHasManagedSaveImage)(virDomainPtr domain, unsigned int flags);

typedef int
    (*virDrvDomainManagedSaveRemove)(virDomainPtr domain, unsigned int flags);

C
Chris Lalancette 已提交
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502
typedef virDomainSnapshotPtr
    (*virDrvDomainSnapshotCreateXML)(virDomainPtr domain,
                                     const char *xmlDesc,
                                     unsigned int flags);

typedef char *
    (*virDrvDomainSnapshotDumpXML)(virDomainSnapshotPtr snapshot,
                                   unsigned int flags);

typedef int
    (*virDrvDomainSnapshotNum)(virDomainPtr domain, unsigned int flags);

typedef int
    (*virDrvDomainSnapshotListNames)(virDomainPtr domain, char **names,
                                     int nameslen,
                                     unsigned int flags);

typedef virDomainSnapshotPtr
    (*virDrvDomainSnapshotLookupByName)(virDomainPtr domain,
                                        const char *name,
                                        unsigned int flags);

typedef int
    (*virDrvDomainHasCurrentSnapshot)(virDomainPtr domain, unsigned int flags);

typedef virDomainSnapshotPtr
    (*virDrvDomainSnapshotCurrent)(virDomainPtr domain,
                                   unsigned int flags);

typedef int
    (*virDrvDomainRevertToSnapshot)(virDomainSnapshotPtr snapshot,
                                    unsigned int flags);

typedef int
    (*virDrvDomainSnapshotDelete)(virDomainSnapshotPtr snapshot,
                                  unsigned int flags);

C
Chris Lalancette 已提交
503 504 505 506
typedef int
    (*virDrvQemuDomainMonitorCommand)(virDomainPtr domain, const char *cmd,
                                      char **result, unsigned int flags);

507 508 509 510 511
typedef int
    (*virDrvDomainOpenConsole)(virDomainPtr dom,
                               const char *devname,
                               virStreamPtr st,
                               unsigned int flags);
C
Chris Lalancette 已提交
512

C
Chris Lalancette 已提交
513

514 515 516 517 518
/**
 * _virDriver:
 *
 * Structure associated to a virtualization driver, defining the various
 * entry points for it.
519 520 521 522 523 524
 *
 * All drivers must support the following fields/methods:
 *  - no
 *  - name
 *  - open
 *  - close
525 526
 */
struct _virDriver {
527
    int        no;	/* the number virDrvNo */
528 529 530
    const char * name;	/* the name of the driver */
    virDrvOpen			open;
    virDrvClose			close;
D
Daniel P. Berrange 已提交
531
    virDrvDrvSupportsFeature   supports_feature;
532 533
    virDrvGetType			type;
    virDrvGetVersion		version;
534
    virDrvGetLibVersion		libvirtVersion;
535
    virDrvGetHostname       getHostname;
E
Eric Blake 已提交
536
    virDrvGetSysinfo            getSysinfo;
537 538 539 540 541
    virDrvGetMaxVcpus		getMaxVcpus;
    virDrvNodeGetInfo		nodeGetInfo;
    virDrvGetCapabilities		getCapabilities;
    virDrvListDomains		listDomains;
    virDrvNumOfDomains		numOfDomains;
542
    virDrvDomainCreateXML		domainCreateXML;
543 544 545 546 547 548 549 550 551 552 553 554
    virDrvDomainLookupByID		domainLookupByID;
    virDrvDomainLookupByUUID	domainLookupByUUID;
    virDrvDomainLookupByName	domainLookupByName;
    virDrvDomainSuspend		domainSuspend;
    virDrvDomainResume		domainResume;
    virDrvDomainShutdown		domainShutdown;
    virDrvDomainReboot		domainReboot;
    virDrvDomainDestroy		domainDestroy;
    virDrvDomainGetOSType		domainGetOSType;
    virDrvDomainGetMaxMemory	domainGetMaxMemory;
    virDrvDomainSetMaxMemory	domainSetMaxMemory;
    virDrvDomainSetMemory		domainSetMemory;
555
    virDrvDomainSetMemoryFlags  domainSetMemoryFlags;
556 557 558 559
    virDrvDomainSetMemoryParameters domainSetMemoryParameters;
    virDrvDomainGetMemoryParameters domainGetMemoryParameters;
    virDrvDomainSetBlkioParameters domainSetBlkioParameters;
    virDrvDomainGetBlkioParameters domainGetBlkioParameters;
560 561 562 563 564
    virDrvDomainGetInfo		domainGetInfo;
    virDrvDomainSave		domainSave;
    virDrvDomainRestore		domainRestore;
    virDrvDomainCoreDump		domainCoreDump;
    virDrvDomainSetVcpus		domainSetVcpus;
E
Eric Blake 已提交
565 566
    virDrvDomainSetVcpusFlags		domainSetVcpusFlags;
    virDrvDomainGetVcpusFlags		domainGetVcpusFlags;
567 568 569
    virDrvDomainPinVcpu		domainPinVcpu;
    virDrvDomainGetVcpus		domainGetVcpus;
    virDrvDomainGetMaxVcpus		domainGetMaxVcpus;
570 571
    virDrvDomainGetSecurityLabel     domainGetSecurityLabel;
    virDrvNodeGetSecurityModel  nodeGetSecurityModel;
572
    virDrvDomainDumpXML		domainDumpXML;
573 574
    virDrvConnectDomainXMLFromNative domainXMLFromNative;
    virDrvConnectDomainXMLToNative domainXMLToNative;
575 576 577
    virDrvListDefinedDomains	listDefinedDomains;
    virDrvNumOfDefinedDomains	numOfDefinedDomains;
    virDrvDomainCreate		domainCreate;
578
    virDrvDomainCreateWithFlags	domainCreateWithFlags;
579 580 581
    virDrvDomainDefineXML           domainDefineXML;
    virDrvDomainUndefine            domainUndefine;
    virDrvDomainAttachDevice	domainAttachDevice;
J
Jim Fehlig 已提交
582
    virDrvDomainAttachDeviceFlags	domainAttachDeviceFlags;
583
    virDrvDomainDetachDevice	domainDetachDevice;
J
Jim Fehlig 已提交
584
    virDrvDomainDetachDeviceFlags	domainDetachDeviceFlags;
585
    virDrvDomainUpdateDeviceFlags	domainUpdateDeviceFlags;
586 587 588 589 590
    virDrvDomainGetAutostart	domainGetAutostart;
    virDrvDomainSetAutostart	domainSetAutostart;
    virDrvDomainGetSchedulerType	domainGetSchedulerType;
    virDrvDomainGetSchedulerParameters domainGetSchedulerParameters;
    virDrvDomainSetSchedulerParameters domainSetSchedulerParameters;
591 592 593
    virDrvDomainMigratePrepare	domainMigratePrepare;
    virDrvDomainMigratePerform	domainMigratePerform;
    virDrvDomainMigrateFinish	domainMigrateFinish;
594 595
    virDrvDomainBlockStats      domainBlockStats;
    virDrvDomainInterfaceStats  domainInterfaceStats;
596
    virDrvDomainMemoryStats     domainMemoryStats;
R
Richard W.M. Jones 已提交
597
    virDrvDomainBlockPeek	domainBlockPeek;
R
Richard W.M. Jones 已提交
598
    virDrvDomainMemoryPeek      domainMemoryPeek;
599
    virDrvDomainGetBlockInfo    domainGetBlockInfo;
600 601
    virDrvNodeGetCellsFreeMemory	nodeGetCellsFreeMemory;
    virDrvNodeGetFreeMemory		getFreeMemory;
602 603
    virDrvDomainEventRegister         domainEventRegister;
    virDrvDomainEventDeregister       domainEventDeregister;
D
Daniel Veillard 已提交
604 605
    virDrvDomainMigratePrepare2	domainMigratePrepare2;
    virDrvDomainMigrateFinish2	domainMigrateFinish2;
606 607 608
    virDrvNodeDeviceDettach     nodeDeviceDettach;
    virDrvNodeDeviceReAttach    nodeDeviceReAttach;
    virDrvNodeDeviceReset       nodeDeviceReset;
C
Chris Lalancette 已提交
609
    virDrvDomainMigratePrepareTunnel domainMigratePrepareTunnel;
610 611 612 613
    virDrvConnectIsEncrypted   isEncrypted;
    virDrvConnectIsSecure      isSecure;
    virDrvDomainIsActive       domainIsActive;
    virDrvDomainIsPersistent   domainIsPersistent;
O
Osier Yang 已提交
614
    virDrvDomainIsUpdated      domainIsUpdated;
J
Jiri Denemark 已提交
615
    virDrvCPUCompare            cpuCompare;
616
    virDrvCPUBaseline           cpuBaseline;
617
    virDrvDomainGetJobInfo     domainGetJobInfo;
618
    virDrvDomainAbortJob     domainAbortJob;
619
    virDrvDomainMigrateSetMaxDowntime  domainMigrateSetMaxDowntime;
620 621
    virDrvDomainEventRegisterAny domainEventRegisterAny;
    virDrvDomainEventDeregisterAny domainEventDeregisterAny;
622 623 624
    virDrvDomainManagedSave domainManagedSave;
    virDrvDomainHasManagedSaveImage domainHasManagedSaveImage;
    virDrvDomainManagedSaveRemove domainManagedSaveRemove;
C
Chris Lalancette 已提交
625 626 627 628 629 630 631 632 633
    virDrvDomainSnapshotCreateXML domainSnapshotCreateXML;
    virDrvDomainSnapshotDumpXML domainSnapshotDumpXML;
    virDrvDomainSnapshotNum domainSnapshotNum;
    virDrvDomainSnapshotListNames domainSnapshotListNames;
    virDrvDomainSnapshotLookupByName domainSnapshotLookupByName;
    virDrvDomainHasCurrentSnapshot domainHasCurrentSnapshot;
    virDrvDomainSnapshotCurrent domainSnapshotCurrent;
    virDrvDomainRevertToSnapshot domainRevertToSnapshot;
    virDrvDomainSnapshotDelete domainSnapshotDelete;
C
Chris Lalancette 已提交
634
    virDrvQemuDomainMonitorCommand qemuDomainMonitorCommand;
635
    virDrvDomainOpenConsole domainOpenConsole;
636 637
};

638
typedef int
639
        (*virDrvNumOfNetworks)		(virConnectPtr conn);
640
typedef int
641 642 643
        (*virDrvListNetworks)		(virConnectPtr conn,
                                         char **const names,
                                         int maxnames);
644
typedef int
645
        (*virDrvNumOfDefinedNetworks)	(virConnectPtr conn);
646
typedef int
647 648 649
        (*virDrvListDefinedNetworks)	(virConnectPtr conn,
                                         char **const names,
                                         int maxnames);
650
typedef virNetworkPtr
651 652
        (*virDrvNetworkLookupByUUID)	(virConnectPtr conn,
                                         const unsigned char *uuid);
653
typedef virNetworkPtr
654 655
        (*virDrvNetworkLookupByName)	(virConnectPtr conn,
                                         const char *name);
656
typedef virNetworkPtr
657 658
        (*virDrvNetworkCreateXML)	(virConnectPtr conn,
                                         const char *xmlDesc);
659
typedef virNetworkPtr
660 661
        (*virDrvNetworkDefineXML)	(virConnectPtr conn,
                                         const char *xml);
662
typedef int
663
        (*virDrvNetworkUndefine)	(virNetworkPtr network);
664
typedef int
665
        (*virDrvNetworkCreate)		(virNetworkPtr network);
666
typedef int
667
        (*virDrvNetworkDestroy)		(virNetworkPtr network);
668
typedef char *
669 670
        (*virDrvNetworkDumpXML)		(virNetworkPtr network,
                                         int flags);
671
typedef char *
672
        (*virDrvNetworkGetBridgeName)	(virNetworkPtr network);
673
typedef int
674 675
        (*virDrvNetworkGetAutostart)	(virNetworkPtr network,
                                         int *autostart);
676
typedef int
677 678
        (*virDrvNetworkSetAutostart)	(virNetworkPtr network,
                                         int autostart);
679

680 681 682 683 684 685
typedef int
        (*virDrvNetworkIsActive)(virNetworkPtr net);
typedef int
        (*virDrvNetworkIsPersistent)(virNetworkPtr net);


686 687 688 689 690 691 692 693 694

typedef struct _virNetworkDriver virNetworkDriver;
typedef virNetworkDriver *virNetworkDriverPtr;

/**
 * _virNetworkDriver:
 *
 * Structure associated to a network virtualization driver, defining the various
 * entry points for it.
695 696 697 698
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
699 700
 */
struct _virNetworkDriver {
701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718
        const char * name;	/* the name of the driver */
        virDrvOpen			open;
        virDrvClose			close;
        virDrvNumOfNetworks		numOfNetworks;
        virDrvListNetworks		listNetworks;
        virDrvNumOfDefinedNetworks	numOfDefinedNetworks;
        virDrvListDefinedNetworks	listDefinedNetworks;
        virDrvNetworkLookupByUUID	networkLookupByUUID;
        virDrvNetworkLookupByName	networkLookupByName;
        virDrvNetworkCreateXML		networkCreateXML;
        virDrvNetworkDefineXML		networkDefineXML;
        virDrvNetworkUndefine		networkUndefine;
        virDrvNetworkCreate		networkCreate;
        virDrvNetworkDestroy		networkDestroy;
        virDrvNetworkDumpXML		networkDumpXML;
        virDrvNetworkGetBridgeName	networkGetBridgeName;
        virDrvNetworkGetAutostart	networkGetAutostart;
        virDrvNetworkSetAutostart	networkSetAutostart;
719 720
        virDrvNetworkIsActive           networkIsActive;
        virDrvNetworkIsPersistent       networkIsPersistent;
721 722
};

D
Daniel Veillard 已提交
723 724 725 726 727 728 729
/*-------*/
typedef int
        (*virDrvNumOfInterfaces)        (virConnectPtr conn);
typedef int
        (*virDrvListInterfaces)         (virConnectPtr conn,
                                         char **const names,
                                         int maxnames);
730 731 732 733 734 735
typedef int
        (*virDrvNumOfDefinedInterfaces) (virConnectPtr conn);
typedef int
        (*virDrvListDefinedInterfaces)  (virConnectPtr conn,
                                         char **const names,
                                         int maxnames);
D
Daniel Veillard 已提交
736 737 738 739 740 741 742 743
typedef virInterfacePtr
        (*virDrvInterfaceLookupByName)  (virConnectPtr conn,
                                         const char *name);
typedef virInterfacePtr
        (*virDrvInterfaceLookupByMACString)   (virConnectPtr conn,
                                               const char *mac);

typedef char *
744
        (*virDrvInterfaceGetXMLDesc)    (virInterfacePtr iface,
D
Daniel Veillard 已提交
745 746 747 748 749 750 751
                                         unsigned int flags);

typedef virInterfacePtr
        (*virDrvInterfaceDefineXML)     (virConnectPtr conn,
                                         const char *xmlDesc,
                                         unsigned int flags);
typedef int
752
        (*virDrvInterfaceUndefine)      (virInterfacePtr iface);
D
Daniel Veillard 已提交
753
typedef int
754
        (*virDrvInterfaceCreate)        (virInterfacePtr iface,
D
Daniel Veillard 已提交
755 756
                                         unsigned int flags);
typedef int
757
        (*virDrvInterfaceDestroy)       (virInterfacePtr iface,
D
Daniel Veillard 已提交
758 759
                                         unsigned int flags);

760 761 762 763
typedef int
        (*virDrvInterfaceIsActive)(virInterfacePtr iface);


D
Daniel Veillard 已提交
764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782
typedef struct _virInterfaceDriver virInterfaceDriver;
typedef virInterfaceDriver *virInterfaceDriverPtr;

/**
 * _virInterfaceDriver:
 *
 * Structure associated to a network virtualization driver, defining the various
 * entry points for it.
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
 */
struct _virInterfaceDriver {
    const char                      *name; /* the name of the driver */
    virDrvOpen                       open;
    virDrvClose                      close;
    virDrvNumOfInterfaces            numOfInterfaces;
    virDrvListInterfaces             listInterfaces;
783 784
    virDrvNumOfDefinedInterfaces     numOfDefinedInterfaces;
    virDrvListDefinedInterfaces      listDefinedInterfaces;
D
Daniel Veillard 已提交
785 786 787 788 789 790 791
    virDrvInterfaceLookupByName      interfaceLookupByName;
    virDrvInterfaceLookupByMACString interfaceLookupByMACString;
    virDrvInterfaceGetXMLDesc        interfaceGetXMLDesc;
    virDrvInterfaceDefineXML         interfaceDefineXML;
    virDrvInterfaceUndefine          interfaceUndefine;
    virDrvInterfaceCreate            interfaceCreate;
    virDrvInterfaceDestroy           interfaceDestroy;
792
    virDrvInterfaceIsActive          interfaceIsActive;
D
Daniel Veillard 已提交
793 794
};

795 796 797 798 799 800 801 802 803 804 805 806 807

typedef int
    (*virDrvConnectNumOfStoragePools)        (virConnectPtr conn);
typedef int
    (*virDrvConnectListStoragePools)         (virConnectPtr conn,
                                              char **const names,
                                              int maxnames);
typedef int
    (*virDrvConnectNumOfDefinedStoragePools) (virConnectPtr conn);
typedef int
    (*virDrvConnectListDefinedStoragePools)  (virConnectPtr conn,
                                              char **const names,
                                              int maxnames);
808 809 810 811 812
typedef char *
    (*virDrvConnectFindStoragePoolSources)   (virConnectPtr conn,
                                              const char *type,
                                              const char *srcSpec,
                                              unsigned int flags);
813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883
typedef virStoragePoolPtr
    (*virDrvStoragePoolLookupByName)         (virConnectPtr conn,
                                              const char *name);
typedef virStoragePoolPtr
    (*virDrvStoragePoolLookupByUUID)         (virConnectPtr conn,
                                              const unsigned char *uuid);
typedef virStoragePoolPtr
    (*virDrvStoragePoolLookupByVolume)       (virStorageVolPtr vol);
typedef virStoragePoolPtr
    (*virDrvStoragePoolCreateXML)            (virConnectPtr conn,
                                              const char *xmlDesc,
                                              unsigned int flags);
typedef virStoragePoolPtr
    (*virDrvStoragePoolDefineXML)            (virConnectPtr conn,
                                              const char *xmlDesc,
                                              unsigned int flags);
typedef int
    (*virDrvStoragePoolUndefine)             (virStoragePoolPtr pool);
typedef int
    (*virDrvStoragePoolBuild)                (virStoragePoolPtr pool,
                                              unsigned int flags);
typedef int
    (*virDrvStoragePoolCreate)               (virStoragePoolPtr pool,
                                              unsigned int flags);
typedef int
    (*virDrvStoragePoolDestroy)              (virStoragePoolPtr pool);
typedef int
    (*virDrvStoragePoolDelete)               (virStoragePoolPtr pool,
                                              unsigned int flags);
typedef int
    (*virDrvStoragePoolRefresh)              (virStoragePoolPtr pool,
                                              unsigned int flags);
typedef int
    (*virDrvStoragePoolGetInfo)              (virStoragePoolPtr vol,
                                              virStoragePoolInfoPtr info);
typedef char *
    (*virDrvStoragePoolGetXMLDesc)           (virStoragePoolPtr pool,
                                              unsigned int flags);
typedef int
    (*virDrvStoragePoolGetAutostart)         (virStoragePoolPtr pool,
                                              int *autostart);
typedef int
    (*virDrvStoragePoolSetAutostart)         (virStoragePoolPtr pool,
                                              int autostart);
typedef int
    (*virDrvStoragePoolNumOfVolumes)         (virStoragePoolPtr pool);
typedef int
    (*virDrvStoragePoolListVolumes)          (virStoragePoolPtr pool,
                                              char **const names,
                                              int maxnames);


typedef virStorageVolPtr
    (*virDrvStorageVolLookupByName)          (virStoragePoolPtr pool,
                                              const char *name);
typedef virStorageVolPtr
    (*virDrvStorageVolLookupByKey)           (virConnectPtr pool,
                                              const char *key);
typedef virStorageVolPtr
    (*virDrvStorageVolLookupByPath)          (virConnectPtr pool,
                                              const char *path);


typedef virStorageVolPtr
    (*virDrvStorageVolCreateXML)             (virStoragePoolPtr pool,
                                              const char *xmldesc,
                                              unsigned int flags);
typedef int
    (*virDrvStorageVolDelete)               (virStorageVolPtr vol,
                                             unsigned int flags);

884 885 886 887
typedef int
    (*virDrvStorageVolWipe)                  (virStorageVolPtr vol,
                                              unsigned int flags);

888 889 890 891 892 893 894 895 896
typedef int
    (*virDrvStorageVolGetInfo)               (virStorageVolPtr vol,
                                              virStorageVolInfoPtr info);
typedef char *
    (*virDrvStorageVolGetXMLDesc)            (virStorageVolPtr pool,
                                              unsigned int flags);
typedef char *
    (*virDrvStorageVolGetPath)               (virStorageVolPtr vol);

897 898 899 900 901
typedef virStorageVolPtr
    (*virDrvStorageVolCreateXMLFrom)         (virStoragePoolPtr pool,
                                              const char *xmldesc,
                                              virStorageVolPtr clone,
                                              unsigned int flags);
902

903 904 905 906 907 908
typedef int
        (*virDrvStoragePoolIsActive)(virStoragePoolPtr pool);
typedef int
        (*virDrvStoragePoolIsPersistent)(virStoragePoolPtr pool);


909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931

typedef struct _virStorageDriver virStorageDriver;
typedef virStorageDriver *virStorageDriverPtr;

/**
 * _virStorageDriver:
 *
 * Structure associated to a network virtualization driver, defining the various
 * entry points for it.
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
 */
struct _virStorageDriver {
    const char * name;    /* the name of the driver */
    virDrvOpen            open;
    virDrvClose           close;

    virDrvConnectNumOfStoragePools numOfPools;
    virDrvConnectListStoragePools listPools;
    virDrvConnectNumOfDefinedStoragePools numOfDefinedPools;
    virDrvConnectListDefinedStoragePools listDefinedPools;
932
    virDrvConnectFindStoragePoolSources findPoolSources;
933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954
    virDrvStoragePoolLookupByName poolLookupByName;
    virDrvStoragePoolLookupByUUID poolLookupByUUID;
    virDrvStoragePoolLookupByVolume poolLookupByVolume;
    virDrvStoragePoolCreateXML poolCreateXML;
    virDrvStoragePoolDefineXML poolDefineXML;
    virDrvStoragePoolBuild poolBuild;
    virDrvStoragePoolUndefine poolUndefine;
    virDrvStoragePoolCreate poolCreate;
    virDrvStoragePoolDestroy poolDestroy;
    virDrvStoragePoolDelete poolDelete;
    virDrvStoragePoolRefresh poolRefresh;
    virDrvStoragePoolGetInfo poolGetInfo;
    virDrvStoragePoolGetXMLDesc poolGetXMLDesc;
    virDrvStoragePoolGetAutostart poolGetAutostart;
    virDrvStoragePoolSetAutostart poolSetAutostart;
    virDrvStoragePoolNumOfVolumes poolNumOfVolumes;
    virDrvStoragePoolListVolumes poolListVolumes;

    virDrvStorageVolLookupByName volLookupByName;
    virDrvStorageVolLookupByKey volLookupByKey;
    virDrvStorageVolLookupByPath volLookupByPath;
    virDrvStorageVolCreateXML volCreateXML;
955
    virDrvStorageVolCreateXMLFrom volCreateXMLFrom;
956
    virDrvStorageVolDelete volDelete;
957
    virDrvStorageVolWipe volWipe;
958 959 960
    virDrvStorageVolGetInfo volGetInfo;
    virDrvStorageVolGetXMLDesc volGetXMLDesc;
    virDrvStorageVolGetPath volGetPath;
961 962
    virDrvStoragePoolIsActive   poolIsActive;
    virDrvStoragePoolIsPersistent   poolIsPersistent;
963 964
};

965
# ifdef WITH_LIBVIRTD
966
typedef int (*virDrvStateInitialize) (int privileged);
967 968 969 970 971 972 973 974
typedef int (*virDrvStateCleanup) (void);
typedef int (*virDrvStateReload) (void);
typedef int (*virDrvStateActive) (void);

typedef struct _virStateDriver virStateDriver;
typedef virStateDriver *virStateDriverPtr;

struct _virStateDriver {
975
    const char *name;
976 977 978 979 980
    virDrvStateInitialize  initialize;
    virDrvStateCleanup     cleanup;
    virDrvStateReload      reload;
    virDrvStateActive      active;
};
981
# endif
982

983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010

typedef struct _virDeviceMonitor virDeviceMonitor;
typedef virDeviceMonitor *virDeviceMonitorPtr;

typedef int (*virDevMonNumOfDevices)(virConnectPtr conn,
                                     const char *cap,
                                     unsigned int flags);

typedef int (*virDevMonListDevices)(virConnectPtr conn,
                                    const char *cap,
                                    char **const names,
                                    int maxnames,
                                    unsigned int flags);

typedef virNodeDevicePtr (*virDevMonDeviceLookupByName)(virConnectPtr conn,
                                                        const char *name);

typedef char * (*virDevMonDeviceDumpXML)(virNodeDevicePtr dev,
                                         unsigned int flags);

typedef char * (*virDevMonDeviceGetParent)(virNodeDevicePtr dev);

typedef int (*virDevMonDeviceNumOfCaps)(virNodeDevicePtr dev);

typedef int (*virDevMonDeviceListCaps)(virNodeDevicePtr dev,
                                       char **const names,
                                       int maxnames);

1011 1012 1013 1014 1015
typedef virNodeDevicePtr (*virDrvNodeDeviceCreateXML)(virConnectPtr conn,
                                                      const char *xmlDesc,
                                                      unsigned int flags);
typedef int (*virDrvNodeDeviceDestroy)(virNodeDevicePtr dev);

1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033
/**
 * _virDeviceMonitor:
 *
 * Structure associated with monitoring the devices
 * on a virtualized node.
 *
 */
struct _virDeviceMonitor {
    const char * name;    /* the name of the driver */
    virDrvOpen open;
    virDrvClose close;
    virDevMonNumOfDevices numOfDevices;
    virDevMonListDevices listDevices;
    virDevMonDeviceLookupByName deviceLookupByName;
    virDevMonDeviceDumpXML deviceDumpXML;
    virDevMonDeviceGetParent deviceGetParent;
    virDevMonDeviceNumOfCaps deviceNumOfCaps;
    virDevMonDeviceListCaps deviceListCaps;
1034 1035
    virDrvNodeDeviceCreateXML deviceCreateXML;
    virDrvNodeDeviceDestroy deviceDestroy;
1036 1037
};

1038
/* bits 16 and above of virDomainXMLFlags are for internal use */
1039
# define VIR_DOMAIN_XML_FLAGS_MASK 0xffff
1040 1041

/* Bits 16 and above of virSecretGetValue flags are for internal use */
1042
# define VIR_SECRET_GET_VALUE_FLAGS_MASK 0xffff
1043 1044 1045 1046 1047 1048 1049

enum {
    /* This getValue call is inside libvirt, override the "private" flag.
       This flag can not be set by outside callers. */
    VIR_SECRET_GET_VALUE_INTERNAL_CALL = 1 << 16
};

1050
typedef virSecretPtr
1051 1052
    (*virDrvSecretLookupByUUID)        (virConnectPtr conn,
                                        const unsigned char *uuid);
1053 1054 1055 1056
typedef virSecretPtr
    (*virDrvSecretLookupByUsage)       (virConnectPtr conn,
                                        int usageType,
                                        const char *usageID);
1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101
typedef virSecretPtr
    (*virDrvSecretDefineXML)                 (virConnectPtr conn,
                                              const char *xml,
                                              unsigned int flags);
typedef char *
    (*virDrvSecretGetXMLDesc)                (virSecretPtr secret,
                                              unsigned int flags);
typedef int
    (*virDrvSecretSetValue)                  (virSecretPtr secret,
                                              const unsigned char *value,
                                              size_t value_size,
                                              unsigned int flags);
typedef unsigned char *
    (*virDrvSecretGetValue)                  (virSecretPtr secret,
                                              size_t *value_size,
                                              unsigned int flags);
typedef int
    (*virDrvSecretUndefine)                  (virSecretPtr secret);
typedef int
    (*virDrvSecretNumOfSecrets)              (virConnectPtr conn);
typedef int
    (*virDrvSecretListSecrets)               (virConnectPtr conn,
                                              char **uuids,
                                              int maxuuids);

typedef struct _virSecretDriver virSecretDriver;
typedef virSecretDriver *virSecretDriverPtr;

/**
 * _virSecretDriver:
 *
 * Structure associated to a driver for storing secrets, defining the various
 * entry points for it.
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
 */
struct _virSecretDriver {
    const char *name;
    virDrvOpen open;
    virDrvClose close;

    virDrvSecretNumOfSecrets numOfSecrets;
    virDrvSecretListSecrets listSecrets;
1102
    virDrvSecretLookupByUUID lookupByUUID;
1103
    virDrvSecretLookupByUsage lookupByUsage;
1104 1105 1106 1107 1108 1109 1110
    virDrvSecretDefineXML defineXML;
    virDrvSecretGetXMLDesc getXMLDesc;
    virDrvSecretSetValue setValue;
    virDrvSecretGetValue getValue;
    virDrvSecretUndefine undefine;
};

1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145

typedef struct _virStreamDriver virStreamDriver;
typedef virStreamDriver *virStreamDriverPtr;

typedef int (*virDrvStreamSend)(virStreamPtr st,
                                const char *data,
                                size_t nbytes);
typedef int (*virDrvStreamRecv)(virStreamPtr st,
                                char *data,
                                size_t nbytes);

typedef int (*virDrvStreamEventAddCallback)(virStreamPtr stream,
                                            int events,
                                            virStreamEventCallback cb,
                                            void *opaque,
                                            virFreeCallback ff);

typedef int (*virDrvStreamEventUpdateCallback)(virStreamPtr stream,
                                               int events);
typedef int (*virDrvStreamEventRemoveCallback)(virStreamPtr stream);
typedef int (*virDrvStreamFinish)(virStreamPtr st);
typedef int (*virDrvStreamAbort)(virStreamPtr st);


struct _virStreamDriver {
    virDrvStreamSend streamSend;
    virDrvStreamRecv streamRecv;
    virDrvStreamEventAddCallback streamAddCallback;
    virDrvStreamEventUpdateCallback streamUpdateCallback;
    virDrvStreamEventRemoveCallback streamRemoveCallback;
    virDrvStreamFinish streamFinish;
    virDrvStreamAbort streamAbort;
};


S
Stefan Berger 已提交
1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162
typedef int
    (*virDrvConnectNumOfNWFilters)        (virConnectPtr conn);
typedef int
    (*virDrvConnectListNWFilters)         (virConnectPtr conn,
                                           char **const names,
                                           int maxnames);
typedef virNWFilterPtr
    (*virDrvNWFilterLookupByName)             (virConnectPtr conn,
                                               const char *name);
typedef virNWFilterPtr
    (*virDrvNWFilterLookupByUUID)             (virConnectPtr conn,
                                               const unsigned char *uuid);
typedef virNWFilterPtr
    (*virDrvNWFilterDefineXML)                (virConnectPtr conn,
                                               const char *xmlDesc,
                                               unsigned int flags);
typedef int
1163
    (*virDrvNWFilterUndefine)                 (virNWFilterPtr nwfilter);
S
Stefan Berger 已提交
1164 1165

typedef char *
1166
    (*virDrvNWFilterGetXMLDesc)              (virNWFilterPtr nwfilter,
S
Stefan Berger 已提交
1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197
                                              unsigned int flags);


typedef struct _virNWFilterDriver virNWFilterDriver;
typedef virNWFilterDriver *virNWFilterDriverPtr;

/**
 * _virNWFilterDriver:
 *
 * Structure associated to a network filter driver, defining the various
 * entry points for it.
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
 */
struct _virNWFilterDriver {
    const char * name;    /* the name of the driver */
    virDrvOpen            open;
    virDrvClose           close;

    virDrvConnectNumOfNWFilters numOfNWFilters;
    virDrvConnectListNWFilters listNWFilters;
    virDrvNWFilterLookupByName nwfilterLookupByName;
    virDrvNWFilterLookupByUUID nwfilterLookupByUUID;
    virDrvNWFilterDefineXML defineXML;
    virDrvNWFilterUndefine undefine;
    virDrvNWFilterGetXMLDesc getXMLDesc;
};


1198 1199 1200 1201 1202 1203
/*
 * Registration
 * TODO: also need ways to (des)activate a given driver
 *       lookup based on the URI given in a virConnectOpen(ReadOnly)
 */
int virRegisterDriver(virDriverPtr);
1204
int virRegisterNetworkDriver(virNetworkDriverPtr);
D
Daniel Veillard 已提交
1205
int virRegisterInterfaceDriver(virInterfaceDriverPtr);
1206
int virRegisterStorageDriver(virStorageDriverPtr);
1207
int virRegisterDeviceMonitor(virDeviceMonitorPtr);
1208
int virRegisterSecretDriver(virSecretDriverPtr);
S
Stefan Berger 已提交
1209
int virRegisterNWFilterDriver(virNWFilterDriverPtr);
1210
# ifdef WITH_LIBVIRTD
1211
int virRegisterStateDriver(virStateDriverPtr);
1212
# endif
1213
void *virDriverLoadModule(const char *name);
1214 1215

#endif /* __VIR_DRIVER_H__ */