NetBurner 3.1
pop3.h
Go to the documentation of this file.
1 /*NB_REVISION*/
2 
3 /*NB_COPYRIGHT*/
4 
13 #ifndef _POP3_H_
14 #define _POP3_H_
15 
16 #include <nettypes.h>
17 
18 // #define POP3_DEBUG ( 1 ) // Library debug switch
19 
20 #ifdef POP3_DEBUG
21 #define POP3_DEBUG_IPRINTF(...) \
22  { \
23  iprintf("%s:%d", __FUNCTION__, __LINE__); \
24  iprintf(__VA_ARGS__); \
25  iprintf("\r\n"); \
26  }
27 #else /* #ifdef POP3_DEBUG */
28 #define POP3_DEBUG_IPRINTF(...) ((void)0)
29 #endif /* #ifdef POP3_DEBUG */
30 
34 #define POP_OK (0)
35 #define POP_TIMEOUT (-1)
36 #define POP_PASSWORDERROR (-2)
37 #define POP_CONNECTFAIL (-3)
38 #define POP_COMMANDFAIL (-4)
39 #define POP_BADSESSION (-5)
40 #define POP_NETWORKERROR (-6)
41 #define POP_BUFFER_FULL (-7)
42 
44 
53 int POPGetResultCode(int fd, uint32_t timeout);
54 
68 int POP3_InitializeSession(IPADDR server_address, uint16_t port, PCSTR UserName, PCSTR Password, uint32_t timeout);
69 
78 int POP3_CloseSession(int session);
79 
91 int POP3_StatCmd(int session, uint32_t *num_messages, uint32_t *total_bytes, uint32_t timeout);
92 
104 int POP3_ListCmd(int session, uint32_t message_number, uint32_t *total_bytes, uint32_t timeout);
105 
118 int POP3_DeleteCmd(int session, uint32_t message_number, uint32_t timeout);
119 
138 int POP3_RetrieveMessage(int session,
139  uint32_t message_number,
140  char *buffer,
141  char **subject_ptr,
142  char **body_ptr,
143  int max_bufferlen,
144  uint32_t timeout);
145 
154 PCSTR GetPOPErrorString(int err);
155 
156 #endif /* #ifndef _POP3_H_ */
157 
int POP3_ListCmd(int session, uint32_t message_number, uint32_t *total_bytes, uint32_t timeout)
Get the size of a message on the server.
Definition: pop3.cpp:285
Used to hold and manipulate IPv4 and IPv6 addresses in dual stack mode.
Definition: ipv6_addr.h:28
int POP3_InitializeSession(IPADDR server_address, uint16_t port, PCSTR UserName, PCSTR Password, uint32_t timeout)
Create a connection to the POP3 server and log in.
Definition: pop3.cpp:204
int POP3_DeleteCmd(int session, uint32_t message_number, uint32_t timeout)
Delete a pending message on the server.
Definition: pop3.cpp:310
int POP3_RetrieveMessage(int session, uint32_t message_number, char *buffer, char **subject_ptr, char **body_ptr, int max_bufferlen, uint32_t timeout)
Retrieve a message from the server.
Definition: pop3.cpp:325
int POPGetResultCode(int fd, uint32_t timeout)
Returns the result code of the previous POP3 operation.
Definition: pop3.cpp:88
PCSTR GetPOPErrorString(int err)
Returns the error text for an error code.
Definition: pop3.cpp:363
int POP3_StatCmd(int session, uint32_t *num_messages, uint32_t *total_bytes, uint32_t timeout)
Returns the status of the mailstore on the POP3 server.
Definition: pop3.cpp:263
int POP3_CloseSession(int session)
Close a POP3 session.
Definition: pop3.cpp:254