/* this is libspopc.h file.
 * this is part of the libspopc library sources
 * copyright © 2002 Benoit Rouits <brouits@free.fr>
 * released under the terms of GNU LGPL
 * (GNU Lesser General Public Licence).
 * libspopc offers simple API for a pop3 client (MTA).
 * See RFC 1725 for pop3 specifications.
 * more information on http://brouits.free.fr/libspopc/
 */


/**************
 * connecting *
 **************/

int pop3_prepare(const char* servername, const int port, struct sockaddr_in* connection, struct hostent* server);
/* prepares the pop session and returns a socket descriptor */

char* pop3_connect(int sock, struct sockaddr_in* connection);
/* connects to the server through the sock and returns server's welcome */

void pop3_disconnect(int sock);
/* close socket  */


/****************
 * pop3 queries *
 ****************/

char* pop3_user(int sock, char* name);
/* performs "USER" pop query and returns server's <64 bytes response */

char* pop3_pass(int sock, char* pw);
/* performs "PASS" pop query and return server's <63 bytes response */

char* pop3_quit(int sock);
/* performs "QUIT" pop query and returns server's <64 bytes response */

char* pop3_stat(int sock);
/* performs "STAT" pop query and returns server's <64 bytes response */

char* recv_rest(int sock, char* buf, int cs, int bs);
/* recv rest of data through sock, given a cs bytes filled buffer of total size bs */
/* end of data is assumed when data has a "\n.\n" or "\n.\0" string */

char* pop3_list(int sock, int id);
/* performs a "LIST" pop query and returns server's (long) response */

char* pop3_retr(int sock, int id);
/* performs a "RETR" pop query and returns server's (long) response */

char* pop3_dele(int sock, int id);
/* performs a "DELE" pop query and returns server's <64 bytes response */

char* pop3_noop(int sock);
/* performs a "NOOP" pop query and returns server's <64 bytes response */

char* pop3_rset(int sock);
/* performs a "RSET" pop query and returns server's <64 bytes response */

char* pop3_top(int sock, int id, int lines);
/* performs a "TOP" pop query and returns server's (long) response */

char* pop3_uidl(int sock, int id);
/* performs a "UIDL" pop query and returns server's (long) response */

char* pop3_apop(int sock, char* name, char* digest);
/* performs a "APOP" secure pop query and returns server's <64 bytes response */