add rudimentary protocol handling
[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 struct interface_proto_state {
17 struct interface *iface;
18
19 /* filled in by the protocol user */
20 void (*proto_event)(struct interface_proto_state *, enum interface_proto_event ev);
21
22 /* filled in by the protocol handler */
23 int (*handler)(struct interface_proto_state *, enum interface_proto_cmd cmd, bool force);
24 void (*free)(struct interface_proto_state *);
25 };
26
27 struct interface_proto_state *get_default_proto(void);
28
29 #endif