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

📄 cabinet.h

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

#ifndef SMTPPROTOCOL_H
#define SMTPPROTOCOL_H

#define DLL_CALLCONV __stdcall
#define _STL std

#ifdef CABINET_EXPORTS
#define SMTP_API __declspec(dllexport)
#else
#define SMTP_API __declspec(dllimport)
#endif

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

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

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

static const GUID CLSID_POP3_PROTOCOL =
{ 0x03e5e194, 0x323d, 0x4330, { 0xae, 0xf6, 0x86, 0x05, 0x8d, 0x47, 0xd0, 0x5b } };

static const GUID CLSID_SMTP_PROTOCOL =
{ 0x23a2c36e, 0xddd9, 0x49de, { 0xaf, 0x57, 0x06, 0xf1, 0xa1, 0xe0, 0x2d, 0x47 } };

static const GUID CLSID_IRC_PROTOCOL = 
{ 0xe255b27a, 0x7587, 0x49f5, { 0xbb, 0x07, 0xd1, 0x0d, 0x34, 0x1d, 0xce, 0x49 } };

static const GUID CLSID_POP3_SESSION = 
{ 0x4185ea23, 0xfcff, 0x4690, { 0x88, 0xe7, 0x6e, 0x3, 0xf2, 0x14, 0x28, 0xda } };

// ========================================================
// Session Handling
// ========================================================

struct ISession : public IUnknown {
	virtual void DLL_CALLCONV Initialize(TRANSPORT_HANDLE transport, Connection *connection) = 0; 
	virtual int DLL_CALLCONV GetProtocolCount() = 0;
	virtual void DLL_CALLCONV GetProtocols(GUID *guid) = 0;
	virtual bool DLL_CALLCONV Receive(EpEvent *event) = 0;
};

// ========================================================
// Protocol Handling
// ========================================================

#pragma pack(push, 1)
struct Pop3Top {
	int message_id;
	int max_lines;
};

struct MailRecvLogin {
	const char *username;
	const char *password;
};

struct MailMessageCount {
	int message_count;
	int octets;
};

struct MailMessageListEntry {
	int message_id;
	int octets;
};

struct MailMessageList {
	int message_count;
	MailMessageListEntry entries[1];
};
#pragma pack(pop)

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

enum POP3Events {
	POP3_REPLY_OK = 0,
	POP3_REPLY_ERROR,
	POP3_REPLY_LISTING,
	POP3_REPLY_ENDLIST,
	POP3_USER,              // [AUTHORIZATION] user name
	POP3_PASS,              // [AUTHORIZATION] password
	POP3_NOOP,              // no operation (server replies +OK)
	POP3_STAT,              // retrieves the number of mails waiting + size in octets
	POP3_LIST,              // provides information about a particular message
	POP3_RETR,              // retrieves an e-mail
	POP3_DELE,              // deletes an e-mail from the server
	POP3_UIDL,              // retrieves an unique id for a message
	POP3_RSET,              // resets messages that were marked deleted 
	POP3_QUIT,              // logs out from the pop3 server
	POP3_TOP,               // retrieves a given number of lines from a message (not always supported)
};

enum Pop3SessionEvents {
	POP3_LOGGED_IN = 0,
};

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

enum SMTPEvents {
	SMTP_REPLY_SERVICE_READY = 0,
	SMTP_REPLY_SERVICE_NOT_AVAILABLE,
	SMTP_REPLY_SERVICE_CLOSING,
	SMTP_REPLY_SYSTEM_STATUS,
	SMTP_REPLY_HELP_MESSAGE,
	SMTP_REPLY_TRANSACTION_FAILED,
	SMTP_REPLY_USER_FORWARDED,
	SMTP_REPLY_START_MAIL_INPUT,
	SMTP_REPLY_REQUESTED_MAIL_COMPLETED,
	SMTP_REPLY_MAILBOX_UNAVAILABLE,
	SMTP_REPLY_MAILBOX_BUSY,
	SMTP_REPLY_MAILBOX_NAME_NOT_ALLOWED,	
	SMTP_REPLY_LOCAL_ERROR_IN_PROCESSING,
	SMTP_REPLY_INSUFFICIENT_STORAGE,
	SMTP_REPLY_COMMAND_UNREGOGNIZED,
	SMTP_REPLY_INVALID_PARAMETERS,
	SMTP_REPLY_COMMAND_NOT_IMPLEMENTED,
	SMTP_REPLY_PARAMETER_NOT_IMPLEMENTED,
	SMTP_REPLY_BAD_SEQUENCE,
	SMTP_REPLY_USER_NOT_LOCAL,
	SMTP_REPLY_EXCEEDED_STORAGE_ALLOCATION,
	SMTP_MAIL_FROM,
	SMTP_MAIL_TO,
};

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

#pragma pack(push, 1)
struct IRCUser {
	const char *username;
	const char *hostname;
	const char *servername;
	const char *realname;
};

struct IRCStatusMessage {
	char server[64];
	char message[512];
};

struct IRCReply {
	char nickserver[64];
	char command[32];
	char trailing[32];
	char middle[128];
};

struct IRCChannelTopic {
	char server[64];
	char channel[64];
	char topic[256];
};

struct IRCPrivateMsg {
	char *target;
	char *message;
};

struct IRCReplyPrivateMsg {
	char channel[64];
	char nick[16];
	char mask[64];
	char message[512];
};

struct IRCNick {
	char nick[16];
	char mask[64];
	char channel[256];
};
#pragma pack(pop)

enum IRCEvents {
	IRC_RAW = 0,
	IRC_NOTICEAUTH,
	IRC_STATUS_MESSAGE,
	IRC_CHANNEL_TOPIC,
	IRC_NICK_ENTRY,
	IRC_JOIN,
	IRC_PART,
	IRC_QUIT,	
	IRC_PRIVMSG,
	IRC_MESSAGE,
	IRC_PING,
	IRC_CMD_USER,
	IRC_CMD_NICK,
	IRC_CMD_PASS,
	IRC_CMD_PONG,
	IRC_CMD_JOIN,
	IRC_CMD_PRIVMSG,
};

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

struct IPop3Session : public ISession {
	virtual void DLL_CALLCONV Login(const char *username, const char *password) = 0;
};

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

extern "C" {
	SMTP_API void DLL_CALLCONV OocInitialize();
	SMTP_API HRESULT DLL_CALLCONV OocCreateSession(void **iif);
};

#endif // SMTPPROTOCOL_H

⌨️ 快捷键说明

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