1 #ifndef __NETIFD_INTERFACE_H
2 #define __NETIFD_INTERFACE_H
5 struct interface_proto;
6 struct interface_proto_state;
8 extern struct list_head interfaces;
10 enum interface_event {
15 enum interface_proto_event {
20 struct interface_proto_state {
21 struct interface *iface;
22 const struct interface_proto *proto;
24 /* filled in by the protocol user */
25 int (*proto_event)(struct interface_proto_state *, enum interface_proto_event ev);
27 /* filled in by the protocol handler */
28 int (*event)(struct interface_proto_state *, enum interface_event ev);
29 void (*free)(struct interface_proto_state *);
32 struct interface_error {
33 struct list_head list;
35 const char *subsystem;
41 * interface configuration
44 struct list_head list;
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_iface;
58 /* primary protocol state */
59 struct interface_proto_state *state;
61 /* errors/warnings while trying to bring up the interface */
62 struct list_head errors;
64 struct ubus_object ubus;
67 struct interface *get_interface(const char *name);
68 struct interface *alloc_interface(const char *name);
69 void free_interface(struct interface *iface);
71 int set_interface_up(struct interface *iface);
72 int set_interface_down(struct interface *iface);
74 int interface_add_link(struct interface *iface, struct device *llif);
75 void interface_remove_link(struct interface *iface, struct device *llif);
77 void interface_add_error(struct interface *iface, const char *subsystem,
78 const char *code, const char **data, int n_data);
80 int interface_attach_bridge(struct interface *iface, struct uci_section *s);