yumapro  20.10-12
YumaPro SDK
agt_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
3  * Copyright (c) 2012 - 2021, YumaWorks, Inc., All Rights Reserved.
4  *
5  * Unless required by applicable law or agreed to in writing,
6  * software distributed under the License is distributed on an
7  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8  * KIND, either express or implied. See the License for the
9  * specific language governing permissions and limitations
10  * under the License.
11  */
12 #ifndef _H_agt_conf
13 #define _H_agt_conf
14 
15 /* FILE: agt_conf.h
16 *********************************************************************
17 * *
18 * P U R P O S E *
19 * *
20 *********************************************************************/
21 
28 /*********************************************************************
29 * *
30 * C H A N G E H I S T O R Y *
31 * *
32 *********************************************************************
33 
34 date init comment
35 ----------------------------------------------------------------------
36 06-oct-17 abb Begun; split from agt_cli.h
37 
38 */
39 
40 #include <stdio.h>
41 #include <xmlstring.h>
42 
43 #ifndef _H_val
44 #include "val.h"
45 #endif
46 
47 #ifndef _H_status_enum
48 #include "status_enum.h"
49 #endif
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 /* group defined in agt_cli.h */
56 
57 
70 /********************************************************************
71 * *
72 * T Y P E S *
73 * *
74 *********************************************************************/
75 
76 
86 typedef status_t (*agt_conf_write_fn_t)(FILE *conf_file, void *cookie);
87 
88 
89 /********************************************************************
90 * *
91 * F U N C T I O N S *
92 * *
93 *********************************************************************/
94 
95 
113 extern status_t
114  agt_conf_load_files (const xmlChar *conf_filespec,
115  val_value_t *valset,
116  const xmlChar *conf_dirspec,
117  boolean *skip_def_confdir);
118 
119 
129 extern status_t
130  agt_conf_create_file (const xmlChar *confname,
131  const xmlChar *revision,
132  agt_conf_write_fn_t conf_write_fn,
133  void *cookie);
134 
135 
143 extern status_t
144  agt_conf_delete_file (const xmlChar *confname,
145  const xmlChar *revision);
146 
154 extern status_t
155  agt_conf_test_write_file (const xmlChar *confname,
156  const xmlChar *revision);
157 
158 
162 #ifdef __cplusplus
163 } /* end extern 'C' */
164 #endif
165 
166 #endif /* _H_agt_conf */
xml_strlen
uint32 xml_strlen(const xmlChar *str)
Get the String len for xmlChar.
Definition: xml_util.c:1406
agt_conf.h
NETCONF Server Configuration File Handling.
ncx_file_remove
status_t ncx_file_remove(const xmlChar *filespec, boolean do_warn)
Close a file; check result.
Definition: ncx.c:13262
xml_strdup
xmlChar * xml_strdup(const xmlChar *copyFrom)
String duplicate for xmlChar.
Definition: xml_util.c:1553
val_find_child
val_value_t * val_find_child(const val_value_t *parent, const xmlChar *modname, const xmlChar *childname)
Find the first instance of the specified child node.
Definition: val.c:8560
val.h
Value Node Basic Support.
status_enum.h
global error status code enumerations
log_debug3
void void void void void void void void void void void log_debug3(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG3 log entry.
agt_conf_create_file
status_t agt_conf_create_file(const xmlChar *confname, const xmlChar *revision, agt_conf_write_fn_t conf_write_fn, void *cookie)
Create a module or bundle config in the confdir.
Definition: agt_conf.c:301
ncx_clean_mbackptrQ
void ncx_clean_mbackptrQ(dlq_hdr_t *backptrQ)
Clean an entire Q of ncx_backptr_t structs Use ncx_free_mbackptr to free node pointers.
Definition: ncx.c:11492
ncx_next_backptr
ncx_backptr_t * ncx_next_backptr(ncx_backptr_t *curptr)
Get next back pointer struct.
Definition: ncx.c:11545
ncxconst.h
Contains NCX constants.
ncxmod.h
NCX Module Load Manager.
dlq_insertAhead
void dlq_insertAhead(void *newP, void *nodeP)
insert the new queue entry before the current entry
Definition: dlq.c:447
log_info
void void void void void log_info(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_INFO log entry.
log_debug2
void void void void void void void void void log_debug2(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG2 log entry.
errno_to_status
status_t errno_to_status(void)
Get the errno variable and convert it to a status_t.
Definition: status.c:968
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
log_debug4
void void void void void void void void void void void void void log_debug4(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG4 log entry.
conf_parse_val_from_filespec
status_t conf_parse_val_from_filespec(const xmlChar *filespec, val_value_t *val, boolean keepvals, boolean fileerr)
Parse a file as an NCX text config file against a specific parmset definition.
Definition: conf.c:1267
LOGDEBUG2
#define LOGDEBUG2
Check if at least log-level=debug2.
Definition: log.h:292
dlq_createSQue
void dlq_createSQue(dlq_hdrT *queAddr)
create a static queue header
Definition: dlq.c:177
val_util.h
Value Node Utilities.
NCX_PATHSEP_CH
#define NCX_PATHSEP_CH
filespec identifier field separator token
Definition: ncxconst.h:404
ERR_NCX_WRONG_LEN
@ ERR_NCX_WRONG_LEN
222
Definition: status_enum.h:261
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
get_error_string
const char * get_error_string(status_t res)
Get the error message for a specific internal error.
Definition: status.c:239
LOGINFO
#define LOGINFO
Check if at least log-level=info.
Definition: log.h:279
conf.h
NCX Text Config file parser.
agt_conf_load_files
status_t agt_conf_load_files(const xmlChar *conf_filespec, val_value_t *valset, const xmlChar *conf_dirspec, boolean *skip_def_confdir)
Default main loaded first: /etc/yumapro/netconfd-pro.conf.
Definition: agt_conf.c:203
ERR_NCX_NOT_FOUND
@ ERR_NCX_NOT_FOUND
225
Definition: status_enum.h:264
agt_conf_delete_file
status_t agt_conf_delete_file(const xmlChar *confname, const xmlChar *revision)
Delete a module or bundle config in the confdir.
Definition: agt_conf.c:378
ncx_first_backptr
ncx_backptr_t * ncx_first_backptr(dlq_hdr_t *que)
Get first back pointer struct.
Definition: ncx.c:11513
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
val_set_by_default
boolean val_set_by_default(const val_value_t *val)
Check if the value was set by val_add_defaults.
Definition: val.c:12571
LOGDEBUG4
#define LOGDEBUG4
Check if at least log-level=debug4.
Definition: log.h:302
agt_cli.h
NETCONF Server Command Line Interface handler.
ncxmod_get_conf_files
status_t ncxmod_get_conf_files(const xmlChar *confdir, boolean must_exist, ncxmod_conf_cbfn_t cbfn, void *cookie)
Get all the available conf files found in the specified config directory if it exist; Invoke the call...
Definition: ncxmod.c:8890
ncx_free_mbackptr
void ncx_free_mbackptr(ncx_backptr_t *ptr)
Free an ncx_backptr_t struct; Free the 'node' pointer first.
Definition: ncx.c:11451
xml_strcpy
uint32 xml_strcpy(xmlChar *copyTo, const xmlChar *copyFrom)
String copy for xmlChar.
Definition: xml_util.c:1486
agt_get_profile
agt_profile_t * agt_get_profile(void)
Get the server profile struct.
Definition: agt.c:4118
ncx_get_backptr_node
void * ncx_get_backptr_node(ncx_backptr_t *backptr)
Get the back pointer node pointer.
Definition: ncx.c:11577
ncx_get_source
xmlChar * ncx_get_source(const xmlChar *fspec, status_t *res)
Expand a filespec into an absolute path.
Definition: ncx.c:8362
ncx.h
YANG module utility functions.
agt_conf_test_write_file
status_t agt_conf_test_write_file(const xmlChar *confname, const xmlChar *revision)
Test Append a conf dir.
Definition: agt_conf.c:431
ncx_file_close
void ncx_file_close(FILE *fp)
Close a file; check result.
Definition: ncx.c:13235
agt_conf_write_fn_t
status_t(* agt_conf_write_fn_t)(FILE *conf_file, void *cookie)
conf file writer function callback
Definition: agt_conf.h:86
dlq_enque
void dlq_enque(REG void *newP, REG dlq_hdrT *listP)
add a queue node to the end of a queue list Add newP to listP
Definition: dlq.c:246
VAL_STR
#define VAL_STR(V)
Access the value as a string ONLY if typ_is_string() is true.
Definition: val.h:464
status.h
Global error messages for status code enumerations.
ncx_new_backptr
ncx_backptr_t * ncx_new_backptr(void *node)
Malloc and initialize a new ncx_backptr_t struct.
Definition: ncx.c:11412
LOGDEBUG3
#define LOGDEBUG3
Check if at least log-level=debug3.
Definition: log.h:297