summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorzhanghailiang2016-03-01 06:37:02 +0100
committerJason Wang2016-03-08 08:34:18 +0100
commit338d3f415e131673ea51719b0c30edf65f69d806 (patch)
tree7140a1e0b637aa6287b23d3a0db533e47f8fc124 /include
parentrocker: allow user to specify rocker world by property (diff)
downloadqemu-338d3f415e131673ea51719b0c30edf65f69d806.tar.gz
qemu-338d3f415e131673ea51719b0c30edf65f69d806.tar.xz
qemu-338d3f415e131673ea51719b0c30edf65f69d806.zip
filter: Add 'status' property for filter object
With this property, users can control if this filter is 'on' or 'off'. The default behavior for filter is 'on'. For some types of filters, they may need to react to status changing, So here, we introduced status changing callback/notifier for filter class. We will skip the disabled ('off') filter when delivering packets in net layer. Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Cc: Jason Wang <jasowang@redhat.com> Cc: Yang Hongyang <hongyang.yang@easystack.cn> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/net/filter.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/net/filter.h b/include/net/filter.h
index 56399763cc..cfb11728df 100644
--- a/include/net/filter.h
+++ b/include/net/filter.h
@@ -36,12 +36,15 @@ typedef ssize_t (FilterReceiveIOV)(NetFilterState *nc,
int iovcnt,
NetPacketSent *sent_cb);
+typedef void (FilterStatusChanged) (NetFilterState *nf, Error **errp);
+
typedef struct NetFilterClass {
ObjectClass parent_class;
/* optional */
FilterSetup *setup;
FilterCleanup *cleanup;
+ FilterStatusChanged *status_changed;
/* mandatory */
FilterReceiveIOV *receive_iov;
} NetFilterClass;
@@ -55,6 +58,7 @@ struct NetFilterState {
char *netdev_id;
NetClientState *netdev;
NetFilterDirection direction;
+ bool on;
QTAILQ_ENTRY(NetFilterState) next;
};