📄 smtp.h
字号:
/****************************************************************************** Copyright (C) 2005 UTStarcom (Hangzhou) Telecom Co., Ltd. All rights reserved. Contains confidential proprietary information of UTStarcom, Inc. Reverse engineering is prohibited. The copyright notice does not imply publication. Project Name: Project No. : File Name : Smtp.h Module : Email Description : ************** REVISION HISTORY ******************************************* Date Author Reference =========== ========== ========================== 2005-06-20 TangJun Initial version ******************************************************************************/#ifndef _SMTP_H#define _SMTP_H#include "email.h"/* The internal macro definition of SMTP */#define SMTP_TASK_PRIORITY 100#define SMTP_STACK_SIZE 4096#define SMTP_PORT 25#define SMTPLOG printf/* Different commands of SMTP to the server */typedef enum{ SMTP_ABORT_CMD = 0, /* Not used actually, just the initial value */ SMTP_OPEN_CMD, /* Open the TCP connection */ SMTP_EHLO_CMD, /* 'EHLO' command identifies itself */ SMTP_HELO_CMD, /* 'HELO' command identifies itself */ SMTP_AUTH_CMD, /* 'AUTH' command to indicate authentication type */ SMTP_USERPASS_CMD, /* User name and password information to authorize */ SMTP_MAIL_CMD, /* 'MAIL' command to indicate the reverse path */ SMTP_RCPT_CMD, /* 'RCPT' command to indicate the forward path(s) */ SMTP_DATA_CMD, /* 'DATA' command to indicate transmitting of data */ SMTP_XMIT_CMD, /* Begin to transmit email data */ SMTP_RSET_CMD, /* 'RSET' command to cancel of the email sending */ SMTP_QUIT_CMD, /* 'QUIT' command to close the connection */ /* The next commands defined for expansion */ SMTP_NOOP_CMD, /* 'NOOP' command requires OK reply */ SMTP_SEND_CMD, /* 'SEND' command requires the email delivered to the user terminal */ SMTP_SOML_CMD, /* 'SOML' command requires the email delivered to the user terminal or mailbox */ SMTP_SAML_CMD, /* 'SAML' command requires the email delivered to the user terminal and mailbox */ SMTP_VRFY_CMD, /* 'VRFY' command asks the receiver to identify the user */ SMTP_MAX_CMD} SmtpCmdType;/* Different commands from PM to SMTP */typedef enum{ SMTP_SEND_EMAIL = 0, /* Command to send email to Smtp server */ SMTP_CANCEL_SEND, /* Command to cancel the sending of email */ SMTP_PM_MAX_CMD /* Max command to SMTP */} SmtpPmCmdType;/* the structure of SMTP control */typedef struct{ SmtpPmCmdType pmCmd; /* PM command received */ SmtpCmdType lastCmd; /* last command sent to the smtp server */ SmtpCmdType nextCmd; /* next command will be sent to the server */ int sock; /* the descriptor referencing the socket */ int numberEmail; /* the total number of the emails will be sent */ int numberTo; /* the total number of the To emails */ int numberCc; /* the total number of the Cc emails */ int numberBcc; /* the total number of the Bcc emails */ int currentEmail; /* the sequence number of email current sending */ BOOL isValidRecipient; /* there is one recipient at least */ char authType[12]; /* the Authentication type */ void (*cb)(EMAIL_ERROR_TYPE *err); /* the callback function to inform error of email sending */} SmtpType;/* Different methods of ESMTP authentication */typedef enum { ESMTP_NULL = 0, /* No authentication */ ESMTP_LOGIN, /* "LOGIN" */ ESMTP_PLAIN, /* "PLAIN" */ ESMTP_DIGEST_MD5, /* "DIGEST-MD5" */ ESMTP_CRAM_MD5, /* "CRAM-MD5" */ ESMTP_GSSAPI, /* "GSSAPI" */ ESMTP_KERBEROS_V4 /* "KERBEROS_V4" */} ESmtpAuthType;/* Message structure PM ->SMTP */typedef struct{ SmtpPmCmdType SmtpCmd; U8 bbuf[4];} MsgSmtp;#ifdef __cplusplusextern "C" {#endif /* __cplusplus *//* the structure of SMTP control */SmtpType smtp;/* the structure of SMTP data(MMI ==> Protocol) *///EMAIL_SMTP_ENTITY smtp_mail; /* Should be defined by MMI *//* the structure of the status sending the mail (Protocol ==> MMI) */EMAIL_ERROR_TYPE smtp_err[3*EMAIL_MAX_RCPTS +1];/******************************************************************************************* Function Name: SmtpTaskInit* Description : Initialize the SMTP task, include creating the message queue and the task.* Note : should be called when system initialization.* * Parameter : None.* Return values : None.* * Author : Tang Jun 2005-07-25* ******************************************************************************************/VOID SmtpTaskInit( VOID );/******************************************************************************************* Function Name: SmtpSendMail* Description : Send the email to SMTP server.* Note : Should be called when MMI or test module prapare to send email to SMTP server.* * Parameter : smtpMail -> the information of the email.* pCallBackFunc -> the callback function called when email sent or error occured* Return values : None.* * Author : Tang Jun 2005-07-25* ******************************************************************************************/VOID SmtpSendMail(EMAIL_SMTP_ENTITY * smtpMail, void (*pCallBackFunc)(EMAIL_ERROR_TYPE *err));/******************************************************************************************* Function Name: SmtpCancelMail* Description : Cancel the email sending to SMTP server.* Note : Could be called if MMI or test module want to cancel the email sending.* * Parameter : None.* * Return values : None.* * Author : Tang Jun 2005-07-25* ******************************************************************************************/BOOLEAN SmtpCancelMail(VOID);/******************************************************************************************* Function Name: tSmtpMain* Description : the main function of the SMTP task.* Note : None.* * Parameter : None.* * Return values : None.* * Author : Tang Jun 2005-07-25* ******************************************************************************************/VOID tSmtpMain(VOID);/******************************************************************************************* Function Name: SmtpPmResultReport* Description : Report the result of the email sending to MMI.* Note : None.* * Parameter : None.* * Return values : None.* * Author : Tang Jun 2005-07-25* ******************************************************************************************/void SmtpPmResultReport(void);#ifdef __cplusplus}#endif /* __cplusplus */#endif /* _SMTP_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -