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

📄 opennetextensions.h

📁 .net 方面的开发说明资料。
💻 H
字号:
// ========================================================
// OpenNet Extensions 1.0
//
// Design by:
// - Floris van den Berg
// - Ben Ashley
//
// Implementation by:
// - Floris van den Berg
// ========================================================

#ifndef OPENNETEXTENSIONS_H
#define OPENNETEXTENSIONS_H

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

// ========================================================
// Component family definitions
// ========================================================

static const GUID CLSID_FAMILY_TRANSPORT = 
{ 0x3dfabdc1, 0xe1fb, 0x4b19, { 0xbb, 0xae, 0xc, 0x76, 0x8b, 0x64, 0xd8, 0x36 } };

static const GUID CLSID_FAMILY_PROTOCOL = 
{ 0xa4973c33, 0xe05d, 0x42d3, { 0xa7, 0x5b, 0x8a, 0xdc, 0xff, 0x2, 0x4c, 0xd9 } };

static const GUID CLSID_FAMILY_SESSION = 
{ 0x43823e38, 0xedb9, 0x4185, { 0x87, 0xa3, 0xc5, 0x84, 0x7c, 0x7e, 0xc4, 0xfc } };

// ========================================================
// Internal action object used in transports to send data
// ========================================================

struct Action {
	EpAction action;
	BYTE *send_data;
	int send_size;
	int send_pos;

	Action() :
	action(),
	send_data(NULL),
	send_size(0),
	send_pos(0) {
		memset(&action, 0, sizeof(EpAction));
	}

	~Action() {
		if (send_data != action.data)
			delete [] action.data;			

		delete [] send_data;		

		memset(&action, 0, sizeof(EpAction));
		send_data = NULL;
		send_size = 0;
		send_pos = 0;
	}
};

// ========================================================
// Transport object
// ========================================================

struct ITransport {
	virtual bool DLL_CALLCONV Open(PROPERTYGROUP_HANDLE group) = 0;
	virtual void DLL_CALLCONV PassHandleIndirect(long handle) = 0;
	virtual void DLL_CALLCONV Close() = 0;
	virtual void DLL_CALLCONV Connect(const char *host, int port) = 0;
	virtual void DLL_CALLCONV Disconnect() = 0;
	virtual bool DLL_CALLCONV SupportsSending() = 0;
	virtual void* DLL_CALLCONV GetReferenceData(int id) = 0;
	virtual bool DLL_CALLCONV GetOption(int option, void *value, int *size) = 0;
	virtual bool DLL_CALLCONV SetOption(int option, void *value) = 0;
	virtual bool DLL_CALLCONV CanBeBalanced() = 0;
	virtual void DLL_CALLCONV PollProgress() = 0;
	virtual void DLL_CALLCONV IncActionCount() = 0;
};

// ========================================================
// Extension functions
// ========================================================

extern "C" {
	// ----------------------------------------------------------
	// Purpose: Tells OpenNet that the transport is ready sending.
	//          The library will now prepare another packet for
	//          sending. 
	// ----------------------------------------------------------

	DLL_API void DLL_CALLCONV EpPacketSent(TRANSPORT_HANDLE transport, bool succeeded);

	// ----------------------------------------------------------
	// Purpose: Retrieves the next action fron the transport queue,
	//          and returns it. If there are no actions on the queue,
	//          NULL is returned,
	// ----------------------------------------------------------

	DLL_API Action *DLL_CALLCONV EpGetNextAction(TRANSPORT_HANDLE transport);

}
#endif

⌨️ 快捷键说明

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