if (!iface->state || !iface->state->event)
return 0;
- return iface->state->event(iface, iface->state, ev);
+ return iface->state->event(iface->state, ev);
}
static void
netifd_ubus_remove_interface(iface);
list_del(&iface->list);
if (iface->state && iface->state->free)
- iface->state->free(iface, iface->state);
+ iface->state->free(iface->state);
free(iface);
}
IFEV_DOWN,
};
+enum interface_proto_event {
+ PROTO_UP,
+ PROTO_DOWN,
+};
+
struct interface_proto_state {
+ struct interface *iface;
const struct interface_proto *proto;
- int (*event)(struct interface *, struct interface_proto_state *, enum interface_event ev);
- void (*free)(struct interface *, struct interface_proto_state *);
+ /* filled in by the protocol user */
+ int (*proto_event)(struct interface_proto_state *, enum interface_proto_event ev);
+
+ /* filled in by the protocol handler */
+ int (*event)(struct interface_proto_state *, enum interface_event ev);
+ void (*free)(struct interface_proto_state *);
};
struct interface_error {