• 大小: 1.15MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-09
  • 语言: 其他
  • 标签: snmp  agent++  代理  

资源简介

本程序是用agnt++写的代理端程序,包括get,set请求,和trap发送过程。

资源截图

代码片段和文件信息

// Agent.cpp : Defines the class behaviors for the application.
//

#include “stdafx.h“
#include “Agent.h“

#include “MainFrm.h“
#include “pcap.h“
#include “SNMPAgent.h“

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAgentApp

BEGIN_MESSAGE_MAP(CAgentApp CWinApp)
//{{AFX_MSG_MAP(CAgentApp)
ON_COMMAND(ID_APP_ABOUT OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
//    DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAgentApp construction

CAgentApp::CAgentApp()
{
// TODO: add construction code here
// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CAgentApp object

//全局变量及原型说明
CRITICAL_SECTION g_lock; //同步资源锁
pcap_t * g_fp = NULL;
CSNMPAgent *g_agent = new CSNMPAgent;
UINT StartCapture(LPVOID pParam);
void packet_handler(u_char *pParamconst struct pcap_pkthdr *header
const u_char *pkt_data);
//UINT Analyse(UINT data_length const UCHAR *packet_data);
int AnalysePackage(UINT len const UCHAR *package);

CAgentApp theApp;
int GetConfig();

/////////////////////////////////////////////////////////////////////////////
// CAgentApp initialization

BOOL CAgentApp::InitInstance()
{
AfxEnableControlContainer();

// Standard initialization
// If you are not using these features and wish to reduce the size
//  of your final executable you should remove from the following
//  the specific initialization routines you do not need.

#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T(“Local AppWizard-Generated Applications“));


// To create the main window this code creates a new frame window
// object and then sets it as the application‘s main window object.

CMainframe* pframe = new CMainframe;
m_pMainWnd = pframe;

// create and load the frame with its resources

pframe->Loadframe(IDR_MAINframe
WS_OVERLAPPEDWINDOW | FWS_ADDTOtitle NULL
NULL);

// The one and only window has been initialized so show and update it.
//pframe->ShowWindow(SW_SHOW);
pframe->ShowWindow(SW_MINIMIZE);
pframe->UpdateWindow();

//启动监听
LoadAdapter();
GetConfig();

InitializeCriticalSection(&g_lock);

return TRUE;
}

int CAgentApp::ExitInstance() 
{
// TODO: Add your specialized code here and/or call the base class
DeleteCritic

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     目录          0  2006-04-02 11:47  Agent\Debug

     文件       4012  2005-11-30 14:43  Agent\include\winpcap\bittypes.h

     文件       2133  2005-11-30 14:43  Agent\include\winpcap\bucket_lookup.h

     文件       2113  2005-11-30 14:43  Agent\include\winpcap\count_packets.h

     文件       3963  2005-11-30 14:43  Agent\include\winpcap\Devioctl.h

     文件        833  2005-11-30 14:43  Agent\include\winpcap\Gnuc.h

     文件       5752  2005-11-30 14:43  Agent\include\winpcap\ip6_misc.h

     文件       4140  2005-11-30 14:43  Agent\include\winpcap\memory_t.h

     文件       2185  2005-11-30 14:43  Agent\include\winpcap\normal_lookup.h

     文件      48556  2005-11-30 14:43  Agent\include\winpcap\Ntddndis.h

     文件       1292  2005-11-30 14:43  Agent\include\winpcap\Ntddpack.h

     文件      21642  2005-11-30 14:43  Agent\include\winpcap\Packet32.h

     文件      22732  2005-11-30 14:43  Agent\include\winpcap\pcap-bpf.h

     文件      13101  2005-11-30 14:43  Agent\include\winpcap\pcap-int.h

     文件       2292  2005-11-30 14:43  Agent\include\winpcap\pcap-stdinc.h

     文件      11559  2005-11-30 14:43  Agent\include\winpcap\pcap.h

     文件      35625  2005-11-30 14:43  Agent\include\winpcap\pthread.h

     文件      13813  2005-11-30 14:43  Agent\include\winpcap\remote-ext.h

     文件       4726  2005-11-30 14:43  Agent\include\winpcap\sched.h

     文件       4265  2005-11-30 14:43  Agent\include\winpcap\semaphore.h

     文件       2969  2005-11-30 14:43  Agent\include\winpcap\tcp_session.h

     文件      10659  2005-11-30 14:43  Agent\include\winpcap\time_calls.h

     文件       6060  2005-11-30 14:43  Agent\include\winpcap\tme.h

     文件       3364  2005-11-30 14:43  Agent\include\winpcap\Win32-Extensions.h

    ..AD...         0  2006-04-02 11:47  Agent\include\winpcap

     文件      20084  2005-11-30 14:43  Agent\include\snmp_pp\address.h

     文件      17835  2005-11-30 14:43  Agent\include\snmp_pp\asn1.h

     文件      20460  2005-11-30 14:43  Agent\include\snmp_pp\auth_priv.h

     文件       3580  2005-11-30 14:43  Agent\include\snmp_pp\collect.h

     文件       7438  2005-11-30 14:43  Agent\include\snmp_pp\collect1.h

............此处省略121个文件信息

评论

共有 条评论