libamxd  6.4.1
Data Model Manager
Data Model Default Parameter Action Implementations
Collaboration diagram for Data Model Default Parameter Action Implementations:

Functions

amxd_status_t amxd_action_param_read (amxd_object_t *object, amxd_param_t *param, amxd_action_t reason, const amxc_var_t *const args, amxc_var_t *const retval, void *priv)
 Default parameter read action implementation. More...
 
amxd_status_t amxd_action_param_read_hidden_value (amxd_object_t *object, amxd_param_t *param, amxd_action_t reason, const amxc_var_t *const args, amxc_var_t *const retval, void *priv)
 Default parameter read action implementation for hidden values. More...
 
amxd_status_t amxd_action_param_write (amxd_object_t *object, amxd_param_t *param, amxd_action_t reason, const amxc_var_t *const args, amxc_var_t *const retval, void *priv)
 Default parameter write action implementation. More...
 
amxd_status_t amxd_action_param_validate (amxd_object_t *object, amxd_param_t *param, amxd_action_t reason, const amxc_var_t *const args, amxc_var_t *const retval, void *priv)
 Default parameter validate action implementation. More...
 
amxd_status_t amxd_action_param_check_range (amxd_object_t *object, amxd_param_t *param, amxd_action_t reason, const amxc_var_t *const args, amxc_var_t *const retval, void *priv)
 Default check range parameter validate action implementation. More...
 
amxd_status_t amxd_action_param_check_minimum (amxd_object_t *object, amxd_param_t *param, amxd_action_t reason, const amxc_var_t *const args, amxc_var_t *const retval, void *priv)
 Default check minimum parameter validate action implementation. More...
 
amxd_status_t amxd_action_param_check_maximum (amxd_object_t *object, amxd_param_t *param, amxd_action_t reason, const amxc_var_t *const args, amxc_var_t *const retval, void *priv)
 Default check maximum parameter validate action implementation. More...
 
amxd_status_t amxd_action_param_check_enum (amxd_object_t *object, amxd_param_t *param, amxd_action_t reason, const amxc_var_t *const args, amxc_var_t *const retval, void *priv)
 Default check enum parameter validate action implementation. More...
 
amxd_status_t amxd_action_param_check_is_in (amxd_object_t *object, amxd_param_t *param, amxd_action_t reason, const amxc_var_t *const args, amxc_var_t *const retval, void *priv)
 Default check is in parameter validate action implementation. More...
 
amxd_status_t amxd_action_param_describe (amxd_object_t *object, amxd_param_t *param, amxd_action_t reason, const amxc_var_t *const args, amxc_var_t *const retval, void *priv)
 Default parameter describe action implementation. More...
 
amxd_status_t amxd_action_param_destroy (amxd_object_t *object, amxd_param_t *param, amxd_action_t reason, const amxc_var_t *const args, amxc_var_t *const retval, void *priv)
 Default parameter destroy action implementation. More...
 

Detailed Description

Function Documentation

◆ amxd_action_param_check_enum()

amxd_status_t amxd_action_param_check_enum ( amxd_object_t object,
amxd_param_t param,
amxd_action_t  reason,
const amxc_var_t *const  args,
amxc_var_t *const  retval,
void *  priv 
)

Default check enum parameter validate action implementation.

This default implementation checks if the new value is in a list of allowed values.

The allowed value must be defined in as a list variant which contains all possible values. The variant pointer must be set as the priv data.

If the new value is a comma or space separated string of values, then each value must be in the list of possible values.

Parameters
objectThe data model object that contains the parameter on which the action is invoked.
paramThe parameter on which the action is invoked
reasonThe action reason. This should be action_param_validate or action_any If the reason is any other action, status amxd_status_function_not_implemented must be returned.
argsThe value that must be validated
retvalNot used in the parameter validate action
privA pointer to a variant, containing the a variant list of allowed values
Returns
  • amxd_status_ok if the new value is valid.
  • amxd_status_function_not_implemented if called for the wrong reason
  • amxd_status_invalid_value if an invalid value is provided (null variant or it can not be converted to the parameter type or not an allowed values)

Definition at line 369 of file amxd_action_param_validate.c.

374  {
376  amxc_var_t* data = (amxc_var_t*) priv;
377  const amxc_llist_t* values = NULL;
378  amxc_var_t check_value;
379 
380  amxc_var_init(&check_value);
381  when_true_status(amxc_var_type_of(data) != AMXC_VAR_ID_LIST,
382  exit,
384 
385  status = amxd_action_describe_action(reason, retval, "check_enum", priv);
386  when_true(status == amxd_status_ok, exit);
387 
388  status = amxd_action_param_validate(object, param, reason, args, retval, priv);
389  when_failed(status, exit);
390 
391  when_true_status(is_key_in_template(object, param), exit, status = amxd_status_ok);
392 
393  amxc_var_convert(&check_value, args, amxd_param_get_type(param));
394  values = amxc_var_constcast(amxc_llist_t, data);
395  when_false_status(is_value_in(&check_value, values),
396  exit,
398 
399 exit:
400  amxc_var_clean(&check_value);
401  return status;
402 }
static bool is_value_in(amxc_var_t *value, const amxc_llist_t *values)
static bool is_key_in_template(const amxd_object_t *object, const amxd_param_t *param)
amxd_status_t amxd_action_param_validate(UNUSED amxd_object_t *object, amxd_param_t *param, amxd_action_t reason, const amxc_var_t *const args, UNUSED amxc_var_t *const retval, UNUSED void *priv)
amxd_status_t amxd_action_describe_action(amxd_action_t reason, amxc_var_t *const retval, const char *description, void *priv)
Definition: amxd_common.c:142
static uint32_t amxd_param_get_type(const amxd_param_t *const param)
enum _amxd_status amxd_status_t
@ amxd_status_invalid_type
Definition: amxd_types.h:90
@ amxd_status_ok
Definition: amxd_types.h:78
@ amxd_status_unknown_error
Definition: amxd_types.h:79
@ amxd_status_invalid_value
Definition: amxd_types.h:88
static amxd_status_t status

◆ amxd_action_param_check_is_in()

amxd_status_t amxd_action_param_check_is_in ( amxd_object_t object,
amxd_param_t param,
amxd_action_t  reason,
const amxc_var_t *const  args,
amxc_var_t *const  retval,
void *  priv 
)

Default check is in parameter validate action implementation.

This default implementation checks if the new value is in a list of possible values. The list of possible values is fetched from a parameter in the local data model. The referenced parameter path is provided as a string variant. The pointer to the string variant is provided as the private data.

If the referenced parameter, that contains the list of valid values, is an empty string, any value is accepted.

Parameters
objectThe data model object that contains the parameter on which the action is invoked.
paramThe parameter on which the action is invoked
reasonThe action reason. This should be action_param_validate or action_any If the reason is any other action, status amxd_status_function_not_implemented must be returned.
argsThe value that must be validated
retvalNot used in the parameter validate action
privA pointer to a string variant, containing the path to a parameter that contains the list of possible values (as a csv or ssv string)
Returns
  • amxd_status_ok if the new value is valid.
  • amxd_status_function_not_implemented if called for the wrong reason
  • amxd_status_invalid_value if an invalid value is provided (null variant or it can not be converted to the parameter type or not an allowed values)

Definition at line 404 of file amxd_action_param_validate.c.

409  {
411  amxc_var_t* data = (amxc_var_t*) priv;
412  amxc_var_t* ref_value = NULL;
413  amxc_llist_t* values = NULL;
414  amxc_var_t check_value;
415 
416  amxc_var_init(&check_value);
417  when_true_status(amxc_var_type_of(data) != AMXC_VAR_ID_CSTRING,
418  exit,
420 
421  status = amxd_action_describe_action(reason, retval, "check_is_in", priv);
422  when_true(status == amxd_status_ok, exit);
423 
424  status = amxd_action_param_validate(object, param, reason, args, retval, priv);
425  when_failed(status, exit);
426 
427  when_true_status(is_key_in_template(object, param), exit, status = amxd_status_ok);
428 
429  ref_value = amxd_resolve_param_ref(object, data);
430  when_true_status(ref_value == NULL &&
432  exit, status = amxd_status_ok);
433  when_null_status(ref_value, exit, status = amxd_status_invalid_value);
434  when_true_status(is_string_empty(ref_value), exit, status = amxd_status_ok);
435 
436  amxc_var_convert(&check_value, args, amxd_param_get_type(param));
437  values = amxc_var_dyncast(amxc_llist_t, ref_value);
438  when_false_status(is_value_in(&check_value, values),
439  exit,
441 
442 exit:
443  amxc_var_clean(&check_value);
444  amxc_llist_delete(&values, variant_list_it_free);
445  return status;
446 }
static bool is_string_empty(const amxc_var_t *value)
amxc_var_t * amxd_resolve_param_ref(amxd_object_t *obj, amxc_var_t *ref)
@ amxd_object_template
Definition: amxd_types.h:183
static amxd_object_type_t amxd_object_get_type(const amxd_object_t *const object)
Returns the object type.
Definition: amxd_object.h:586

◆ amxd_action_param_check_maximum()

amxd_status_t amxd_action_param_check_maximum ( amxd_object_t object,
amxd_param_t param,
amxd_action_t  reason,
const amxc_var_t *const  args,
amxc_var_t *const  retval,
void *  priv 
)

Default check maximum parameter validate action implementation.

This default implementation checks if the new value is equal or lower than a maximum value.

The maximum value must be defined in a variant which must be convertible to int64. The variant pointer must be set as the priv data.

It is allowed to use local parameter references as maximum value. A local parameter reference is a full path to a parameter in the local data model. When local parameter reference is used, the value of the referenced parameter is used as maximum.

If the parameter, for which the new value must be validate, is of the type string (or ssv string or csv string), the length of the new value (as a string) must be at less or equal to the maximum.

Parameters
objectThe data model object that contains the parameter on which the action is invoked.
paramThe parameter on which the action is invoked
reasonThe action reason. This should be action_param_validate or action_any If the reason is any other action, status amxd_status_function_not_implemented must be returned.
argsThe value that must be validated
retvalNot used in the parameter validate action
privA pointer to a variant, containing the maximum value
Returns
  • amxd_status_ok if the new value is valid.
  • amxd_status_function_not_implemented if called for the wrong reason
  • amxd_status_invalid_value if an invalid value is provided (null variant or it can not be converted to the parameter type or higher then maximum)

Definition at line 335 of file amxd_action_param_validate.c.

340  {
342  amxc_var_t* data = (amxc_var_t*) priv;
343  const char* name = "check_maximum";
344 
345  when_null_status(param, exit, status = amxd_status_parameter_not_found);
346  when_null_status(data, exit, status = amxd_status_invalid_value);
347 
348  if((amxc_var_type_of(&param->value) == AMXC_VAR_ID_CSTRING) ||
349  (amxc_var_type_of(&param->value) == AMXC_VAR_ID_CSV_STRING) ||
350  (amxc_var_type_of(&param->value) == AMXC_VAR_ID_SSV_STRING)) {
351  name = "check_maximum_length";
352  }
353 
354  status = amxd_action_describe_action(reason, retval, name, priv);
355  when_true(status == amxd_status_ok, exit);
356 
357  status = amxd_action_param_validate(object, param, reason, args, retval, priv);
358  when_failed(status, exit);
359 
360  when_true_status(is_key_in_template(object, param), exit, status = amxd_status_ok);
361 
362  status = amxd_param_check_maximum(param, data, args);
363  when_failed(status, exit);
364 
365 exit:
366  return status;
367 }
static amxd_status_t amxd_param_check_maximum(amxd_param_t *param, amxc_var_t *data, const amxc_var_t *value)
@ amxd_status_parameter_not_found
Definition: amxd_types.h:82
amxc_var_t value
Definition: amxd_types.h:390

◆ amxd_action_param_check_minimum()

amxd_status_t amxd_action_param_check_minimum ( amxd_object_t object,
amxd_param_t param,
amxd_action_t  reason,
const amxc_var_t *const  args,
amxc_var_t *const  retval,
void *  priv 
)

Default check minimum parameter validate action implementation.

This default implementation checks if the new value is equal or higher than a minimum value.

The minimum value must be defined in a variant which must be convertible to int64. The variant pointer must be set as the priv data.

It is allowed to use local parameter references as minimum value. A local parameter reference is a full path to a parameter in the local data model. When local parameter reference is used, the value of the referenced parameter is used as minimum.

If the parameter, for which the new value must be validated, is of the type string (or ssv string or csv string), the length of the new value (as a string) must be at least equal to the minimum.

Parameters
objectThe data model object that contains the parameter on which the action is invoked.
paramThe parameter on which the action is invoked
reasonThe action reason. This should be action_param_validate or action_any If the reason is any other action, status amxd_status_function_not_implemented must be returned.
argsThe value that must be validated
retvalNot used in the parameter validate action
privA pointer to a variant, containing the minimum value
Returns
  • amxd_status_ok if the new value is valid.
  • amxd_status_function_not_implemented if called for the wrong reason
  • amxd_status_invalid_value if an invalid value is provided (null variant or it can not be converted to the parameter type or below minimum)

Definition at line 302 of file amxd_action_param_validate.c.

307  {
309  amxc_var_t* data = (amxc_var_t*) priv;
310  const char* name = "check_minimum";
311 
312  when_null_status(param, exit, status = amxd_status_parameter_not_found);
313  when_null_status(data, exit, status = amxd_status_invalid_value);
314 
315  if((amxc_var_type_of(&param->value) == AMXC_VAR_ID_CSTRING) ||
316  (amxc_var_type_of(&param->value) == AMXC_VAR_ID_CSV_STRING) ||
317  (amxc_var_type_of(&param->value) == AMXC_VAR_ID_SSV_STRING)) {
318  name = "check_minimum_length";
319  }
320  status = amxd_action_describe_action(reason, retval, name, priv);
321  when_true(status == amxd_status_ok, exit);
322 
323  status = amxd_action_param_validate(object, param, reason, args, retval, priv);
324  when_failed(status, exit);
325 
326  when_true_status(is_key_in_template(object, param), exit, status = amxd_status_ok);
327 
328  status = amxd_param_check_minimum(param, data, args);
329  when_failed(status, exit);
330 
331 exit:
332  return status;
333 }
static amxd_status_t amxd_param_check_minimum(amxd_param_t *param, amxc_var_t *data, const amxc_var_t *value)

◆ amxd_action_param_check_range()

amxd_status_t amxd_action_param_check_range ( amxd_object_t object,
amxd_param_t param,
amxd_action_t  reason,
const amxc_var_t *const  args,
amxc_var_t *const  retval,
void *  priv 
)

Default check range parameter validate action implementation.

This default implementation checks if the new value fits in the defined range.

The range must be defined in a variant which must be either a htable variant or a list variant. The variant pointer must be set as the priv data.

When the variant is a htable variant, the minimum value must be set in the htable using key "min" and the maximum value must be set in the htable using key "max".

When the variant is a list variant, the first value must be the minimum value and the second value must be maximum value.

It is allowed to use local parameter references as minimum or maximum values. A local parameter reference is a full path to a parameter in the local data model. When local parameter references are used, the value of the referenced parameter is used as minimum or maximum.

The minimum and maximum are included in the range.

If the parameter, for which the new value must be validated, is of the type string (or ssv string or csv string), the length of the new value (as a string) must be in the range defined.

Parameters
objectThe data model object that contains the parameter on which the action is invoked.
paramThe parameter on which the action is invoked
reasonThe action reason. This should be action_param_validate or action_any If the reason is any other action, status amxd_status_function_not_implemented must be returned.
argsThe value that must be validated
retvalNot used in the parameter validate action
privA pointer to a variant, containing the minimum and maximum value
Returns
  • amxd_status_ok if the new value is valid.
  • amxd_status_function_not_implemented if called for the wrong reason
  • amxd_status_invalid_value if an invalid value is provided (null variant or it can not be converted to the parameter type or out of range)

Definition at line 262 of file amxd_action_param_validate.c.

267  {
269  amxc_var_t* data = (amxc_var_t*) priv;
270  amxc_var_t* min_var = NULL;
271  amxc_var_t* max_var = NULL;
272 
273  if(amxc_var_type_of(data) == AMXC_VAR_ID_HTABLE) {
274  min_var = amxc_var_get_key(data, "min", AMXC_VAR_FLAG_DEFAULT);
275  max_var = amxc_var_get_key(data, "max", AMXC_VAR_FLAG_DEFAULT);
276  } else if(amxc_var_type_of(data) == AMXC_VAR_ID_LIST) {
277  min_var = amxc_var_get_path(data, "0", AMXC_VAR_FLAG_DEFAULT);
278  max_var = amxc_var_get_path(data, "1", AMXC_VAR_FLAG_DEFAULT);
279  } else {
281  goto exit;
282  }
283 
284  status = amxd_action_describe_action(reason, retval, "check_range", priv);
285  when_true(status == amxd_status_ok, exit);
286 
287  status = amxd_action_param_validate(object, param, reason, args, retval, priv);
288  when_failed(status, exit);
289 
290  when_true_status(is_key_in_template(object, param), exit, status = amxd_status_ok);
291 
292  status = amxd_param_check_minimum(param, min_var, args);
293  when_failed(status, exit);
294 
295  status = amxd_param_check_maximum(param, max_var, args);
296  when_failed(status, exit);
297 
298 exit:
299  return status;
300 }

◆ amxd_action_param_describe()

amxd_status_t amxd_action_param_describe ( amxd_object_t object,
amxd_param_t param,
amxd_action_t  reason,
const amxc_var_t *const  args,
amxc_var_t *const  retval,
void *  priv 
)

Default parameter describe action implementation.

This action is mainly invoked for introspection purposes. It will create an htable variant, containing all the parameter attributes, user flags, parameter name, parameter type id and parameter type name.

In most cases, unless no-param-value is set in the arguments, the parameter value is available as well.

For this action the args must be NULL or a htable variant and may contain the following parameters in the htable:

  • no-param-value - boolean

When no-param-value is set to true, the parameter value is not provided in the returned htable variant.

The resulting htable variant will be set in the retval. The retval htable will contain:

  • the parameter attributes (attributes) as a htable variant, in which each attribute is represented as a boolean value, where the key is the name of the attribute, and the value is a boolean, set to true if the attribute is set for the parameter.
  • the parameter user flags ('flags') as a list variant, in which each user flag is represented as a string variant.
  • the name of the parameter (name) as a string variant
  • the parameter type id (type_id) as an integer
  • the parameter type name (type_name) as a string
  • the parameter value (value), a variant with the same type as the parameter definition

Example of a retval:

{
attributes = {
counter = false,
instance = false,
key = false,
mutable = false,
persistent = false
private = false,
protected = false,
read-only = false,
template = false,
unique = false,
volatile = false,
},
flags = [
],
name = "Configured",
type_id = 12
type_name = "bool",
value = true,
}
static int counter
Parameters
objectThe data model object that contains the parameter on which the action is invoked.
paramThe parameter on which the action is invoked
reasonThe action reason. This should be action_param_describe or action_any If the reason is any other action, status amxd_status_function_not_implemented must be returned.
argsNULL or a variant that is a htable variant
retvalThe parameter describe result, which is a htable variant.
privNot used in the parameter describe action
Returns
  • amxd_status_ok if successful.
  • amxd_status_function_not_implemented if called for the wrong reason

◆ amxd_action_param_destroy()

amxd_status_t amxd_action_param_destroy ( amxd_object_t object,
amxd_param_t param,
amxd_action_t  reason,
const amxc_var_t *const  args,
amxc_var_t *const  retval,
void *  priv 
)

Default parameter destroy action implementation.

This action is invoked when the parameter is removed from the data model. This action should never fail, it should either return amxd_status_ok or amxd_status_function_not_implemented if called for the wrong reason.

The parameter pointer becomes invalid when returning from this action implementation, as it will be deleted from memory and removed from the data model.

When adding private data to the parameter pointer, this action provides you with the possiblity to do some clean-up (like deleting the private data).

The default implementation is doing nothing.

Parameters
objectThe data model object that contains the parameter on which the action is invoked.
paramThe parameter on which the action is invoked
reasonThe action reason. This should be action_param_destroy or action_any If the reason is any other action, status amxd_status_function_not_implemented must be returned.
argsNot used in the parameter destroy action
retvalNot used in the parameter destroy action
privNot used in the parameter destroy action
Returns
  • amxd_status_ok if successful.
  • amxd_status_function_not_implemented if called for the wrong reason

◆ amxd_action_param_read()

amxd_status_t amxd_action_param_read ( amxd_object_t object,
amxd_param_t param,
amxd_action_t  reason,
const amxc_var_t *const  args,
amxc_var_t *const  retval,
void *  priv 
)

Default parameter read action implementation.

Fetches the value of a parameter in the data model. The value must be set in the retval variant and must be of the same type as the parameter.

Parameters
objectThe data model object that contains the parameter on which the action is invoked.
paramThe parameter on which the action is invoked
reasonThe action reason. This should be action_param_read or action_any If the reason is any other action, status amxd_status_function_not_implemented must be returned.
argsNot used in the parameter read action
retvalA variant that must be filled with the current value of the parameter
privAn opaque pointer (user data), that is added when the action callback was set. This pointer can be NULL.
Returns
  • amxd_status_ok if successful.
  • amxd_status_function_not_implemented if called for the wrong reason
  • amxd_status_unknown_error if an error occured

◆ amxd_action_param_read_hidden_value()

amxd_status_t amxd_action_param_read_hidden_value ( amxd_object_t object,
amxd_param_t param,
amxd_action_t  reason,
const amxc_var_t *const  args,
amxc_var_t *const  retval,
void *  priv 
)

Default parameter read action implementation for hidden values.

This parameter read action implementation will always return an empty string as the parameters value, unless the access is protected or private.

This parameter read action can be used for TR181 parameters where the value never can be read (for public access).

Examples of such parameters in TR181:

  • Device.WiFi.AccessPoint.{i}.Security.WEPKey
  • Device.WiFi.AccessPoint.{i}.Security.PreSharedKey
  • Device.WiFi.AccessPoint.{i}.WPS.PIN
  • Device.PPP.Interface.{i}.Password
Parameters
objectThe data model object that contains the parameter on which the action is invoked.
paramThe parameter on which the action is invoked
reasonThe action reason. This should be action_param_read or action_any If the reason is any other action, status amxd_status_function_not_implemented must be returned.
argsNot used in the parameter read action
retvalA variant that must be filled with the current value of the parameter
privAn opaque pointer (user data), that is added when the action callback was set. This pointer can be NULL.
Returns
  • amxd_status_ok if successful.
  • amxd_status_function_not_implemented if called for the wrong reason
  • amxd_status_unknown_error if an error occured

Definition at line 87 of file amxd_action_param_read.c.

92  {
95 
96  when_null(param, exit);
97  when_null(retval, exit);
98  when_true_status(reason != action_param_read,
99  exit,
101 
102 
103  access = (amxd_dm_access_t) GET_UINT32(args, "access");
104  if(access > amxd_dm_access_public) {
105  status = amxd_action_param_read(object, param, reason, args, retval, priv);
106  } else {
107  amxc_var_set(cstring_t, retval, "");
109  }
110 
111 exit:
112  return status;
113 }
amxd_status_t amxd_action_param_read(UNUSED amxd_object_t *object, amxd_param_t *param, amxd_action_t reason, UNUSED const amxc_var_t *const args, amxc_var_t *const retval, UNUSED void *priv)
@ action_param_read
Definition: amxd_types.h:112
@ amxd_status_function_not_implemented
Definition: amxd_types.h:83
enum _amxd_dm_access amxd_dm_access_t
Access level.
@ amxd_dm_access_public
Definition: amxd_types.h:136

◆ amxd_action_param_validate()

amxd_status_t amxd_action_param_validate ( amxd_object_t object,
amxd_param_t param,
amxd_action_t  reason,
const amxc_var_t *const  args,
amxc_var_t *const  retval,
void *  priv 
)

Default parameter validate action implementation.

This default implementation will only check if the new value can be converted to the parameter type.

Parameters
objectThe data model object that contains the parameter on which the action is invoked.
paramThe parameter on which the action is invoked
reasonThe action reason. This should be action_param_validate or action_any If the reason is any other action, status amxd_status_function_not_implemented must be returned.
argsThe value that must be validated
retvalNot used in the parameter validate action
privAn opaque pointer (user data), that is added when the action callback was set. This pointer can be NULL.
Returns
  • amxd_status_ok if the new value is valid.
  • amxd_status_function_not_implemented if called for the wrong reason
  • amxd_status_invalid_value if an invalid value is provided (null variant or it can not be converted to the parameter type)

◆ amxd_action_param_write()

amxd_status_t amxd_action_param_write ( amxd_object_t object,
amxd_param_t param,
amxd_action_t  reason,
const amxc_var_t *const  args,
amxc_var_t *const  retval,
void *  priv 
)

Default parameter write action implementation.

Sets the value of a parameter in the data model. The value that must be set is available in the args variant.

This default implementation checks:

  • that the parameter is writable
  • the new value doesn't create duplicates in multi-instance objects (for key parameters or unique parameters in instance objects)
  • the new value can be converted to the type of the parameter

It will also set the read-only parameter if the parameter is an immutable key parameter. So an immutable key parameter can be set once.

Parameters
objectThe data model object that contains the parameter on which the action is invoked.
paramThe parameter on which the action is invoked
reasonThe action reason. This should be action_param_write or action_any If the reason is any other action, status amxd_status_function_not_implemented must be returned.
argsThe value that must be set
retvalNot used in the parameter write action
privAn opaque pointer (user data), that is added when the action callback was set. This pointer can be NULL.
Returns
  • amxd_status_ok if successful.
  • amxd_status_function_not_implemented if called for the wrong reason
  • amxd_status_invalid_value if an invalid value is provided (the new value can not be converted to the parameter type or the new value causes a duplicate instance)
  • amxd_status_invalid_attr if the parameter is not writable