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