1 #ifndef __NETIFD_INTERFACE_H
2 #define __NETIFD_INTERFACE_H
8 struct interface_proto_state
;
10 enum interface_event
{
15 enum interface_state
{
22 enum interface_config_state
{
28 struct interface_error
{
29 struct list_head list
;
31 const char *subsystem
;
37 * interface configuration
40 struct vlist_node node
;
47 bool config_autostart
;
49 enum interface_state state
;
50 enum interface_config_state config_state
;
52 /* main interface that the interface is bound to */
53 struct device_user main_dev
;
55 /* interface that layer 3 communication will go through */
56 struct device_user
*l3_dev
;
58 struct blob_attr
*config
;
60 /* primary protocol state */
61 const struct proto_handler
*proto_handler
;
62 struct interface_proto_state
*proto
;
64 struct vlist_tree proto_addr
;
65 struct vlist_tree proto_route
;
67 /* errors/warnings while trying to bring up the interface */
68 struct list_head errors
;
70 struct uloop_timeout remove_timer
;
71 struct ubus_object ubus
;
74 extern struct vlist_tree interfaces
;
75 extern const struct config_param_list interface_attr_list
;
77 void interface_init(struct interface
*iface
, const char *name
,
78 struct blob_attr
*config
);
80 void interface_add(struct interface
*iface
, struct blob_attr
*config
);
82 void interface_set_proto_state(struct interface
*iface
, struct interface_proto_state
*state
);
84 void interface_set_available(struct interface
*iface
, bool new_state
);
85 int interface_set_up(struct interface
*iface
);
86 int interface_set_down(struct interface
*iface
);
88 int interface_add_link(struct interface
*iface
, struct device
*llif
);
89 void interface_remove_link(struct interface
*iface
, struct device
*llif
);
91 void interface_add_error(struct interface
*iface
, const char *subsystem
,
92 const char *code
, const char **data
, int n_data
);
94 void interface_start_pending(void);