yumapro  20.10-12
YumaPro SDK
agt_templates.h
Go to the documentation of this file.
1 #ifdef WITH_TEMPLATES
2 #ifndef _H_agt_templates
3 #define _H_agt_templates
4 /*
5  * Copyright (c) 2017 - 2021, YumaWorks, Inc., All Rights Reserved.
6  *
7  * Unless required by applicable law or agreed to in writing,
8  * software distributed under the License is distributed on an
9  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
10  * KIND, either express or implied. See the License for the
11  * specific language governing permissions and limitations
12  * under the License.
13  */
14 
15 #include <xmlstring.h>
16 
17 #include "obj.h"
18 #include "val.h"
19 #include "ses.h"
20 #include "status_enum.h"
21 #include "rpc.h"
22 #include "xml_util.h"
23 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 
52 extern status_t
53  agt_templates_init (void);
54 
55 
61 extern void agt_templates_cleanup (void);
62 
63 
73 extern status_t
74  agt_templates_set (const xmlChar *name,
75  const xmlChar *targstr,
76  obj_template_t *targobj,
77  val_value_t *targval);
78 
79 
85 extern void
86  agt_templates_clear (const xmlChar *name);
87 
88 
103 extern status_t
104  agt_templates_validate_parm (ses_cb_t *scb,
105  rpc_msg_t *msg,
106  xml_node_t *methnode);
107 
108 
120 extern status_t
121  agt_templates_apply_parm (rpc_msg_t *msg,
122  val_value_t *newval);
123 
124 
128 #ifdef __cplusplus
129 } /* end extern 'C' */
130 #endif
131 
132 #endif // _H_agt_templates
133 #endif // WITH_TEMPLATES
ses.h
NETCONF Session Common definitions module.
ncx_feature.h
NCX Module Library YANG Feature Utility Functions.
agt_util.h
Utility Functions for NCX Server method routines.
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.
xml_util.h
XML Utilities.
obj_next_key
obj_key_t * obj_next_key(obj_key_t *objkey)
Get the next key record.
Definition: obj.c:9559
agt_rpc.h
NETCONF protocol remote procedure call server-side definitions.
status_enum.h
global error status code enumerations
NCX_LAYER_OPERATION
@ NCX_LAYER_OPERATION
protocol operation layer
Definition: ncxtypes.h:346
obj_first_key
obj_key_t * obj_first_key(obj_template_t *obj)
Get the first key record.
Definition: obj.c:9472
agt_action.h
NETCONF Server YANG action handler.
val_compare
int32 val_compare(const val_value_t *val1, const val_value_t *val2)
Compare 2 val_value_t struct value contents.
Definition: val.c:9456
val_apply_template
status_t val_apply_template(val_value_t *template_val, val_value_t *target_val)
Apply the specified template to the val_value_t node.
Definition: val_util.c:7507
ERR_NCX_DUP_ENTRY
@ ERR_NCX_DUP_ENTRY
224
Definition: status_enum.h:263
ncxmod.h
NCX Module Load Manager.
agt_cb.h
NETCONF Server Data Model callback handler.
obj_is_list
boolean obj_is_list(const obj_template_t *obj)
Check if object is a YANG list.
Definition: obj.c:13349
dlq_insertAhead
void dlq_insertAhead(void *newP, void *nodeP)
insert the new queue entry before the current entry
Definition: dlq.c:447
agt_record_error
void agt_record_error(ses_cb_t *scb, xml_msg_hdr_t *msghdr, ncx_layer_t layer, status_t res, const xml_node_t *xmlnode, ncx_node_t parmtyp, const void *error_info, ncx_node_t nodetyp, void *error_path)
Generate an rpc_err_rec_t and save it in the msg.
Definition: agt_util.c:1942
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.
agt_templates_init
status_t agt_templates_init(void)
initialize the yumaworks-templates
Definition: agt_templates.c:293
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
ERR_NCX_TEMPLATE_NOT_FOUND
@ ERR_NCX_TEMPLATE_NOT_FOUND
417
Definition: status_enum.h:460
obj_get_name
const xmlChar * obj_get_name(const obj_template_t *obj)
Get the name field for this obj.
Definition: obj.c:10511
agt_templates_clear
void agt_templates_clear(const xmlChar *name)
Clear a config template if found.
Definition: agt_templates.c:368
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
dlq_remove
void dlq_remove(void *nodeP)
remove the queue entry from its queue list entry MUST have been enqueued somehow before this function...
Definition: dlq.c:519
val_util.h
Value Node Utilities.
val_index_match
boolean val_index_match(const val_value_t *val1, const val_value_t *val2)
Check 2 val_value structs for the same instance ID.
Definition: val.c:9032
agt_sil_lib.h
Server Instrumentation Library Support.
rpc.h
NETCONF protocol remote procedure call common definitions.
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
val_child.h
Value Node Child Access Support.
ERR_INTERNAL_INIT_SEQ
@ ERR_INTERNAL_INIT_SEQ
007
Definition: status_enum.h:197
agt_templates_validate_parm
status_t agt_templates_validate_parm(ses_cb_t *scb, rpc_msg_t *msg, xml_node_t *methnode)
Check for with-template parameter.
Definition: agt_templates.c:394
dlq_nextEntry
#define dlq_nextEntry(nodeP)
get the next queue entry after the current entry
Definition: dlq.h:265
agt.h
Multi-Protocol Network Management Server.
agt_templates_cleanup
void agt_templates_cleanup(void)
Cleanup the yumaworks-templates.
Definition: agt_templates.c:312
agt_templates_apply_parm
status_t agt_templates_apply_parm(rpc_msg_t *msg, val_value_t *newval)
Apply a template to a subtree.
Definition: agt_templates.c:461
obj_get_mod_name
const xmlChar * obj_get_mod_name(const obj_template_t *obj)
Get the module name for this object.
Definition: obj.c:12176
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
val_get_next_child
val_value_t * val_get_next_child(const val_value_t *curchild)
Get the next child node.
Definition: val.c:8496
ncxtypes.h
YANG module data structures Many internal representations of YANG module constructs.
VAL_SET_FROM_TEMPLATE
#define VAL_SET_FROM_TEMPLATE(V)
flag the value as set from a template
Definition: val.h:642
agt_templates.h
YANG Configuration Templates (yumaworks-templates.yang)
NCX_NT_VAL
@ NCX_NT_VAL
val_value_t
Definition: ncxtypes.h:276
agt_cfg.h
Manage Server configuration edit transactions.
dlq_deque
void * dlq_deque(dlq_hdrT *listP)
remove the first queue node from the queue list
Definition: dlq.c:286
val_get_first_child
val_value_t * val_get_first_child(const val_value_t *parent)
Get the first child node.
Definition: val.c:8477
dlq_empty
#define dlq_empty(listP)
check if queue list is empty
Definition: dlq.h:367
dlq_firstEntry
#define dlq_firstEntry(listP)
get the first entry in the queue list
Definition: dlq.h:337
VAL_OBJ
#define VAL_OBJ(V)
Access the object template.
Definition: val.h:381
ncx.h
YANG module utility functions.
obj.h
Data Object Support.
obj_key_count
uint32 obj_key_count(const obj_template_t *obj)
Get the number of keys for this object.
Definition: obj.c:9637
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_child_next_same
val_value_t * val_child_next_same(val_value_t *curnode)
Get the next node of the same type.
Definition: val_child.c:2359
VAL_STR
#define VAL_STR(V)
Access the value as a string ONLY if typ_is_string() is true.
Definition: val.h:464
agt_timer.h
Handle timer services for the server.
SET_ERROR
#define SET_ERROR(E)
macro SET_ERROR
Definition: status_enum.h:103
val_free_value
void val_free_value(val_value_t *val)
Scrub the memory in a val_value_t by freeing all the sub-fields and then freeing the entire struct it...
Definition: val.c:2842
status.h
Global error messages for status code enumerations.
agt_templates_set
status_t agt_templates_set(const xmlChar *name, const xmlChar *targstr, obj_template_t *targobj, val_value_t *targval)
Set a config template (new or replace)
Definition: agt_templates.c:330
dlq.h
dlq provides general double-linked list and queue support: