mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 01:43:23 +00:00
Move virNWFilterTechDriver struct out of nwfilter_conf.h
The virNWFilterTechDriver struct is nothing to do with the nwfilter XML configuration. It stores data specific to the driver implementation so should be in a header in the driver directory instead. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
9b095625e4
commit
bc46c7fb92
@ -860,6 +860,7 @@ UTIL_IO_HELPER_SOURCES = \
|
|||||||
# Network filters
|
# Network filters
|
||||||
NWFILTER_DRIVER_SOURCES = \
|
NWFILTER_DRIVER_SOURCES = \
|
||||||
nwfilter/nwfilter_driver.h nwfilter/nwfilter_driver.c \
|
nwfilter/nwfilter_driver.h nwfilter/nwfilter_driver.c \
|
||||||
|
nwfilter/nwfilter_tech_driver.h \
|
||||||
nwfilter/nwfilter_gentech_driver.c \
|
nwfilter/nwfilter_gentech_driver.c \
|
||||||
nwfilter/nwfilter_gentech_driver.h \
|
nwfilter/nwfilter_gentech_driver.h \
|
||||||
nwfilter/nwfilter_dhcpsnoop.c \
|
nwfilter/nwfilter_dhcpsnoop.c \
|
||||||
|
@ -567,19 +567,6 @@ struct _virNWFilterDriverState {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct _virNWFilterTechDriver virNWFilterTechDriver;
|
|
||||||
typedef virNWFilterTechDriver *virNWFilterTechDriverPtr;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _virNWFilterRuleInst virNWFilterRuleInst;
|
|
||||||
typedef virNWFilterRuleInst *virNWFilterRuleInstPtr;
|
|
||||||
struct _virNWFilterRuleInst {
|
|
||||||
size_t ndata;
|
|
||||||
void **data;
|
|
||||||
virNWFilterTechDriverPtr techdriver;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
enum UpdateStep {
|
enum UpdateStep {
|
||||||
STEP_APPLY_NEW,
|
STEP_APPLY_NEW,
|
||||||
STEP_TEAR_NEW,
|
STEP_TEAR_NEW,
|
||||||
@ -594,79 +581,6 @@ struct domUpdateCBStruct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef int (*virNWFilterTechDrvInit)(bool privileged);
|
|
||||||
typedef void (*virNWFilterTechDrvShutdown)(void);
|
|
||||||
|
|
||||||
enum virDomainNetType;
|
|
||||||
|
|
||||||
typedef int (*virNWFilterRuleCreateInstance)(enum virDomainNetType nettype,
|
|
||||||
virNWFilterDefPtr filter,
|
|
||||||
virNWFilterRuleDefPtr rule,
|
|
||||||
const char *ifname,
|
|
||||||
virNWFilterHashTablePtr vars,
|
|
||||||
virNWFilterRuleInstPtr res);
|
|
||||||
|
|
||||||
typedef int (*virNWFilterRuleApplyNewRules)(const char *ifname,
|
|
||||||
int nruleInstances,
|
|
||||||
void **_inst);
|
|
||||||
|
|
||||||
typedef int (*virNWFilterRuleTeardownNewRules)(const char *ifname);
|
|
||||||
|
|
||||||
typedef int (*virNWFilterRuleTeardownOldRules)(const char *ifname);
|
|
||||||
|
|
||||||
typedef int (*virNWFilterRuleRemoveRules)(const char *ifname,
|
|
||||||
int nruleInstances,
|
|
||||||
void **_inst);
|
|
||||||
|
|
||||||
typedef int (*virNWFilterRuleAllTeardown)(const char *ifname);
|
|
||||||
|
|
||||||
typedef int (*virNWFilterRuleFreeInstanceData)(void * _inst);
|
|
||||||
|
|
||||||
typedef int (*virNWFilterRuleDisplayInstanceData)(void *_inst);
|
|
||||||
|
|
||||||
typedef int (*virNWFilterCanApplyBasicRules)(void);
|
|
||||||
|
|
||||||
typedef int (*virNWFilterApplyBasicRules)(const char *ifname,
|
|
||||||
const virMacAddr *macaddr);
|
|
||||||
|
|
||||||
typedef int (*virNWFilterApplyDHCPOnlyRules)(const char *ifname,
|
|
||||||
const virMacAddr *macaddr,
|
|
||||||
virNWFilterVarValuePtr dhcpsrvs,
|
|
||||||
bool leaveTemporary);
|
|
||||||
|
|
||||||
typedef int (*virNWFilterRemoveBasicRules)(const char *ifname);
|
|
||||||
|
|
||||||
typedef int (*virNWFilterDropAllRules)(const char *ifname);
|
|
||||||
|
|
||||||
enum techDrvFlags {
|
|
||||||
TECHDRV_FLAG_INITIALIZED = (1 << 0),
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _virNWFilterTechDriver {
|
|
||||||
const char *name;
|
|
||||||
enum techDrvFlags flags;
|
|
||||||
|
|
||||||
virNWFilterTechDrvInit init;
|
|
||||||
virNWFilterTechDrvShutdown shutdown;
|
|
||||||
|
|
||||||
virNWFilterRuleCreateInstance createRuleInstance;
|
|
||||||
virNWFilterRuleApplyNewRules applyNewRules;
|
|
||||||
virNWFilterRuleTeardownNewRules tearNewRules;
|
|
||||||
virNWFilterRuleTeardownOldRules tearOldRules;
|
|
||||||
virNWFilterRuleRemoveRules removeRules;
|
|
||||||
virNWFilterRuleAllTeardown allTeardown;
|
|
||||||
virNWFilterRuleFreeInstanceData freeRuleInstance;
|
|
||||||
virNWFilterRuleDisplayInstanceData displayRuleInstance;
|
|
||||||
|
|
||||||
virNWFilterCanApplyBasicRules canApplyBasicRules;
|
|
||||||
virNWFilterApplyBasicRules applyBasicRules;
|
|
||||||
virNWFilterApplyDHCPOnlyRules applyDHCPOnlyRules;
|
|
||||||
virNWFilterDropAllRules applyDropAllRules;
|
|
||||||
virNWFilterRemoveBasicRules removeBasicRules;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void virNWFilterRuleDefFree(virNWFilterRuleDefPtr def);
|
void virNWFilterRuleDefFree(virNWFilterRuleDefPtr def);
|
||||||
|
|
||||||
void virNWFilterDefFree(virNWFilterDefPtr def);
|
void virNWFilterDefFree(virNWFilterDefPtr def);
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#ifndef __NWFILTER_DHCPSNOOP_H
|
#ifndef __NWFILTER_DHCPSNOOP_H
|
||||||
# define __NWFILTER_DHCPSNOOP_H
|
# define __NWFILTER_DHCPSNOOP_H
|
||||||
|
|
||||||
|
# include "nwfilter_tech_driver.h"
|
||||||
|
|
||||||
int virNWFilterDHCPSnoopInit(void);
|
int virNWFilterDHCPSnoopInit(void);
|
||||||
void virNWFilterDHCPSnoopShutdown(void);
|
void virNWFilterDHCPSnoopShutdown(void);
|
||||||
int virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
|
int virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
#ifndef VIR_NWFILTER_EBTABLES_DRIVER_H__
|
#ifndef VIR_NWFILTER_EBTABLES_DRIVER_H__
|
||||||
# define VIR_NWFILTER_EBTABLES_DRIVER_H__
|
# define VIR_NWFILTER_EBTABLES_DRIVER_H__
|
||||||
|
|
||||||
|
# include "nwfilter_tech_driver.h"
|
||||||
|
|
||||||
# define MAX_CHAINNAME_LENGTH 32 /* see linux/netfilter_bridge/ebtables.h */
|
# define MAX_CHAINNAME_LENGTH 32 /* see linux/netfilter_bridge/ebtables.h */
|
||||||
|
|
||||||
enum RuleType {
|
enum RuleType {
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
# define __NWFILTER_GENTECH_DRIVER_H
|
# define __NWFILTER_GENTECH_DRIVER_H
|
||||||
|
|
||||||
# include "nwfilter_conf.h"
|
# include "nwfilter_conf.h"
|
||||||
|
# include "nwfilter_tech_driver.h"
|
||||||
|
|
||||||
virNWFilterTechDriverPtr virNWFilterTechDriverForName(const char *name);
|
virNWFilterTechDriverPtr virNWFilterTechDriverForName(const char *name);
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
# define __NWFILTER_LEARNIPADDR_H
|
# define __NWFILTER_LEARNIPADDR_H
|
||||||
|
|
||||||
# include "conf/nwfilter_params.h"
|
# include "conf/nwfilter_params.h"
|
||||||
|
# include "nwfilter_tech_driver.h"
|
||||||
# include <net/if.h>
|
# include <net/if.h>
|
||||||
|
|
||||||
enum howDetect {
|
enum howDetect {
|
||||||
|
115
src/nwfilter/nwfilter_tech_driver.h
Normal file
115
src/nwfilter/nwfilter_tech_driver.h
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
/*
|
||||||
|
* nwfilter_tech_driver.h: network filter technology driver interface
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2014 Red Hat, Inc.
|
||||||
|
* Copyright (C) 2006-2008 Daniel P. Berrange
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 IBM Corporation
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*
|
||||||
|
* Author: Stefan Berger <stefanb@us.ibm.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __NWFILTER_TECH_DRIVER_H__
|
||||||
|
# define __NWFILTER_TECH_DRIVER_H__
|
||||||
|
|
||||||
|
# include "nwfilter_conf.h"
|
||||||
|
|
||||||
|
typedef struct _virNWFilterTechDriver virNWFilterTechDriver;
|
||||||
|
typedef virNWFilterTechDriver *virNWFilterTechDriverPtr;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _virNWFilterRuleInst virNWFilterRuleInst;
|
||||||
|
typedef virNWFilterRuleInst *virNWFilterRuleInstPtr;
|
||||||
|
struct _virNWFilterRuleInst {
|
||||||
|
size_t ndata;
|
||||||
|
void **data;
|
||||||
|
virNWFilterTechDriverPtr techdriver;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef int (*virNWFilterTechDrvInit)(bool privileged);
|
||||||
|
typedef void (*virNWFilterTechDrvShutdown)(void);
|
||||||
|
|
||||||
|
enum virDomainNetType;
|
||||||
|
|
||||||
|
typedef int (*virNWFilterRuleCreateInstance)(enum virDomainNetType nettype,
|
||||||
|
virNWFilterDefPtr filter,
|
||||||
|
virNWFilterRuleDefPtr rule,
|
||||||
|
const char *ifname,
|
||||||
|
virNWFilterHashTablePtr vars,
|
||||||
|
virNWFilterRuleInstPtr res);
|
||||||
|
|
||||||
|
typedef int (*virNWFilterRuleApplyNewRules)(const char *ifname,
|
||||||
|
int nruleInstances,
|
||||||
|
void **_inst);
|
||||||
|
|
||||||
|
typedef int (*virNWFilterRuleTeardownNewRules)(const char *ifname);
|
||||||
|
|
||||||
|
typedef int (*virNWFilterRuleTeardownOldRules)(const char *ifname);
|
||||||
|
|
||||||
|
typedef int (*virNWFilterRuleRemoveRules)(const char *ifname,
|
||||||
|
int nruleInstances,
|
||||||
|
void **_inst);
|
||||||
|
|
||||||
|
typedef int (*virNWFilterRuleAllTeardown)(const char *ifname);
|
||||||
|
|
||||||
|
typedef int (*virNWFilterRuleFreeInstanceData)(void * _inst);
|
||||||
|
|
||||||
|
typedef int (*virNWFilterRuleDisplayInstanceData)(void *_inst);
|
||||||
|
|
||||||
|
typedef int (*virNWFilterCanApplyBasicRules)(void);
|
||||||
|
|
||||||
|
typedef int (*virNWFilterApplyBasicRules)(const char *ifname,
|
||||||
|
const virMacAddr *macaddr);
|
||||||
|
|
||||||
|
typedef int (*virNWFilterApplyDHCPOnlyRules)(const char *ifname,
|
||||||
|
const virMacAddr *macaddr,
|
||||||
|
virNWFilterVarValuePtr dhcpsrvs,
|
||||||
|
bool leaveTemporary);
|
||||||
|
|
||||||
|
typedef int (*virNWFilterRemoveBasicRules)(const char *ifname);
|
||||||
|
|
||||||
|
typedef int (*virNWFilterDropAllRules)(const char *ifname);
|
||||||
|
|
||||||
|
enum techDrvFlags {
|
||||||
|
TECHDRV_FLAG_INITIALIZED = (1 << 0),
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _virNWFilterTechDriver {
|
||||||
|
const char *name;
|
||||||
|
enum techDrvFlags flags;
|
||||||
|
|
||||||
|
virNWFilterTechDrvInit init;
|
||||||
|
virNWFilterTechDrvShutdown shutdown;
|
||||||
|
|
||||||
|
virNWFilterRuleCreateInstance createRuleInstance;
|
||||||
|
virNWFilterRuleApplyNewRules applyNewRules;
|
||||||
|
virNWFilterRuleTeardownNewRules tearNewRules;
|
||||||
|
virNWFilterRuleTeardownOldRules tearOldRules;
|
||||||
|
virNWFilterRuleRemoveRules removeRules;
|
||||||
|
virNWFilterRuleAllTeardown allTeardown;
|
||||||
|
virNWFilterRuleFreeInstanceData freeRuleInstance;
|
||||||
|
virNWFilterRuleDisplayInstanceData displayRuleInstance;
|
||||||
|
|
||||||
|
virNWFilterCanApplyBasicRules canApplyBasicRules;
|
||||||
|
virNWFilterApplyBasicRules applyBasicRules;
|
||||||
|
virNWFilterApplyDHCPOnlyRules applyDHCPOnlyRules;
|
||||||
|
virNWFilterDropAllRules applyDropAllRules;
|
||||||
|
virNWFilterRemoveBasicRules removeBasicRules;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __NWFILTER_TECH_DRIVER_H__ */
|
Loading…
Reference in New Issue
Block a user