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 struct interface_proto_state
{
16 const struct interface_proto
*proto
;
18 int (*event
)(struct interface
*, struct interface_proto_state
*, enum interface_event ev
);
19 void (*free
)(struct interface
*, struct interface_proto_state
*);
22 struct interface_error
{
23 struct list_head list
;
25 const char *subsystem
;
31 * interface configuration
34 struct list_head list
;
42 /* main interface that the interface is bound to */
43 struct device_user main_dev
;
45 /* interface that layer 3 communication will go through */
46 struct device_user
*l3_iface
;
48 /* primary protocol state */
49 struct interface_proto_state
*state
;
51 /* errors/warnings while trying to bring up the interface */
52 struct list_head errors
;
54 struct ubus_object ubus
;
57 struct interface
*get_interface(const char *name
);
58 struct interface
*alloc_interface(const char *name
);
59 void free_interface(struct interface
*iface
);
61 int set_interface_up(struct interface
*iface
);
62 int set_interface_down(struct interface
*iface
);
64 int interface_add_link(struct interface
*iface
, struct device
*llif
);
65 void interface_remove_link(struct interface
*iface
, struct device
*llif
);
67 void interface_add_error(struct interface
*iface
, const char *subsystem
,
68 const char *code
, const char **data
, int n_data
);
70 int interface_attach_bridge(struct interface
*iface
, struct uci_section
*s
);