virnetworkobj.h 6.2 KB
Newer Older
J
John Ferlan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
/*
 * 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/>.
 */

#ifndef __VIRNETWORKOBJ_H__
# define __VIRNETWORKOBJ_H__

# include "internal.h"

# include "network_conf.h"

typedef struct _virNetworkObj virNetworkObj;
typedef virNetworkObj *virNetworkObjPtr;

30 31 32
virNetworkObjPtr
virNetworkObjNew(void);

33 34 35 36 37 38 39 40 41 42
virNetworkDefPtr
virNetworkObjGetDef(virNetworkObjPtr obj);

void
virNetworkObjSetDef(virNetworkObjPtr obj,
                    virNetworkDefPtr def);

virNetworkDefPtr
virNetworkObjGetNewDef(virNetworkObjPtr obj);

43 44 45 46 47 48 49
bool
virNetworkObjIsActive(virNetworkObjPtr obj);

void
virNetworkObjSetActive(virNetworkObjPtr obj,
                       bool active);

50 51 52
bool
virNetworkObjIsPersistent(virNetworkObjPtr obj);

53 54 55 56 57 58 59
bool
virNetworkObjIsAutostart(virNetworkObjPtr obj);

void
virNetworkObjSetAutostart(virNetworkObjPtr obj,
                          bool autostart);

60 61 62
virMacMapPtr
virNetworkObjGetMacMap(virNetworkObjPtr obj);

63 64 65 66 67 68 69 70 71 72 73 74 75 76
pid_t
virNetworkObjGetDnsmasqPid(virNetworkObjPtr obj);

void
virNetworkObjSetDnsmasqPid(virNetworkObjPtr obj,
                           pid_t dnsmasqPid);

pid_t
virNetworkObjGetRadvdPid(virNetworkObjPtr obj);

void
virNetworkObjSetRadvdPid(virNetworkObjPtr obj,
                         pid_t radvdPid);

77 78 79
virBitmapPtr
virNetworkObjGetClassIdMap(virNetworkObjPtr obj);

80 81 82 83 84 85 86
unsigned long long
virNetworkObjGetFloorSum(virNetworkObjPtr obj);

void
virNetworkObjSetFloorSum(virNetworkObjPtr obj,
                         unsigned long long floor_sum);

87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
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);

106 107
void
virNetworkObjEndAPI(virNetworkObjPtr *net);
J
John Ferlan 已提交
108 109 110 111

typedef struct _virNetworkObjList virNetworkObjList;
typedef virNetworkObjList *virNetworkObjListPtr;

112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
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
132 133 134
virNetworkObjAssignDef(virNetworkObjListPtr nets,
                       virNetworkDefPtr def,
                       unsigned int flags);
135 136

void
137 138 139
virNetworkObjUpdateAssignDef(virNetworkObjPtr network,
                             virNetworkDefPtr def,
                             bool live);
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155

int
virNetworkObjSetDefTransient(virNetworkObjPtr network,
                             bool live);

void
virNetworkObjUnsetDefTransient(virNetworkObjPtr network);

virNetworkDefPtr
virNetworkObjGetPersistentDef(virNetworkObjPtr network);

int
virNetworkObjReplacePersistentDef(virNetworkObjPtr network,
                                  virNetworkDefPtr def);

void
156 157
virNetworkObjRemoveInactive(virNetworkObjListPtr nets,
                            virNetworkObjPtr net);
158 159

int
160 161
virNetworkObjSaveStatus(const char *statusDir,
                        virNetworkObjPtr net) ATTRIBUTE_RETURN_CHECK;
162 163

int
164 165 166
virNetworkObjLoadAllConfigs(virNetworkObjListPtr nets,
                            const char *configDir,
                            const char *autostartDir);
167 168

int
169 170
virNetworkObjLoadAllState(virNetworkObjListPtr nets,
                          const char *stateDir);
171 172

int
173 174 175
virNetworkObjDeleteConfig(const char *configDir,
                          const char *autostartDir,
                          virNetworkObjPtr net);
176 177

int
178 179 180
virNetworkObjBridgeInUse(virNetworkObjListPtr nets,
                         const char *bridge,
                         const char *skipname);
J
John Ferlan 已提交
181 182 183 184 185 186 187 188 189

int
virNetworkObjUpdate(virNetworkObjPtr obj,
                    unsigned int command, /* virNetworkUpdateCommand */
                    unsigned int section, /* virNetworkUpdateSection */
                    int parentIndex,
                    const char *xml,
                    unsigned int flags);  /* virNetworkUpdateFlags */

190 191 192 193 194 195 196 197 198
int
virNetworkObjListExport(virConnectPtr conn,
                        virNetworkObjListPtr netobjs,
                        virNetworkPtr **nets,
                        virNetworkObjListFilter filter,
                        unsigned int flags);

typedef int
(*virNetworkObjListIterator)(virNetworkObjPtr net,
J
John Ferlan 已提交
199 200
                             void *opaque);

201 202 203 204
int
virNetworkObjListForEach(virNetworkObjListPtr nets,
                         virNetworkObjListIterator callback,
                         void *opaque);
J
John Ferlan 已提交
205

206 207 208 209
int
virNetworkObjListGetNames(virNetworkObjListPtr nets,
                          bool active,
                          char **names,
210
                          int maxnames,
211 212
                          virNetworkObjListFilter filter,
                          virConnectPtr conn);
J
John Ferlan 已提交
213

214 215 216 217 218 219 220 221 222
int
virNetworkObjListNumOfNetworks(virNetworkObjListPtr nets,
                               bool active,
                               virNetworkObjListFilter filter,
                               virConnectPtr conn);

void
virNetworkObjListPrune(virNetworkObjListPtr nets,
                       unsigned int flags);
J
John Ferlan 已提交
223 224

#endif /* __VIRNETWORKOBJ_H__ */