2017-03-08 15:25:24 +00:00
|
|
|
/*
|
|
|
|
* virnetworkobj.h: handle network objects
|
|
|
|
* (derived from network_conf.h)
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2019-06-07 20:20:17 +00:00
|
|
|
#pragma once
|
2017-03-08 15:25:24 +00:00
|
|
|
|
2019-06-07 20:20:17 +00:00
|
|
|
#include "internal.h"
|
2017-03-08 15:25:24 +00:00
|
|
|
|
2019-06-07 20:20:17 +00:00
|
|
|
#include "network_conf.h"
|
2018-12-19 14:24:53 +00:00
|
|
|
#include "virnetworkportdef.h"
|
2017-03-08 15:25:24 +00:00
|
|
|
|
|
|
|
typedef struct _virNetworkObj virNetworkObj;
|
|
|
|
typedef virNetworkObj *virNetworkObjPtr;
|
|
|
|
|
2017-03-08 15:52:18 +00:00
|
|
|
virNetworkObjPtr
|
|
|
|
virNetworkObjNew(void);
|
|
|
|
|
2017-05-09 22:38:58 +00:00
|
|
|
virNetworkDefPtr
|
|
|
|
virNetworkObjGetDef(virNetworkObjPtr obj);
|
|
|
|
|
|
|
|
void
|
|
|
|
virNetworkObjSetDef(virNetworkObjPtr obj,
|
|
|
|
virNetworkDefPtr def);
|
|
|
|
|
|
|
|
virNetworkDefPtr
|
|
|
|
virNetworkObjGetNewDef(virNetworkObjPtr obj);
|
|
|
|
|
2017-05-10 11:22:15 +00:00
|
|
|
bool
|
|
|
|
virNetworkObjIsActive(virNetworkObjPtr obj);
|
|
|
|
|
|
|
|
void
|
|
|
|
virNetworkObjSetActive(virNetworkObjPtr obj,
|
|
|
|
bool active);
|
|
|
|
|
2017-05-10 11:29:57 +00:00
|
|
|
bool
|
|
|
|
virNetworkObjIsPersistent(virNetworkObjPtr obj);
|
|
|
|
|
2017-05-10 11:12:27 +00:00
|
|
|
bool
|
|
|
|
virNetworkObjIsAutostart(virNetworkObjPtr obj);
|
|
|
|
|
|
|
|
void
|
|
|
|
virNetworkObjSetAutostart(virNetworkObjPtr obj,
|
|
|
|
bool autostart);
|
|
|
|
|
2017-05-09 20:51:05 +00:00
|
|
|
virMacMapPtr
|
|
|
|
virNetworkObjGetMacMap(virNetworkObjPtr obj);
|
|
|
|
|
2017-05-09 21:22:43 +00:00
|
|
|
pid_t
|
|
|
|
virNetworkObjGetDnsmasqPid(virNetworkObjPtr obj);
|
|
|
|
|
|
|
|
void
|
|
|
|
virNetworkObjSetDnsmasqPid(virNetworkObjPtr obj,
|
|
|
|
pid_t dnsmasqPid);
|
|
|
|
|
|
|
|
pid_t
|
|
|
|
virNetworkObjGetRadvdPid(virNetworkObjPtr obj);
|
|
|
|
|
|
|
|
void
|
|
|
|
virNetworkObjSetRadvdPid(virNetworkObjPtr obj,
|
|
|
|
pid_t radvdPid);
|
|
|
|
|
2017-05-09 21:41:23 +00:00
|
|
|
virBitmapPtr
|
|
|
|
virNetworkObjGetClassIdMap(virNetworkObjPtr obj);
|
|
|
|
|
2017-05-09 21:57:41 +00:00
|
|
|
unsigned long long
|
|
|
|
virNetworkObjGetFloorSum(virNetworkObjPtr obj);
|
|
|
|
|
|
|
|
void
|
|
|
|
virNetworkObjSetFloorSum(virNetworkObjPtr obj,
|
|
|
|
unsigned long long floor_sum);
|
|
|
|
|
2017-05-09 20:51:05 +00:00
|
|
|
void
|
|
|
|
virNetworkObjSetMacMap(virNetworkObjPtr obj,
|
|
|
|
virMacMapPtr macmap);
|
|
|
|
|
|
|
|
void
|
|
|
|
virNetworkObjUnrefMacMap(virNetworkObjPtr obj);
|
|
|
|
|
|
|
|
int
|
|
|
|
virNetworkObjMacMgrAdd(virNetworkObjPtr obj,
|
|
|
|
const char *dnsmasqStateDir,
|
|
|
|
const char *domain,
|
|
|
|
const virMacAddr *mac);
|
|
|
|
|
|
|
|
int
|
|
|
|
virNetworkObjMacMgrDel(virNetworkObjPtr obj,
|
|
|
|
const char *dnsmasqStateDir,
|
|
|
|
const char *domain,
|
|
|
|
const virMacAddr *mac);
|
|
|
|
|
2017-03-08 15:52:18 +00:00
|
|
|
void
|
|
|
|
virNetworkObjEndAPI(virNetworkObjPtr *net);
|
2017-03-08 15:25:24 +00:00
|
|
|
|
|
|
|
typedef struct _virNetworkObjList virNetworkObjList;
|
|
|
|
typedef virNetworkObjList *virNetworkObjListPtr;
|
|
|
|
|
2017-03-08 15:52:18 +00:00
|
|
|
virNetworkObjListPtr
|
|
|
|
virNetworkObjListNew(void);
|
|
|
|
|
|
|
|
virNetworkObjPtr
|
|
|
|
virNetworkObjFindByUUID(virNetworkObjListPtr nets,
|
|
|
|
const unsigned char *uuid);
|
|
|
|
|
|
|
|
virNetworkObjPtr
|
|
|
|
virNetworkObjFindByName(virNetworkObjListPtr nets,
|
|
|
|
const char *name);
|
|
|
|
|
|
|
|
bool
|
|
|
|
virNetworkObjTaint(virNetworkObjPtr obj,
|
|
|
|
virNetworkTaintFlags taint);
|
|
|
|
|
|
|
|
typedef bool
|
|
|
|
(*virNetworkObjListFilter)(virConnectPtr conn,
|
|
|
|
virNetworkDefPtr def);
|
|
|
|
|
|
|
|
virNetworkObjPtr
|
2017-03-08 16:41:18 +00:00
|
|
|
virNetworkObjAssignDef(virNetworkObjListPtr nets,
|
|
|
|
virNetworkDefPtr def,
|
|
|
|
unsigned int flags);
|
2017-03-08 15:52:18 +00:00
|
|
|
|
|
|
|
void
|
2017-03-08 16:19:20 +00:00
|
|
|
virNetworkObjUpdateAssignDef(virNetworkObjPtr network,
|
|
|
|
virNetworkDefPtr def,
|
|
|
|
bool live);
|
2017-03-08 15:52:18 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
virNetworkObjSetDefTransient(virNetworkObjPtr network,
|
2019-07-14 16:15:12 +00:00
|
|
|
bool live,
|
|
|
|
virNetworkXMLOptionPtr xmlopt);
|
2017-03-08 15:52:18 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
virNetworkObjUnsetDefTransient(virNetworkObjPtr network);
|
|
|
|
|
|
|
|
virNetworkDefPtr
|
|
|
|
virNetworkObjGetPersistentDef(virNetworkObjPtr network);
|
|
|
|
|
|
|
|
int
|
|
|
|
virNetworkObjReplacePersistentDef(virNetworkObjPtr network,
|
|
|
|
virNetworkDefPtr def);
|
|
|
|
|
|
|
|
void
|
2017-03-08 16:41:18 +00:00
|
|
|
virNetworkObjRemoveInactive(virNetworkObjListPtr nets,
|
|
|
|
virNetworkObjPtr net);
|
2017-03-08 15:52:18 +00:00
|
|
|
|
2018-12-19 14:24:53 +00:00
|
|
|
int
|
|
|
|
virNetworkObjAddPort(virNetworkObjPtr net,
|
|
|
|
virNetworkPortDefPtr portdef,
|
|
|
|
const char *stateDir);
|
|
|
|
|
|
|
|
char *
|
|
|
|
virNetworkObjGetPortStatusDir(virNetworkObjPtr net,
|
|
|
|
const char *stateDir);
|
|
|
|
|
|
|
|
virNetworkPortDefPtr
|
|
|
|
virNetworkObjLookupPort(virNetworkObjPtr net,
|
|
|
|
const unsigned char *uuid);
|
|
|
|
|
|
|
|
int
|
|
|
|
virNetworkObjDeletePort(virNetworkObjPtr net,
|
|
|
|
const unsigned char *uuid,
|
|
|
|
const char *stateDir);
|
|
|
|
|
|
|
|
int
|
|
|
|
virNetworkObjDeleteAllPorts(virNetworkObjPtr net,
|
|
|
|
const char *stateDir);
|
|
|
|
|
|
|
|
typedef bool
|
|
|
|
(*virNetworkPortListFilter)(virConnectPtr conn,
|
|
|
|
virNetworkDefPtr def,
|
|
|
|
virNetworkPortDefPtr portdef);
|
|
|
|
|
|
|
|
int
|
|
|
|
virNetworkObjPortListExport(virNetworkPtr net,
|
|
|
|
virNetworkObjPtr obj,
|
|
|
|
virNetworkPortPtr **ports,
|
|
|
|
virNetworkPortListFilter filter);
|
|
|
|
|
2019-09-13 14:54:18 +00:00
|
|
|
typedef bool
|
|
|
|
(*virNetworkPortListIter)(virNetworkPortDefPtr portdef,
|
|
|
|
void *opaque);
|
|
|
|
|
|
|
|
int
|
|
|
|
virNetworkObjPortForEach(virNetworkObjPtr obj,
|
|
|
|
virNetworkPortListIter iter,
|
|
|
|
void *opaque);
|
|
|
|
|
2017-03-08 15:52:18 +00:00
|
|
|
int
|
2017-03-08 16:41:18 +00:00
|
|
|
virNetworkObjSaveStatus(const char *statusDir,
|
2019-07-14 16:15:12 +00:00
|
|
|
virNetworkObjPtr net,
|
2019-10-14 12:25:14 +00:00
|
|
|
virNetworkXMLOptionPtr xmlopt) G_GNUC_WARN_UNUSED_RESULT;
|
2017-03-08 15:52:18 +00:00
|
|
|
|
|
|
|
int
|
2017-03-08 16:41:18 +00:00
|
|
|
virNetworkObjLoadAllConfigs(virNetworkObjListPtr nets,
|
|
|
|
const char *configDir,
|
2019-07-14 16:15:12 +00:00
|
|
|
const char *autostartDir,
|
|
|
|
virNetworkXMLOptionPtr xmlopt);
|
2017-03-08 15:52:18 +00:00
|
|
|
|
|
|
|
int
|
2017-03-08 16:41:18 +00:00
|
|
|
virNetworkObjLoadAllState(virNetworkObjListPtr nets,
|
2019-07-14 16:15:12 +00:00
|
|
|
const char *stateDir,
|
|
|
|
virNetworkXMLOptionPtr xmlopt);
|
2017-03-08 15:52:18 +00:00
|
|
|
|
|
|
|
int
|
2017-03-08 16:41:18 +00:00
|
|
|
virNetworkObjDeleteConfig(const char *configDir,
|
|
|
|
const char *autostartDir,
|
|
|
|
virNetworkObjPtr net);
|
2017-03-08 15:52:18 +00:00
|
|
|
|
2017-08-17 19:41:37 +00:00
|
|
|
bool
|
2017-03-08 16:41:18 +00:00
|
|
|
virNetworkObjBridgeInUse(virNetworkObjListPtr nets,
|
|
|
|
const char *bridge,
|
|
|
|
const char *skipname);
|
2017-03-08 15:25:24 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
virNetworkObjUpdate(virNetworkObjPtr obj,
|
|
|
|
unsigned int command, /* virNetworkUpdateCommand */
|
|
|
|
unsigned int section, /* virNetworkUpdateSection */
|
|
|
|
int parentIndex,
|
|
|
|
const char *xml,
|
2019-07-14 16:15:12 +00:00
|
|
|
virNetworkXMLOptionPtr xmlopt,
|
2017-03-08 15:25:24 +00:00
|
|
|
unsigned int flags); /* virNetworkUpdateFlags */
|
|
|
|
|
2017-03-08 15:52:18 +00:00
|
|
|
int
|
|
|
|
virNetworkObjListExport(virConnectPtr conn,
|
|
|
|
virNetworkObjListPtr netobjs,
|
|
|
|
virNetworkPtr **nets,
|
|
|
|
virNetworkObjListFilter filter,
|
|
|
|
unsigned int flags);
|
|
|
|
|
|
|
|
typedef int
|
|
|
|
(*virNetworkObjListIterator)(virNetworkObjPtr net,
|
2017-03-08 15:25:24 +00:00
|
|
|
void *opaque);
|
|
|
|
|
2017-03-08 15:52:18 +00:00
|
|
|
int
|
|
|
|
virNetworkObjListForEach(virNetworkObjListPtr nets,
|
|
|
|
virNetworkObjListIterator callback,
|
|
|
|
void *opaque);
|
2017-03-08 15:25:24 +00:00
|
|
|
|
2017-03-08 15:52:18 +00:00
|
|
|
int
|
|
|
|
virNetworkObjListGetNames(virNetworkObjListPtr nets,
|
|
|
|
bool active,
|
|
|
|
char **names,
|
2017-07-26 14:18:39 +00:00
|
|
|
int maxnames,
|
2017-03-08 15:52:18 +00:00
|
|
|
virNetworkObjListFilter filter,
|
|
|
|
virConnectPtr conn);
|
2017-03-08 15:25:24 +00:00
|
|
|
|
2017-03-08 15:52:18 +00:00
|
|
|
int
|
|
|
|
virNetworkObjListNumOfNetworks(virNetworkObjListPtr nets,
|
|
|
|
bool active,
|
|
|
|
virNetworkObjListFilter filter,
|
|
|
|
virConnectPtr conn);
|
|
|
|
|
|
|
|
void
|
|
|
|
virNetworkObjListPrune(virNetworkObjListPtr nets,
|
|
|
|
unsigned int flags);
|