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

📄 smtp_callbacks.c

📁 opentcp_mcf5282原代码
💻 C
字号:
/***************************************************************************************
File:			smtp_callbacks.c

Date:			11.8.2002

Version:		0.1

Author:			Jari Lahti (jari@violasystems.com)

Description:	This file contains implementation of SMTP E-mail client callback
				functions (environment depended).

Version Info:	9.8.2002 - First version (JaL)
***************************************************************************************/

#include "opentcp.h"

UINT8 smtp_temp = 0;



/********************************************************************************
Function:		smtpc_error

Parameters:		void

Return val:		void

Date:			20.8.2002

Desc:			This callback function is called by SMTP Client when there
				happens error of some kind (timeout, losing of connection etc.).
				It indicates that E-mail was not delivered to server
*********************************************************************************/

void smtpc_error (void)
{


}


/********************************************************************************
Function:		smtpc_allok

Parameters:		void

Return val:		void

Date:			12.8.2002

Desc:			This callback function is called by SMTP Client when the packet
				is succesfully delivered to E-mail server.
*********************************************************************************/

void smtpc_allok (void)
{


}

/********************************************************************************
Function:		smtpc_getserverIP

Parameters:		void

Return val:		UINT32 - 0 = server IP not valid
						 >0 = server IP

Date:			12.8.2002

Desc:			This callback function is called by SMTP Client when it wants
				to know the IP address of SMTP server
*********************************************************************************/


UINT32 smtpc_getserverIP (void)
{
	/* Return there the IP address of SMTP Server	*/

	return(0);


}


/********************************************************************************
Function:		smtpc_getdomain

Parameters:		UINT8* dbuf - pointer to buffer to which the domain name will be stored

Return val:		INT8 - (-1) = Error
					   (>0) = Number of bytes inserted

Date:			12.8.2002

Desc:			This callback function is called by SMTP Client when it wants
				to know the local domain. The user is responsible of storing that
				domain to destbuf without NULL termination ('\0') and returning
				number of bytes on domain.
*********************************************************************************/

INT8 smtpc_getdomain (UINT8* dbuf)
{
	/* Insert the domain part of the E-mail address of device to dbuf	*/
	/* and return the length of the string								*/

	return(-1);

}



/********************************************************************************
Function:		smtpc_getsender

Parameters:		UINT8* dbuf - pointer to buffer to which the sender will be stored

Return val:		INT8 - (-1) = Error
					   (>0) = Number of bytes inserted

Date:			12.8.2002

Desc:			This callback function is called by SMTP Client when it wants
				to know the E-mail address of sender. The user is responsible of
				storing that address to destbuf without NULL termination ('\0')
				and returning number of bytes on E-mail address.
*********************************************************************************/

INT8 smtpc_getsender (UINT8* dbuf)
{

	/* Insert the E-mail address to dbuf and return the length of it	*/

	return(-1);


}




/********************************************************************************
Function:		smtpc_getreceiver

Parameters:		UINT8* dbuf - pointer to buffer to which the receiver will be stored

Return val:		INT8 - (-1) = Error
					   (>0) = Number of bytes inserted

Date:			12.8.2002

Desc:			This callback function is called by SMTP Client when it wants
				to know the E-mail address of receiver. The user is responsible of
				storing that address to destbuf without NULL termination ('\0')
				and returning number of bytes on E-mail address.
*********************************************************************************/

INT8 smtpc_getreceiver (UINT8* dbuf)
{

	/* Insert the E-mail address of receiver to dbuf and return the length of it	*/

	return(-1);

}


/********************************************************************************
Function:		smtpc_getsubject

Parameters:		UINT8* dbuf - pointer to buffer to which the subject will be stored

Return val:		INT8 - (-1) = Error
					   (>0) = Number of bytes inserted

Date:			12.8.2002

Desc:			This callback function is called by SMTP Client when it wants
				to know the subject of E-mail to be sent. The user is responsible
				of storing subject to destbuf without NULL termination ('\0')
				and returning number of bytes inserted.
*********************************************************************************/


INT8 smtpc_getsubject (UINT8* dbuf)
{

	/* Insert the subject of outgoing E-mail to dbuf and return the length of it	*/

	return(-1);


}



/********************************************************************************
Function:		smtpc_getdata

Parameters:		UINT8* dbuf - pointer to buffer to which the data will be stored
				UINT16 buflen - length of data buffer

Return val:		INT16 - (-1) = End of data (no bytes assembled to buffer)
					    (>0) = Number of bytes assembled to buffer

Date:			12.8.2002

Desc:			This callback function is called by SMTP Client when it wants
				to get mail plain data from user. The user is responsible of
				filling dbuf and returning number of bytes assembled. When data
				end is reached the function must return (-1) without storing
				any bytes to buffer (so just send data untill you don't have
				any bytes to sent when callback is made to that function and
				return -1). Do not move read pointer of your data forward before
				SMTP makes callback to smtpc_dataacked!
*********************************************************************************/

INT16 smtpc_getdata (UINT8* dbuf, UINT16 buflen)
{

	/* Insert the actual message or part of it to dbuf and return the number	*/
	/* of bytes inserted. When end-of-message retun -1							*/

	return(-1);

}



/********************************************************************************
Function:		smtpc_dataacked

Parameters:		void

Return val:		void

Date:			12.8.2002

Desc:			This callback function is called by SMTP Client when TCP has
				ensured that the last packet was transmitted succesfully and
				next time when smtpc_getdata callback is made new data should be
				assembled
*********************************************************************************/

void smtpc_dataacked (void)
{
	/* Move forward your message read pointer	*/

}

⌨️ 快捷键说明

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