2017-02-28 22:37:15 +00:00
|
|
|
/*
|
|
|
|
* virnwfilterobj.h: network filter object processing
|
|
|
|
* (derived from nwfilter_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/>.
|
|
|
|
*/
|
2018-12-13 13:32:06 +00:00
|
|
|
|
2019-06-07 20:20:18 +00:00
|
|
|
#pragma once
|
2017-02-28 22:37:15 +00:00
|
|
|
|
2019-06-07 20:20:18 +00:00
|
|
|
#include "internal.h"
|
2017-02-28 22:37:15 +00:00
|
|
|
|
2019-06-07 20:20:18 +00:00
|
|
|
#include "nwfilter_conf.h"
|
|
|
|
#include "virnwfilterbindingobjlist.h"
|
2017-02-28 22:37:15 +00:00
|
|
|
|
|
|
|
typedef struct _virNWFilterObj virNWFilterObj;
|
|
|
|
typedef virNWFilterObj *virNWFilterObjPtr;
|
|
|
|
|
|
|
|
typedef struct _virNWFilterObjList virNWFilterObjList;
|
|
|
|
typedef virNWFilterObjList *virNWFilterObjListPtr;
|
|
|
|
|
|
|
|
typedef struct _virNWFilterDriverState virNWFilterDriverState;
|
|
|
|
typedef virNWFilterDriverState *virNWFilterDriverStatePtr;
|
|
|
|
struct _virNWFilterDriverState {
|
|
|
|
virMutex lock;
|
|
|
|
bool privileged;
|
|
|
|
|
2019-05-23 10:34:08 +00:00
|
|
|
/* pid file FD, ensures two copies of the driver can't use the same root */
|
|
|
|
int lockFD;
|
|
|
|
|
2017-04-18 16:52:10 +00:00
|
|
|
virNWFilterObjListPtr nwfilters;
|
2017-02-28 22:37:15 +00:00
|
|
|
|
2018-04-26 17:34:33 +00:00
|
|
|
virNWFilterBindingObjListPtr bindings;
|
|
|
|
|
2019-05-23 10:34:08 +00:00
|
|
|
char *stateDir;
|
2017-02-28 22:37:15 +00:00
|
|
|
char *configDir;
|
2018-04-26 17:34:33 +00:00
|
|
|
char *bindingDir;
|
2017-02-28 22:37:15 +00:00
|
|
|
};
|
|
|
|
|
2017-04-18 16:02:12 +00:00
|
|
|
virNWFilterDefPtr
|
|
|
|
virNWFilterObjGetDef(virNWFilterObjPtr obj);
|
|
|
|
|
|
|
|
virNWFilterDefPtr
|
|
|
|
virNWFilterObjGetNewDef(virNWFilterObjPtr obj);
|
|
|
|
|
|
|
|
bool
|
|
|
|
virNWFilterObjWantRemoved(virNWFilterObjPtr obj);
|
|
|
|
|
2017-04-18 16:52:10 +00:00
|
|
|
virNWFilterObjListPtr
|
|
|
|
virNWFilterObjListNew(void);
|
|
|
|
|
2017-03-02 17:58:41 +00:00
|
|
|
void
|
|
|
|
virNWFilterObjListFree(virNWFilterObjListPtr nwfilters);
|
2017-02-28 22:37:15 +00:00
|
|
|
|
2017-03-02 17:58:41 +00:00
|
|
|
void
|
2017-04-18 16:38:50 +00:00
|
|
|
virNWFilterObjListRemove(virNWFilterObjListPtr nwfilters,
|
|
|
|
virNWFilterObjPtr obj);
|
2017-02-28 22:37:15 +00:00
|
|
|
|
2017-03-02 17:58:41 +00:00
|
|
|
virNWFilterObjPtr
|
2017-04-18 16:38:50 +00:00
|
|
|
virNWFilterObjListFindByUUID(virNWFilterObjListPtr nwfilters,
|
|
|
|
const unsigned char *uuid);
|
2017-02-28 22:37:15 +00:00
|
|
|
|
2017-03-02 17:58:41 +00:00
|
|
|
virNWFilterObjPtr
|
2017-04-18 16:38:50 +00:00
|
|
|
virNWFilterObjListFindByName(virNWFilterObjListPtr nwfilters,
|
|
|
|
const char *name);
|
2017-02-28 22:37:15 +00:00
|
|
|
|
2017-05-30 21:27:04 +00:00
|
|
|
virNWFilterObjPtr
|
|
|
|
virNWFilterObjListFindInstantiateFilter(virNWFilterObjListPtr nwfilters,
|
|
|
|
const char *filtername);
|
|
|
|
|
2017-03-02 17:58:41 +00:00
|
|
|
virNWFilterObjPtr
|
2017-04-18 16:38:50 +00:00
|
|
|
virNWFilterObjListAssignDef(virNWFilterObjListPtr nwfilters,
|
|
|
|
virNWFilterDefPtr def);
|
2017-02-28 22:37:15 +00:00
|
|
|
|
2017-03-02 17:58:41 +00:00
|
|
|
int
|
2017-04-19 02:30:15 +00:00
|
|
|
virNWFilterObjTestUnassignDef(virNWFilterObjPtr obj);
|
2017-02-28 22:37:15 +00:00
|
|
|
|
2017-03-19 12:20:25 +00:00
|
|
|
typedef bool
|
|
|
|
(*virNWFilterObjListFilter)(virConnectPtr conn,
|
|
|
|
virNWFilterDefPtr def);
|
|
|
|
|
|
|
|
int
|
2017-04-18 16:38:50 +00:00
|
|
|
virNWFilterObjListNumOfNWFilters(virNWFilterObjListPtr nwfilters,
|
|
|
|
virConnectPtr conn,
|
2017-08-16 13:26:07 +00:00
|
|
|
virNWFilterObjListFilter filter);
|
2017-03-19 12:20:25 +00:00
|
|
|
|
2017-03-19 20:24:59 +00:00
|
|
|
int
|
2017-04-18 16:38:50 +00:00
|
|
|
virNWFilterObjListGetNames(virNWFilterObjListPtr nwfilters,
|
|
|
|
virConnectPtr conn,
|
2017-08-16 13:26:07 +00:00
|
|
|
virNWFilterObjListFilter filter,
|
2017-04-18 16:38:50 +00:00
|
|
|
char **const names,
|
|
|
|
int maxnames);
|
2017-03-19 20:24:59 +00:00
|
|
|
|
2017-03-20 11:08:46 +00:00
|
|
|
int
|
|
|
|
virNWFilterObjListExport(virConnectPtr conn,
|
|
|
|
virNWFilterObjListPtr nwfilters,
|
|
|
|
virNWFilterPtr **filters,
|
2017-08-16 13:26:07 +00:00
|
|
|
virNWFilterObjListFilter filter);
|
2017-03-20 11:08:46 +00:00
|
|
|
|
2017-03-02 17:58:41 +00:00
|
|
|
int
|
2017-04-18 16:38:50 +00:00
|
|
|
virNWFilterObjListLoadAllConfigs(virNWFilterObjListPtr nwfilters,
|
|
|
|
const char *configDir);
|
2017-02-28 22:37:15 +00:00
|
|
|
|
2017-03-02 17:58:41 +00:00
|
|
|
void
|
|
|
|
virNWFilterObjLock(virNWFilterObjPtr obj);
|
2017-02-28 22:37:15 +00:00
|
|
|
|
2017-03-02 17:58:41 +00:00
|
|
|
void
|
|
|
|
virNWFilterObjUnlock(virNWFilterObjPtr obj);
|