yumapro  20.10-12
YumaPro SDK
agt_hook_util.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_hook_util
13 #define _H_agt_hook_util
14 
15 /* FILE: agt_hook_util.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 04-jan-16 ma Begun
37 
38 
39 *********************************************************************
40 * *
41 * I N C L U D E F I L E S *
42 * *
43 *********************************************************************/
44 #ifndef _H_status
45 #include "status.h"
46 #endif
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 
94 /********************************************************************
95 * *
96 * T Y P E S *
97 * *
98 *********************************************************************/
99 
101 typedef enum agt_hook_fmt_t_ {
105 } agt_hook_fmt_t;
106 
107 
108 /********************************************************************
109 * *
110 * F U N C T I O N S *
111 * *
112 *********************************************************************/
113 
114 
121 extern boolean
122  agt_hook_type_valid (agt_hook_type_t type);
123 
124 
131 extern boolean
132  agt_hook_fmt_valid (agt_hook_fmt_t format);
133 
134 
141 extern const xmlChar *
142  agt_hook_get_type_name (agt_hook_type_t type);
143 
144 
151 extern agt_hook_type_t
152  agt_hook_get_type_enum (const xmlChar *type);
153 
154 
161 extern const xmlChar *
162  agt_hook_get_format_name (agt_hook_fmt_t format);
163 
164 
171 extern agt_hook_fmt_t
172  agt_hook_get_format_enum (const xmlChar *format);
173 
174 
184 extern status_t
185  agt_hook_obj_ok (obj_template_t *obj,
186  agt_hook_fmt_t format,
187  agt_hook_type_t type,
188  const xmlChar *defpath);
189 
190 
200 extern status_t
201  agt_hook_order_obj_ok (obj_template_t *obj,
202  const xmlChar *defpath);
203 
204 
212 extern status_t
213  agt_hook_post_sethook_obj_ok (obj_template_t *obj,
214  const xmlChar *defpath);
215 
216 
224 extern boolean
225  agt_hooks_callback_set (obj_template_t *obj);
226 
227 
235 extern boolean
236  agt_post_sethook_callback_set (obj_template_t *obj);
237 
238 
246 extern boolean
247  agt_sethook_callback_set (obj_template_t *obj);
248 
249 
257 extern boolean
258  agt_txhook_callback_set (obj_template_t *obj);
259 
260 
268 extern boolean
269  agt_hook_subtree_format (obj_template_t *obj);
270 
271 
272 #ifdef WITH_YCONTROL
273 
281 extern status_t
282  agt_hook_post_sethook_subsys_register (const xmlChar *subsys_id,
283  const xmlChar *defpath);
284 
285 
296 extern status_t
297  agt_hook_hooks_subsys_register (const xmlChar *subsys_id,
298  const xmlChar *defpath,
299  agt_hook_fmt_t format,
300  agt_hook_type_t type);
301 #endif // WITH_YCONTROL
302 
303 
307 #ifdef __cplusplus
308 } /* end extern 'C' */
309 #endif
310 
311 #endif // _H_agt_hook_util
AGT_HOOK_TYPE_SETHOOK
@ AGT_HOOK_TYPE_SETHOOK
Set-Hook.
Definition: agt.h:712
AGT_HOOK_TYPE_NONE
@ AGT_HOOK_TYPE_NONE
not set
Definition: agt.h:711
agt_hook_fmt_valid
boolean agt_hook_fmt_valid(agt_hook_fmt_t format)
Verify that the hook format is valid.
Definition: agt_hook_util.c:188
agt_hook_get_format_enum
agt_hook_fmt_t agt_hook_get_format_enum(const xmlChar *format)
Get agt_hook_fmt_t enumeration structure from specified string.
Definition: agt_hook_util.c:304
OBJ_TYP_LIST
@ OBJ_TYP_LIST
list: last real database object
Definition: obj.h:617
agt_hooks_callback_set
boolean agt_hooks_callback_set(obj_template_t *obj)
Check if an any Hook callback is registered for this object for SIL-SA usage.
Definition: agt_hook_util.c:496
log_error
void log_error(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_ERROR log entry.
xml_util.h
XML Utilities.
ncx_set_sethook_registered
void ncx_set_sethook_registered(boolean val)
Set the sethook_registered value.
Definition: ncx.c:14664
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_CB_SET_REMOTE_PSHOOK
#define AGT_CB_SET_REMOTE_PSHOOK(C)
set remote has a post-set-hook
Definition: agt_cb.h:175
agt_hook_get_type_name
const xmlChar * agt_hook_get_type_name(agt_hook_type_t type)
Get the keyword for the specified agt_hook_type_t enumeration.
Definition: agt_hook_util.c:219
ERR_NCX_DUP_ENTRY
@ ERR_NCX_DUP_ENTRY
224
Definition: status_enum.h:263
AGT_CB_FL_TRANSHOOK_TREE
#define AGT_CB_FL_TRANSHOOK_TREE
transaction hook tree
Definition: agt_cb.h:118
ncxconst.h
Contains NCX constants.
OBJ_TYP_CONTAINER
@ OBJ_TYP_CONTAINER
container
Definition: obj.h:614
AGT_HOOKFMT_NODE
@ AGT_HOOKFMT_NODE
node mode
Definition: agt_hook_util.h:108
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
log_info
void void void void void log_info(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_INFO log entry.
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
xpath.h
Schema and data model Xpath search support.
AGT_CB_SET_REMOTE_SHOOK
#define AGT_CB_SET_REMOTE_SHOOK(C)
set remote has a set-hook
Definition: agt_cb.h:178
AGT_HOOK_TYPE_TRANSACTION
@ AGT_HOOK_TYPE_TRANSACTION
Transaction Hook.
Definition: agt.h:713
agt_post_sethook_callback_set
boolean agt_post_sethook_callback_set(obj_template_t *obj)
Check if an Post Set Hook callback is registered for this object for SIL-SA usage.
Definition: agt_hook_util.c:534
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.
agt_hook_post_sethook_subsys_register
status_t agt_hook_post_sethook_subsys_register(const xmlChar *subsys_id, const xmlChar *defpath)
Register an object specific SIL-SA Post Set Hook callback function.
Definition: agt_hook_util.c:686
obj_get_name
const xmlChar * obj_get_name(const obj_template_t *obj)
Get the name field for this obj.
Definition: obj.c:10511
dlq_createSQue
void dlq_createSQue(dlq_hdrT *queAddr)
create a static queue header
Definition: dlq.c:177
agt_hook_obj_ok
status_t agt_hook_obj_ok(obj_template_t *obj, agt_hook_fmt_t format, agt_hook_type_t type, const xmlChar *defpath)
Check if format of the callback is acceptable for the object.
Definition: agt_hook_util.c:333
OBJ_TYP_ANYDATA
@ OBJ_TYP_ANYDATA
anydata: YANG 1.1 only
Definition: obj.h:626
ERR_NCX_INVALID_VALUE
@ ERR_NCX_INVALID_VALUE
258
Definition: status_enum.h:299
AGT_CB_SET_REMOTE_TXHOOK
#define AGT_CB_SET_REMOTE_TXHOOK(C)
set remote has a transaction-hook
Definition: agt_cb.h:181
AGT_CB_SUBSYS_HAS_PSHOOK
#define AGT_CB_SUBSYS_HAS_PSHOOK(S)
Hooks Support flags handling check subsystem has a post-set-hook.
Definition: agt_cb.h:145
agt_hook_get_format_name
const xmlChar * agt_hook_get_format_name(agt_hook_fmt_t format)
Get the keyword for the specified agt_hook_fmt_t enumeration.
Definition: agt_hook_util.c:277
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
agt_hook_type_valid
boolean agt_hook_type_valid(agt_hook_type_t type)
Verify that the hook TYPE is valid.
Definition: agt_hook_util.c:156
LOGINFO
#define LOGINFO
Check if at least log-level=info.
Definition: log.h:279
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_CB_SUBSYS_SET_PSHOOK
#define AGT_CB_SUBSYS_SET_PSHOOK(S)
set subsystem has a post-set-hook
Definition: agt_cb.h:154
agt_hook_fmt_t_
agt_hook_fmt_t_
different hook formats dictates specific hook functionality
Definition: agt_hook_util.h:101
OBJ_TYP_LEAF_LIST
@ OBJ_TYP_LEAF_LIST
leaf-list
Definition: obj.h:616
AGT_CB_FL_SHOOK
#define AGT_CB_FL_SHOOK
Set Hook.
Definition: agt_cb.h:112
agt_hook_util.h
NETCONF Server Set/Transaction Hook utility functions.
OBJ_TYP_ANYXML
@ OBJ_TYP_ANYXML
anyxml
Definition: obj.h:613
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
agt_hook_get_type_enum
agt_hook_type_t agt_hook_get_type_enum(const xmlChar *type)
Get agt_hook_fmt_t enumeration structure from specified string.
Definition: agt_hook_util.c:248
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
agt_hook_post_sethook_obj_ok
status_t agt_hook_post_sethook_obj_ok(obj_template_t *obj, const xmlChar *defpath)
Check if format of the callback is acceptable for the object.
Definition: agt_hook_util.c:442
LOGDEBUG4
#define LOGDEBUG4
Check if at least log-level=debug4.
Definition: log.h:302
agt_hook_hooks_subsys_register
status_t agt_hook_hooks_subsys_register(const xmlChar *subsys_id, const xmlChar *defpath, agt_hook_fmt_t format, agt_hook_type_t type)
Register an object specific SIL-SA Post Set Hook callback function.
Definition: agt_hook_util.c:780
agt_hook_subtree_format
boolean agt_hook_subtree_format(obj_template_t *obj)
Check if an Transaction Hook callback is registered for this object for SIL-SA usage.
Definition: agt_hook_util.c:642
AGT_CB_FL_PSHOOK
#define AGT_CB_FL_PSHOOK
3 flags for the HOOKS support in agt_cb_subsys_t.flags field
Definition: agt_cb.h:111
AGT_HOOKFMT_NONE
@ AGT_HOOKFMT_NONE
not set
Definition: agt_hook_util.h:106
AGT_CB_FL_TXHOOK
#define AGT_CB_FL_TXHOOK
Transaction Hook.
Definition: agt_cb.h:113
AGT_CB_SUBSYS_HAS_TXHOOK
#define AGT_CB_SUBSYS_HAS_TXHOOK(S)
check subsystem has a transaction-hook
Definition: agt_cb.h:151
dlq_firstEntry
#define dlq_firstEntry(listP)
get the first entry in the queue list
Definition: dlq.h:337
obj.h
Data Object Support.
AGT_CB_SUBSYS_SET_SHOOK
#define AGT_CB_SUBSYS_SET_SHOOK(S)
set subsystem has a set-hook
Definition: agt_cb.h:157
agt_sethook_callback_set
boolean agt_sethook_callback_set(obj_template_t *obj)
Check if an Set Hook callback is registered for this object for SIL-SA usage.
Definition: agt_hook_util.c:570
xpath_find_schema_target_int
status_t xpath_find_schema_target_int(const xmlChar *target, obj_template_t **targobj)
@
Definition: xpath.c:2475
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
agt_txhook_callback_set
boolean agt_txhook_callback_set(obj_template_t *obj)
Check if an Transaction Hook callback is registered for this object for SIL-SA usage.
Definition: agt_hook_util.c:606
AGT_CB_SUBSYS_HAS_SHOOK
#define AGT_CB_SUBSYS_HAS_SHOOK(S)
check subsystem has a set-hook
Definition: agt_cb.h:148
obj_is_data_db
boolean obj_is_data_db(const obj_template_t *obj)
Check if the object is some sort of data Constrained to only check the config DB objects,...
Definition: obj.c:13788
AGT_CB_FL_SETHOOK_TREE
#define AGT_CB_FL_SETHOOK_TREE
4 flags for the agt_cb_fnset_t.flags field
Definition: agt_cb.h:117
AGT_CB_SUBSYS_SET_TXHOOK
#define AGT_CB_SUBSYS_SET_TXHOOK(S)
set subsystem has a transaction-hook
Definition: agt_cb.h:160
OBJ_TYP_LEAF
@ OBJ_TYP_LEAF
leaf
Definition: obj.h:615
AGT_HOOKFMT_SUBTREE
@ AGT_HOOKFMT_SUBTREE
subtree mode
Definition: agt_hook_util.h:107
obj_get_typestr
const xmlChar * obj_get_typestr(const obj_template_t *obj)
Get the name of the object type.
Definition: obj.c:11392
AGT_HOOK_TYPE_POST_SETHOOK
@ AGT_HOOK_TYPE_POST_SETHOOK
Post Set-Hook.
Definition: agt.h:714
status.h
Global error messages for status code enumerations.
dlq.h
dlq provides general double-linked list and queue support:
agt_hook_order_obj_ok
status_t agt_hook_order_obj_ok(obj_template_t *obj, const xmlChar *defpath)
Check if format of the callback is acceptable for the object.
Definition: agt_hook_util.c:393
LOGDEBUG3
#define LOGDEBUG3
Check if at least log-level=debug3.
Definition: log.h:297