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;
41 struct list_head hotplug_list;
42 enum interface_event hotplug_ev;
49 bool config_autostart;
52 enum interface_state state;
53 enum interface_config_state config_state;
55 /* main interface that the interface is bound to */
56 struct device_user main_dev;
58 /* interface that layer 3 communication will go through */
59 struct device_user *l3_dev;
61 struct blob_attr *config;
63 /* primary protocol state */
64 const struct proto_handler *proto_handler;
65 struct interface_proto_state *proto;
67 struct vlist_tree proto_addr;
68 struct vlist_tree proto_route;
70 struct list_head proto_dns_servers;
71 struct list_head proto_dns_search;
73 /* errors/warnings while trying to bring up the interface */
74 struct list_head errors;
76 struct uloop_timeout remove_timer;
77 struct ubus_object ubus;
80 extern struct vlist_tree interfaces;
81 extern const struct config_param_list interface_attr_list;
83 void interface_init(struct interface *iface, const char *name,
84 struct blob_attr *config);
86 void interface_add(struct interface *iface, struct blob_attr *config);
88 void interface_set_proto_state(struct interface *iface, struct interface_proto_state *state);
90 void interface_set_available(struct interface *iface, bool new_state);
91 int interface_set_up(struct interface *iface);
92 int interface_set_down(struct interface *iface);
94 int interface_add_link(struct interface *iface, struct device *llif);
95 void interface_remove_link(struct interface *iface, struct device *llif);
97 void interface_add_error(struct interface *iface, const char *subsystem,
98 const char *code, const char **data, int n_data);
100 void interface_queue_event(struct interface *iface, enum interface_event ev);
101 void interface_dequeue_event(struct interface *iface);
103 void interface_start_pending(void);