snmp++资料急需(谢谢各位大侠光顾)

cloudstrife 2001-07-02 03:18:07
小弟近日急需snmp++开发包的snmp_pp.h头文件,希望哪位大侠如果有的话,帮忙指点迷津,谢谢了!
...全文
166 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
burntorun 2001-07-02
  • 打赏
  • 举报
回复
/*_############################################################################
_##
_## snmp_pp.h
_##
_## SNMP++v3.0.2
_## ------------------------------
_## Copyright (c) 2000 Jochen Katz
_##
_## This software is based on SNMP++2.6 from Hewlett Packard:
_##
_## Copyright (c) 1996
_## Hewlett-Packard Company
_##
_## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
_## Permission to use, copy, modify, distribute and/or sell this software
_## and/or its documentation is hereby granted without fee. User agrees
_## to display the above copyright notice and this license notice in all
_## copies of the software and any documentation of the software. User
_## agrees to assume all liability for the use of the software;
_## Hewlett-Packard and Jochen Katz make no representations about the
_## suitability of this software for any purpose. It is provided
_## "AS-IS" without warranty of any kind, either express or implied. User
_## hereby grants a royalty-free license to any and all derivatives based
_## upon this software code base.
_##
_## Karlsruhe, Germany, Tue Mar 6 15:03:38 MET 2001
_##
_##########################################################################*/
/*===================================================================

Copyright (c) 1999
Hewlett-Packard Company

ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
Permission to use, copy, modify, distribute and/or sell this software
and/or its documentation is hereby granted without fee. User agrees
to display the above copyright notice and this license notice in all
copies of the software and any documentation of the software. User
agrees to assume all liability for the use of the software; Hewlett-Packard
makes no representations about the suitability of this software for any
purpose. It is provided "AS-IS without warranty of any kind,either express
or implied. User hereby grants a royalty-free license to any and all
derivatives based upon this software code base.



SNMP++ S N M P_PP . H

SNMP CLASS DEFINITION

VERSION
2.84

RCS INFO:
$Header: /tm/users/u0/katz/work/SNMPv3/snmp++/include/RCS/snmp_pp.h,v 2.0 2000/05/24 19:40:13 katz Exp katz $

DESCRIPTION:
SNMP class defintion. The Snmp class provides an object oriented
approach to SNMP. The SNMP class is an encapsulation of SNMP
sessions, gets, sets and get nexts. The class manages all SNMP
resources and provides complete retry and timeout capability.
This file is portable. It does not rely on any WinSnmp or any
other snmp libraries. The matching implementation of this file
is platform specific.

DESIGN:
Peter E Mellquist

AUTHOR:
Peter E Mellquist

LANGUAGE:
ANSI C++

OPERATING SYSTEMS:
Win32
BSD UNIX

=====================================================================*/

#ifndef _SNMP_CLS
#define _SNMP_CLS

//------[ C externals ]------------------------------------------------
extern "C"
{
#include <memory.h> // memcpy's
#include <string.h> // strlen, etc..
}

//-----[ snmp++ classes ]------------------------------------------------
#include "config.h" // config file (SNMPv3)
#include "oid.h" // snmp++ oid class
#include "vb.h" // snbmp++ vb class
#include "target.h" // snmp++ target class
#include "pdu.h" // snmp++ pdu class
#include "snmperrs.h" // error macros and strings
#include "address.h" // snmp++ address class defs

#ifdef _SNMPv3
#include "v3.h" // SNMPv3
#endif

// WinSNMP is not supported by SNMP++v3.0
// so the unix functions need to be included on
// non UNIX systems too
#include "eventlist.h"

#include <reentrant.h>

//-----[ internally used defines ]----------------------------------------
#define MAX_SNMP_PACKET 2048 // maximum snmp packet len
#define MAXNAME 80 // maximum name length
#define MAX_ADDR_LEN 10 // maximum address len, ipx is 4+6
#define SNMP_SHUTDOWN_MSG 0x0400+177 // shut down msg for stoping a blocked message

//-----[ async defines for engine ]---------------------------------------
#define sNMP_PDU_GET_ASYNC 21
#define sNMP_PDU_GETNEXT_ASYNC 22
#define sNMP_PDU_SET_ASYNC 23
#define sNMP_PDU_GETBULK_ASYNC 24
#define sNMP_PDU_INFORM_ASYNC 25

//-----[ trap / notify macros ]-------------------------------------------
#define IP_NOTIFY 162 // IP notification
#define IPX_NOTIFY 0x2121 // IPX notification


//------[ forward declaration of Snmp class ]-----------------------------
class Snmp;

//-----------[ async methods callback ]-----------------------------------
// async methods require the caller to provide a callback
// address of a function with the following typedef
typedef void (*snmp_callback)( int, // reason
Snmp*, // session handle
Pdu &, // pdu passsed in
SnmpTarget &, // source target
void * ); // optional callback data

#ifdef _SNMPv3
struct V3CallBackData {
Pdu *pdu;
long int non_reps;
long int max_reps;
SnmpTarget *target;
snmp_callback oldCallback ;
const void * cbd;
};
#endif

//------------[ SNMP Class Def ]---------------------------------------------
//
class DLLOPT Snmp: public SnmpSynchronized {


public:
//------------------[ constructor,blocked usage ]---------------------
Snmp( int &status, const u_short out_port=0); // construction status

//-------------------[ destructor ]------------------------------------
virtual ~Snmp();

//-------------------[ returns error string ]--------------------------
const char * error_msg( const int c);
#ifdef _SNMPv3
const char* error_msg(const Oid& v3Oid);
#endif

//----------------------[ cancel a pending request ]--------------------
virtual int cancel( const unsigned long rid);

//------------------------[ get ]---------------------------------------
virtual int get( Pdu &pdu, // pdu to get
SnmpTarget &target); // get target

//------------------------[ get async ]----------------------------------
virtual int get( Pdu &pdu, // pdu to get async
SnmpTarget &target, // destination target
const snmp_callback callback, // async callback to use
const void * callback_data=0); // callback data

//------------------------[ get next ]-----------------------------------
virtual int get_next( Pdu &pdu, // pdu to get_next
SnmpTarget &target); // get target

//------------------------[ get next async ]-----------------------------
virtual int get_next( Pdu &pdu, // pdu to get_next async
SnmpTarget &target, // destination target
const snmp_callback callback, // async callback to use
const void * callback_data=0); // callback data

//-------------------------[ set ]---------------------------------------
virtual int set( Pdu &pdu, // pdu to set
SnmpTarget &target); // target address

//------------------------[ set async ]----------------------------------
virtual int set( Pdu &pdu, // pdu to set async
SnmpTarget &target, // destination target
const snmp_callback callback, // async callback
const void * callback_data=0); // callback data

//-----------------------[ get bulk ]------------------------------------
virtual int get_bulk( Pdu &pdu, // pdu to get_bulk
SnmpTarget &target, // destination target
const int non_repeaters, // number of non repeaters
const int max_reps); // maximum number of repetitions

//-----------------------[ get bulk async ]------------------------------
virtual int get_bulk( Pdu &pdu, // pdu to get_bulk async
SnmpTarget &target, // destination target
const int non_repeaters, // number of non repeaters
const int max_reps, // max repeaters
const snmp_callback callback, // async callback
const void *callback_data=0); // callback data


//-----------------------[ send a trap ]----------------------------------
virtual int trap( Pdu &pdu, // pdu to send
SnmpTarget &target); // destination target


//-----------------------[ send a v3 report ]-----------------------------
virtual int report( Pdu &pdu, // pdu to send
SnmpTarget *target); // destination target

//----------------------[ blocking inform, V2 only]------------------------
virtual int inform( Pdu &pdu, // pdu to send
SnmpTarget &target); // destination target

//----------------------[ asynch inform, V2 only]------------------------
virtual int inform( Pdu &pdu, // pdu to send
SnmpTarget &target, // destination target
const snmp_callback callback, // callback function
const void * callback_data=0); // callback data

//-------------------------[ response ]----------------------------------
virtual int response( Pdu &pdu, // pdu to send
SnmpTarget &target); // target address

virtual int send_raw_data( unsigned char *send_buf,
size_t send_len, UdpAddress &address,
int fd = 0);

//-----------------------[ register to get informs]-------------------------
virtual int notify_register( const OidCollection &trapids, // ids to listen for
const TargetCollection &targets, // targets to listen for
const snmp_callback callback, // callback to use
const void *callback_data=0); // callback data

//-----------------------[ register to get informs]-------------------------
virtual int notify_register( const OidCollection &trapids, // ids to listen for
const TargetCollection &targets, // targets to listen for
const AddressCollection &listen_addresses, // interfaces to listen on
const snmp_callback callback, // callback to use
const void *callback_data=0); // callback data


//-----------------------[ un-register to get traps]----------------------
virtual int notify_unregister();

//-----------------------[ get notify register info ]---------------------
virtual int get_notify_filter( OidCollection &trapids, TargetCollection &targets);


//-----------------------[ access the trap reception info ]---------------
snmp_callback get_notify_callback();

void * get_notify_callback_data();

//-----------[ Snmp Engine ]----------------------------------------
// gets, sets and get nexts go through here....
// This mf does all snmp sending (using sendMsg) and reception
// except for traps which are sent using trap().
int snmp_engine( Pdu &pdu, // pdu to use
long int non_reps, // get bulk only
long int max_reps, // get bulk only
SnmpTarget &target, // destination target
const snmp_callback cb, // async callback function
const void *cbd); // callback data

protected:

//---[ instance variables ]
#ifdef WIN32
unsigned long iv_snmp_session;
#else
SNMPHANDLE iv_snmp_session; // session handle
#endif
SNMPHANDLE pdu_handler; // pdu handler win proc
int construct_status; // status of construction

// inform receive member variables
TargetCollection *notify_targets;
OidCollection *notify_ids;
AddressCollection *listen_addresses;
snmp_callback notifycallback;
void * notifycallback_data;


//-----------[ Snmp sendMsg ]---------------------------------
// send a message using whatever underlying stack is available.
//
int sendMsg( SnmpTarget &target, // target of send
Pdu &pdu, // the pdu to send
long int non_reps, // # of non repititions
long int max_reps, // # of max repititions
long int request_id); // id to use in send

};

#endif //_SNMP_CLS
cloudstrife 2001-07-02
  • 打赏
  • 举报
回复
没有人知道吗????

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧