smtp.h 2.7 KB

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