1 2 /** 3 * \addtogroup smtp 4 * @{ 5 */ 6 7 8 /** 9 * \file 10 * SMTP header file 11 * \author Adam Dunkels <[email protected]> 12 */ 13 14 /* 15 * Copyright (c) 2002, Adam Dunkels. 16 * All rights reserved. 17 * 18 * Redistribution and use in source and binary forms, with or without 19 * modification, are permitted provided that the following conditions 20 * are met: 21 * 1. Redistributions of source code must retain the above copyright 22 * notice, this list of conditions and the following disclaimer. 23 * 2. Redistributions in binary form must reproduce the above copyright 24 * notice, this list of conditions and the following disclaimer in the 25 * documentation and/or other materials provided with the distribution. 26 * 3. The name of the author may not be used to endorse or promote 27 * products derived from this software without specific prior 28 * written permission. 29 * 30 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 31 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 32 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 33 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 34 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 35 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 36 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 37 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 38 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 39 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 40 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 * 42 * This file is part of the uIP TCP/IP stack. 43 * 44 * $Id: smtp.h,v 1.4 2006/06/11 21:46:37 adam Exp $ 45 * 46 */ 47 #ifndef __SMTP_H__ 48 #define __SMTP_H__ 49 50 #include "uipopt.h" 51 52 /** 53 * Error number that signifies a non-error condition. 54 */ 55 #define SMTP_ERR_OK 0 56 57 /** 58 * Callback function that is called when an e-mail transmission is 59 * done. 60 * 61 * This function must be implemented by the module that uses the SMTP 62 * module. 63 * 64 * \param error The number of the error if an error occured, or 65 * SMTP_ERR_OK. 66 */ 67 void smtp_done(unsigned char error); 68 69 void smtp_init(void); 70 71 /* Functions. */ 72 void smtp_configure(char *localhostname, u16_t *smtpserver); 73 unsigned char smtp_send(char *to, char *from, 74 char *subject, char *msg, 75 u16_t msglen); 76 #define SMTP_SEND(to, cc, from, subject, msg) \ 77 smtp_send(to, cc, from, subject, msg, strlen(msg)) 78 79 void smtp_appcall(void); 80 81 struct smtp_state { 82 u8_t state; 83 char *to; 84 char *from; 85 char *subject; 86 char *msg; 87 u16_t msglen; 88 89 u16_t sentlen, textlen; 90 u16_t sendptr; 91 92 }; 93 94 95 #ifndef UIP_APPCALL 96 #define UIP_APPCALL smtp_appcall 97 #endif 98 typedef struct smtp_state uip_tcp_appstate_t; 99 100 101 #endif /* __SMTP_H__ */ 102 103 /** @} */ 104