diff options
Diffstat (limited to 'common/state/state_variables.c')
-rw-r--r-- | common/state/state_variables.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/common/state/state_variables.c b/common/state/state_variables.c index 688467d8cd..de9ba4ab61 100644 --- a/common/state/state_variables.c +++ b/common/state/state_variables.c @@ -450,26 +450,31 @@ static struct state_variable *state_string_create(struct state *state, static struct variable_type types[] = { { .type_name = "uint8", + .type = STATE_VARIABLE_TYPE_UINT8, .export = state_uint32_export, .import = state_uint32_import, .create = state_uint8_create, }, { .type_name = "uint32", + .type = STATE_VARIABLE_TYPE_UINT32, .export = state_uint32_export, .import = state_uint32_import, .create = state_uint32_create, }, { .type_name = "enum32", + .type = STATE_VARIABLE_TYPE_ENUM32, .export = state_enum32_export, .import = state_enum32_import, .create = state_enum32_create, }, { .type_name = "mac", + .type = STATE_VARIABLE_TYPE_MAC, .export = state_mac_export, .import = state_mac_import, .create = state_mac_create, }, { .type_name = "string", + .type = STATE_VARIABLE_TYPE_STRING, .export = state_string_export, .import = state_string_import, .create = state_string_create, @@ -489,6 +494,19 @@ struct variable_type *state_find_type_by_name(const char *name) return NULL; } +struct variable_type *state_find_type(const enum state_variable_type type) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(types); i++) { + if (type == types[i].type) { + return &types[i]; + } + } + + return NULL; +} + struct state_variable *state_find_var(struct state *state, const char *name) { struct state_variable *sv; |