all clixon event functions prepended with clixon_
Replaced fcgi getparam code with clixon-data parameters
This commit is contained in:
parent
a455b15f03
commit
14b03f63a3
34 changed files with 567 additions and 877 deletions
|
|
@ -2,7 +2,9 @@
|
|||
*
|
||||
***** BEGIN LICENSE BLOCK *****
|
||||
|
||||
Copyright (C) 2009-2019 Olof Hagsand and Benny Holmgren
|
||||
Copyright (C) 2009-2016 Olof Hagsand and Benny Holmgren
|
||||
Copyright (C) 2017-2019 Olof Hagsand
|
||||
Copyright (C) 2020 Olof Hagsand and Rubicon Communications, LLC(Netgate)
|
||||
|
||||
This file is part of CLIXON.
|
||||
|
||||
|
|
@ -35,6 +37,7 @@
|
|||
* Access functions for clixon data.
|
||||
* Free-typed values for runtime getting and setting.
|
||||
* Accessed with clicon_data(h).
|
||||
* @see clixon_option.[ch] for clixon options
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "clixon_config.h" /* generated by config & autoconf */
|
||||
|
|
@ -75,8 +78,66 @@
|
|||
#include "clixon_xpath.h"
|
||||
#include "clixon_data.h"
|
||||
|
||||
/*! Get YANG specification for application specs
|
||||
* Must use hash functions directly since they are not strings.
|
||||
/*! Get generic clixon data on the form <name>=<val> where <val> is string
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] name Data name
|
||||
* @param[out] val Data value as string
|
||||
* @retval 0 OK
|
||||
* @retval -1 Not found
|
||||
* @see clicon_option_str
|
||||
*/
|
||||
int
|
||||
clicon_data_get(clicon_handle h,
|
||||
char *name,
|
||||
char **val)
|
||||
{
|
||||
clicon_hash_t *cdat = clicon_data(h);
|
||||
|
||||
if (val == NULL){
|
||||
clicon_err(OE_CFG, EINVAL, "%s val is NULL", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
if (clicon_hash_lookup(cdat, (char*)name) == NULL)
|
||||
return -1;
|
||||
*val = clicon_hash_value(cdat, (char*)name, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*! Set generic clixon data on the form <name>=<val> where <val> is string
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] name Data name
|
||||
* @param[in] val Data value as null-terminated string
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* @see clicon_option_str_set
|
||||
*/
|
||||
int
|
||||
clicon_data_set(clicon_handle h,
|
||||
char *name,
|
||||
char *val)
|
||||
{
|
||||
clicon_hash_t *cdat = clicon_data(h);
|
||||
|
||||
return clicon_hash_add(cdat, (char*)name, val, strlen(val)+1)==NULL?-1:0;
|
||||
}
|
||||
|
||||
/*! Delete generic clixon data
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] name Data name
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* @see clicon_option_del
|
||||
*/
|
||||
int
|
||||
clicon_data_del(clicon_handle h,
|
||||
char *name)
|
||||
{
|
||||
clicon_hash_t *cdat = clicon_data(h);
|
||||
|
||||
return clicon_hash_del(cdat, (char*)name);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @param[in] h Clicon handle
|
||||
* @retval yspec Yang spec
|
||||
* @see clicon_config_yang for the configuration yang
|
||||
|
|
@ -655,3 +716,4 @@ clicon_session_id_set(clicon_handle h,
|
|||
clicon_hash_add(cdat, "session-id", &id, sizeof(uint32_t));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue