hw/isa/lpc_ich9: Ignore reserved/invalid SCI IRQ
[qemu/kevin.git] / include / net / filter.h
blob27ffc630df4225d85a00687aa1120f3100dee29a
1 /*
2 * Copyright (c) 2015 FUJITSU LIMITED
3 * Author: Yang Hongyang <yanghy@cn.fujitsu.com>
5 * This work is licensed under the terms of the GNU GPL, version 2 or
6 * later. See the COPYING file in the top-level directory.
7 */
9 #ifndef QEMU_NET_FILTER_H
10 #define QEMU_NET_FILTER_H
12 #include "qapi/qapi-types-net.h"
13 #include "qemu/queue.h"
14 #include "qom/object.h"
15 #include "net/queue.h"
17 #define TYPE_NETFILTER "netfilter"
18 OBJECT_DECLARE_TYPE(NetFilterState, NetFilterClass, NETFILTER)
20 typedef void (FilterSetup) (NetFilterState *nf, Error **errp);
21 typedef void (FilterCleanup) (NetFilterState *nf);
23 * Return:
24 * 0: finished handling the packet, we should continue
25 * size: filter stolen this packet, we stop pass this packet further
27 typedef ssize_t (FilterReceiveIOV)(NetFilterState *nc,
28 NetClientState *sender,
29 unsigned flags,
30 const struct iovec *iov,
31 int iovcnt,
32 NetPacketSent *sent_cb);
34 typedef void (FilterStatusChanged) (NetFilterState *nf, Error **errp);
36 typedef void (FilterHandleEvent) (NetFilterState *nf, int event, Error **errp);
38 struct NetFilterClass {
39 ObjectClass parent_class;
41 /* optional */
42 FilterSetup *setup;
43 FilterCleanup *cleanup;
44 FilterStatusChanged *status_changed;
45 FilterHandleEvent *handle_event;
46 /* mandatory */
47 FilterReceiveIOV *receive_iov;
51 struct NetFilterState {
52 /* private */
53 Object parent;
55 /* protected */
56 char *netdev_id;
57 NetClientState *netdev;
58 NetFilterDirection direction;
59 bool on;
60 char *position;
61 bool insert_before_flag;
62 QTAILQ_ENTRY(NetFilterState) next;
65 ssize_t qemu_netfilter_receive(NetFilterState *nf,
66 NetFilterDirection direction,
67 NetClientState *sender,
68 unsigned flags,
69 const struct iovec *iov,
70 int iovcnt,
71 NetPacketSent *sent_cb);
73 /* pass the packet to the next filter */
74 ssize_t qemu_netfilter_pass_to_next(NetClientState *sender,
75 unsigned flags,
76 const struct iovec *iov,
77 int iovcnt,
78 void *opaque);
80 void colo_notify_filters_event(int event, Error **errp);
82 #endif /* QEMU_NET_FILTER_H */