SNMP_ERR_NOTWRITABLE is a more appropriate return value for the last two commits

The instance of the SNMP node was found, that's why the functions have been called. So if set_test() and/or set_value() do not exist, it means the SNMP node instance is not writable.
This commit is contained in:
Dirk Ziegelmeier 2018-10-24 09:59:06 +02:00
parent ee2f5c52d1
commit ec28364a2f
2 changed files with 4 additions and 4 deletions

View File

@ -206,7 +206,7 @@ snmp_scalar_array_get_value(struct snmp_node_instance *instance, void *value)
static snmp_err_t
snmp_scalar_array_set_test(struct snmp_node_instance *instance, u16_t value_len, void *value)
{
snmp_err_t result = SNMP_ERR_NOSUCHINSTANCE;
snmp_err_t result = SNMP_ERR_NOTWRITABLE;
const struct snmp_scalar_array_node *array_node = (const struct snmp_scalar_array_node *)(const void *)instance->node;
const struct snmp_scalar_array_node_def *array_node_def = (const struct snmp_scalar_array_node_def *)instance->reference.const_ptr;
@ -219,7 +219,7 @@ snmp_scalar_array_set_test(struct snmp_node_instance *instance, u16_t value_len,
static snmp_err_t
snmp_scalar_array_set_value(struct snmp_node_instance *instance, u16_t value_len, void *value)
{
snmp_err_t result = SNMP_ERR_NOSUCHINSTANCE;
snmp_err_t result = SNMP_ERR_NOTWRITABLE;
const struct snmp_scalar_array_node *array_node = (const struct snmp_scalar_array_node *)(const void *)instance->node;
const struct snmp_scalar_array_node_def *array_node_def = (const struct snmp_scalar_array_node_def *)instance->reference.const_ptr;

View File

@ -83,7 +83,7 @@ threadsync_set_test_synced(void *ctx)
if (call_data->proxy_instance.set_test != NULL) {
call_data->retval.err = call_data->proxy_instance.set_test(&call_data->proxy_instance, call_data->arg2.len, call_data->arg1.value);
} else {
call_data->retval.err = SNMP_ERR_NOSUCHINSTANCE;
call_data->retval.err = SNMP_ERR_NOTWRITABLE;
}
sys_sem_signal(&call_data->threadsync_node->instance->sem);
@ -109,7 +109,7 @@ threadsync_set_value_synced(void *ctx)
if (call_data->proxy_instance.set_value != NULL) {
call_data->retval.err = call_data->proxy_instance.set_value(&call_data->proxy_instance, call_data->arg2.len, call_data->arg1.value);
} else {
call_data->retval.err = SNMP_ERR_NOSUCHINSTANCE;
call_data->retval.err = SNMP_ERR_NOTWRITABLE;
}
sys_sem_signal(&call_data->threadsync_node->instance->sem);