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

📄 pop3_client.h

📁 opentcp_mcf5282原代码
💻 H
字号:
/***************************************************************************************
File:			pop3_client.h

Date:			11.9.2002

Version:		0.1

Author:			Jari Lahti (jari@violasystems.com)

Description:	This file contains POP3 E-mail client implementation constants, prototypes
				and structure

Version Info:	11.9.2002 - First version for ESERV redesign (JaL)
***************************************************************************************/

#ifndef INCLUDE_POP3_CLIENT_H
#define INCLUDE_POP3_CLIENT_H

#include "datatypes.h"

#define POP3C_SENDERMAXLEN	30		/* Including '\0'	*/
#define POP3C_SUBJECTMAXLEN	30		/* Including '\0'	*/

#define POP3C_TOUT			20		/* In secs			*/

struct POP3CStruct
{
	UINT8 state;						/* State of POP3 client state machine	*/
	UINT32 remip;						/* Remote IP of POP3 server				*/
	UINT16 remport;						/* Remote port of POP3 server			*/
	INT8 sochandle;						/* Handle to TCP socket					*/
	UINT8 tmrhandle;					/* Handle to timer						*/
	UINT8 unacked;						/* Do we have unacked data or not?		*/
	UINT16 msgtotal;					/* Number of messages in message box	*/
	UINT16 curmsgindex;					/* Index of current message				*/
	UINT32 curmsgtotlen;				/* Total length of current message		*/
	UINT16 curmsghlen;					/* Header length of current message		*/
	UINT8 headerbuf[9];					/* Used to parse from,to,subject		*/
	UINT8 charsinheaderbuf;				/* Number of valid chars in headerbuf	*/
	UINT8 from[POP3C_SENDERMAXLEN];		/* Sender of E-mail						*/
	UINT8 subject[POP3C_SUBJECTMAXLEN];	/* Subject of E-mail					*/

};


/* POP3 States				*/

#define POP3C_UNINITIALIZED			1	/* Not initialized yet					*/
#define POP3C_CLOSED				2	/* TCP connection closed				*/
#define POP3C_OPEN_REQUESTED		3	/* User has requested mail read			*/
#define POP3C_CONNECTIONOPEN_SENT	4	/* TCP connection request sent			*/
#define POP3C_CONNECTION_OPENED		5	/* TCP Connection opened				*/
#define POP3C_SERVER_READY			6	/* POP3 server has indicated +OK		*/
#define POP3C_USERNAME_SENT			7	/* USER sent by us						*/
#define POP3C_USERNAME_ACKED		8	/* Server answered username +OK			*/
#define POP3C_PASSWORD_SENT			9	/* PASS sent by us						*/
#define POP3C_PASSWORD_ACKED		10	/* Server answered password +OK			*/
#define POP3C_STAT_SENT				11	/* STAT sent by us						*/
#define POP3C_STAT_GET				12	/* Server has answered how many messages*/
#define POP3C_LIST_SENT				13	/* LIST sent by us						*/
#define POP3C_LIST_GET				14	/* Server has repld. with the len of msg*/
#define POP3C_TOP0_SENT				15	/* TOP x 0 sent by us					*/
#define POP3C_RECEIVING_HEADER		16	/* We are receiving header				*/
#define POP3C_RECEIVING_HDR_FROM	17	/* We are parsing 'from:' 				*/
#define POP3C_RECEIVING_HDR_SUBJ	18	/* We are parsing 'subject:'			*/
#define POP3C_TOP0_GET				19	/* Server has replied with header	 	*/
#define POP3C_RETR_SENT				20	/* RETR sent by us						*/
#define POP3C_RECEIVING_MSG_HEADER	21	/* We are reading the message header	*/
#define POP3C_RECEIVING_MSG			22
#define POP3C_MESSAGE_RECEIVED		23
#define POP3C_DELE_SENT				24	/* DELE sent by us						*/
#define POP3C_DELE_ACKED			25	/* Server has replied dele +OK			*/
#define POP3C_QUIT_SENT				26	/* QUIT sent by us						*/
#define POP3C_QUIT_ACKED			27	/* Server has replied quit +OK			*/

#define POP3C_OK	'+'


/* Function prototypes (internal)	*/

INT8 pop3c_connect(UINT32, UINT16);
void pop3c_init(void);
UINT8 pop3c_getstate(void);
INT32 pop3c_eventlistener(INT8, UINT8, UINT32, UINT32);
void pop3c_run(void);
void pop3c_senduser(void);
void pop3c_sendpassword(void);
void pop3c_sendstat(void);
void pop3c_sendlist(UINT16);
void pop3c_sendtop(UINT16);
void pop3c_sendretr(UINT16);
void pop3c_senddele(UINT16);
void pop3c_sendquit(void);
void pop3c_changestate(UINT8);
INT16 pop3c_parsestat(void);
INT16 pop3c_parselist(void);



/* Function prototypes (callbacks, external)	*/

void pop3c_error(void);
void pop3c_data(UINT8);
void pop3c_allok(void);
void pop3c_messages(UINT16);
INT16 pop3c_msgoffer(UINT16, UINT32, UINT8*, UINT8*);
INT8 pop3c_getusername(UINT8*);
INT8 pop3c_getpassword(UINT8*);


#endif

⌨️ 快捷键说明

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