le_cfgAdmin API Reference

Files

file  le_cfgAdmin_common.h
 
file  le_cfgAdmin_interface.h
 

Typedefs

typedef struct le_cfgAdmin_Iterator * le_cfgAdmin_IteratorRef_t
 
typedef void(* le_cfgAdmin_DisconnectHandler_t) (void *)
 

Functions

void le_cfgAdmin_ConnectService (void)
 
le_result_t le_cfgAdmin_TryConnectService (void)
 
LE_FULL_API void le_cfgAdmin_SetServerDisconnectHandler (le_cfgAdmin_DisconnectHandler_t disconnectHandler, void *contextPtr)
 
void le_cfgAdmin_DisconnectService (void)
 
le_result_t le_cfgAdmin_ImportTree (le_cfg_IteratorRef_t iteratorRef, const char *LE_NONNULL filePath, const char *LE_NONNULL nodePath)
 
le_result_t le_cfgAdmin_ExportTree (le_cfg_IteratorRef_t iteratorRef, const char *LE_NONNULL filePath, const char *LE_NONNULL nodePath)
 
void le_cfgAdmin_DeleteTree (const char *LE_NONNULL treeName)
 
le_cfgAdmin_IteratorRef_t le_cfgAdmin_CreateTreeIterator (void)
 
void le_cfgAdmin_ReleaseTreeIterator (le_cfgAdmin_IteratorRef_t iteratorRef)
 
le_result_t le_cfgAdmin_GetTreeName (le_cfgAdmin_IteratorRef_t iteratorRef, char *name, size_t nameSize)
 
le_result_t le_cfgAdmin_NextTree (le_cfgAdmin_IteratorRef_t iteratorRef)
 

Detailed Description

Typedef Documentation

◆ le_cfgAdmin_DisconnectHandler_t

typedef void(* le_cfgAdmin_DisconnectHandler_t) (void *)

Type for handler called when a server disconnects.

◆ le_cfgAdmin_IteratorRef_t

typedef struct le_cfgAdmin_Iterator* le_cfgAdmin_IteratorRef_t

Reference to an iterator object that can be used to iterate over the list of trees.

Function Documentation

◆ le_cfgAdmin_ConnectService()

void le_cfgAdmin_ConnectService ( void  )

Connect the current client thread to the service providing this API. Block until the service is available.

For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client Specific Functions.

This function is created automatically.

◆ le_cfgAdmin_CreateTreeIterator()

le_cfgAdmin_IteratorRef_t le_cfgAdmin_CreateTreeIterator ( void  )

Create a new iterator object for iterating over the list of trees currently managed by the config tree daemon.

◆ le_cfgAdmin_DeleteTree()

void le_cfgAdmin_DeleteTree ( const char *LE_NONNULL  treeName)

Delete a tree from the system, both from the filesystem and from memory.

Parameters
[in]treeNameName of the tree to delete.

◆ le_cfgAdmin_DisconnectService()

void le_cfgAdmin_DisconnectService ( void  )

Disconnect the current client thread from the service providing this API.

Normally, this function doesn't need to be called. After this function is called, there's no longer a connection to the service, and the functions in this API can't be used. For details, see Client Specific Functions.

This function is created automatically.

◆ le_cfgAdmin_ExportTree()

le_result_t le_cfgAdmin_ExportTree ( le_cfg_IteratorRef_t  iteratorRef,
const char *LE_NONNULL  filePath,
const char *LE_NONNULL  nodePath 
)

Take a node given from nodePath and stream it and it's children to the file given by filePath.

This funciton uses the iterator's read transaction, and takes a snapshot of the current state of the tree. The data write happens immediately.

Returns
This function will return one of the following values:
    - LE_OK     - The commit was completed successfuly.
    - LE_FAULT  - An I/O error occured while writing the data.
Parameters
[in]iteratorRefWrite iterator that is being used for the export.
[in]filePathImport the tree data from the this file.
[in]nodePathWhere in the tree should this export happen? Leave as an empty string to use the iterator's current node.

◆ le_cfgAdmin_GetTreeName()

le_result_t le_cfgAdmin_GetTreeName ( le_cfgAdmin_IteratorRef_t  iteratorRef,
char *  name,
size_t  nameSize 
)

Read the name of the tree currently pointed at by the iterator.

Returns
LE_OK if there is enough room to copy the name into the supplied buffer. LE_OVERFLOW if not. LE_NOT_FOUND is returned if the list is empty or if the iterator hasn't been moved onto the first item yet.
Parameters
[in]iteratorRefIterator object to read.
[out]nameName of the currently referenced tree is passed in this out parameter.
[in]nameSize

◆ le_cfgAdmin_ImportTree()

le_result_t le_cfgAdmin_ImportTree ( le_cfg_IteratorRef_t  iteratorRef,
const char *LE_NONNULL  filePath,
const char *LE_NONNULL  nodePath 
)

Reference to an iterator object that can be used to iterate over the list of trees. Read a subset of the configuration tree from the given filePath. The tree then overwrites the node at the given nodePath.

This function will import a sub-tree as part of the iterator's current transaction. This allows you to create an iterator on a given node. Import a sub-tree, and then examine the contents of the import before deciding to commit the new data.

Returns
This function will return one of the following values:
    - LE_OK            - The commit was completed successfuly.
    - LE_FAULT         - An I/O error occured while reading the data.
    - LE_FORMAT_ERROR  - The configuration data being imported appears corrupted.
Parameters
[in]iteratorRefWrite iterator that is being used for the import.
[in]filePathImport the tree data from the this file.
[in]nodePathWhere in the tree should this import happen? Leave as an empty string to use the iterator's current node.

◆ le_cfgAdmin_NextTree()

le_result_t le_cfgAdmin_NextTree ( le_cfgAdmin_IteratorRef_t  iteratorRef)

Move onto the next tree in the list. If there are no more trees this function returns false, otherwise true is returned.

Returns
LE_OK if there are more trees to iterate through. LE_NOT_FOUND if not.
Parameters
[in]iteratorRefIterator to iterate.

◆ le_cfgAdmin_ReleaseTreeIterator()

void le_cfgAdmin_ReleaseTreeIterator ( le_cfgAdmin_IteratorRef_t  iteratorRef)

Release the iterator and free it's memory back to the system.

Parameters
[in]iteratorRefIterator object to release.

◆ le_cfgAdmin_SetServerDisconnectHandler()

LE_FULL_API void le_cfgAdmin_SetServerDisconnectHandler ( le_cfgAdmin_DisconnectHandler_t  disconnectHandler,
void *  contextPtr 
)

Set handler called when server disconnection is detected.

When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants to continue without exiting, it should call longjmp() from inside the handler.

◆ le_cfgAdmin_TryConnectService()

le_result_t le_cfgAdmin_TryConnectService ( void  )

Try to connect the current client thread to the service providing this API. Return with an error if the service is not available.

For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client Specific Functions.

This function is created automatically.

Returns
  • LE_OK if the client connected successfully to the service.
  • LE_UNAVAILABLE if the server is not currently offering the service to which the client is bound.
  • LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
  • LE_COMM_ERROR if the Service Directory cannot be reached.