⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 agent.h

📁 .net 方面的开发说明资料。
💻 H
字号:
// ========================================================
// Grid implementation
//
// Design and Implementation by Floris van den Berg
// ========================================================

#ifndef AGENT_H
#define AGENT_H

#include <assert.h>

#ifndef _LIST_
#include <list>
#endif

#ifndef _MAP_
#include <map>
#endif

#ifndef _MEMORY_
#include <memory>
#endif

#ifndef _VECTOR_
#include <vector>
#endif

#ifndef OPENNET_H
#include "OpenNet.h"
#endif

#ifndef OPENNETEXTENSIONS_H
#include "OpenNetExtensions.h"
#endif

#ifndef EVENTDISPATCHER_H
#include "EventDispatcher.h"
#endif

#ifndef BOOST_THREAD_WEK070601_HPP
#include <boost/thread/thread.hpp>
#endif

// --------------------------------------------------------

struct TransportEntry;
struct TransportInfo;
struct FilterEntry;
struct Action;
struct ITransport;
class Agent;

// --------------------------------------------------------
// Some internal structures
// --------------------------------------------------------

struct EpEventEx {
	TRANSPORT_HANDLE transport;          // transport that sent the event
	EpEvent *event;                      // the actual event
};

struct SessionProtocol {
	GUID guid;
	Protocol *protocol;
	void *self;
	int ref_count;
};

// --------------------------------------------------------
// Typedefs
// --------------------------------------------------------

typedef _STL::list<FilterEntry> EventFilterList;
typedef _STL::map<ITransport *, TransportEntry *> PlugMap;
typedef _STL::list<SessionProtocol *> ProtocolList;
typedef _STL::list<GUID> ProtocolPtrList;

// --------------------------------------------------------
// Structures
// --------------------------------------------------------

struct TransportEntry {
	ITransport *transport;
	CallbackProc callback;
	void *data;
	int thread_entry;
	bool m_enable_debug_events;
	ProtocolList protocols;
	ProtocolList::reverse_iterator protocols_it;
	_STL::list<Action *> m_queue;
	boost::mutex m_mutex;
};

// --------------------------------------------------------

static const GUID CLSID_AGENT = 
{ 0xd1a7f12f, 0x82d8, 0x483b, { 0xbb, 0xbd, 0xe2, 0xd6, 0x4b, 0xbc, 0x9a, 0x28 } };

// --------------------------------------------------------

struct IAgent {
	virtual void DLL_CALLCONV enableDebugEvents(ITransport *transport, bool enable) = 0;
	virtual TRANSPORT_HANDLE DLL_CALLCONV createTransport(const char *properties, CallbackProc callback, bool enable_debug_events, void *data) = 0;
	virtual void DLL_CALLCONV destroyTransport(ITransport *transport) = 0;
	virtual bool DLL_CALLCONV getOption(ITransport *transport, int option, void *value, int *size) = 0;
	virtual bool DLL_CALLCONV setOption(ITransport *transport, int option, void *value) = 0;
	virtual bool DLL_CALLCONV addProtocol(ITransport *transport, GUID *protocol_id) = 0;
	virtual void DLL_CALLCONV resetProtocol(ITransport *transport, GUID protocol) = 0;
	virtual void DLL_CALLCONV connect(ITransport *transport, const char *host, int port, int timeout) = 0;
	virtual void DLL_CALLCONV disconnect(ITransport *transport) = 0;
	virtual bool DLL_CALLCONV sendAction(ITransport *transport, EpAction *action) = 0;
	virtual void DLL_CALLCONV completeAction(ITransport *transport, unsigned char *data, int size) = 0;
	virtual bool DLL_CALLCONV sendRawData(ITransport *transport, unsigned char *data, int size, GUID reply_protocol, int reply_msg, int timeout) = 0;
	virtual void DLL_CALLCONV inheritedRecv(ITransport *transport, unsigned char *data, int size) = 0;
	virtual void *DLL_CALLCONV getEventRefData(ITransport *transport, int reference) = 0;
	virtual bool DLL_CALLCONV dispatchPacketSent(ITransport *transport, bool succeeded) = 0;
	virtual TransportEntry* DLL_CALLCONV findPlugEntry(ITransport *transport) = 0;
	virtual Action *DLL_CALLCONV getNextAction(ITransport *transport) = 0;
	virtual PlugMap* DLL_CALLCONV getTransportMap() = 0;
	virtual int DLL_CALLCONV getProtocolName(ITransport *transport, GUID protocol, char *name, int size) = 0;
	virtual int DLL_CALLCONV getProtocolMsgName(ITransport *transport, GUID protocol, int msg, char *name, int size) = 0;
};

// --------------------------------------------------------

HRESULT DLL_CALLCONV AgentCreate(void **iif);

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -