summaryrefslogtreecommitdiff
path: root/proto-static.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-04-13 23:40:26 +0200
committerFelix Fietkau <nbd@openwrt.org>2011-04-13 23:40:26 +0200
commit37bdee9b7282f08cbe6e423765bd3950d753a2c6 (patch)
tree2ce326c55594850602955d5ac9de9cf121c02849 /proto-static.c
parent6b7accf51072d883a7692d7a4bb1d7d1a2e7242b (diff)
downloadnetifd-37bdee9b7282f08cbe6e423765bd3950d753a2c6.tar.gz
add a dummy protocol handler for "static"
Diffstat (limited to 'proto-static.c')
-rw-r--r--proto-static.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/proto-static.c b/proto-static.c
new file mode 100644
index 0000000..614177b
--- /dev/null
+++ b/proto-static.c
@@ -0,0 +1,52 @@
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "netifd.h"
+#include "proto.h"
+
+struct static_proto_state {
+ struct interface_proto_state proto;
+};
+
+
+static int
+static_handler(struct interface_proto_state *proto,
+ enum interface_proto_cmd cmd, bool force)
+{
+ return 0;
+}
+
+static void
+static_free(struct interface_proto_state *proto)
+{
+ struct static_proto_state *state;
+
+ state = container_of(proto, struct static_proto_state, proto);
+ free(state);
+}
+
+struct interface_proto_state *
+static_attach(struct proto_handler *h, struct interface *iface,
+ struct uci_section *s)
+{
+ struct static_proto_state *state;
+
+ state = calloc(1, sizeof(*state));
+ state->proto.free = static_free;
+ state->proto.handler = static_handler;
+ state->proto.flags = PROTO_FLAG_IMMEDIATE;
+
+ return &state->proto;
+}
+
+static struct proto_handler static_proto = {
+ .name = "static",
+ .attach = static_attach,
+};
+
+static void __init
+static_proto_init(void)
+{
+ add_proto_handler(&static_proto);
+}