+#include "ubus.h"
+
+
+static bool
+put_value(void *ptr, void *val, int elem_size, bool is_list)
+{
+ void *copy;
+
+ if (is_list)
+ {
+ copy = malloc(elem_size);
+
+ if (!copy)
+ return false;
+
+ memcpy(copy, val, elem_size);
+ list_add_tail((struct list_head *)copy, (struct list_head *)ptr);
+ return true;
+ }
+
+ memcpy(ptr, val, elem_size);
+ return false;
+}
+
+static bool
+parse_enum(void *ptr, const char *val, const char **values, int min, int max)
+{
+ int i, l = strlen(val);
+
+ if (l > 0)
+ {
+ for (i = 0; i <= (max - min); i++)
+ {
+ if (!strncasecmp(val, values[i], l))
+ {
+ *((int *)ptr) = min + i;
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+
+const char *fw3_flag_names[__FW3_FLAG_MAX] = {
+ "filter",
+ "nat",
+ "mangle",
+ "raw",
+
+ "IPv4",
+ "IPv6",
+
+ "ACCEPT",
+ "REJECT",
+ "DROP",
+ "NOTRACK",
+ "MARK",
+ "DNAT",
+ "SNAT",
+ "MASQUERADE",
+
+ "ACCEPT",
+ "REJECT",
+ "DROP",
+};
+
+const char *fw3_limit_units[__FW3_LIMIT_UNIT_MAX] = {
+ "second",
+ "minute",
+ "hour",
+ "day",
+};
+
+const char *fw3_ipset_method_names[__FW3_IPSET_METHOD_MAX] = {
+ "(bug)",
+ "bitmap",
+ "hash",
+ "list",
+};
+
+const char *fw3_ipset_type_names[__FW3_IPSET_TYPE_MAX] = {
+ "(bug)",
+ "ip",
+ "port",
+ "mac",
+ "net",
+ "set",
+};
+
+static const char *weekdays[] = {
+ "monday",
+ "tuesday",
+ "wednesday",
+ "thursday",
+ "friday",
+ "saturday",
+ "sunday",
+};
+
+static const char *include_types[] = {
+ "script",
+ "restore",
+};
+
+static const char *reflection_sources[] = {
+ "internal",
+ "external",
+};
+