Restructured error,debug anf log API
Renamed functions clicon->clixon, replaced global variables w access functions Unified clicon_netconf_error with clixon_err()
This commit is contained in:
parent
261469be16
commit
24a4991ec8
199 changed files with 4668 additions and 4158 deletions
|
|
@ -58,20 +58,20 @@
|
|||
/* cligen */
|
||||
#include <cligen/cligen.h>
|
||||
|
||||
/* clicon */
|
||||
/* clixon */
|
||||
#include <clixon/clixon.h>
|
||||
|
||||
#include "restconf_lib.h"
|
||||
#include "restconf_handle.h"
|
||||
|
||||
/* header part is copied from struct clicon_handle in lib/src/clixon_handle.c */
|
||||
/* header part is copied from struct clixon_handle in lib/src/clixon_handle.c */
|
||||
|
||||
#define CLICON_MAGIC 0x99aafabe
|
||||
|
||||
#define handle(h) (assert(clicon_handle_check(h)==0),(struct restconf_handle *)(h))
|
||||
#define handle(h) (assert(clixon_handle_check(h)==0),(struct restconf_handle *)(h))
|
||||
|
||||
/* Clicon_handle for backends.
|
||||
* First part of this is header, same for clicon_handle and cli_handle.
|
||||
/* Clixon_handle for backends.
|
||||
* First part of this is header, same for clixon_handle and cli_handle.
|
||||
* Access functions for common fields are found in clicon lib: clicon_options.[ch]
|
||||
* This file should only contain access functions for the _specific_
|
||||
* entries in the struct below.
|
||||
|
|
@ -80,8 +80,8 @@
|
|||
*
|
||||
* This file should only contain access functions for the _specific_
|
||||
* entries in the struct below.
|
||||
* @note The top part must be equivalent to struct clicon_handle in clixon_handle.c
|
||||
* @see struct clicon_handle, struct cli_handle
|
||||
* @note The top part must be equivalent to struct clixon_handle in clixon_handle.c
|
||||
* @see struct clixon_handle, struct cli_handle
|
||||
*/
|
||||
struct restconf_handle {
|
||||
int rh_magic; /* magic (HDR)*/
|
||||
|
|
@ -100,12 +100,12 @@ struct restconf_handle {
|
|||
|
||||
/*! Creates and returns a clicon config handle for other CLICON API calls
|
||||
*/
|
||||
clicon_handle
|
||||
clixon_handle
|
||||
restconf_handle_init(void)
|
||||
{
|
||||
struct restconf_handle *rh;
|
||||
|
||||
rh = clicon_handle_init0(sizeof(struct restconf_handle));
|
||||
rh = clixon_handle_init0(sizeof(struct restconf_handle));
|
||||
rh->rh_pretty = 1; /* clixon-restconf.yang : pretty is default true*/
|
||||
return rh;
|
||||
}
|
||||
|
|
@ -116,13 +116,13 @@ restconf_handle_init(void)
|
|||
* @see backend_client_rm
|
||||
*/
|
||||
int
|
||||
restconf_handle_exit(clicon_handle h)
|
||||
restconf_handle_exit(clixon_handle h)
|
||||
{
|
||||
struct restconf_handle *rh = handle(h);
|
||||
|
||||
if (rh->rh_fcgi_socket)
|
||||
free(rh->rh_fcgi_socket);
|
||||
clicon_handle_exit(h); /* frees h and options (and streams) */
|
||||
clixon_handle_exit(h); /* frees h and options (and streams) */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ restconf_handle_exit(clicon_handle h)
|
|||
* Currently using clixon runtime data but there is risk for colliding names
|
||||
*/
|
||||
char *
|
||||
restconf_param_get(clicon_handle h,
|
||||
restconf_param_get(clixon_handle h,
|
||||
const char *param)
|
||||
{
|
||||
struct restconf_handle *rh = handle(h);
|
||||
|
|
@ -154,7 +154,7 @@ restconf_param_get(clicon_handle h,
|
|||
* Currently using clixon runtime data but there is risk for colliding names
|
||||
*/
|
||||
int
|
||||
restconf_param_set(clicon_handle h,
|
||||
restconf_param_set(clixon_handle h,
|
||||
const char *param,
|
||||
char *val)
|
||||
{
|
||||
|
|
@ -176,7 +176,7 @@ restconf_param_set(clicon_handle h,
|
|||
* Currently using clixon runtime data but there is risk for colliding names
|
||||
*/
|
||||
int
|
||||
restconf_param_del_all(clicon_handle h)
|
||||
restconf_param_del_all(clixon_handle h)
|
||||
{
|
||||
int retval = -1;
|
||||
struct restconf_handle *rh = handle(h);
|
||||
|
|
@ -197,7 +197,7 @@ restconf_param_del_all(clicon_handle h)
|
|||
* @retval auth_type
|
||||
*/
|
||||
clixon_auth_type_t
|
||||
restconf_auth_type_get(clicon_handle h)
|
||||
restconf_auth_type_get(clixon_handle h)
|
||||
{
|
||||
struct restconf_handle *rh = handle(h);
|
||||
|
||||
|
|
@ -214,7 +214,7 @@ restconf_auth_type_get(clicon_handle h)
|
|||
* Currently using clixon runtime data but there is risk for colliding names
|
||||
*/
|
||||
int
|
||||
restconf_auth_type_set(clicon_handle h,
|
||||
restconf_auth_type_set(clixon_handle h,
|
||||
clixon_auth_type_t type)
|
||||
{
|
||||
struct restconf_handle *rh = handle(h);
|
||||
|
|
@ -229,7 +229,7 @@ restconf_auth_type_set(clicon_handle h,
|
|||
* @retval pretty
|
||||
*/
|
||||
int
|
||||
restconf_pretty_get(clicon_handle h)
|
||||
restconf_pretty_get(clixon_handle h)
|
||||
{
|
||||
struct restconf_handle *rh = handle(h);
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ restconf_pretty_get(clicon_handle h)
|
|||
* @retval -1 Error
|
||||
*/
|
||||
int
|
||||
restconf_pretty_set(clicon_handle h,
|
||||
restconf_pretty_set(clixon_handle h,
|
||||
int pretty)
|
||||
{
|
||||
struct restconf_handle *rh = handle(h);
|
||||
|
|
@ -260,7 +260,7 @@ restconf_pretty_set(clicon_handle h,
|
|||
* @retval 1 No, http-data disabled
|
||||
*/
|
||||
int
|
||||
restconf_http_data_get(clicon_handle h)
|
||||
restconf_http_data_get(clixon_handle h)
|
||||
{
|
||||
struct restconf_handle *rh = handle(h);
|
||||
|
||||
|
|
@ -274,7 +274,7 @@ restconf_http_data_get(clicon_handle h)
|
|||
* @retval -1 Error
|
||||
*/
|
||||
int
|
||||
restconf_http_data_set(clicon_handle h,
|
||||
restconf_http_data_set(clixon_handle h,
|
||||
int http_data)
|
||||
{
|
||||
struct restconf_handle *rh = handle(h);
|
||||
|
|
@ -289,7 +289,7 @@ restconf_http_data_set(clicon_handle h,
|
|||
* @retval socketpath
|
||||
*/
|
||||
char*
|
||||
restconf_fcgi_socket_get(clicon_handle h)
|
||||
restconf_fcgi_socket_get(clixon_handle h)
|
||||
{
|
||||
struct restconf_handle *rh = handle(h);
|
||||
|
||||
|
|
@ -306,13 +306,13 @@ restconf_fcgi_socket_get(clicon_handle h)
|
|||
* Currently using clixon runtime data but there is risk for colliding names
|
||||
*/
|
||||
int
|
||||
restconf_fcgi_socket_set(clicon_handle h,
|
||||
restconf_fcgi_socket_set(clixon_handle h,
|
||||
char *socketpath)
|
||||
{
|
||||
struct restconf_handle *rh = handle(h);
|
||||
|
||||
if ((rh->rh_fcgi_socket = strdup(socketpath)) == NULL){
|
||||
clicon_err(OE_RESTCONF, errno, "strdup");
|
||||
clixon_err(OE_RESTCONF, errno, "strdup");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue