libamxs  0.6.0
Data Model Synchronization C API
Object synchronization API
Collaboration diagram for Object synchronization API:

Modules

 Object synchronization API
 
 Parameter synchronization API
 
 synchronization API types
 
 synchronization API Utility functions
 

Functions

amxs_status_t amxs_sync_ctx_new (amxs_sync_ctx_t **ctx, const char *object_a, const char *object_b, int attributes)
 Synchronization context constructor function. More...
 
void amxs_sync_ctx_delete (amxs_sync_ctx_t **ctx)
 Synchronization context destructor function. More...
 
amxs_status_t amxs_sync_ctx_init (amxs_sync_ctx_t *ctx, const char *object_a, const char *object_b, int attributes)
 Synchronization context initialization function. More...
 
void amxs_sync_ctx_clean (amxs_sync_ctx_t *ctx)
 Synchronization context cleanup function. More...
 
amxs_status_t amxs_sync_ctx_copy (amxs_sync_ctx_t **dest, amxs_sync_ctx_t *src, void *priv)
 Copies an existing synchronization context to a new synchronization context. More...
 
amxs_status_t amxs_sync_ctx_start_sync (amxs_sync_ctx_t *ctx)
 Starts the object synchronization. More...
 
void amxs_sync_ctx_stop_sync (amxs_sync_ctx_t *ctx)
 Stops the object synchronization. More...
 
static bool amxs_sync_ctx_is_started (const amxs_sync_ctx_t *const ctx)
 Checks is the synchronization context is running. More...
 
amxs_status_t amxs_sync_ctx_set_paths (amxs_sync_ctx_t *const ctx, const char *object_a, const char *object_b)
 Updates the object paths of the synchronization context. More...
 
amxs_status_t amxs_sync_ctx_add_param (amxs_sync_ctx_t *ctx, amxs_sync_param_t *param)
 Adds a synchronization parameter to a synchronization context. More...
 
amxs_status_t amxs_sync_ctx_add_new_param (amxs_sync_ctx_t *ctx, const char *param_a, const char *param_b, int attributes, amxs_translation_cb_t translation_cb, amxs_action_cb_t action_cb, void *priv)
 Creates and adds a synchronization parameter to a synchronization context. More...
 
amxs_status_t amxs_sync_ctx_add_new_copy_param (amxs_sync_ctx_t *ctx, const char *param_a, const char *param_b, int attributes)
 Creates and adds a synchronization parameter to a synchronization context. More...
 
amxs_status_t amxs_sync_ctx_add_object (amxs_sync_ctx_t *ctx, amxs_sync_object_t *object)
 Adds a synchronization object to a synchronization context. More...
 
amxs_status_t amxs_sync_ctx_add_new_object (amxs_sync_ctx_t *ctx, const char *object_a, const char *object_b, int attributes, amxs_translation_cb_t translation_cb, amxs_action_cb_t action_cb, void *priv)
 Creates and adds a synchronization object to a synchronization context. More...
 

Detailed Description

Function Documentation

◆ amxs_sync_ctx_add_new_copy_param()

amxs_status_t amxs_sync_ctx_add_new_copy_param ( amxs_sync_ctx_t ctx,
const char *  param_a,
const char *  param_b,
int  attributes 
)

Creates and adds a synchronization parameter to a synchronization context.

Allocates memory for a new synchronization parameter and initializes this parameter. Then adds it to the synchronization context.

Adding the synchronization parameter fails when:

  • The parameter was already added to the context
  • The parameter attributes are conflicting with those of the context. E.g. The context has the AMXS_SYNC_ONLY_B_TO_A attribute set, and the parameter has AMXS_SYNC_ONLY_A_TO_B set.

If the context attributes are more strict than those of the parameter, the parameter attributes will be updated to match those of the context.

Uses default translation amxs_sync_batch_param_copy_trans_cb and action amxs_sync_param_copy_action_cb callbacks.

Parameters
ctxPointer to a synchronization context.
param_aName of the parameter in object A
param_bName of the parameter in object B
attributesBitwise OR of zero or more of the following attributes:
Returns
  • amxs_status_ok: the new synchronization parameter is added to the synchronization context
  • amxs_status_duplicate: another synchronization parameter with the same direction and parameter names already exists for this synchronization context
  • amxs_status_invalid_attr: the attributes of the synchronization parameter are conflicting with those of the synchronization context
  • amxs_status_unknown_error: any other error

Definition at line 903 of file amxs_sync_ctx.c.

906  {
907  return amxs_sync_ctx_add_new_param(ctx,
908  param_a,
909  param_b,
910  attributes | AMXS_SYNC_PARAM_BATCH,
911  NULL,
912  NULL,
913  NULL);
914 }
#define AMXS_SYNC_PARAM_BATCH
Indicate that this parameter may be part of a batch copy operation.
Definition: amxs_types.h:210
amxs_status_t amxs_sync_ctx_add_new_param(amxs_sync_ctx_t *ctx, const char *param_a, const char *param_b, int attributes, amxs_translation_cb_t translation_cb, amxs_action_cb_t action_cb, void *priv)
Creates and adds a synchronization parameter to a synchronization context.

◆ amxs_sync_ctx_add_new_object()

amxs_status_t amxs_sync_ctx_add_new_object ( amxs_sync_ctx_t ctx,
const char *  object_a,
const char *  object_b,
int  attributes,
amxs_translation_cb_t  translation_cb,
amxs_action_cb_t  action_cb,
void *  priv 
)

Creates and adds a synchronization object to a synchronization context.

Allocates memory for a new synchronization object and initializes this object. Then adds it to the synchronization context.

Adding the synchronization object fails when:

  • The object was already added to the context
  • The object attributes are conflicting with those of the context. E.g. The context has the AMXS_SYNC_ONLY_B_TO_A attribute set, and the object has AMXS_SYNC_ONLY_A_TO_B set.

If the context attributes are more strict than those of the object, the object attributes will be updated to match those of the context.

Parameters
ctxPointer to a synchronization context.
object_aName of the object in object A
object_bName of the object in object B
attributesBitwise OR of zero or more of the following attributes:
translation_cbCallback function to translate data coming from an object event. The output data of this function will be passed to the action callback function if this function executes succesfully. If this argument is NULL, the data from the event will be passed directly to the action callback function.
action_cbCallback function to act on an object event.
privPointer to user data which will be passed to the translation and action callbacks.
Returns
  • amxs_status_ok: the new synchronization object is added to the synchronization context
  • amxs_status_duplicate: another synchronization object with the same direction and object names already exists for this synchronization context
  • amxs_status_invalid_attr: the attributes of the synchronization object are conflicting with those of the synchronization context
  • amxs_status_unknown_error: any other error

Definition at line 929 of file amxs_sync_ctx.c.

935  {
937  amxs_sync_object_t* object = NULL;
938 
939  status = amxs_sync_object_new(&object, object_a, object_b, attributes, translation_cb, action_cb, priv);
940  when_failed(status, exit);
941 
942  status = amxs_sync_ctx_add_object(ctx, object);
943  if(status != amxs_status_ok) {
944  amxs_sync_object_delete(&object);
945  }
946 
947 exit:
948  return status;
949 }
@ amxs_status_ok
Definition: amxs_types.h:86
@ amxs_status_unknown_error
Definition: amxs_types.h:90
enum _amxs_status amxs_status_t
amxs_status_t amxs_sync_object_new(amxs_sync_object_t **object, const char *object_a, const char *object_b, int attributes, amxs_translation_cb_t translation_cb, amxs_action_cb_t action_cb, void *priv)
Synchronization object constructor function.
void amxs_sync_object_delete(amxs_sync_object_t **object)
Synchronization object destructor function.
amxs_status_t amxs_sync_ctx_add_object(amxs_sync_ctx_t *ctx, amxs_sync_object_t *object)
Adds a synchronization object to a synchronization context.
Definition: amxs_types.h:161

◆ amxs_sync_ctx_add_new_param()

amxs_status_t amxs_sync_ctx_add_new_param ( amxs_sync_ctx_t ctx,
const char *  param_a,
const char *  param_b,
int  attributes,
amxs_translation_cb_t  translation_cb,
amxs_action_cb_t  action_cb,
void *  priv 
)

Creates and adds a synchronization parameter to a synchronization context.

Allocates memory for a new synchronization parameter and initializes this parameter. Then adds it to the synchronization context.

Adding the synchronization parameter fails when:

  • The parameter was already added to the context
  • The parameter attributes are conflicting with those of the context. E.g. The context has the AMXS_SYNC_ONLY_B_TO_A attribute set, and the parameter has AMXS_SYNC_ONLY_A_TO_B set.

If the context attributes are more strict than those of the parameter, the parameter attributes will be updated to match those of the context.

Parameters
ctxPointer to a synchronization context.
param_aName of the parameter in object A
param_bName of the parameter in object B
attributesBitwise OR of zero or more of the following attributes:
translation_cbCallback function to translate data coming from a parameter changed event. The output data of this function will be passed to the action callback function if this function executes succesfully. If this argument is NULL, the data from the event will be passed directly to the action callback function.
action_cbCallback function to act on a parameter changed event.
privPointer to user data which will be passed to the translation and action callbacks.
Returns
  • amxs_status_ok: the new synchronization parameter is added to the synchronization context
  • amxs_status_duplicate: another synchronization parameter with the same direction and parameter names already exists for this synchronization context
  • amxs_status_invalid_attr: the attributes of the synchronization parameter are conflicting with those of the synchronization context
  • amxs_status_unknown_error: any other error

Definition at line 881 of file amxs_sync_ctx.c.

887  {
889  amxs_sync_param_t* param = NULL;
890 
891  status = amxs_sync_param_new(&param, param_a, param_b, attributes, translation_cb, action_cb, priv);
892  when_failed(status, exit);
893 
894  status = amxs_sync_ctx_add_param(ctx, param);
895  if(status != amxs_status_ok) {
896  amxs_sync_param_delete(&param);
897  }
898 
899 exit:
900  return status;
901 }
void amxs_sync_param_delete(amxs_sync_param_t **param)
Synchronization parameter destructor function.
amxs_status_t amxs_sync_param_new(amxs_sync_param_t **param, const char *param_a, const char *param_b, int attributes, amxs_translation_cb_t translation_cb, amxs_action_cb_t action_cb, void *priv)
Synchronization parameter constructor function.
amxs_status_t amxs_sync_ctx_add_param(amxs_sync_ctx_t *ctx, amxs_sync_param_t *param)
Adds a synchronization parameter to a synchronization context.

◆ amxs_sync_ctx_add_object()

amxs_status_t amxs_sync_ctx_add_object ( amxs_sync_ctx_t ctx,
amxs_sync_object_t object 
)

Adds a synchronization object to a synchronization context.

The synchronization object can be be created using amxs_sync_object_new.

Adding the synchronization object fails when:

  • The object was already added to the context
  • The object attributes are conflicting with those of the context. E.g. The context has the AMXS_SYNC_ONLY_B_TO_A attribute set, and the object has AMXS_SYNC_ONLY_A_TO_B set.

If the context attributes are more strict than those of the object, the object attributes will be updated to match those of the context.

Parameters
ctxPointer to a synchronization context.
objectPointer to a synchronization object.
Returns
  • amxs_status_ok: the synchronization object is added to the synchronization context
  • amxs_status_duplicate: another synchronization object with the same direction and object names already exists for this synchronization context
  • amxs_status_invalid_attr: the attributes of the synchronization object are conflicting with those of the synchronization context
  • amxs_status_unknown_error: any other error

Definition at line 916 of file amxs_sync_ctx.c.

916  {
918  when_null(ctx, exit);
919  when_null(object, exit);
920  when_false_status(ctx->type == amxs_sync_type_ctx, exit, status = amxs_status_invalid_type);
921  when_false_status(object->type == amxs_sync_type_object, exit, status = amxs_status_invalid_type);
922 
923  status = amxs_sync_entry_add_entry(ctx, object);
924 
925 exit:
926  return status;
927 }
amxs_status_t amxs_sync_entry_add_entry(amxs_sync_entry_t *parent, amxs_sync_entry_t *child)
@ amxs_status_invalid_type
Definition: amxs_types.h:92
@ amxs_sync_type_object
Definition: amxs_types.h:101
@ amxs_sync_type_ctx
Definition: amxs_types.h:100
amxs_sync_entry_type_t type
Definition: amxs_types.h:170

◆ amxs_sync_ctx_add_param()

amxs_status_t amxs_sync_ctx_add_param ( amxs_sync_ctx_t ctx,
amxs_sync_param_t param 
)

Adds a synchronization parameter to a synchronization context.

The synchronization parameter can be be created using amxs_sync_param_new.

Adding the synchronization parameter fails when:

  • The parameter was already added to the context
  • The parameter attributes are conflicting with those of the context. E.g. The context has the AMXS_SYNC_ONLY_B_TO_A attribute set, and the parameter has AMXS_SYNC_ONLY_A_TO_B set.

If the context attributes are more strict than those of the parameter, the parameter attributes will be updated to match those of the context.

Parameters
ctxPointer to a synchronization context.
paramPointer to a synchronization parameter.
Returns
  • amxs_status_ok: the synchronization parameter is added to the synchronization context
  • amxs_status_duplicate: another synchronization parameter with the same direction and parameter names already exists for this synchronization context
  • amxs_status_invalid_attr: the attributes of the synchronization parameter are conflicting with those of the synchronization context
  • amxs_status_unknown_error: any other error

Definition at line 868 of file amxs_sync_ctx.c.

868  {
870  when_null(ctx, exit);
871  when_null(param, exit);
872  when_false_status(ctx->type == amxs_sync_type_ctx, exit, status = amxs_status_invalid_type);
873  when_false_status(param->type == amxs_sync_type_param, exit, status = amxs_status_invalid_type);
874 
875  status = amxs_sync_entry_add_entry(ctx, param);
876 
877 exit:
878  return status;
879 }
@ amxs_sync_type_param
Definition: amxs_types.h:102

◆ amxs_sync_ctx_clean()

void amxs_sync_ctx_clean ( amxs_sync_ctx_t ctx)

Synchronization context cleanup function.

Frees any memory that was allocated to store data in this synchronization context.

If the synchronization context has any synchronization objects or parameters attached to it, these will be removed and freed.

Parameters
ctxPointer to a synchronization context.

Definition at line 752 of file amxs_sync_ctx.c.

752  {
753  when_null(ctx, exit);
754  when_false(ctx->type == amxs_sync_type_ctx, exit);
755 
757 
758 exit:
759  return;
760 }
void amxs_sync_entry_clean(amxs_sync_entry_t *entry)

◆ amxs_sync_ctx_copy()

amxs_status_t amxs_sync_ctx_copy ( amxs_sync_ctx_t **  dest,
amxs_sync_ctx_t src,
void *  priv 
)

Copies an existing synchronization context to a new synchronization context.

When the copy is successful the synchronization object paths must be updated using amxs_sync_ctx_set_paths before starting the synchronization context

Parameters
destPointer to a synchronization context pointer, will contain the copy.
srcThe synchronization context that will be copied.
privPrivate data.
Returns
amxs_status_ok when the synchronization context is created, or another status code when failed to create the synchronization context.

Definition at line 762 of file amxs_sync_ctx.c.

762  {
763  return amxs_sync_entry_copy(dest, src, priv);
764 }
amxs_status_t amxs_sync_entry_copy(amxs_sync_entry_t **dest, amxs_sync_entry_t *src, void *priv)

◆ amxs_sync_ctx_delete()

void amxs_sync_ctx_delete ( amxs_sync_ctx_t **  ctx)

Synchronization context destructor function.

Frees all memory allocated for a synchronization context.

If the synchronization context has any synchronization objects or parameters attached to it, these will be removed and freed as well.

Parameters
ctxPointer to a synchronization context pointer.

Definition at line 727 of file amxs_sync_ctx.c.

727  {
728  when_null(ctx, exit);
729  when_null(*ctx, exit);
730  when_false((*ctx)->type == amxs_sync_type_ctx, exit);
731 
733 
734 exit:
735  return;
736 }
void amxs_sync_entry_delete(amxs_sync_entry_t **entry)

◆ amxs_sync_ctx_init()

amxs_status_t amxs_sync_ctx_init ( amxs_sync_ctx_t ctx,
const char *  object_a,
const char *  object_b,
int  attributes 
)

Synchronization context initialization function.

Initializes a synchronization context that was allocated on the stack.

Allocates memory for a new synchronization context and initializes this context.

Use amxs_sync_ctx_clean to make sure that all allocated memory to store the data is freed.

Please note that the attributes that are set on the synchronization context will always override those that are set on syncronization objects or parameters. E.g. when setting the AMXS_SYNC_ONLY_B_TO_A attribute on the context, and setting AMXS_SYNC_DEFAULT on a parameter, the syncronyzation will only be executed from object B to object A.

Parameters
ctxPointer to a synchronization context.
object_aPath to the first object to be synchronized, hereafter referenced as object A.
object_bPath to the second object to be synchronized, hereafter referenced as object B.
attributesBitwise OR of zero or more of the following attributes:
Returns
amxs_status_ok when the synchronization context is initialized, or another status code when failed to initialize the synchronization context.

Definition at line 738 of file amxs_sync_ctx.c.

741  {
742  return amxs_sync_entry_init(ctx,
743  object_a,
744  object_b,
745  attributes,
746  NULL,
747  NULL,
749  NULL);
750 }
amxs_status_t amxs_sync_entry_init(amxs_sync_entry_t *entry, const char *a, const char *b, int attributes, amxs_translation_cb_t translation_cb, amxs_action_cb_t action_cb, amxs_sync_entry_type_t type, void *priv)

◆ amxs_sync_ctx_is_started()

static bool amxs_sync_ctx_is_started ( const amxs_sync_ctx_t *const  ctx)
inlinestatic

Checks is the synchronization context is running.

Checks if the synchronization context was already startued

Parameters
ctxPointer to a synchronization context.
Returns
  • true: when started
  • false: when not started yet.

Definition at line 231 of file amxs_sync_ctx.h.

231  {
232  return ctx == NULL? false:!amxc_llist_is_empty(&ctx->subscriptions);
233 }
amxc_llist_t subscriptions
Definition: amxs_types.h:173

◆ amxs_sync_ctx_new()

amxs_status_t amxs_sync_ctx_new ( amxs_sync_ctx_t **  ctx,
const char *  object_a,
const char *  object_b,
int  attributes 
)

Synchronization context constructor function.

Allocates memory for a new synchronization context and initializes the context.

Use amxs_sync_ctx_delete to remove the synchronizaion context and free all allocated memory.

The object paths that can be used in a synchronization context must be an absolute path to:

  • singleton objects
  • instance objects

Search paths (key addressing) can be used but must resolve to exatly one object. Key paths can be used as well, but are not recomended.

Creating a synchronization context using template objects paths (ending with a multi-instance object) are not allowed, in this case creation will fail.

Parameters
ctxPointer to a synchronization context pointer. The address of the new allocated synchronization context is stored in this pointer.
object_aPath to the first object to be synchronized, hereafter referenced as object A.
object_bPath to the second object to be synchronized, hereafter referenced as object B.
attributesBitwise OR of zero or more of the following attributes:
Returns
amxs_status_ok when the synchronization context is created, or another status code when failed to create the synchronization context.

Definition at line 713 of file amxs_sync_ctx.c.

716  {
717  return amxs_sync_entry_new(ctx,
718  object_a,
719  object_b,
720  attributes,
721  NULL,
722  NULL,
724  NULL);
725 }
amxs_status_t amxs_sync_entry_new(amxs_sync_entry_t **entry, const char *a, const char *b, int attributes, amxs_translation_cb_t translation_cb, amxs_action_cb_t action_cb, amxs_sync_entry_type_t type, void *priv)

◆ amxs_sync_ctx_set_paths()

amxs_status_t amxs_sync_ctx_set_paths ( amxs_sync_ctx_t *const  ctx,
const char *  object_a,
const char *  object_b 
)

Updates the object paths of the synchronization context.

When a copy is made of a synchronization context using amxs_sync_ctx_copy, the object paths of the new synchronization context can be set using this function.

The new set object paths must match the original object paths at supported data model level.

Parameters
ctxPointer to a synchronization context.
object_aThe new path to object a.
object_bThe new path to object b.
Returns
  • amxs_status_ok: the new paths are set.
  • amxs_status_invalid_arg: an invalid path has been provided.
  • amxs_status_object_not_found: object A or object B was not found.
  • amxs_status_unknown_error: any other error

Definition at line 828 of file amxs_sync_ctx.c.

830  {
832  char* supported_a = NULL;
833  char* supported_b = NULL;
834 
835  when_null(ctx, exit);
836  when_str_empty_status(object_a, exit, status = amxs_status_invalid_arg);
837  when_str_empty_status(object_b, exit, status = amxs_status_invalid_arg);
838 
839  supported_a = ctx->a;
840  supported_b = ctx->b;
841 
842  ctx->a = strdup(object_a);
843  ctx->b = strdup(object_b);
844 
845  if(ctx->bus_ctx_a == NULL) {
846  ctx->bus_ctx_a = amxb_be_who_has(ctx->a);
847  }
848  if(ctx->bus_ctx_b == NULL) {
849  ctx->bus_ctx_b = amxb_be_who_has(ctx->b);
850  }
851 
852  when_failed_status(amxs_sync_ctx_validate_path(ctx, amxs_sync_a_to_b), exit,
854  when_failed_status(amxs_sync_ctx_validate_path(ctx, amxs_sync_b_to_a), exit,
856 
857  when_false_status(amxs_sync_ctx_paths_match(ctx->a, supported_a), exit, status = amxs_status_invalid_arg);
858  when_false_status(amxs_sync_ctx_paths_match(ctx->b, supported_b), exit, status = amxs_status_invalid_arg);
859 
860  status = amxs_status_ok;
861 
862 exit:
863  free(supported_a);
864  free(supported_b);
865  return status;
866 }
static amxs_status_t amxs_sync_ctx_validate_path(amxs_sync_ctx_t *ctx, amxs_sync_direction_t direction)
static bool amxs_sync_ctx_paths_match(const char *new_path, const char *old_path)
@ amxs_status_object_not_found
Definition: amxs_types.h:93
@ amxs_status_invalid_arg
Definition: amxs_types.h:89
@ amxs_sync_a_to_b
Definition: amxs_types.h:80
@ amxs_sync_b_to_a
Definition: amxs_types.h:81
char * a
Definition: amxs_types.h:163
amxb_bus_ctx_t * bus_ctx_a
Definition: amxs_types.h:171
char * b
Definition: amxs_types.h:164
amxb_bus_ctx_t * bus_ctx_b
Definition: amxs_types.h:172

◆ amxs_sync_ctx_start_sync()

amxs_status_t amxs_sync_ctx_start_sync ( amxs_sync_ctx_t ctx)

Starts the object synchronization.

Starts the synchronization by looking up the initial values and then subscribing for changes on the configured objects and parameters. Synchronization will fail if no objects or parameters are attached to the context.

Parameters
ctxPointer to a synchronization context.
Returns
amxs_status_ok when the synchronization is started succesfully, or another status code when failed to start the synchronization.

Definition at line 766 of file amxs_sync_ctx.c.

766  {
768  when_null(ctx, exit);
769 
770  when_false_status(ctx->type == amxs_sync_type_ctx, exit, status = amxs_status_invalid_type);
771  when_true_status(amxc_llist_is_empty(&ctx->entries), exit, status = amxs_status_empty_context);
772 
773  if(ctx->bus_ctx_a == NULL) {
774  ctx->bus_ctx_a = amxb_be_who_has(ctx->a);
775  }
776  if(ctx->bus_ctx_b == NULL) {
777  ctx->bus_ctx_b = amxb_be_who_has(ctx->b);
778  }
779 
780  if((ctx->attributes & AMXS_SYNC_ONLY_B_TO_A) == 0) {
781  when_null_status(ctx->bus_ctx_a, exit, status = amxs_status_object_not_found);
782  when_failed_status(amxs_sync_ctx_validate_path(ctx, amxs_sync_a_to_b), exit,
784  when_failed_status(amxs_sync_ctx_verify_local_dm(ctx, amxs_sync_b_to_a), exit,
786  }
787 
788  if((ctx->attributes & AMXS_SYNC_ONLY_A_TO_B) == 0) {
789  when_null_status(ctx->bus_ctx_b, exit, status = amxs_status_object_not_found);
790  when_failed_status(amxs_sync_ctx_validate_path(ctx, amxs_sync_b_to_a), exit,
792  when_failed_status(amxs_sync_ctx_verify_local_dm(ctx, amxs_sync_a_to_b), exit,
794  }
795 
796  if((ctx->attributes & AMXS_SYNC_ONLY_B_TO_A) == 0) {
797  status = amxs_subscribe(ctx, ctx, amxs_sync_a_to_b);
798  when_failed(status, cleanup_subs);
799  }
800 
801  if((ctx->attributes & AMXS_SYNC_ONLY_A_TO_B) == 0) {
802  status = amxs_subscribe(ctx, ctx, amxs_sync_b_to_a);
803  when_failed(status, cleanup_subs);
804  }
805 
806  status = amxs_do_initial_sync(ctx);
807  when_failed(status, cleanup_subs);
808 
809 cleanup_subs:
810  if(status != amxs_status_ok) {
811  amxc_llist_clean(&ctx->subscriptions, amxs_llist_it_delete_subscription);
812  }
813 
814 exit:
815  return status;
816 }
void amxs_llist_it_delete_subscription(amxc_llist_it_t *it)
Definition: amxs_common.c:140
static amxs_status_t amxs_sync_ctx_verify_local_dm(amxs_sync_ctx_t *ctx, amxs_sync_direction_t direction)
static amxs_status_t amxs_subscribe(amxs_sync_ctx_t *ctx, amxs_sync_entry_t *entry, amxs_sync_direction_t direction)
static amxs_status_t amxs_do_initial_sync(amxs_sync_ctx_t *ctx)
@ amxs_status_empty_context
Definition: amxs_types.h:91
#define AMXS_SYNC_ONLY_B_TO_A
Only synchronize from object B to object A.
Definition: amxs_types.h:195
#define AMXS_SYNC_ONLY_A_TO_B
Only synchronize from object A to object B.
Definition: amxs_types.h:200
int attributes
Definition: amxs_types.h:165
amxc_llist_t entries
Definition: amxs_types.h:169

◆ amxs_sync_ctx_stop_sync()

void amxs_sync_ctx_stop_sync ( amxs_sync_ctx_t ctx)

Stops the object synchronization.

Stops the synchronization by unsubscribing for changes on the configured objects and parameters.

Parameters
ctxPointer to a synchronization context.

Definition at line 818 of file amxs_sync_ctx.c.

818  {
819  when_null(ctx, exit);
820  when_false(ctx->type == amxs_sync_type_ctx, exit);
821 
822  amxc_llist_clean(&ctx->subscriptions, amxs_llist_it_delete_subscription);
823 
824 exit:
825  return;
826 }