projects
/
project
/
netifd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7fff5da
)
restructure the proto state, add a callback for notifications by the protocol handler...
author
Felix Fietkau
<nbd@openwrt.org>
Mon, 28 Mar 2011 19:54:19 +0000
(21:54 +0200)
committer
Felix Fietkau
<nbd@openwrt.org>
Mon, 28 Mar 2011 19:55:40 +0000
(21:55 +0200)
interface.c
patch
|
blob
|
history
interface.h
patch
|
blob
|
history
diff --git
a/interface.c
b/interface.c
index
7bf0ed4
..
0aa0b0d
100644
(file)
--- a/
interface.c
+++ b/
interface.c
@@
-58,7
+58,7
@@
interface_event(struct interface *iface, enum interface_event ev)
if (!iface->state || !iface->state->event)
return 0;
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
}
static void
@@
-148,7
+148,7
@@
free_interface(struct interface *iface)
netifd_ubus_remove_interface(iface);
list_del(&iface->list);
if (iface->state && iface->state->free)
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);
}
free(iface);
}
diff --git
a/interface.h
b/interface.h
index
3a0b96f
..
dd72389
100644
(file)
--- a/
interface.h
+++ b/
interface.h
@@
-12,11
+12,21
@@
enum interface_event {
IFEV_DOWN,
};
IFEV_DOWN,
};
+enum interface_proto_event {
+ PROTO_UP,
+ PROTO_DOWN,
+};
+
struct interface_proto_state {
struct interface_proto_state {
+ struct interface *iface;
const struct interface_proto *proto;
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 {
};
struct interface_error {