Input Output Element Management APIs for C and C++

Input Output Element Management APIs are used to set the value to, or retrieve the value from, the input output (I/O) element. I/O elements are similar to XML containers; they have a name-value pair. You can nest them arbitrarily within other elements.

This page contains information about the Input Output Element Management APIs for C and C++, including the description and syntax, and the input, input types, input description, and input return values.

 

na_child_add

Prototype

na_elem_t* na_child_add(na_elem_t* elt, na_elem_t* childelt);

Description

Adds the nested child element childelt to the parent element elt.

All nested elements are unordered and are accessed by their name. However, this API adds the child element to the end of the nested element list.

 

Input

Type

Description

elt

na_elem_t*

The pointer to the parent element.

childelt

na_elem_t*

The pointer to the child element that is to be added to the parent element elt.

Return value

[top]

na_child_add_int

Prototype

na_elem_t*  na_child_add_int(na_elem_t * elt, const  char * name, int value);

Description

 

Input

Type

Description

elt

na_elem_t*

The pointer to the parent element.

name

const char *

The name of the child element.

value

int

The value to be assigned to the child element.

Return value

[top]

na_child_add_int64

Prototype

na_elem_t * na_child_add_int64(na_elem_t * e, const char * name, int64_t value);

Description

 

Input

Type

Description

elt

na_elem_t*

The pointer to the parent element.

name

const char *

The name of the child element.

value

int64_t

The 64-bit integer value to be assigned to the child element.

Return value

[top]

na_child_add_uint32

Prototype

na_elem_t* na_child_add_uint32(na_elem_t * e, const char * name, uint32_t value);

Description

Input

Type

Description

elt

na_elem_t*

The pointer to the parent element.

name

const char *

The name of the child element.

value

uint32_t

The 32-bit unsigned integer value to be assigned to the child element.

Return value

[top]

na_child_add_uint64

Prototype

na_elem_t * na_child_add_uint64(na_elem_t * e, const char * name, uint64_t value);

Description

 

Input

Type

Description

elt

na_elem_t*

The pointer to the parent element.

name

const char *

The name of the child element.

value

uint64_t

The 64-bit unsigned integer value to be assigned to the child element.

Return value

[top]

na_child_add_string

Prototype

na_elem_t* na_child_add_string(na_elem_t* elt, const char* name, const char* value);

Description

 

Input

Type

Description

elt

na_elem_t*

The pointer to the parent element.

name

const char *

The name of the child element.

value

char *

The value to be assigned to the child element.

Return value

[top]

na_child_add_string_encrypted

Prototype

na_elem_t* na_child_add_string_encrypted(na_elem_t* elt, const char* name, const char* value, const char* key);

Description

 

Input

Type

Description

elt

na_elem_t *

The pointer to the parent element.

name

const char *

The name of the child element.

value

const char *

The value to be assigned to the child element.

key

const char*

The encryption key.

Return value

[top]

na_elem_set_content

Prototype

int na_elem_set_content(na_elem_t* elt, const char* value);

Description

Sets or modifies the value of the given element.

The value to be set can only be of string type. If a non-string value is required to be set, then it should be converted to string first and then passed to this API.

 

Input

Type

Description

elt

na_elem_t  *

The pointer to the element.

name

const char *

The value of the element that is to be set.

Return value

[top]

na_child_get_bool

Prototype

bool_t na_child_get_bool(na_elem_t * elt, const char * name, bool_t deflt);

Description

Gets the boolean value of the given child element, which is nested under the element elt.

 

Input

Type

Description

elt

na_elem_t *

The pointer to the parent element.

name

const char *

The name of the child element.

deflt

bool_t

The default boolean value.

Return value

[top]

na_child_get_int

Prototype

int na_child_get_int(na_elem_t *, const char *, int);

Description

Gets the integer value of the given child element, which is nested under the element elt.

 

Input

Type

Description

elt

na_elem_t *

The pointer to the parent element.

name

const char *

The name of the child element.

deflt

int

The default integer value.

Return value

[top]

na_child_get_int64

Prototype

int64_t na_child_get_int64(na_elem_t * e, const char * name, int64_t deflt);

Description

Gets the 64-bit integer value of the given child element, which is nested under the element elt.

 

Input

Type

Description

elt

na_elem_t *

The pointer to the parent element.

name

const char *

The name of the child element.

deflt

int64_t

The default 64-bit integer value.

Return value

[top]

na_child_get_uint32

Prototype

uint32_t na_child_get_uint32(na_elem_t * e, const char * name, uint32_t deflt);

Description

Gets the 32-bit unsigned integer value of the given child element, which is nested under element elt.

Input

Type

Description

elt

na_elem_t *

The pointer to the parent element.

name

const char *

The name of the child element.

deflt

int64_t

The default 32-bit integer value.

Return value

[top]

na_child_get_uint64

uint64_t na_child_get_uint64(na_elem_t * e, const char * name, uint64_t deflt);

Description

Gets the 64-bit unsigned integer value of the given child element, which is nested under the element elt.

 

Input

Type

Description

elt

na_elem_t *

The pointer to the parent element.

name

const char *

The name of the child element.

deflt

uint64_t

The default 64-bit unsigned integer value.

Return value

[top]

na_child_get_string

Prototype

const char* na_child_get_string(na_elem_t* elt, const char* name);

Description

Gets the string value of the given child element, which is nested under the element elt.

 

Input

Type

Description

elt

na_elem_t *

The pointer to the parent element.

name

const char *

The name of the child element.

Return value

[top]

na_child_get_string_encrypted

Prototype

char* na_child_get_string_encrypted(na_elem_t* elt, const char* name, const char* key);

Description

Gets the decrypted string value of the given child element, which is nested under element elt.

The string is decrypted using the given key. The default key is used if the given key is NULL. The system allocates memory for the decrypted data. You must explicitly free it with na_free() after the API call is over.

 

Input

Type

Description

elt

na_elem_t *

The pointer to the parent element.

name

const char *

The name of the child element.

key

const char *

The decrypt key.

Return value

[top]

na_elem_child

Prototype

na_elem_t*  na_elem_child(na_elem_t* elt, const char* eltname);

Description

Gets the child element address, which is nested under the element elt.

 

Input

Type

Description

elt

na_elem_t *

The pointer to the parent element.

eltname

const char *

The name of the child element.

Return value

[top]

na_elem_get_content

Prototype

const char* na_elem_get_content(na_elem_t * elt);

Description

Gets the content of the element elt.

 

Input

Type

Description

elt

na_elem_t  *

The pointer to the element.

Return value

[top]

na_elem_get_name

Prototype

const char* na_elem_get_name(na_elem_t * e);

Description

Gets the name of the element.

 

Input

Type

Description

elt

na_elem_t  *

The pointer to the element.

Return value

[top]

na_elem_has_children

Prototype

int na_elem_has_children(na_elem_t* elt);

Description

Checks whether the element has any nested elements within it.

 

Input

Type

Description

elt

na_elem_t  *

The pointer to the element.

Return value

[top]

na_encrypt_basic

Prototype

void na_encrypt_basic(const char *key, const char* input, char * output, int nbytes);

Description

 

Assumptions:

Input

Type

Description

key

const char *

The encryption key.

input

const char *

The string to be encrypted.

output

char *

The string that is encrypted.

nBytes

int

The number of bytes of the input string.

Return value

None

[top]

na_child_iterator

Prototype

na_elem_iter_t  na_child_iterator(na_elem_t* elt);

Description

Sets an iterator for traversing the child elements of elt.

You call na_iterator_next() on this iterator to walk through the nested element list.

 

Input

Type

Description

elt

na_elem_t *

The pointer to the element.

Return value

The element iterator for looping through the children of an element

[top]

na_iterator_next

Prototype

na_elem_t*  na_iterator_next(na_elem_iter_t* tag);

Description

Repeatedly iterates through all the children of elt for a given tag returned by the na_child_iterator(elt).

 

Input

Type

Description

tag

na_elem_iter_t*

The pointer to the iterator.

Return value

The next item from an iterator

[top]

na_zapi_get_elem_from_raw_xmlinput

Prototype

na_elem_t* na_zapi_get_elem_from_raw_xmlinput(char * val);

Description

Retrieves the API element from a raw XML input.

 

Input

Type

Description

val

char *

The pointer to the raw XML input.

Return value

The pointer to the API element for a given raw XML

[top]

na_elem_sprintf

Prototype

char*  na_elem_sprintf(na_elem_t* elt);

Description

You should free the returned buffer using na_free().

 

Input

Type

Description

elt

na_elem_t *

The pointer to the input output element.

Return value: