- glob("./*.sh", 0, NULL, &g);
- for (i = 0; i < g.gl_pathc; i++)
- proto_shell_add_script(g.gl_pathv[i]);
+ tmp = json_get_field(obj, "no-proto-task", json_type_boolean);
+ if (tmp && json_object_get_boolean(tmp))
+ handler->proto.flags |= PROTO_FLAG_NO_TASK;
+
+ tmp = json_get_field(obj, "available", json_type_boolean);
+ if (tmp && json_object_get_boolean(tmp))
+ handler->proto.flags |= PROTO_FLAG_INIT_AVAILABLE;
+
+ tmp = json_get_field(obj, "renew-handler", json_type_boolean);
+ if (tmp && json_object_get_boolean(tmp))
+ handler->proto.flags |= PROTO_FLAG_RENEW_AVAILABLE;
+
+ tmp = json_get_field(obj, "lasterror", json_type_boolean);
+ if (tmp && json_object_get_boolean(tmp))
+ handler->proto.flags |= PROTO_FLAG_LASTERROR;
+
+ tmp = json_get_field(obj, "teardown-on-l3-link-down", json_type_boolean);
+ if (tmp && json_object_get_boolean(tmp))
+ handler->proto.flags |= PROTO_FLAG_TEARDOWN_ON_L3_LINK_DOWN;
+
+ config = json_get_field(obj, "config", json_type_array);
+ if (config)
+ handler->config_buf = netifd_handler_parse_config(&handler->config, config);
+
+ DPRINTF("Add handler for script %s: %s\n", script, proto->name);
+ add_proto_handler(proto);
+}
+
+void proto_shell_init(void)
+{
+ proto_fd = netifd_open_subdir("proto");
+ if (proto_fd < 0)
+ return;