pop3c.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef PRO_POP3C_H
  2. #define PRO_POP3C_H
  3. /*
  4. * Copyright 2010 by egnite GmbH
  5. *
  6. * All rights reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. *
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. * 2. Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in the
  16. * documentation and/or other materials provided with the distribution.
  17. * 3. Neither the name of the copyright holders nor the names of
  18. * contributors may be used to endorse or promote products derived
  19. * from this software without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  28. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  29. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  31. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  32. * SUCH DAMAGE.
  33. *
  34. * For additional information see http://www.ethernut.de/
  35. */
  36. /*!
  37. * \file pro/pop3c.h
  38. * \brief POP3 client functions.
  39. *
  40. * \verbatim
  41. * $Id$
  42. * \endverbatim
  43. */
  44. #include <sys/socket.h>
  45. #include <stdio.h>
  46. #ifndef POP3_BUFSIZ
  47. /*! \brief Size of the POP3 buffer. */
  48. #define POP3_BUFSIZ 256
  49. #endif
  50. /*!
  51. * \brief POP3 session structure type.
  52. */
  53. typedef struct _POP3CLIENTSESSION {
  54. /*! \brief Socket of this session. */
  55. TCPSOCKET *pop3_sock;
  56. /*! \brief Stream of this session. */
  57. FILE *pop3_stream;
  58. /*! \brief Server timestamp. */
  59. char *pop3_stamp;
  60. /*! \brief POP3 buffer. */
  61. char pop3_buff[POP3_BUFSIZ];
  62. } POP3CLIENTSESSION;
  63. extern POP3CLIENTSESSION *NutPop3Connect(uint32_t ip, uint16_t port);
  64. extern void NutPop3Disconnect(POP3CLIENTSESSION * si);
  65. extern int NutPop3Login(POP3CLIENTSESSION * si, char *user, char *pass);
  66. extern int NutPop3RetrieveMsg(POP3CLIENTSESSION * si, int msg);
  67. extern int NutPop3DeleteMsg(POP3CLIENTSESSION * si, int msg);
  68. extern const char *NutPop3SendCommand(POP3CLIENTSESSION * si, const char *fmt, ...);
  69. extern const char *NutPop3ReceiveResponse(POP3CLIENTSESSION * si);
  70. #endif