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

📄 email.h

📁 JK Proxy Project - Version 0.1 ------------------------------ This was going to be a proxy serve
💻 H
字号:
#ifndef _EMAIL_H_
#define _EMAIL_H_

#define EMAILBUFFSIZE 20480

#include <map>

#ifdef WIN32
	#include "windows.h"
#endif


bool StartMailProxy();
void StopMailProxy();
void DoEmailJobs();

// pre-defines messages
#define MSG_NOTALLOWED "-ERR this command is not allowed at this state \x0D\x0A\0"

// emumeration for connection states
enum EMAILCONNSTATE {
	// authorization
	ECS_CSENTHELLO,		// sent hello to client, waiting for username
	ECS_SCONNECT,		// connecting to server
	ECS_SSENTUSR,		// sent username to server
	ECS_CWAITPASS,		// waiting for password from client
	ECS_SSENTPASS,		// forwarded passwort to server
	ECS_READY,			// ready

	// transaction / server
	ECS_SSENTSTAT,		// sent STAT command to server
	ECS_SMSGLIST,		// receiving msg list from server
	ECS_SMSG,			// receiving a message from server
	ECS_SDELETE			// deleting message from server

	// transaction / client
};


// server & username info struct, send by client in USER command
struct SERVERUSER
{
	CHARPTR server;
	USHORT port;

	CHARPTR user;
};

// struct that contains information about emails waiting 
// to be requested by the client
struct SERVERMAILS
{
	UINT nummails;		// number of emaisl
	CHARPTR* paths;		// array of pointers to email files on HD
	UINT* sizes;		// array of integers that contain sizes of files
	UINT fullsize;		// complete size of all emails
};


// email-connection struct
struct EMAILCONN
{

	UINT clientsock;
	UINT serversock;
	CHARPTR ipaddr;		// ip-address string


	EMAILCONNSTATE state;
	bool mailschecked;	// saves if emails have already been retrieved from the server
	UINT savecommand;	// used to save client command when emails als retrieved from server
	UINT savenum;		// used to save msg number belonging to command above

	CHARPTR username;	// save real username until connected to server

	CHARPTR cbuff;		// local buffer for incoming data
	UINT cbuffused;		// number of bytes used in buffer

	CHARPTR sbuff;		// local buffer for incoming data
	UINT sbuffused;		// number of bytes used in buffer

	bool first;			// 
	UINT srvnummails;	// number of emails on server
	UINT srvcurmsg;		// number of current message to be downloaded
	UINT* srvmsglen;	// array of integers to msg length
	CHARPTR srvmail;	// pointer to mail contents
	UINT srvmaillen;	// current number of bytes being used in buffer
	CHARPTR msgdir;		// message directory
	SERVERMAILS* srvm;	// server mails

};



// maps from socks to EMAILCONN structs
typedef std::map<UINT, EMAILCONN*> MAILCONNMAP;
typedef std::map<UINT, EMAILCONN*>* MAILCONNMAPPTR;


#endif

⌨️ 快捷键说明

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