libamxd
6.4.1
Data Model Manager
|
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... | |
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.
object | The data model object that contains the parameter on which the action is invoked. |
param | The parameter on which the action is invoked |
reason | The 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. |
args | The value that must be validated |
retval | Not used in the parameter validate action |
priv | A pointer to a variant, containing the a variant list of allowed values |
Definition at line 369 of file amxd_action_param_validate.c.
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.
object | The data model object that contains the parameter on which the action is invoked. |
param | The parameter on which the action is invoked |
reason | The 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. |
args | The value that must be validated |
retval | Not used in the parameter validate action |
priv | A pointer to a string variant, containing the path to a parameter that contains the list of possible values (as a csv or ssv string) |
Definition at line 404 of file amxd_action_param_validate.c.
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.
object | The data model object that contains the parameter on which the action is invoked. |
param | The parameter on which the action is invoked |
reason | The 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. |
args | The value that must be validated |
retval | Not used in the parameter validate action |
priv | A pointer to a variant, containing the maximum value |
Definition at line 335 of file amxd_action_param_validate.c.
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.
object | The data model object that contains the parameter on which the action is invoked. |
param | The parameter on which the action is invoked |
reason | The 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. |
args | The value that must be validated |
retval | Not used in the parameter validate action |
priv | A pointer to a variant, containing the minimum value |
Definition at line 302 of file amxd_action_param_validate.c.
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.
object | The data model object that contains the parameter on which the action is invoked. |
param | The parameter on which the action is invoked |
reason | The 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. |
args | The value that must be validated |
retval | Not used in the parameter validate action |
priv | A pointer to a variant, containing the minimum and maximum value |
Definition at line 262 of file amxd_action_param_validate.c.
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:
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:
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.name
) as a string varianttype_id
) as an integertype_name
) as a stringvalue
), a variant with the same type as the parameter definitionExample of a retval:
object | The data model object that contains the parameter on which the action is invoked. |
param | The parameter on which the action is invoked |
reason | The 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. |
args | NULL or a variant that is a htable variant |
retval | The parameter describe result, which is a htable variant. |
priv | Not used in the parameter describe action |
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.
object | The data model object that contains the parameter on which the action is invoked. |
param | The parameter on which the action is invoked |
reason | The 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. |
args | Not used in the parameter destroy action |
retval | Not used in the parameter destroy action |
priv | Not used in the parameter destroy action |
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.
object | The data model object that contains the parameter on which the action is invoked. |
param | The parameter on which the action is invoked |
reason | The 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. |
args | Not used in the parameter read action |
retval | A variant that must be filled with the current value of the parameter |
priv | An opaque pointer (user data), that is added when the action callback was set. This pointer can be NULL. |
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:
object | The data model object that contains the parameter on which the action is invoked. |
param | The parameter on which the action is invoked |
reason | The 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. |
args | Not used in the parameter read action |
retval | A variant that must be filled with the current value of the parameter |
priv | An opaque pointer (user data), that is added when the action callback was set. This pointer can be NULL. |
Definition at line 87 of file amxd_action_param_read.c.
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.
object | The data model object that contains the parameter on which the action is invoked. |
param | The parameter on which the action is invoked |
reason | The 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. |
args | The value that must be validated |
retval | Not used in the parameter validate action |
priv | An opaque pointer (user data), that is added when the action callback was set. This pointer can be NULL. |
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:
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.
object | The data model object that contains the parameter on which the action is invoked. |
param | The parameter on which the action is invoked |
reason | The 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. |
args | The value that must be set |
retval | Not used in the parameter write action |
priv | An opaque pointer (user data), that is added when the action callback was set. This pointer can be NULL. |