- Main Page
- Modules
- Data Structures
- Files
- Examples

# smtp.h

    00001
    00002 /**
    00003  * \addtogroup smtp
    00004  * @{
    00005  */
    00006
    00007
    00008 /**
    00009  * \file
    00010  * SMTP header file
    00011  * \author Adam Dunkels <adam@dunkels.com>
    00012  */
    00013
    00014 /*
    00015  * Copyright (c) 2002, Adam Dunkels.
    00016  * All rights reserved.
    00017  *
    00018  * Redistribution and use in source and binary forms, with or without
    00019  * modification, are permitted provided that the following conditions
    00020  * are met:
    00021  * 1. Redistributions of source code must retain the above copyright
    00022  *    notice, this list of conditions and the following disclaimer.
    00023  * 2. Redistributions in binary form must reproduce the above copyright
    00024  *    notice, this list of conditions and the following disclaimer in the
    00025  *    documentation and/or other materials provided with the distribution.
    00026  * 3. The name of the author may not be used to endorse or promote
    00027  *    products derived from this software without specific prior
    00028  *    written permission.
    00029  *
    00030  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
    00031  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    00032  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    00033  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
    00034  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    00035  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
    00036  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    00037  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    00038  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    00039  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    00040  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00041  *
    00042  * This file is part of the uIP TCP/IP stack.
    00043  *
    00044  * $Id: smtp.h,v 1.4 2006/06/11 21:46:37 adam Exp $
    00045  *
    00046  */
    00047 #ifndef __SMTP_H__
    00048 #define __SMTP_H__
    00049
    00050 #include "uipopt.h"
    00051
    00052 /**
    00053  * Error number that signifies a non-error condition.
    00054  */
    00055 #define SMTP_ERR_OK 0
    00056
    00057 /**
    00058  * Callback function that is called when an e-mail transmission is
    00059  * done.
    00060  *
    00061  * This function must be implemented by the module that uses the SMTP
    00062  * module.
    00063  *
    00064  * \param error The number of the error if an error occured, or
    00065  * SMTP_ERR_OK.
    00066  */
    00067 void smtp_done(unsigned char error);
    00068
    00069 void smtp_init(void);
    00070
    00071 /* Functions. */
    00072 void smtp_configure(char *localhostname, u16_t *smtpserver);
    00073 unsigned char smtp_send(char *to, char *from,
    00074                         char *subject, char *msg,
    00075                         u16_t msglen);
    00076 #define SMTP_SEND(to, cc, from, subject, msg) \
    00077         smtp_send(to, cc, from, subject, msg, strlen(msg))
    00078
    00079 void smtp_appcall(void);
    00080
    00081 struct smtp_state {
    00082   u8_t state;
    00083   char *to;
    00084   char *from;
    00085   char *subject;
    00086   char *msg;
    00087   u16_t msglen;
    00088
    00089   u16_t sentlen, textlen;
    00090   u16_t sendptr;
    00091
    00092 };
    00093
    00094
    00095 #ifndef UIP_APPCALL
    00096 #define UIP_APPCALL     smtp_appcall
    00097 #endif
    00098 typedef struct smtp_state uip_tcp_appstate_t;
    00099
    00100
    00101 #endif /* __SMTP_H__ */
    00102
    00103 /** @} */