00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef SNMP_API_H
00012 #define SNMP_API_H
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef DONT_SHARE_ERROR_WITH_OTHER_THREADS
00028 #define SET_SNMP_ERROR(x) snmp_errno=(x)
00029 #else
00030 #define SET_SNMP_ERROR(x)
00031 #endif
00032
00033
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00062 struct variable_list;
00063 typedef struct variable_list netsnmp_variable_list;
00064 struct timeval;
00065 struct netsnmp_transport_s;
00066
00067 #define USM_AUTH_KU_LEN 32
00068 #define USM_PRIV_KU_LEN 32
00069
00075 typedef struct snmp_pdu {
00076
00077
00078
00079
00081 long version;
00083 int command;
00085 long reqid;
00087 long msgid;
00089 long transid;
00091 long sessid;
00093 long errstat;
00095 long errindex;
00097 u_long time;
00098 u_long flags;
00099
00100 int securityModel;
00102 int securityLevel;
00103 int msgParseModel;
00104
00110 void *transport_data;
00111 int transport_data_length;
00112
00117 const oid *tDomain;
00118 size_t tDomainLen;
00119
00120 netsnmp_variable_list *variables;
00121
00122
00123
00124
00125
00127 u_char *community;
00129 size_t community_len;
00130
00131
00132
00133
00135 oid *enterprise;
00136 size_t enterprise_length;
00138 long trap_type;
00140 long specific_type;
00142 unsigned char agent_addr[4];
00143
00144
00145
00146
00148 u_char *contextEngineID;
00150 size_t contextEngineIDLen;
00152 char *contextName;
00154 size_t contextNameLen;
00156 u_char *securityEngineID;
00158 size_t securityEngineIDLen;
00160 char *securityName;
00162 size_t securityNameLen;
00163
00164
00165
00166
00167
00168 int priority;
00169 int range_subid;
00170
00171 void *securityStateRef;
00172 } netsnmp_pdu;
00173
00174 struct snmp_session;
00175
00178 typedef struct snmp_session netsnmp_session;
00179
00180 typedef int (*snmp_callback) (int, netsnmp_session *, int,
00181 netsnmp_pdu *, void *);
00182 typedef int (*netsnmp_callback) (int, netsnmp_session *, int,
00183 netsnmp_pdu *, void *);
00187 struct snmp_session {
00188
00189
00190
00192 long version;
00194 int retries;
00196 long timeout;
00197 u_long flags;
00198 struct snmp_session *subsession;
00199 struct snmp_session *next;
00200
00202 char *peername;
00204 u_short remote_port;
00206 char *localname;
00208 u_short local_port;
00212 u_char *(*authenticator) (u_char *, size_t *, u_char *, size_t);
00214 netsnmp_callback callback;
00218 void *callback_magic;
00220 int s_errno;
00222 int s_snmp_errno;
00224 long sessid;
00225
00226
00227
00228
00230 u_char *community;
00232 size_t community_len;
00234 size_t rcvMsgMaxSize;
00236 size_t sndMsgMaxSize;
00237
00238
00239
00240
00242 u_char isAuthoritative;
00244 u_char *contextEngineID;
00246 size_t contextEngineIDLen;
00248 u_int engineBoots;
00250 u_int engineTime;
00252 char *contextName;
00254 size_t contextNameLen;
00256 u_char *securityEngineID;
00258 size_t securityEngineIDLen;
00260 char *securityName;
00262 size_t securityNameLen;
00263
00265 oid *securityAuthProto;
00267 size_t securityAuthProtoLen;
00269 u_char securityAuthKey[USM_AUTH_KU_LEN];
00271 size_t securityAuthKeyLen;
00273 u_char *securityAuthLocalKey;
00275 size_t securityAuthLocalKeyLen;
00276
00278 oid *securityPrivProto;
00280 size_t securityPrivProtoLen;
00282 u_char securityPrivKey[USM_PRIV_KU_LEN];
00284 size_t securityPrivKeyLen;
00286 u_char *securityPrivLocalKey;
00288 size_t securityPrivLocalKeyLen;
00289
00291 int securityModel;
00293 int securityLevel;
00295 char *paramName;
00296
00300 void *securityInfo;
00301
00305 void *myvoid;
00306 };
00307
00308
00309
00310
00311 #ifdef SNMP_NEED_REQUEST_LIST
00312 typedef struct request_list {
00313 struct request_list *next_request;
00314 long request_id;
00315 long message_id;
00316 netsnmp_callback callback;
00317 void *cb_data;
00318 int retries;
00319 u_long timeout;
00320 struct timeval time;
00321 struct timeval expire;
00322 struct snmp_session *session;
00323 netsnmp_pdu *pdu;
00324
00325 } netsnmp_request_list;
00326 #endif
00327
00328
00329
00330
00331 #define SNMP_DEFAULT_COMMUNITY_LEN 0
00332 #define SNMP_DEFAULT_RETRIES -1
00333 #define SNMP_DEFAULT_TIMEOUT -1
00334 #define SNMP_DEFAULT_REMPORT 0
00335 #define SNMP_DEFAULT_REQID -1
00336 #define SNMP_DEFAULT_MSGID -1
00337 #define SNMP_DEFAULT_ERRSTAT -1
00338 #define SNMP_DEFAULT_ERRINDEX -1
00339 #define SNMP_DEFAULT_ADDRESS 0
00340 #define SNMP_DEFAULT_PEERNAME NULL
00341 #define SNMP_DEFAULT_ENTERPRISE_LENGTH 0
00342 #define SNMP_DEFAULT_TIME 0
00343 #define SNMP_DEFAULT_VERSION -1
00344 #define SNMP_DEFAULT_SECMODEL -1
00345 #define SNMP_DEFAULT_CONTEXT ""
00346 #ifndef NETSNMP_DISABLE_MD5
00347 #define SNMP_DEFAULT_AUTH_PROTO usmHMACMD5AuthProtocol
00348 #else
00349 #define SNMP_DEFAULT_AUTH_PROTO usmHMACSHA1AuthProtocol
00350 #endif
00351 #define SNMP_DEFAULT_AUTH_PROTOLEN USM_LENGTH_OID_TRANSFORM
00352 #ifndef NETSNMP_DISABLE_DES
00353 #define SNMP_DEFAULT_PRIV_PROTO usmDESPrivProtocol
00354 #else
00355 #define SNMP_DEFAULT_PRIV_PROTO usmAESPrivProtocol
00356 #endif
00357 #define SNMP_DEFAULT_PRIV_PROTOLEN USM_LENGTH_OID_TRANSFORM
00358
00359 NETSNMP_IMPORT const char *snmp_api_errstring(int);
00360 NETSNMP_IMPORT void snmp_perror(const char *);
00361 NETSNMP_IMPORT void snmp_set_detail(const char *);
00362
00363 #define SNMP_MAX_MSG_SIZE 1472
00364 #define SNMP_MAX_MSG_V3_HDRS (4+3+4+7+7+3+7+16)
00365 #define SNMP_MAX_ENG_SIZE 32
00366 #define SNMP_MAX_SEC_NAME_SIZE 256
00367 #define SNMP_MAX_CONTEXT_SIZE 256
00368 #define SNMP_SEC_PARAM_BUF_SIZE 256
00369
00370
00371
00372
00373 #define SNMPV3_IGNORE_UNAUTH_REPORTS 0
00374
00375
00376
00377
00378 #define SNMP_SESS_NONAUTHORITATIVE 0
00379 #define SNMP_SESS_AUTHORITATIVE 1
00380 #define SNMP_SESS_UNKNOWNAUTH 2
00381
00382
00383
00384
00385 #define REPORT_STATS_LEN 9
00386 #define REPORT_snmpUnknownSecurityModels_NUM 1
00387 #define REPORT_snmpInvalidMsgs_NUM 2
00388 #define REPORT_usmStatsUnsupportedSecLevels_NUM 1
00389 #define REPORT_usmStatsNotInTimeWindows_NUM 2
00390 #define REPORT_usmStatsUnknownUserNames_NUM 3
00391 #define REPORT_usmStatsUnknownEngineIDs_NUM 4
00392 #define REPORT_usmStatsWrongDigests_NUM 5
00393 #define REPORT_usmStatsDecryptionErrors_NUM 6
00394
00395 #define SNMP_DETAIL_SIZE 512
00396
00397 #define SNMP_FLAGS_USER_CREATED 0x200
00398 #define SNMP_FLAGS_DONT_PROBE 0x100
00399 #define SNMP_FLAGS_STREAM_SOCKET 0x80
00400 #define SNMP_FLAGS_LISTENING 0x40
00401 #define SNMP_FLAGS_SUBSESSION 0x20
00402 #define SNMP_FLAGS_STRIKE2 0x02
00403 #define SNMP_FLAGS_STRIKE1 0x01
00404
00405 #define CLEAR_SNMP_STRIKE_FLAGS(x) \
00406 x &= ~(SNMP_FLAGS_STRIKE2|SNMP_FLAGS_STRIKE1)
00407
00408
00409
00410
00411
00412 #define SET_SNMP_STRIKE_FLAGS(x) \
00413 (( x & SNMP_FLAGS_STRIKE2 ) ? 1 : \
00414 ((( x & SNMP_FLAGS_STRIKE1 ) ? ( x |= SNMP_FLAGS_STRIKE2 ) : \
00415 ( x |= SNMP_FLAGS_STRIKE1 )), \
00416 0))
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426 #define SNMPERR_SUCCESS (0)
00427 #define SNMPERR_GENERR (-1)
00428 #define SNMPERR_BAD_LOCPORT (-2)
00429 #define SNMPERR_BAD_ADDRESS (-3)
00430 #define SNMPERR_BAD_SESSION (-4)
00431 #define SNMPERR_TOO_LONG (-5)
00432 #define SNMPERR_NO_SOCKET (-6)
00433 #define SNMPERR_V2_IN_V1 (-7)
00434 #define SNMPERR_V1_IN_V2 (-8)
00435 #define SNMPERR_BAD_REPEATERS (-9)
00436 #define SNMPERR_BAD_REPETITIONS (-10)
00437 #define SNMPERR_BAD_ASN1_BUILD (-11)
00438 #define SNMPERR_BAD_SENDTO (-12)
00439 #define SNMPERR_BAD_PARSE (-13)
00440 #define SNMPERR_BAD_VERSION (-14)
00441 #define SNMPERR_BAD_SRC_PARTY (-15)
00442 #define SNMPERR_BAD_DST_PARTY (-16)
00443 #define SNMPERR_BAD_CONTEXT (-17)
00444 #define SNMPERR_BAD_COMMUNITY (-18)
00445 #define SNMPERR_NOAUTH_DESPRIV (-19)
00446 #define SNMPERR_BAD_ACL (-20)
00447 #define SNMPERR_BAD_PARTY (-21)
00448 #define SNMPERR_ABORT (-22)
00449 #define SNMPERR_UNKNOWN_PDU (-23)
00450 #define SNMPERR_TIMEOUT (-24)
00451 #define SNMPERR_BAD_RECVFROM (-25)
00452 #define SNMPERR_BAD_ENG_ID (-26)
00453 #define SNMPERR_BAD_SEC_NAME (-27)
00454 #define SNMPERR_BAD_SEC_LEVEL (-28)
00455 #define SNMPERR_ASN_PARSE_ERR (-29)
00456 #define SNMPERR_UNKNOWN_SEC_MODEL (-30)
00457 #define SNMPERR_INVALID_MSG (-31)
00458 #define SNMPERR_UNKNOWN_ENG_ID (-32)
00459 #define SNMPERR_UNKNOWN_USER_NAME (-33)
00460 #define SNMPERR_UNSUPPORTED_SEC_LEVEL (-34)
00461 #define SNMPERR_AUTHENTICATION_FAILURE (-35)
00462 #define SNMPERR_NOT_IN_TIME_WINDOW (-36)
00463 #define SNMPERR_DECRYPTION_ERR (-37)
00464 #define SNMPERR_SC_GENERAL_FAILURE (-38)
00465 #define SNMPERR_SC_NOT_CONFIGURED (-39)
00466 #define SNMPERR_KT_NOT_AVAILABLE (-40)
00467 #define SNMPERR_UNKNOWN_REPORT (-41)
00468 #define SNMPERR_USM_GENERICERROR (-42)
00469 #define SNMPERR_USM_UNKNOWNSECURITYNAME (-43)
00470 #define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL (-44)
00471 #define SNMPERR_USM_ENCRYPTIONERROR (-45)
00472 #define SNMPERR_USM_AUTHENTICATIONFAILURE (-46)
00473 #define SNMPERR_USM_PARSEERROR (-47)
00474 #define SNMPERR_USM_UNKNOWNENGINEID (-48)
00475 #define SNMPERR_USM_NOTINTIMEWINDOW (-49)
00476 #define SNMPERR_USM_DECRYPTIONERROR (-50)
00477 #define SNMPERR_NOMIB (-51)
00478 #define SNMPERR_RANGE (-52)
00479 #define SNMPERR_MAX_SUBID (-53)
00480 #define SNMPERR_BAD_SUBID (-54)
00481 #define SNMPERR_LONG_OID (-55)
00482 #define SNMPERR_BAD_NAME (-56)
00483 #define SNMPERR_VALUE (-57)
00484 #define SNMPERR_UNKNOWN_OBJID (-58)
00485 #define SNMPERR_NULL_PDU (-59)
00486 #define SNMPERR_NO_VARS (-60)
00487 #define SNMPERR_VAR_TYPE (-61)
00488 #define SNMPERR_MALLOC (-62)
00489 #define SNMPERR_KRB5 (-63)
00490 #define SNMPERR_PROTOCOL (-64)
00491 #define SNMPERR_OID_NONINCREASING (-65)
00492
00493 #define SNMPERR_MAX (-65)
00494
00495 #define non_repeaters errstat
00496 #define max_repetitions errindex
00497
00498 typedef union {
00499 long *integer;
00500 u_char *string;
00501 oid *objid;
00502 u_char *bitstring;
00503 struct counter64 *counter64;
00504 #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
00505 float *floatVal;
00506 double *doubleVal;
00507
00508
00509
00510 #endif
00511 } netsnmp_vardata;
00512
00513
00518 struct variable_list {
00520 struct variable_list *next_variable;
00522 oid *name;
00524 size_t name_length;
00526 u_char type;
00528 netsnmp_vardata val;
00530 size_t val_len;
00532 oid name_loc[MAX_OID_LEN];
00534 u_char buf[40];
00536 void *data;
00538 void (*dataFreeHook)(void *);
00539 int index;
00540 };
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554 netsnmp_session *snmp_open(netsnmp_session *);
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566 int snmp_close(netsnmp_session *);
00567 int snmp_close_sessions(void);
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583 int snmp_send(netsnmp_session *, netsnmp_pdu *);
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601 int snmp_async_send(netsnmp_session *, netsnmp_pdu *,
00602 netsnmp_callback, void *);
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615 void snmp_read(fd_set *);
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626 void snmp_free_pdu(netsnmp_pdu *);
00627
00628 void snmp_free_var(netsnmp_variable_list *);
00629
00630 void snmp_free_varbind(netsnmp_variable_list * var);
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659 int snmp_select_info(int *, fd_set *, struct timeval *,
00660 int *);
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676 void snmp_timeout(void);
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710 #define NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE 1
00711 #define NETSNMP_CALLBACK_OP_TIMED_OUT 2
00712 #define NETSNMP_CALLBACK_OP_SEND_FAILED 3
00713 #define NETSNMP_CALLBACK_OP_CONNECT 4
00714 #define NETSNMP_CALLBACK_OP_DISCONNECT 5
00715
00716 long snmp_get_next_msgid(void);
00717 long snmp_get_next_reqid(void);
00718 long snmp_get_next_sessid(void);
00719 long snmp_get_next_transid(void);
00720
00721 int snmp_oid_compare(const oid *, size_t, const oid *,
00722 size_t);
00723 int snmp_oid_ncompare(const oid *, size_t, const oid *,
00724 size_t, size_t);
00725 int snmp_oidtree_compare(const oid *, size_t, const oid *,
00726 size_t);
00727 int snmp_oidsubtree_compare(const oid *, size_t, const oid *,
00728 size_t);
00729 int netsnmp_oid_compare_ll(const oid * in_name1,
00730 size_t len1, const oid * in_name2,
00731 size_t len2, size_t *offpt);
00732 int netsnmp_oid_equals(const oid *, size_t, const oid *,
00733 size_t);
00734 int netsnmp_oid_tree_equals(const oid *, size_t, const oid *,
00735 size_t);
00736 int netsnmp_oid_is_subtree(const oid *, size_t, const oid *,
00737 size_t);
00738 int netsnmp_oid_find_prefix(const oid * in_name1, size_t len1,
00739 const oid * in_name2, size_t len2);
00740 void init_snmp(const char *);
00741 u_char *snmp_pdu_build(netsnmp_pdu *, u_char *, size_t *);
00742 #ifdef NETSNMP_USE_REVERSE_ASNENCODING
00743 u_char *snmp_pdu_rbuild(netsnmp_pdu *, u_char *, size_t *);
00744 #endif
00745 int snmpv3_parse(netsnmp_pdu *, u_char *, size_t *,
00746 u_char **, netsnmp_session *);
00747 int snmpv3_packet_build(netsnmp_session *,
00748 netsnmp_pdu *pdu, u_char * packet,
00749 size_t * out_length,
00750 u_char * pdu_data,
00751 size_t pdu_data_len);
00752 int snmpv3_packet_rbuild(netsnmp_session *,
00753 netsnmp_pdu *pdu, u_char * packet,
00754 size_t * out_length,
00755 u_char * pdu_data,
00756 size_t pdu_data_len);
00757 int snmpv3_make_report(netsnmp_pdu *pdu, int error);
00758 int snmpv3_get_report_type(netsnmp_pdu *pdu);
00759 int snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data,
00760 size_t * length);
00761 u_char *snmpv3_scopedPDU_parse(netsnmp_pdu *pdu, u_char * cp,
00762 size_t * length);
00763 void snmp_store(const char *type);
00764 void snmp_shutdown(const char *type);
00765 netsnmp_variable_list *snmp_pdu_add_variable(netsnmp_pdu *, const oid *,
00766 size_t, u_char, const u_char *,
00767 size_t);
00768 netsnmp_variable_list *snmp_varlist_add_variable(netsnmp_variable_list
00769 ** varlist,
00770 const oid * name,
00771 size_t name_length,
00772 u_char type,
00773 const u_char * value,
00774 size_t len);
00775 int snmp_add_var(netsnmp_pdu *, const oid *, size_t, char,
00776 const char *);
00777 oid *snmp_duplicate_objid(const oid * objToCopy, size_t);
00778 u_int snmp_increment_statistic(int which);
00779 u_int snmp_increment_statistic_by(int which, int count);
00780 u_int snmp_get_statistic(int which);
00781 void snmp_init_statistics(void);
00782 int create_user_from_session(netsnmp_session * session);
00783 int snmp_get_fd_for_session(struct snmp_session *sessp);
00784
00785
00786
00787
00788 #ifdef NETSNMP_USE_REVERSE_ASNENCODING
00789
00790 int snmpv3_packet_realloc_rbuild(u_char ** pkt, size_t * pkt_len,
00791 size_t * offset,
00792 netsnmp_session * session,
00793 netsnmp_pdu *pdu, u_char * pdu_data,
00794 size_t pdu_data_len);
00795
00796 int snmp_pdu_realloc_rbuild(u_char ** pkt, size_t * pkt_len,
00797 size_t * offset, netsnmp_pdu *pdu);
00798 #endif
00799
00800
00801
00802
00803
00804
00805
00806 netsnmp_session *snmp_open_ex(netsnmp_session *,
00807 int (*fpre_parse) (netsnmp_session *,
00808 struct
00809 netsnmp_transport_s *,
00810 void *, int),
00811 int (*fparse) (netsnmp_session *,
00812 netsnmp_pdu *, u_char *,
00813 size_t),
00814 int (*fpost_parse) (netsnmp_session *,
00815 netsnmp_pdu *, int),
00816 int (*fbuild) (netsnmp_session *,
00817 netsnmp_pdu *, u_char *,
00818 size_t *),
00819 int (*frbuild) (netsnmp_session *,
00820 netsnmp_pdu *, u_char **,
00821 size_t *, size_t *),
00822 int (*fcheck) (u_char *, size_t));
00823
00824
00825
00826
00827
00828
00829 void snmp_set_do_debugging(int);
00830 int snmp_get_do_debugging(void);
00831
00832
00833
00834
00835
00836
00837
00838 void snmp_error(netsnmp_session *, int *, int *, char **);
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877 void snmp_sess_init(netsnmp_session *);
00878 void *snmp_sess_open(netsnmp_session *);
00879 void *snmp_sess_pointer(netsnmp_session *);
00880 netsnmp_session *snmp_sess_session(void *);
00881
00882
00883
00884
00885
00886
00887 struct netsnmp_transport_s *snmp_sess_transport(void *);
00888 void snmp_sess_transport_set(void *,
00889 struct netsnmp_transport_s *);
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904 void *snmp_sess_add_ex(netsnmp_session *,
00905 struct netsnmp_transport_s *,
00906 int (*fpre_parse) (netsnmp_session *,
00907 struct
00908 netsnmp_transport_s
00909 *, void *, int),
00910 int (*fparse) (netsnmp_session *,
00911 struct snmp_pdu *,
00912 u_char *, size_t),
00913 int (*fpost_parse) (netsnmp_session *,
00914 struct snmp_pdu *,
00915 int),
00916 int (*fbuild) (netsnmp_session *,
00917 struct snmp_pdu *,
00918 u_char *, size_t *),
00919 int (*frbuild) (netsnmp_session *,
00920 struct snmp_pdu *,
00921 u_char **, size_t *,
00922 size_t *),
00923 int (*fcheck) (u_char *, size_t),
00924 netsnmp_pdu *(*fcreate_pdu) (struct
00925 netsnmp_transport_s
00926 *,
00927 void *,
00928 size_t));
00929
00930 void *snmp_sess_add(netsnmp_session *,
00931 struct netsnmp_transport_s *,
00932 int (*fpre_parse) (netsnmp_session *,
00933 struct
00934 netsnmp_transport_s *,
00935 void *, int),
00936 int (*fpost_parse) (netsnmp_session *,
00937 netsnmp_pdu *, int));
00938
00939 netsnmp_session *snmp_add(netsnmp_session *,
00940 struct netsnmp_transport_s *,
00941 int (*fpre_parse) (netsnmp_session *,
00942 struct netsnmp_transport_s
00943 *, void *, int),
00944 int (*fpost_parse) (netsnmp_session *,
00945 netsnmp_pdu *, int));
00946 netsnmp_session *snmp_add_full(netsnmp_session * in_session,
00947 struct netsnmp_transport_s *transport,
00948 int (*fpre_parse) (netsnmp_session *,
00949 struct
00950 netsnmp_transport_s
00951 *, void *, int),
00952 int (*fparse) (netsnmp_session *,
00953 netsnmp_pdu *, u_char *,
00954 size_t),
00955 int (*fpost_parse) (netsnmp_session *,
00956 netsnmp_pdu *, int),
00957 int (*fbuild) (netsnmp_session *,
00958 netsnmp_pdu *, u_char *,
00959 size_t *),
00960 int (*frbuild) (netsnmp_session *,
00961 netsnmp_pdu *,
00962 u_char **, size_t *,
00963 size_t *),
00964 int (*fcheck) (u_char *, size_t),
00965 netsnmp_pdu *(*fcreate_pdu) (struct
00966 netsnmp_transport_s
00967 *, void *,
00968 size_t)
00969 );
00970
00971
00972
00973
00974
00975 int snmp_sess_send(void *, netsnmp_pdu *);
00976 int snmp_sess_async_send(void *, netsnmp_pdu *,
00977 netsnmp_callback, void *);
00978 int snmp_sess_select_info(void *, int *, fd_set *,
00979 struct timeval *, int *);
00980 int snmp_sess_read(void *, fd_set *);
00981 void snmp_sess_timeout(void *);
00982 int snmp_sess_close(void *);
00983
00984 void snmp_sess_error(void *, int *, int *, char **);
00985 void netsnmp_sess_log_error(int priority,
00986 const char *prog_string,
00987 netsnmp_session * ss);
00988 void snmp_sess_perror(const char *prog_string,
00989 netsnmp_session * ss);
00990 const char * snmp_pdu_type(int type);
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007 #define STAT_SNMPUNKNOWNSECURITYMODELS 0
01008 #define STAT_SNMPINVALIDMSGS 1
01009 #define STAT_SNMPUNKNOWNPDUHANDLERS 2
01010 #define STAT_MPD_STATS_START STAT_SNMPUNKNOWNSECURITYMODELS
01011 #define STAT_MPD_STATS_END STAT_SNMPUNKNOWNPDUHANDLERS
01012
01013
01014
01015
01016 #define STAT_USMSTATSUNSUPPORTEDSECLEVELS 3
01017 #define STAT_USMSTATSNOTINTIMEWINDOWS 4
01018 #define STAT_USMSTATSUNKNOWNUSERNAMES 5
01019 #define STAT_USMSTATSUNKNOWNENGINEIDS 6
01020 #define STAT_USMSTATSWRONGDIGESTS 7
01021 #define STAT_USMSTATSDECRYPTIONERRORS 8
01022 #define STAT_USM_STATS_START STAT_USMSTATSUNSUPPORTEDSECLEVELS
01023 #define STAT_USM_STATS_END STAT_USMSTATSDECRYPTIONERRORS
01024
01025
01026
01027
01028 #define STAT_SNMPINPKTS 9
01029 #define STAT_SNMPOUTPKTS 10
01030 #define STAT_SNMPINBADVERSIONS 11
01031 #define STAT_SNMPINBADCOMMUNITYNAMES 12
01032 #define STAT_SNMPINBADCOMMUNITYUSES 13
01033 #define STAT_SNMPINASNPARSEERRS 14
01034
01035
01036
01037 #define STAT_SNMPINTOOBIGS 16
01038 #define STAT_SNMPINNOSUCHNAMES 17
01039 #define STAT_SNMPINBADVALUES 18
01040 #define STAT_SNMPINREADONLYS 19
01041 #define STAT_SNMPINGENERRS 20
01042 #define STAT_SNMPINTOTALREQVARS 21
01043 #define STAT_SNMPINTOTALSETVARS 22
01044 #define STAT_SNMPINGETREQUESTS 23
01045 #define STAT_SNMPINGETNEXTS 24
01046 #define STAT_SNMPINSETREQUESTS 25
01047 #define STAT_SNMPINGETRESPONSES 26
01048 #define STAT_SNMPINTRAPS 27
01049 #define STAT_SNMPOUTTOOBIGS 28
01050 #define STAT_SNMPOUTNOSUCHNAMES 29
01051 #define STAT_SNMPOUTBADVALUES 30
01052
01053
01054
01055 #define STAT_SNMPOUTGENERRS 32
01056 #define STAT_SNMPOUTGETREQUESTS 33
01057 #define STAT_SNMPOUTGETNEXTS 34
01058 #define STAT_SNMPOUTSETREQUESTS 35
01059 #define STAT_SNMPOUTGETRESPONSES 36
01060 #define STAT_SNMPOUTTRAPS 37
01061
01062
01063
01064 #define STAT_SNMPSILENTDROPS 39
01065 #define STAT_SNMPPROXYDROPS 40
01066 #define STAT_SNMP_STATS_START STAT_SNMPINPKTS
01067 #define STAT_SNMP_STATS_END STAT_SNMPPROXYDROPS
01068
01069
01070
01071
01072 #define STAT_SNMPUNAVAILABLECONTEXTS 41
01073 #define STAT_SNMPUNKNOWNCONTEXTS 42
01074 #define STAT_TARGET_STATS_START STAT_SNMPUNAVAILABLECONTEXTS
01075 #define STAT_TARGET_STATS_END STAT_SNMPUNKNOWNCONTEXTS
01076
01077 #define MAX_STATS 43
01078
01079 #ifdef __cplusplus
01080 }
01081 #endif
01082 #endif