1 #ifndef __NETIFD_PROTO_H
2 #define __NETIFD_PROTO_H
5 struct interface_proto_state
;
8 enum interface_proto_event
{
13 enum interface_proto_cmd
{
19 PROTO_FLAG_IMMEDIATE
= (1 << 0),
22 struct interface_proto_state
{
23 struct interface
*iface
;
26 /* filled in by the protocol user */
27 void (*proto_event
)(struct interface_proto_state
*, enum interface_proto_event ev
);
29 /* filled in by the protocol handler */
30 int (*handler
)(struct interface_proto_state
*, enum interface_proto_cmd cmd
, bool force
);
31 void (*free
)(struct interface_proto_state
*);
34 typedef struct interface_proto_state
*
35 (*proto_attach_cb
)(const struct proto_handler
*h
, struct interface
*,
36 struct uci_section
*s
);
38 struct proto_handler
{
42 proto_attach_cb attach
;
45 void add_proto_handler(struct proto_handler
*p
);
46 void proto_init_interface(struct interface
*iface
, struct uci_section
*s
);
47 void proto_attach_interface(struct interface
*iface
, const char *proto_name
);
48 int interface_proto_event(struct interface_proto_state
*proto
,
49 enum interface_proto_cmd cmd
, bool force
);