nodeupdown_nodelist_create

Langue: en

Autres versions - même langue

Version: August 2003 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

NAME

nodeupdown_nodelist_create, nodeupdown_nodelist_clear, nodeupdown_nodelist_destroy - create, clear, and destroy lists

SYNOPSIS

#include <nodeupdown.h>

int nodeupdown_nodelist_create(nodeupdown_t handle, char ***list);

int nodeupdown_nodelist_clear(nodeupdown_t handle, char **list);

int nodeupdown_nodelist_destroy(nodeupdown_t handle, char **list);

DESCRIPTION

nodeupdown_nodelist_create(), nodeupdown_nodelist_clear(), and nodeupdown_nodelist_destroy() are used to create, clear, and destroy lists (arrays of strings) for use with nodeupdown_get_up_nodes_list(3) and nodeupdown_get_down_nodes_list(3).

nodeupdown_nodelist_create() creates a list with minimum size to store nodes. list is set to point to the created list. The created list is guaranteed to store all the nodes returned from nodeupdown_get_up_nodes_list(3) and nodeupdown_get_down_nodes_list(3).

nodeupdown_nodelist_clear() clears any information stored in the list pointed to by list. This does not have be called after nodeupdown_nodelist_create(). It only has to be called after being used with nodeupdown_get_up_nodes_list(3) or nodeupdown_get_down_nodes_list(3) and the programmer wishes to re-use the list.

nodeupdown_nodelist_destroy() destroys the list pointed to by list and frees all memory assocated with the list.

RETURN VALUES

On success, nodeupdown_nodelist_create() returns the number of elements the created list can store. On success, nodeupdown_nodelist_clear(), and nodeupdown_nodelist_destroy() return 0. On error, -1 is returned, and an error code is returned in handle. The error code can be retrieved via nodeupdown_errnum(3) , and a description of the error code can be retrieved via nodeupdown_strerror(3). Error codes are defined in nodeupdown.h.

ERRORS

NODEUPDOWN_ERR_NULLHANDLE
The handle parameter is NULL. The nodeupdown handle must be created with nodeupdown_handle_create(3).
NODEUPDOWN_ERR_NOTLOADED
nodeupdown_load_data(3) has not been called and no data has been retrieved.
NODEUPDOWN_ERR_PARAMETERS
An incorrect parameter has been passed in.
NODEUPDOWN_ERR_NULLPTR
A null pointer has been found in the list passed in.
NODEUPDOWN_ERR_OUTMEM
malloc(3) has failed internally.
NODEUPDOWN_ERR_ISFREE
All lists associated with handle have already been freed.
NODEUPDOWN_ERR_MAGIC
handle has an incorrect magic number. handle does not point to a nodeupdown handle or handle has been destroyed by nodeupdown_handle_destroy(3).

FILES

/usr/include/nodeupdown.h

SEE ALSO

libnodeupdown(3), nodeupdown_handle_create(3), nodeupdown_load_data(3), nodeupdown_get_up_nodes_list (3), nodeupdown_get_down_nodes_list (3), nodeupdown_errnum(3), nodeupdown_strerror(3)