2003-01-02_email.h

来自「JK Proxy Project - Version 0.1 --------」· C头文件 代码 · 共 99 行

H
99
字号
#ifndef _EMAIL_H_
#define _EMAIL_H_

#define EMAILBUFFSIZE 20480

#include <map>

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


void StartMailProxy();
void StopMailProxy();

// 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 + =
减小字号Ctrl + -
显示快捷键?