1 #ifndef __NETIFD_INTERFACE_H
2 #define __NETIFD_INTERFACE_H
8 struct interface_proto_state;
10 enum interface_event {
15 enum interface_state {
22 struct interface_error {
23 struct list_head list;
25 const char *subsystem;
31 * interface configuration
34 struct list_head list;
41 enum interface_state state;
43 /* main interface that the interface is bound to */
44 struct device_user main_dev;
46 /* interface that layer 3 communication will go through */
47 struct device_user *l3_iface;
49 /* primary protocol state */
50 struct interface_proto_state *proto;
52 struct list_head address, routes;
54 /* errors/warnings while trying to bring up the interface */
55 struct list_head errors;
57 struct ubus_object ubus;
60 extern const struct config_param_list interface_attr_list;
62 struct interface *get_interface(const char *name);
63 struct interface *alloc_interface(const char *name, struct uci_section *s, struct blob_attr *attr);
64 void free_interface(struct interface *iface);
66 void interface_set_proto_state(struct interface *iface, struct interface_proto_state *state);
68 int interface_set_up(struct interface *iface);
69 int interface_set_down(struct interface *iface);
71 int interface_add_link(struct interface *iface, struct device *llif);
72 void interface_remove_link(struct interface *iface, struct device *llif);
74 void interface_add_error(struct interface *iface, const char *subsystem,
75 const char *code, const char **data, int n_data);
77 int interface_attach_bridge(struct interface *iface, struct uci_section *s);
79 int interface_add_address(struct interface *iface, struct device_addr *addr);
80 void interface_del_address(struct interface *iface, struct device_addr *addr);
81 void interface_del_ctx_addr(struct interface *iface, void *ctx);
83 int interface_add_route(struct interface *iface, struct device_route *route);
84 void interface_del_route(struct interface *iface, struct device_route *route);
85 void interface_del_all_routes(struct interface *iface);
87 void start_pending_interfaces(void);