C-style update: Unified comment, retvals in order, remove trailing spaces
Changed function name for `clicon_debug` functions
This commit is contained in:
parent
6e314dd96f
commit
62348fc9c7
204 changed files with 6047 additions and 4904 deletions
|
|
@ -46,7 +46,7 @@
|
|||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
|
||||
#include <cligen/cligen.h>
|
||||
|
||||
/* clicon */
|
||||
|
|
@ -66,6 +66,7 @@
|
|||
#define handle(h) (assert(clicon_handle_check(h)==0),(struct clicon_handle *)(h))
|
||||
|
||||
/*! Internal structure of basic handle. Also header of all other handles.
|
||||
*
|
||||
* @note If you change here, you must also change the structs below:
|
||||
* This is the internal definition of a "Clixon handle" which in its external
|
||||
* form is "clicon_handle" and is used in most Clixon API calls.
|
||||
|
|
@ -96,13 +97,13 @@ struct clicon_handle {
|
|||
/*! Internal call to allocate a CLICON handle.
|
||||
*
|
||||
* @param[in] size Size of handle (internal) struct.
|
||||
* @retval h Clicon handle
|
||||
* @retval h Clixon handle
|
||||
*
|
||||
* There may be different variants of handles with some common options.
|
||||
* So far the only common options is a MAGIC cookie for sanity checks and
|
||||
* CLICON options
|
||||
*/
|
||||
clicon_handle
|
||||
clicon_handle
|
||||
clicon_handle_init0(int size)
|
||||
{
|
||||
struct clicon_handle *ch;
|
||||
|
|
@ -133,21 +134,24 @@ clicon_handle_init0(int size)
|
|||
|
||||
/*! Basic CLICON init functions returning a handle for API access.
|
||||
*
|
||||
* @retval h Clicon handle
|
||||
* @retval h Clixon handle
|
||||
* This is the first call to CLICON basic API which returns a handle to be
|
||||
* used in the API functions. There are other clicon_init functions for more
|
||||
* elaborate applications (cli/backend/netconf). This should be used by the most
|
||||
* basic applications that use CLICON lib directly.
|
||||
*/
|
||||
clicon_handle
|
||||
clicon_handle
|
||||
clicon_handle_init(void)
|
||||
{
|
||||
return clicon_handle_init0(sizeof(struct clicon_handle));
|
||||
}
|
||||
|
||||
/*! Deallocate clicon handle, including freeing handle data.
|
||||
* @param[in] h Clicon handle
|
||||
* @Note: handle 'h' cannot be used in calls after this
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* @note: handle 'h' cannot be used in calls after this
|
||||
*/
|
||||
int
|
||||
clicon_handle_exit(clicon_handle h)
|
||||
|
|
@ -169,7 +173,8 @@ clicon_handle_exit(clicon_handle h)
|
|||
}
|
||||
|
||||
/*! Check struct magic number for sanity checks
|
||||
* @param[in] h Clicon handle
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
* @retval 0 Sanity check OK
|
||||
* @retval -1 Sanity check failed
|
||||
*/
|
||||
|
|
@ -183,7 +188,8 @@ clicon_handle_check(clicon_handle h)
|
|||
}
|
||||
|
||||
/*! Return clicon options (hash-array) given a handle.
|
||||
* @param[in] h Clicon handle
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
*/
|
||||
clicon_hash_t *
|
||||
clicon_options(clicon_handle h)
|
||||
|
|
@ -194,7 +200,8 @@ clicon_options(clicon_handle h)
|
|||
}
|
||||
|
||||
/*! Return clicon data (hash-array) given a handle.
|
||||
* @param[in] h Clicon handle
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
*/
|
||||
clicon_hash_t *
|
||||
clicon_data(clicon_handle h)
|
||||
|
|
@ -205,7 +212,8 @@ clicon_data(clicon_handle h)
|
|||
}
|
||||
|
||||
/*! Return clicon db_elmnt (hash-array) given a handle.
|
||||
* @param[in] h Clicon handle
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
*/
|
||||
clicon_hash_t *
|
||||
clicon_db_elmnt(clicon_handle h)
|
||||
|
|
@ -216,7 +224,8 @@ clicon_db_elmnt(clicon_handle h)
|
|||
}
|
||||
|
||||
/*! Return stream hash-array given a clicon handle.
|
||||
* @param[in] h Clicon handle
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
*/
|
||||
event_stream_t *
|
||||
clicon_stream(clicon_handle h)
|
||||
|
|
@ -241,7 +250,7 @@ clicon_stream_append(clicon_handle h,
|
|||
event_stream_t *es)
|
||||
{
|
||||
struct clicon_handle *ch = handle(h);
|
||||
|
||||
|
||||
ADDQ(es, ch->ch_stream);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue