smtp.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef __SMTP_H
  2. #define __SMTP_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at http://curl.haxx.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. * $Id$
  24. ***************************************************************************/
  25. #include "pingpong.h"
  26. /****************************************************************************
  27. * SMTP unique setup
  28. ***************************************************************************/
  29. typedef enum {
  30. SMTP_STOP, /* do nothing state, stops the state machine */
  31. SMTP_SERVERGREET, /* waiting for the initial greeting immediately after
  32. a connect */
  33. SMTP_EHLO,
  34. SMTP_STARTTLS,
  35. SMTP_MAIL, /* MAIL FROM */
  36. SMTP_RCPT, /* RCPT TO */
  37. SMTP_DATA,
  38. SMTP_QUIT,
  39. SMTP_LAST /* never used */
  40. } smtpstate;
  41. /* smtp_conn is used for struct connection-oriented data in the connectdata
  42. struct */
  43. struct smtp_conn {
  44. struct pingpong pp;
  45. char *domain; /* what to send in the EHLO */
  46. int eob; /* number of bytes of the EOB (End Of Body) that has been
  47. received thus far */
  48. smtpstate state; /* always use smtp.c:state() to change state! */
  49. };
  50. extern const struct Curl_handler Curl_handler_smtp;
  51. extern const struct Curl_handler Curl_handler_smtps;
  52. /* this is the 5-bytes End-Of-Body marker for SMTP */
  53. #define SMTP_EOB "\x0d\x0a\x2e\x0d\x0a"
  54. #define SMTP_EOB_LEN 5
  55. /* if found in data, replace it with this string instead */
  56. #define SMTP_EOB_REPL "\x0d\x0a\x2e\x2e"
  57. #define SMTP_EOB_REPL_LEN 4
  58. CURLcode Curl_smtp_escape_eob(struct connectdata *conn, int nread);
  59. #endif /* __SMTP_H */