yumapro  20.10-12
YumaPro SDK
getcb.h File Reference

GET1 and GET2 Callback Support. More...

#include "ncxconst.h"
#include "obj.h"
#include "rpc.h"
#include "ses.h"
#include "status_enum.h"
#include "val.h"
#include "val_util.h"
Include dependency graph for getcb.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  getcb_keyval_t_
 Key value holder, temp Q of ordered key leaf values used while parsing a path to store the keys until they are all collected. More...
 
struct  getcb_get2_lookup_t_
 GET2 lookup struct. More...
 
struct  getcb_get2_select_t_
 GET2 select struct. More...
 
struct  getcb_get2_getbulk_t_
 GET2 getbulk struct This is only used for YANG list objects to produce N getnext entries at a time. More...
 
struct  getcb_get2_t_
 GET2 control block. More...
 

Typedefs

typedef status_t(* getcb_fn_t) (ses_cb_t *scb, getcb_mode_t cbmode, const val_value_t *virval, val_value_t *dstval)
 GET1 Callback function for agent node get handler. More...
 
typedef status_t(* getcb_fn2_t) (ses_cb_t *scb, xml_msg_hdr_t *msg, getcb_get2_t *get2cb)
 GET2 PRODUCER FUNCTION. More...
 
typedef getcb_walker_status_t(* getcb_get2_walker_fn_t) (getcb_walker_mode_t walker_mode, getcb_get2_t *get2cb, obj_template_t *obj, val_value_t *val, void *cookie)
 GET2 CONSUMER FUNCTION. More...
 

Enumerations

enum  getcb_mode_t_ {
  GETCB_NONE,
  GETCB_GET_VALUE,
  GETCB_GETNEXT_VALUE
}
 get callback retrieval types; only get2 supports getnext More...
 
enum  getcb_walker_mode_t_
 get2 walker callback modes

 
enum  getcb_walker_status_t_
 get2 walker callback return status values
 

Functions

void getcb_init_get2cb (getcb_get2_t *get2cb)
 Init a GET2 control block. More...
 
getcb_get2_t * getcb_new_get2cb (void)
 Malloc and init a new get2 control block. More...
 
void getcb_free_get2cb (getcb_get2_t *get2cb)
 Clean and free a malloced GET2 control block. More...
 
void getcb_clean_get2cb (getcb_get2_t *get2cb, boolean reuse)
 Clean a get2 control block. More...
 
void getcb_add_return_val (getcb_get2_t *get2cb, val_value_t *val)
 Add a return val to a get2cb return_valQ. More...
 
val_value_t * getcb_find_return_val (getcb_get2_t *get2cb, obj_template_t *obj)
 Find a return val in the get2cb return_valQ. More...
 
val_value_t * getcb_find_return_val2 (getcb_get2_t *get2cb, xmlns_id_t obj_nsid, const xmlChar *obj_name)
 Find a return val in the get2cb return_valQ use { NSID, NAME } instead of object pointer. More...
 
val_value_t * getcb_find_return_val_str (getcb_get2_t *get2cb, xmlns_id_t obj_nsid, const xmlChar *obj_name, const xmlChar *valstr)
 Find a return val in the get2cb return_valQ use { NSID, NAME } instead of object pointer. More...
 
val_value_t * getcb_find_next_return_val (getcb_get2_t *get2cb, val_value_t *curval)
 Find the next matching return val in the get2cb return_valQ. More...
 
val_value_t * getcb_find_key (getcb_get2_t *get2cb, obj_template_t *obj)
 Find an input keyval in the get2cb keyQ. More...
 
val_value_t * getcb_find_key_str (getcb_get2_t *get2cb, const xmlChar *modname, const xmlChar *objname)
 Find an input keyval in the get2cb keyQ with a string. More...
 
val_value_t * getcb_find_key_num (getcb_get2_t *get2cb, const xmlChar *modname, const xmlChar *objname, uint32 keynum)
 Find an input keyval in the get2cb keyQ. More...
 
val_value_t * getcb_find_key_lvl (getcb_get2_t *get2cb, const xmlChar *modname, const xmlChar *objname, uint32 objlvl)
 Find an input keyval in the get2cb keyQ. More...
 
val_value_t * getcb_find_match (getcb_get2_t *get2cb, obj_template_t *obj)
 Find an input keyval in the get2cb matchQ. More...
 
void getcb_add_key (getcb_get2_t *get2cb, val_value_t *val)
 Add a keyval to a get2cb keyQ. More...
 
void getcb_add_match (getcb_get2_t *get2cb, val_value_t *val)
 Add a match node to a get2cb matchQ. More...
 
status_t getcb_add_select (getcb_get2_t *get2cb, const xmlChar *modname, const xmlChar *objname)
 Add a select node to a get2cb matchQ. More...
 
void getcb_add_return_key (getcb_get2_t *get2cb, val_value_t *val)
 Add a return keyval to a get2cb return_keyQ. More...
 
val_value_t * getcb_find_return_key (getcb_get2_t *get2cb, obj_template_t *obj)
 Find a return keyval in the get2cb return_keyQ. More...
 
val_value_t * getcb_find_return_key2 (getcb_get2_t *get2cb, xmlns_id_t obj_nsid, const xmlChar *obj_name)
 Find a return keyval in the get2cb return_keyQ Use { NSID, NAME } instead of object pointer. More...
 
void getcb_move_return_keys (getcb_get2_t *get2cb)
 Move the return keys to the keyQ replacing the nodes in the keyQ if already there. More...
 
void getcb_undo_move_return_keys (getcb_get2_t *get2cb)
 Move back the return keys from the keyQ. More...
 
void getcb_clean_return_data (getcb_get2_t *get2cb)
 Clean the return data in the return_val and return_valQ. More...
 
val_value_t * getcb_get2cb_to_request_val (getcb_get2_t *get2cb, obj_template_t *get_request_obj, boolean preserve_data, xml_msg_hdr_t *msg, status_t *res)
 Convert a get2cb struct to a <get-request> value tree. More...
 
getcb_get2_t * getcb_request_val_to_get2cb (val_value_t *get_request_val, boolean preserve_data, status_t *res)
 Convert a <get-request> value tree into a get2cb struct. More...
 
val_value_t * getcb_get2cb_to_response_val (getcb_get2_t *get2cb, obj_template_t *response_obj, boolean preserve_data, status_t *res)
 Convert a get2cb struct to a <get-response> value tree. More...
 
getcb_get2_t * getcb_response_val_to_get2cb (val_value_t *response_val, boolean preserve_data, status_t *res)
 Convert a <get-response> value to a get2cb struct. More...
 
void getcb_add_return_get2cb (getcb_get2_t *get2cb, getcb_get2_t *return_get2cb)
 Add a return get2cb to a get2cb responseQ Used for get-bulk support. More...
 
status_t getcb_move_response_get2cb (getcb_get2_t *response_get2cb, getcb_get2_t *get2cb)
 Move the return fields from the return get2cb to the target get2cb. More...
 
status_t getcb_replace_response_get2cb (getcb_get2_t *response_get2cb, getcb_get2_t *get2cb, boolean replace_mode)
 Move the return fields from the return get2cb to the target get2cb Can clean out old data first. More...
 
status_t getcb_get2_child_obj (ses_cb_t *scb, xml_msg_hdr_t *msg, val_value_t *parentval, getcb_get2_t *parent_get2cb, obj_template_t *obj, boolean with_defaults, getcb_get2_walker_fn_t walkerfn, void *cookie)
 Process the instances of an object for the object itself and 0 or more nest levels of descendant nodes. More...
 
status_t getcb_get2_child_obj_ex (ses_cb_t *scb, xml_msg_hdr_t *msg, val_value_t *parentval, getcb_get2_t *parent_get2cb, obj_template_t *obj, boolean with_defaults, getcb_get2_walker_fn_t walkerfn, void *cookie, getcb_get2_t *force_get2cb, getcb_api_mode_t api_mode)
 Process the instances of an object for the object itself and 0 or more nest levels of descendant nodes Use the get2cb pointer if provided. More...
 
status_t getcb_handle_acmtest (ses_cb_t *scb, xml_msg_hdr_t *msg, val_nodetest_fn_t testfn, getcb_get2_t *get2cb)
 check the access control and testfn callback for a node that would have it skipped because the write_full_check_val function is skipped More...
 
getcb_keyval_t * getcb_new_keyval (const xmlChar *keyval)
 Create a new GET2 keyval holder. More...
 
getcb_keyval_t * getcb_new_keyval2 (val_value_t *keynode, obj_template_t *keyobj, boolean fixed_value)
 Create a new Get2 keyval holder using val backptr. More...
 
getcb_keyval_t * getcb_new_keyval3 (const xmlChar *keyval, obj_template_t *keyobj, boolean fixed_value)
 Create a new Get2 keyval holder using value string. More...
 
void getcb_free_keyval (getcb_keyval_t *keyval)
 Free a GET2 keyval. More...
 
void getcb_clean_keyvalQ (dlq_hdr_t *que)
 Free all the Get2 keyvals from a dlq_hdr. More...
 
getcb_get2_lookup_t * getcb_new_get2_lookup (obj_template_t *obj, dlq_hdr_t *keyvalQ)
 Create a new getcb_get2_lookup struct. More...
 
void getcb_free_get2_lookup (getcb_get2_lookup_t *lookup)
 Free a getcb_get2_lookup struct. More...
 
void getcb_clean_get2_lookupQ (dlq_hdr_t *lookupQ)
 Clean a queue of getcb_get2_lookup_t. More...
 
getcb_get2_lookup_t * getcb_find_get2_lookup (obj_template_t *obj, dlq_hdr_t *lookupQ)
 Find a getcb_get2_lookup struct. More...
 
getcb_get2_select_t * getcb_new_get2_select (const xmlChar *modname, const xmlChar *objname)
 Create a new getcb_select_t struct. More...
 
void getcb_free_get2_select (getcb_get2_select_t *select_node)
 Free a getcb_get2_select struct. More...
 
boolean getcb_find_get2_select (getcb_get2_t *get2cb, const xmlChar *modname, const xmlChar *objname)
 Find a getcb_get2_select struct. More...
 
void getcb_dump_get2cb (getcb_get2_t *get2cb)
 Print the interesting fields in a get2cb. More...
 
boolean getcb_need_get2 (obj_template_t *curobj, obj_template_t *reqobj)
 check if the node has a get2 callback or in a choice/case subtree that has get2 callback More...
 
boolean getcb_need_get2_ex (obj_template_t *curobj, obj_template_t *reqobj, uint32 *choicecnt, obj_template_t **top_choice)
 check if the node has a get2 callback or in a choice/case subtree that has get2 callback More...
 
obj_template_t * getcb_first_requested_child (getcb_get2_t *get2cb, obj_template_t *parent_obj)
 Check if the specified object has any terminal nodes that need to be returned for a get2 request. More...
 
obj_template_t * getcb_next_requested_child (getcb_get2_t *get2cb, obj_template_t *curchild)
 Check if the specified object has any more terminal nodes that need to be returned for a get2 request. More...
 
status_t getcb_set_active_case (getcb_get2_t *get2cb, const xmlChar *active_case_modname, const xmlChar *active_case)
 Set the active case to the specified object. More...
 
getcb_get2_getbulk_t * getcb_new_get2_getbulk (void)
 Create a new getcb_get2_getbulk struct. More...
 
void getcb_free_get2_getbulk (getcb_get2_getbulk_t *getbulk)
 Free a getcb_get2_getbulk struct. More...
 
status_t getcb_finish_getbulk_entry (getcb_get2_t *get2cb)
 Gather the current response in a getbulk entry and save it in the getcb->getbulkQ; The getcb is ready to start another getcb GETNEXT response after this function is complete. More...
 
status_t getcb_pre_get2_choices (xml_msg_hdr_t *msg, ses_cb_t *scb, getcb_get2_t *parent_get2cb, obj_template_t *targobj, val_value_t *curval, uint32 choice_cnt, obj_template_t *top_choice, boolean *force_remove, getcb_get2_t **ret_get2cb)
 Invoke the get2 callbacks for each of the implied choice-stmt nodes in a subtree or REST resource request. More...
 
void getcb_log_walker (const xmlChar *caller, getcb_walker_mode_t walker_mode, const xmlChar *objname, const xmlChar *valname)
 Print some logging info for a GET2 walker consumer callback. More...
 
status_t getcb_clone_keyQ (dlq_hdr_t *srcQ, dlq_hdr_t *destQ)
 Copy all the key val_value_t structs to the other queue. More...
 
boolean getcb_is_get_exact (getcb_get2_t *get2cb)
 Check if the getcb represents a response that is for a get-exact or a getnext. More...
 
void getcb_clean_responseQ (getcb_get2_t *get2cb)
 Clean the response Q within a get2cb. More...
 
void getcb_add_return_aioQ (getcb_get2_t *get2cb, val_value_t *val)
 Add a return val to a get2cb return_aioQ. More...
 
void getcb_clean_return_aioQ (getcb_get2_t *get2cb)
 Clean the return data return_aioQ. More...
 
boolean getcb_get2_allowed (xml_msg_hdr_t *msg, obj_template_t *chobj)
 Check if the current node and operation are allowed to use the GET2 callback if there is one; Used to keep NMDA and non-NMDA operations separate. More...
 
getcb_get2_t * getcb_new_parent_get2cb (obj_template_t *obj, dlq_hdr_t *keyQ)
 Create a new get2 control block for the parent Used for XGET operation to fill the list's parent get2cb. More...
 
boolean getcb_match_keys_lookup (obj_template_t *useobj, val_value_t *useval, getcb_get2_lookup_t *lookup)
 Match the requested list entry. More...
 
boolean getcb_match_keys_getcb (obj_template_t *useobj, val_value_t *useval, getcb_get2_t *get2cb)
 Match the requested list entry. More...
 
boolean getcb_match_keys_keyQ (obj_template_t *useobj, val_value_t *useval, dlq_hdr_t *srcQ)
 Match the requested list entry. More...
 
status_t getcb_add_return_aio_buff (getcb_get2_t *get2cb, const xmlChar *buffer)
 Add a return buffer to a get2cb control block and set encoding type. More...
 
void getcb_clean_return_aio_buff (getcb_get2_t *get2cb)
 Clean the return AIO buffer, XML or JSON buffer. More...
 
val_value_t * getcb_get2cb_to_val (getcb_get2_t *get2cb, status_t *retres)
 Convert a GET2 CB to the equivalent val_value_t tree only container and list are supported. More...
 

Detailed Description

GET1 and GET2 Callback Support.