yumapro  20.10-12
YumaPro SDK
agt_ypsnmp.h
Go to the documentation of this file.
1 /*****************************************************************************
2 Various copyrights apply to this package, listed in various separate
3 parts below. Please make sure that you read all the parts.
4 
5 ---- Part 1: Sparta, Inc (BSD) -----
6 
7 Copyright (c) 2003-2010, Sparta, Inc
8 All rights reserved.
9 
10 Redistribution and use in source and binary forms, with or without
11 modification, are permitted provided that the following conditions are met:
12 
13 * Redistributions of source code must retain the above copyright notice,
14  this list of conditions and the following disclaimer.
15 
16 * Redistributions in binary form must reproduce the above copyright
17  notice, this list of conditions and the following disclaimer in the
18  documentation and/or other materials provided with the distribution.
19 
20 * Neither the name of Sparta, Inc nor the names of its contributors may
21  be used to endorse or promote products derived from this software
22  without specific prior written permission.
23 
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
25 IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
28 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
31 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
33 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
34 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 
36 ---- Part 2: ScienceLogic, LLC (BSD) ----
37 
38 Copyright (c) 2006, ScienceLogic, LLC
39 All rights reserved.
40 
41 Redistribution and use in source and binary forms, with or without
42 modification, are permitted provided that the following conditions are
43 met:
44 
45 * Redistributions of source code must retain the above copyright notice,
46  this list of conditions and the following disclaimer.
47 
48 * Redistributions in binary form must reproduce the above copyright
49  notice, this list of conditions and the following disclaimer in the
50  documentation and/or other materials provided with the distribution.
51 
52 * Neither the name of ScienceLogic, LLC nor the names of its
53  contributors may be used to endorse or promote products derived
54  from this software without specific prior written permission.
55 
56 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
57 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
58 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
59 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
60 HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
61 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
62 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
63 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
64 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
65 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
66 USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
67 DAMAGE.
68 *************************************************************************/
69 
70 
71 /*************************************************************************
72  OVERVIEW
73 
74  This module implements an snmp abstraction layer that acts as a
75  an intermediate between the yang data store and the snmp library.
76  This module makes use of restconf apis to interface with the data
77  store(s) and provides sort of a gateway functionality by converting
78  requests and responses between snmp and restconf interface.
79 *************************************************************************/
80 
81 
82 /*
83  * Copyright (c) 2016 - 2020, YumaWorks. Inc., All Rights Reserved.
84  *
85  * Unless required by applicable law or agreed to in writing,
86  * software distributed under the License is distributed on an
87  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
88  * KIND, either express or implied. See the License for the
89  * specific language governing permissions and limitations
90  * under the License.
91  */
92 
93 #if defined(WITH_SNMP) && defined(WITH_RESTCONF)
94 #ifndef _H_agt_ypsnmp
95 #define _H_agt_ypsnmp
96 
97 /* FILE: agt_ypsnmp.h
98 *********************************************************************
99 * *
100 * P U R P O S E *
101 * *
102 *********************************************************************/
103 
111 /*********************************************************************
112 * *
113 * C H A N G E H I S T O R Y *
114 * *
115 *********************************************************************
116 
117 date init comment
118 ----------------------------------------------------------------------
119 08-sep-16 rmb Begun.
120 */
121 
122 #ifndef _H_status_enum
123 #include "status_enum.h"
124 #endif
125 
126 #ifndef _H_agt_ypsnmp_util
127 #include "agt_ypsnmp_util.h"
128 #endif
129 
130 #ifndef _H_yangapi
131 #include "yangapi.h"
132 #endif
133 
134 #ifdef __cplusplus
135 extern "C" {
136 #endif
137 
138 /********************************************************************
139 * *
140 * C O N S T A N T S *
141 * *
142 *********************************************************************/
143 
144 
145 /********************************************************************
146 * *
147 * T Y P E S *
148 * *
149 *********************************************************************/
150 
151 
152 /********************************************************************
153 * *
154 * F U N C T I O N S *
155 * *
156 *********************************************************************/
157 
158 /* header only */
159 
160 
202 extern int
203  ypsnmp_snmp_packet (int op_type,
204  netsnmp_session *session,
205  int reqid,
206  netsnmp_pdu *pdu,
207  void *magic);
208 
209 
223 extern int
224  ypsnmp_check_packet (netsnmp_session * session,
225  netsnmp_transport *transport,
226  void *transport_data,
227  int transport_data_length);
228 
229 
240 extern int
241  ypsnmp_check_parse (netsnmp_session * session,
242  netsnmp_pdu *pdu,
243  int result);
244 
245 
253 extern status_t
254  agt_ypsnmp_init (void);
255 
256 
262 extern void
263  agt_ypsnmp_cleanup (void);
264 
265 
273 extern void
274  agt_ypsnmp_check_io (void);
275 
276 
288 extern status_t
289  agt_ypsnmp_reply_handler (ses_cb_t *scb,
290  yangapi_cb_t *rcb,
291  rpc_msg_t *msg,
292  status_t result);
293 
294 
303 extern status_t
304  agt_ypsnmp_notification_handler (agt_not_msg_t *notif);
305 
306 
316 extern status_t
317  agt_ypsnmp_handle_request (ypsnmp_agent_session_t *asp);
318 
319 
323 #ifdef __cplusplus
324 } /* end extern 'C' */
325 #endif
326 
327 #endif // _H_agt_ypsnmp
328 #endif // defined(WITH_SNMP) && defined(WITH_RESTCONF)
obj_first_child
obj_template_t * obj_first_child(obj_template_t *obj)
Get the first child object if the specified object has any children.
Definition: obj.c:6687
log_info_append
void void void void void void log_info_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_INFO log entry.
agt_ypsnmp.h
Yuma Interface to net-snmp data structures. Agent interface.
smioid_new_scalar_object_oid
obj_oid_t * smioid_new_scalar_object_oid(void)
Malloc a scalar index OID: '.0'.
Definition: smioid_tree.c:982
agt_restconf.h
IETF RESTCONF Protocol Message Handler.
agt_ses.h
Server Session Management.
xml_strdup
xmlChar * xml_strdup(const xmlChar *copyFrom)
String duplicate for xmlChar.
Definition: xml_util.c:1553
agt_ypsnmp_free_agent_session
void agt_ypsnmp_free_agent_session(ypsnmp_agent_session_t *asp)
free the ypsnmp session and deallocate any associated memory
Definition: agt_ypsnmp_util.c:2612
obj_is_in_aio_get2
boolean obj_is_in_aio_get2(obj_template_t *obj)
Check if this object is a child of a node with sil-aio-get2 extension setup or if this object itself ...
Definition: obj.c:18305
log_error
void log_error(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_ERROR log entry.
agt_ypsnmp_sec_init
void agt_ypsnmp_sec_init(void)
Initialize the agt_ypsnmp_sec module.
Definition: agt_ypsnmp_sec.c:1668
val.h
Value Node Basic Support.
smioid_tree_find
obj_template_t * smioid_tree_find(obj_oid_t *oid_obj)
Find a object template node from the specified SMI OID string.
Definition: smioid_tree.c:536
agt_ypsnmp_create_snmp_varbind_object
netsnmp_variable_list * agt_ypsnmp_create_snmp_varbind_object(const oid *name, size_t name_length, u_char type, const void *value, size_t len)
Allocates and creates a new netsnmp variable binding object.
Definition: agt_ypsnmp_util.c:1051
agt_ypsnmp_get_varbind_value
const void * agt_ypsnmp_get_varbind_value(netsnmp_variable_list *var)
Get the Varbind value.
Definition: agt_ypsnmp_util.c:1702
val_get_value
val_value_t * val_get_value(ses_cb_t *scb, xml_msg_hdr_t *msg, val_value_t *val, val_nodetest_fn_t testfn, boolean acmcheck, boolean *malloced, status_t *res)
Get the value for a node after lots of internal processing.
Definition: val_util.c:6114
obj_next_key
obj_key_t * obj_next_key(obj_key_t *objkey)
Get the next key record.
Definition: obj.c:9559
status_enum.h
global error status code enumerations
obj_first_key
obj_key_t * obj_first_key(obj_template_t *obj)
Get the first key record.
Definition: obj.c:9472
val_child_find_obj
val_value_t * val_child_find_obj(const val_value_t *parent, const obj_template_t *child_obj)
Find the child node for the specified child object header.
Definition: val_child.c:1858
agt_ypsnmp_convert_varbind_to_oid
obj_oid_t * agt_ypsnmp_convert_varbind_to_oid(netsnmp_variable_list *var_ptr)
Converts an SNMP OID string into an internal object.
Definition: agt_ypsnmp_util.c:1147
free_varbind_yp
void free_varbind_yp(netsnmp_variable_list *var)
Frees the variable and any malloc'd data associated with it.
Definition: agt_ypsnmp_util.c:2678
NCX_BT_LEAFREF
@ NCX_BT_LEAFREF
leafref (needs special processing)
Definition: ncxtypes.h:221
val_get_first_key
val_index_t * val_get_first_key(val_value_t *val)
Get the first key record if this is a list with a key-stmt.
Definition: val.c:13200
agt_ypsnmp_get_index_oid
obj_oid_t * agt_ypsnmp_get_index_oid(obj_oid_t *full_oid, uint32 index_length)
parse requested OID and strip out index OID
Definition: agt_ypsnmp_util.c:1784
agt_ncxserver.h
NCX Server Transport and IO Library.
getcb_get2_child_obj_ex
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 node...
Definition: getcb.c:7602
obj_is_key
boolean obj_is_key(const obj_template_t *obj)
Check if object is being used as a key leaf within a list.
Definition: obj.c:14278
ERR_NCX_NO_INSTANCE
@ ERR_NCX_NO_INSTANCE
1009
Definition: status_enum.h:498
VAL_NAME
#define VAL_NAME(V)
Access the value name.
Definition: val.h:399
agt_not.h
NETCONF Notifications DM module support.
agt_ypsnmp_not_send
status_t agt_ypsnmp_not_send(netsnmp_pdu *pdu)
Send a notification.
Definition: agt_ypsnmp_not.c:935
ses_msg.h
NETCONF Session Message Common definitions module.
yangapi_new_rcb
yangapi_cb_t * yangapi_new_rcb(void)
Create a new YANG-API control block.
Definition: yangapi.c:317
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.
smioid_free_object_oid
void smioid_free_object_oid(obj_oid_t *oid)
Clean and free a malloced get2 control block.
Definition: smioid_tree.c:358
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.
smioid_tree_find_oid
obj_oid_t * smioid_tree_find_oid(obj_template_t *obj)
Find the OID value of the corresponding OBJ template.
Definition: smioid_tree.c:772
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
NCX_BT_LIST
@ NCX_BT_LIST
internal, YANG list
Definition: ncxtypes.h:228
agt_ypsnmp_get_getnext_modename
const xmlChar * agt_ypsnmp_get_getnext_modename(ypsnmp_getnext_mode_t getnextmode)
Get the getnext mode name from its enum.
Definition: agt_ypsnmp_util.c:1744
val_convert_leafref
val_value_t * val_convert_leafref(const val_value_t *val)
Convert a value of type NCX_BT_LEAFREF to the value that the final leafref is pointing at.
Definition: val.c:14761
YPSNMP_MODE_SCAL_INDEXED
@ YPSNMP_MODE_SCAL_INDEXED
scal indexed
Definition: agt_ypsnmp_util.h:294
agt_ses_new_snmp_session
ses_cb_t * agt_ses_new_snmp_session(void)
Create a dummy SNMP session control block.
Definition: agt_ses.c:737
agt_ypsnmp_bestmatch_next_index
val_value_t * agt_ypsnmp_bestmatch_next_index(yangapi_cb_t *rcb)
Find the next best matching list entry in the Queue.
Definition: agt_ypsnmp_util.c:601
yangapi_get_method_name
const xmlChar * yangapi_get_method_name(yangapi_method_t method_enum)
Get the method name from its enum.
Definition: yangapi.c:537
val_dump_value
void val_dump_value(val_value_t *val, int32 startindent, log_debug_t lvl)
Printf the specified val_value_t struct to the logfile, or stdout if none set Uses conf file format (...
Definition: val.c:5688
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.
obj_get_name
const xmlChar * obj_get_name(const obj_template_t *obj)
Get the name field for this obj.
Definition: obj.c:10511
ERR_NCX_OPERATION_FAILED
@ ERR_NCX_OPERATION_FAILED
274
Definition: status_enum.h:315
LOGDEBUG2
#define LOGDEBUG2
Check if at least log-level=debug2.
Definition: log.h:292
val_gen_index_chain
status_t val_gen_index_chain(const obj_template_t *obj, val_value_t *val)
Create an index chain for the just-parsed table or container struct.
Definition: val_util.c:2632
agt_ypsnmp_value_to_indexoid
status_t agt_ypsnmp_value_to_indexoid(yangapi_cb_t *rcb, val_value_t *list)
Converts val_value list with keys into index OID.
Definition: agt_ypsnmp_util.c:2282
val_is_config_data
boolean val_is_config_data(const val_value_t *val)
Check if the specified value is a config DB object instance.
Definition: val.c:11157
ERR_INTERNAL_VAL
@ ERR_INTERNAL_VAL
004
Definition: status_enum.h:194
obj_has_children
boolean obj_has_children(obj_template_t *obj)
Check if there are any accessible nodes within the object.
Definition: obj.c:14831
val_child_next
val_value_t * val_child_next(const val_value_t *curchild)
Get the next child present for the current node Parent must be set.
Definition: val_child.c:2326
getcb_clone_keyQ
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.
Definition: getcb.c:8779
val_child_add
status_t val_child_add(val_value_t *child, val_value_t *parent)
Add a child value node to a parent value node.
Definition: val_child.c:1542
val_util.h
Value Node Utilities.
agt_ypsnmp_handle_request
status_t agt_ypsnmp_handle_request(ypsnmp_agent_session_t *asp)
Incoming Packet handling function.
Definition: agt_ypsnmp.c:3774
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
smioid_concat_object_oid
obj_oid_t * smioid_concat_object_oid(oid_t *name1, uint32 oid_len1, oid_t *name2, uint32 oid_len2)
Concatenate 2 OIDs into one OID.
Definition: smioid_tree.c:885
YPSNMP_MODE_SCAL_NOINDEX
@ YPSNMP_MODE_SCAL_NOINDEX
scal no index
Definition: agt_ypsnmp_util.h:291
agt_restconf_dispatch_ex
boolean agt_restconf_dispatch_ex(ses_cb_t *scb, boolean scb_is_static)
Dispatch an incoming RESTCONF request (Extended)
Definition: agt_restconf.c:2031
obj_next_child
obj_template_t * obj_next_child(obj_template_t *obj)
Get the next child object if the specified object has any children.
Definition: obj.c:6860
getcb_find_return_val
val_value_t * getcb_find_return_val(getcb_get2_t *get2cb, obj_template_t *obj)
Find a return val in the get2cb return_valQ.
Definition: getcb.c:5838
agt_ypsnmp_notification_handler
status_t agt_ypsnmp_notification_handler(agt_not_msg_t *notif)
Handler called for sending a notification.
Definition: agt_ypsnmp.c:3646
YPSNMP_MODE_COMPLEX
@ YPSNMP_MODE_COMPLEX
complex
Definition: agt_ypsnmp_util.h:297
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
obj_get_oid_string
const xmlChar * obj_get_oid_string(obj_template_t *obj)
Get object OID sting value.
Definition: obj.c:17725
val_clone
val_value_t * val_clone(const val_value_t *val)
Clone a specified val_value_t struct and sub-trees.
Definition: val.c:7836
agt_ypsnmp_agentx_connected
boolean agt_ypsnmp_agentx_connected(void)
Check if the AgentX agent succ connected to the master agent.
Definition: agt_ypsnmp_agentx.c:1166
val_child.h
Value Node Child Access Support.
ERR_INTERNAL_INIT_SEQ
@ ERR_INTERNAL_INIT_SEQ
007
Definition: status_enum.h:197
agt_ses_free_snmp_session
void agt_ses_free_snmp_session(ses_cb_t *scb)
Free a dummy snmp session control block.
Definition: agt_ses.c:782
get_error_string
const char * get_error_string(status_t res)
Get the error message for a specific internal error.
Definition: status.c:239
log_debug
void void void void void void void log_debug(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG log entry.
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_ypsnmp_not_cleanup
void agt_ypsnmp_not_cleanup(void)
cleanup the agt_ypsnmp_not module
Definition: agt_ypsnmp_not.c:919
ERR_NCX_NOT_FOUND
@ ERR_NCX_NOT_FOUND
225
Definition: status_enum.h:264
agt_ypsnmp_check_io
void agt_ypsnmp_check_io(void)
Check if any SNMP messages to process.
Definition: agt_ypsnmp.c:3436
YANGAPI_METHOD_NONE
@ YANGAPI_METHOD_NONE
not set
Definition: yangapi.h:116
agt_ypsnmp_init_agent_session
ypsnmp_agent_session_t * agt_ypsnmp_init_agent_session(netsnmp_session *session, netsnmp_pdu *pdu)
Allocate new ypsnmp session context.
Definition: agt_ypsnmp_util.c:2574
ERR_NCX_OPERATION_NOT_SUPPORTED
@ ERR_NCX_OPERATION_NOT_SUPPORTED
273
Definition: status_enum.h:314
yangapi_clean_getnext_listQ
void yangapi_clean_getnext_listQ(yangapi_cb_t *rcb, ses_cb_t *scb)
Free all the snmp getnext list entries.
Definition: yangapi.c:266
smioid_dup_object_oid
obj_oid_t * smioid_dup_object_oid(obj_oid_t *copyfrom)
Duplicate OID.
Definition: smioid_tree.c:940
agt_ypsnmp_cleanup
void agt_ypsnmp_cleanup(void)
Cleanup the agt_ypsnmp module.
Definition: agt_ypsnmp.c:3390
log_debug4_append
void void void void void void void void void void void void void void log_debug4_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_DEBUG4 log entry.
agt_ypsnmp_sec.h
Defines the SNMP security and authentication for incoming snmp requests and notifications.
obj_get_oid_struct
obj_oid_t * obj_get_oid_struct(obj_template_t *obj, boolean *malloced)
Get malloced object OID structure that contains OID string and OID count.
Definition: obj.c:17783
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_not_start_subscription
status_t agt_not_start_subscription(ses_cb_t *scb, const xmlChar *stream, xmlChar *startTime, xmlChar *stopTime, boolean futurestop, op_filtertyp_t filtertype, val_value_t *filterval, val_value_t *selectval)
Malloc and fill in a new subscription control block.
Definition: agt_not.c:6477
agt_ypsnmp_is_augmented_obj
boolean agt_ypsnmp_is_augmented_obj(obj_template_t *curobj)
Check if the object is an augmented object.
Definition: agt_ypsnmp_util.c:966
agt_ypsnmp_util.h
Utility Functions for YP SNMP.
agt_ypsnmp_is_scalar_obj
boolean agt_ypsnmp_is_scalar_obj(obj_template_t *curobj)
Check if the object is a scalar object.
Definition: agt_ypsnmp_util.c:935
ypsnmp_check_parse
int ypsnmp_check_parse(netsnmp_session *session, netsnmp_pdu *pdu, int result)
Check the PDU parse.
Definition: agt_ypsnmp.c:3280
agt_ypsnmp_init
status_t agt_ypsnmp_init(void)
Initialize the agt_ypsnmp module.
Definition: agt_ypsnmp.c:3306
agt_ypsnmp_sec_check
int agt_ypsnmp_sec_check(netsnmp_pdu *pdu)
Checks if the specified pdu meets the access requirements.
Definition: agt_ypsnmp_sec.c:1705
agt_ypsnmp_reply_handler
status_t agt_ypsnmp_reply_handler(ses_cb_t *scb, yangapi_cb_t *rcb, rpc_msg_t *msg, status_t result)
Handler called for sending a response.
Definition: agt_ypsnmp.c:3529
xml_strcmp
int xml_strcmp(const xmlChar *s1, const xmlChar *s2)
String compare for xmlChar.
Definition: xml_util.c:1746
agt_ypsnmp_get_yangapi_method
yangapi_method_t agt_ypsnmp_get_yangapi_method(uint8 msg_code)
Get the YANGAPI method from the SNMP method.
Definition: agt_ypsnmp_util.c:1668
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
ypsnmp_snmp_packet
int ypsnmp_snmp_packet(int op_type, netsnmp_session *session, int reqid, netsnmp_pdu *pdu, void *magic)
Register handle an incoming SNMP packet.
Definition: agt_ypsnmp.c:3100
LOGDEBUG4
#define LOGDEBUG4
Check if at least log-level=debug4.
Definition: log.h:302
val_child_first
val_value_t * val_child_first(const val_value_t *parent)
Get the first child present for this parent.
Definition: val_child.c:2294
obj_is_leaf
boolean obj_is_leaf(const obj_template_t *obj)
Check if object is a proper leaf.
Definition: obj.c:13323
agt_ypsnmp_append_varbind_to_list
void agt_ypsnmp_append_varbind_to_list(netsnmp_variable_list **list, netsnmp_variable_list *var)
Adds the given netsnmp variable binding object to the end of the list of given pdu.
Definition: agt_ypsnmp_util.c:1114
LOGDEBUG
#define LOGDEBUG
Check if at least log-level=debug.
Definition: log.h:287
free_varbind
void free_varbind(netsnmp_variable_list *var)
Frees the variable and any malloc'd data associated with it.
Definition: agt_ypsnmp_util.c:2639
agt_ypsnmp_set_varbind
status_t agt_ypsnmp_set_varbind(ses_cb_t *scb, netsnmp_pdu *pdu, val_value_t *val, const obj_oid_t *oid_obj)
Set the return Varbind based on the found value.
Definition: agt_ypsnmp_util.c:1194
YPSNMP_MODE_TAB_INDEXED
@ YPSNMP_MODE_TAB_INDEXED
table indexed
Definition: agt_ypsnmp_util.h:288
OP_FILTER_NONE
@ OP_FILTER_NONE
not set
Definition: op.h:115
val_match_child
val_value_t * val_match_child(const val_value_t *parent, const xmlChar *modname, const xmlChar *childname)
Match the first instance of the specified child node.
Definition: val.c:8685
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
val_get_next_key
val_index_t * val_get_next_key(val_index_t *curkey)
Get the next key record if this is a list with a key-stmt.
Definition: val.c:13254
dlq_empty
#define dlq_empty(listP)
check if queue list is empty
Definition: dlq.h:367
yangapi_free_rcb
void yangapi_free_rcb(yangapi_cb_t *rcb)
Free a YANGAPI control block.
Definition: yangapi.c:351
obj_get_basetype
ncx_btype_t obj_get_basetype(const obj_template_t *obj)
Get the NCX base type enum for the object type.
Definition: obj.c:12077
agt_get_profile
agt_profile_t * agt_get_profile(void)
Get the server profile struct.
Definition: agt.c:4118
ERR_NCX_VAR_NOT_FOUND
@ ERR_NCX_VAR_NOT_FOUND
360
Definition: status_enum.h:403
dlq_firstEntry
#define dlq_firstEntry(listP)
get the first entry in the queue list
Definition: dlq.h:337
val_new_value
val_value_t * val_new_value(void)
Malloc and initialize the fields in a val_value_t.
Definition: val.c:2697
agt_ncxserver_get_timer_tcb
thd_tcb_t * agt_ncxserver_get_timer_tcb(void)
Get the timer TCB to hijack for the YP-HA standby SCB.
Definition: agt_ncxserver.c:3364
VAL_OBJ
#define VAL_OBJ(V)
Access the object template.
Definition: val.h:381
ncx.h
YANG module utility functions.
agt_ypsnmp_get_table_obj
obj_template_t * agt_ypsnmp_get_table_obj(obj_template_t *obj)
Find the Table object of the current object.
Definition: agt_ypsnmp_util.c:846
getcb_find_return_key
val_value_t * getcb_find_return_key(getcb_get2_t *get2cb, obj_template_t *obj)
Find a return keyval in the get2cb return_keyQ.
Definition: getcb.c:6253
YPSNMP_MODE_NONE
@ YPSNMP_MODE_NONE
not set
Definition: agt_ypsnmp_util.h:282
SES_MY_SID
#define SES_MY_SID(S)
get session-id
Definition: ses.h:105
agt_ypsnmp_not.h
Defines and implements SNMP notification and trap handling.
agt_ypsnmp_indexoid_to_value
status_t agt_ypsnmp_indexoid_to_value(yangapi_cb_t *rcb, obj_template_t *obj, uint32 index_length)
Parse requested OID and strip out index OID.
Definition: agt_ypsnmp_util.c:2015
ypsnmp_check_packet
int ypsnmp_check_packet(netsnmp_session *session, netsnmp_transport *transport, void *transport_data, int transport_data_length)
Handler for all incoming messages (a.k.a.
Definition: agt_ypsnmp.c:3234
agt_ypsnmp_match_obj
boolean agt_ypsnmp_match_obj(obj_template_t *targetobj, obj_template_t *curobj)
Checks if the current object in the walker is the target object for the request.
Definition: agt_ypsnmp_util.c:764
val_init_from_template
void val_init_from_template(val_value_t *val, struct obj_template_t_ *obj)
Initialize a value node from its object template.
agt_ypsnmp_log_pdu
void agt_ypsnmp_log_pdu(netsnmp_pdu *pdu)
logs the received SNMP PDU packet contents
Definition: agt_ypsnmp_util.c:1591
agt_ypsnmp_not_init
void agt_ypsnmp_not_init(void)
Initialize the agt_ypsnmp_not module.
Definition: agt_ypsnmp_not.c:901
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
XML_MSG_GET2_TARGET
#define XML_MSG_GET2_TARGET(M)
GET2 request target terminal node.
Definition: xml_msg.h:270
agt_ypsnmp_get_agentx_scb
ses_cb_t * agt_ypsnmp_get_agentx_scb(void)
Get the AgentX specific session control block.
Definition: agt_ypsnmp_agentx.c:1190
smioid_tree.h
AVL Tree storage of SMI OID data.
SET_ERROR
#define SET_ERROR(E)
macro SET_ERROR
Definition: status_enum.h:103
AGT_SELECT_TIMEOUT_USEC
#define AGT_SELECT_TIMEOUT_USEC
number of microseconds for each select timeout set to 1/100th sec
Definition: agt.h:391
agt_ypsnmp_make_restconf_uri
xmlChar * agt_ypsnmp_make_restconf_uri(obj_template_t *obj)
Make a RESTCONF URI string from the specified OID string.
Definition: agt_ypsnmp_util.c:1548
agt_ypsnmp_sec_cleanup
void agt_ypsnmp_sec_cleanup(void)
Cleanup the agt_ypsnmp_sec module.
Definition: agt_ypsnmp_sec.c:1689
yangapi_clean_target_keyvalQ
void yangapi_clean_target_keyvalQ(yangapi_cb_t *rcb)
Free all the snmp target keyval entries.
Definition: yangapi.c:296
YPSNMP_MODE_TAB_NOINDEX
@ YPSNMP_MODE_TAB_NOINDEX
table no index
Definition: agt_ypsnmp_util.h:285
agt_ypsnmp_agentx.h
Yuma Interface to net-snmp data structures. AgentX interface.
agt_not_remove_subscription
void agt_not_remove_subscription(ses_id_t sid)
Remove and expire a subscription with the specified session ID.
Definition: agt_not.c:5889
smioid_tree_getnext_oid
obj_oid_t * smioid_tree_getnext_oid(obj_oid_t *oid_obj, boolean *found)
Returns the next or closest OID for the specified oid as per the lexicographical order.
Definition: smioid_tree.c:640
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
yangapi.h
YANG-API definitions (pre-RESTCONF)
agt_ypsnmp_setup_peeraddr
status_t agt_ypsnmp_setup_peeraddr(ses_cb_t *scb, netsnmp_pdu *pdu)
Setup the scb->peeraddr for debugging and auditing.
Definition: agt_ypsnmp_util.c:1506
typ_has_children
boolean typ_has_children(ncx_btype_t btyp)
Check if this is a data type that uses the val.v.childQ.
Definition: typ.c:3056