1 /* 2 * driver-interface.h: entry points for interface drivers 3 * 4 * Copyright (C) 2006-2014 Red Hat, Inc. 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library. If not, see 18 * <http://www.gnu.org/licenses/>. 19 */ 20 21 #pragma once 22 23 #ifndef __VIR_DRIVER_H_INCLUDES___ 24 # error "Don't include this file directly, only use driver.h" 25 #endif 26 27 typedef int 28 (*virDrvConnectNumOfInterfaces)(virConnectPtr conn); 29 30 typedef int 31 (*virDrvConnectListInterfaces)(virConnectPtr conn, 32 char **const names, 33 int maxnames); 34 35 typedef int 36 (*virDrvConnectNumOfDefinedInterfaces)(virConnectPtr conn); 37 38 typedef int 39 (*virDrvConnectListDefinedInterfaces)(virConnectPtr conn, 40 char **const names, 41 int maxnames); 42 43 typedef int 44 (*virDrvConnectListAllInterfaces)(virConnectPtr conn, 45 virInterfacePtr **ifaces, 46 unsigned int flags); 47 48 typedef virInterfacePtr 49 (*virDrvInterfaceLookupByName)(virConnectPtr conn, 50 const char *name); 51 52 typedef virInterfacePtr 53 (*virDrvInterfaceLookupByMACString)(virConnectPtr conn, 54 const char *mac); 55 56 typedef char * 57 (*virDrvInterfaceGetXMLDesc)(virInterfacePtr iface, 58 unsigned int flags); 59 60 typedef virInterfacePtr 61 (*virDrvInterfaceDefineXML)(virConnectPtr conn, 62 const char *xmlDesc, 63 unsigned int flags); 64 65 typedef int 66 (*virDrvInterfaceUndefine)(virInterfacePtr iface); 67 68 typedef int 69 (*virDrvInterfaceCreate)(virInterfacePtr iface, 70 unsigned int flags); 71 72 typedef int 73 (*virDrvInterfaceDestroy)(virInterfacePtr iface, 74 unsigned int flags); 75 76 typedef int 77 (*virDrvInterfaceIsActive)(virInterfacePtr iface); 78 79 typedef int 80 (*virDrvInterfaceChangeBegin)(virConnectPtr conn, 81 unsigned int flags); 82 83 typedef int 84 (*virDrvInterfaceChangeCommit)(virConnectPtr conn, 85 unsigned int flags); 86 87 typedef int 88 (*virDrvInterfaceChangeRollback)(virConnectPtr conn, 89 unsigned int flags); 90 91 typedef struct _virInterfaceDriver virInterfaceDriver; 92 93 /** 94 * _virInterfaceDriver: 95 * 96 * Structure associated to a network interface driver, defining the various 97 * entry points for it. 98 */ 99 struct _virInterfaceDriver { 100 const char *name; /* the name of the driver */ 101 virDrvConnectNumOfInterfaces connectNumOfInterfaces; 102 virDrvConnectListInterfaces connectListInterfaces; 103 virDrvConnectNumOfDefinedInterfaces connectNumOfDefinedInterfaces; 104 virDrvConnectListDefinedInterfaces connectListDefinedInterfaces; 105 virDrvConnectListAllInterfaces connectListAllInterfaces; 106 virDrvInterfaceLookupByName interfaceLookupByName; 107 virDrvInterfaceLookupByMACString interfaceLookupByMACString; 108 virDrvInterfaceGetXMLDesc interfaceGetXMLDesc; 109 virDrvInterfaceDefineXML interfaceDefineXML; 110 virDrvInterfaceUndefine interfaceUndefine; 111 virDrvInterfaceCreate interfaceCreate; 112 virDrvInterfaceDestroy interfaceDestroy; 113 virDrvInterfaceIsActive interfaceIsActive; 114 virDrvInterfaceChangeBegin interfaceChangeBegin; 115 virDrvInterfaceChangeCommit interfaceChangeCommit; 116 virDrvInterfaceChangeRollback interfaceChangeRollback; 117 }; 118