make avl_strcmp globally visible
[project/netifd.git] / proto.h
1 #ifndef __NETIFD_PROTO_H
2 #define __NETIFD_PROTO_H
3
4 struct interface_proto_state;
5
6 enum interface_proto_event {
7         IFPEV_UP,
8         IFPEV_DOWN,
9 };
10
11 enum interface_proto_cmd {
12         PROTO_CMD_SETUP,
13         PROTO_CMD_TEARDOWN,
14 };
15
16 enum {
17         PROTO_FLAG_IMMEDIATE = (1 << 0),
18 };
19
20 struct interface_proto_state {
21         struct interface *iface;
22         unsigned int flags;
23
24         /* filled in by the protocol user */
25         void (*proto_event)(struct interface_proto_state *, enum interface_proto_event ev);
26
27         /* filled in by the protocol handler */
28         int (*handler)(struct interface_proto_state *, enum interface_proto_cmd cmd, bool force);
29         void (*free)(struct interface_proto_state *);
30 };
31
32 struct interface_proto_state *get_default_proto(void);
33 int interface_proto_event(struct interface_proto_state *proto,
34                           enum interface_proto_cmd cmd, bool force);
35
36 #endif