net-snmp
5.4.1
|
00001 /* 00002 * snmp_client.h 00003 */ 00004 /*********************************************************** 00005 Copyright 1988, 1989 by Carnegie Mellon University 00006 00007 All Rights Reserved 00008 00009 Permission to use, copy, modify, and distribute this software and its 00010 documentation for any purpose and without fee is hereby granted, 00011 provided that the above copyright notice appear in all copies and that 00012 both that copyright notice and this permission notice appear in 00013 supporting documentation, and that the name of CMU not be 00014 used in advertising or publicity pertaining to distribution of the 00015 software without specific, written prior permission. 00016 00017 CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 00018 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 00019 CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 00020 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 00021 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 00022 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 00023 SOFTWARE. 00024 ******************************************************************/ 00025 00026 #ifndef SNMP_CLIENT_H 00027 #define SNMP_CLIENT_H 00028 00029 #ifdef __cplusplus 00030 extern "C" { 00031 #endif 00032 00033 00034 struct snmp_pdu; 00035 struct snmp_session; 00036 struct variable_list; 00037 00038 struct synch_state { 00039 int waiting; 00040 int status; 00041 /* 00042 * status codes 00043 */ 00044 #define STAT_SUCCESS 0 00045 #define STAT_ERROR 1 00046 #define STAT_TIMEOUT 2 00047 int reqid; 00048 netsnmp_pdu *pdu; 00049 }; 00050 00051 int snmp_set_var_value(netsnmp_variable_list *, 00052 const u_char *, size_t); 00053 int snmp_set_var_objid(netsnmp_variable_list * vp, 00054 const oid * objid, 00055 size_t name_length); 00056 int snmp_set_var_typed_value(netsnmp_variable_list * 00057 newvar, u_char type, 00058 const u_char * val_str, 00059 size_t val_len); 00060 int snmp_set_var_typed_integer(netsnmp_variable_list * newvar, 00061 u_char type, long val); 00062 void snmp_replace_var_types(netsnmp_variable_list * vbl, 00063 u_char old_type, 00064 u_char new_type); 00065 void snmp_reset_var_buffers(netsnmp_variable_list * var); 00066 void snmp_reset_var_types(netsnmp_variable_list * vbl, 00067 u_char new_type); 00068 int count_varbinds(netsnmp_variable_list * var_ptr); 00069 int count_varbinds_of_type(netsnmp_variable_list * var_ptr, 00070 u_char type); 00071 netsnmp_variable_list *find_varbind_of_type(netsnmp_variable_list * 00072 var_ptr, u_char type); 00073 netsnmp_variable_list *find_varbind_in_list(netsnmp_variable_list *vblist, 00074 oid *name, size_t len); 00075 00076 netsnmp_variable_list *snmp_add_null_var(netsnmp_pdu *, const oid *, size_t); 00077 netsnmp_pdu *snmp_pdu_create(int); 00078 netsnmp_pdu *snmp_fix_pdu(netsnmp_pdu *, int); 00079 netsnmp_pdu *snmp_clone_pdu(netsnmp_pdu *); 00080 netsnmp_pdu *snmp_split_pdu(netsnmp_pdu *, int skipCount, 00081 int copyCount); 00082 00083 unsigned long snmp_varbind_len(netsnmp_pdu *pdu); 00084 int snmp_clone_var(netsnmp_variable_list *, 00085 netsnmp_variable_list *); 00086 netsnmp_variable_list *snmp_clone_varbind(netsnmp_variable_list *); 00087 const char *snmp_errstring(int); 00088 int snmp_synch_response(netsnmp_session *, netsnmp_pdu *, 00089 netsnmp_pdu **); 00090 int snmp_synch_response_cb(netsnmp_session *, 00091 netsnmp_pdu *, netsnmp_pdu **, 00092 snmp_callback); 00093 int snmp_clone_mem(void **, void *, unsigned); 00094 00095 /* 00096 * single session API - see snmp_api.h for full details 00097 */ 00098 int snmp_sess_synch_response(void *, netsnmp_pdu *, 00099 netsnmp_pdu **); 00100 00101 void netsnmp_query_set_default_session(netsnmp_session *); 00102 netsnmp_session * netsnmp_query_get_default_session( void ); 00103 int netsnmp_query_get( netsnmp_variable_list *, netsnmp_session *); 00104 int netsnmp_query_getnext( netsnmp_variable_list *, netsnmp_session *); 00105 int netsnmp_query_walk( netsnmp_variable_list *, netsnmp_session *); 00106 int netsnmp_query_set( netsnmp_variable_list *, netsnmp_session *); 00107 00108 #ifdef __cplusplus 00109 } 00110 #endif 00111 #endif /* SNMP_CLIENT_H */