libspopc.h   libspopc.h 
/* this is libspopc.h file. /* this is libspopc.h file.
* this is part of the libspopc library sources * this is part of the libspopc library sources
* copyright * copyright
* released under the terms of GNU LGPL * released under the terms of GNU LGPL
* (GNU Lesser General Public Licence). * (GNU Lesser General Public Licence).
* libspopc offers simple API for a pop3 client (MDA). * libspopc offers simple API for a pop3 client (MDA).
* See RFC 1725 for pop3 specifications. * See RFC 1725 for pop3 specifications.
* more information on http://brouits.free.fr/libspopc/ * more information on http://brouits.free.fr/libspopc/
*/ */
#ifndef _LIBSPOPC_H #ifndef LIBSPOPC_H
#define _LIBSPOPC_H #define LIBSPOPC_H
#include <sys/socket.h> #ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32
#include <winsock.h>
#else
#include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h> #include <netdb.h>
#endif
/*************************************** /***************************************
* low-level methods for a pop3 client * * low-level methods for a pop3 client *
***************************************/ ***************************************/
#define SOCKET_TIMEOUT 15
#define TCPBUFLEN 512
/************************************************************************** **** /************************************************************************** ****
* Be careful, using the low-level API is uncompliant with using the high * * Be careful, using the low-level API is uncompliant with using the high *
* level API. Here, you make your choice. If you don't know the pop3 protoc ol * * level API. Here, you make your choice. If you don't know the pop3 protoc ol *
* or what a socket is, it is then warmly recommended to use the *high-leve l* * * or what a socket is, it is then warmly recommended to use the *high-leve l* *
* API if which is shown far below on this file. * * API if which is shown far below on this file. *
************************************************************************** ****/ ************************************************************************** ****/
/************** /**************
* connecting * * connecting *
**************/ **************/
skipping to change at line 45 skipping to change at line 53
char* pop3_connect(int sock, struct sockaddr_in* connection); char* pop3_connect(int sock, struct sockaddr_in* connection);
/* connects to the server through the sock and returns server's welcome */ /* connects to the server through the sock and returns server's welcome */
void pop3_disconnect(int sock); void pop3_disconnect(int sock);
/* close socket */ /* close socket */
/**************** /****************
* pop3 queries * * pop3 queries *
****************/ ****************/
char* pop3_user(int sock, char* name); char* pop3_user(int sock, const char* name);
/* performs "USER" pop query and returns server's <128 bytes response */ /* performs "USER" pop query and returns server's <128 bytes response */
char* pop3_pass(int sock, char* pw); char* pop3_pass(int sock, const char* pw);
/* performs "PASS" pop query and return server's <128 bytes response */ /* performs "PASS" pop query and return server's <128 bytes response */
char* pop3_quit(int sock); char* pop3_quit(int sock);
/* performs "QUIT" pop query and returns server's <128 bytes response */ /* performs "QUIT" pop query and returns server's <128 bytes response */
char* pop3_stat(int sock); char* pop3_stat(int sock);
/* performs "STAT" pop query and returns server's <128 bytes response */ /* performs "STAT" pop query and returns server's <128 bytes response */
char* pop3_list(int sock, int id); char* pop3_list(int sock, int id);
/* performs a "LIST" pop query and returns server's (long) response */ /* performs a "LIST" pop query and returns server's (long) response */
skipping to change at line 78 skipping to change at line 86
char* pop3_rset(int sock); char* pop3_rset(int sock);
/* performs a "RSET" pop query and returns server's <128 bytes response */ /* performs a "RSET" pop query and returns server's <128 bytes response */
char* pop3_top(int sock, int id, int lines); char* pop3_top(int sock, int id, int lines);
/* performs a "TOP" pop query and returns server's (long) response */ /* performs a "TOP" pop query and returns server's (long) response */
char* pop3_uidl(int sock, int id); char* pop3_uidl(int sock, int id);
/* performs a "UIDL" pop query and returns server's (long) response */ /* performs a "UIDL" pop query and returns server's (long) response */
char* pop3_apop(int sock, char* name, char* digest); char* pop3_apop(int sock, const char* name, const char* digest);
/* performs a "APOP" secure pop query and returns server's <128 bytes respo nse */ /* performs a "APOP" secure pop query and returns server's <128 bytes respo nse */
/* this one is not in the API, just for libspopc internal use: */ /* this one is not in the API, just for libspopc internal use: */
char* recv_rest(int sock, char* buf, int cs, int bs); 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 */ /* 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 */ /* end of data is assumed when data has a "\n.\n" or "\n.\0" string */
/********************* /*********************
* parsing utilities * * parsing utilities *
*********************/ *********************/
skipping to change at line 185 skipping to change at line 193
/* arg 's' is type 'popsession*' */ /* arg 's' is type 'popsession*' */
#define popmsgsize(s,i) ((s)->list[(i)]) #define popmsgsize(s,i) ((s)->list[(i)])
/* gives the size of message 'i' for session 's' */ /* gives the size of message 'i' for session 's' */
/* args are type 'session*'(s) and 'int'(i) */ /* args are type 'session*'(s) and 'int'(i) */
/* 'i' must *not* be 0 */ /* 'i' must *not* be 0 */
#define popmsguid(s,i) ((s)->uidl[(i)]) #define popmsguid(s,i) ((s)->uidl[(i)])
/* points to the 'char*' uid (unique signature) of 'int'(i) message id */ /* points to the 'char*' uid (unique signature) of 'int'(i) message id */
char* popbegin(char* servername,char* user,char* pass, popsession** sp); char* popbegin(const char* servername,const char* user, const char* pass, p opsession** sp);
/* prepares, connect and get lists of messages stored on pop server */ /* prepares, connect and get lists of messages stored on pop server */
/* you must give a valid servername, user and pass */ /* you must give a valid servername, user and pass */
/* returns an error message if a problem occurs, else NULL */ /* returns an error message if a problem occurs, else NULL */
char* popgethead(popsession* session, int id); char* popgethead(popsession* session, int id);
/* returns the header of a message (id from 1 to popnum()) or NULL if bad i d */ /* returns the header of a message (id from 1 to popnum()) or NULL if bad i d */
char* popgetmsg(popsession* session, int id); char* popgetmsg(popsession* session, int id);
/* returns a message (id from 1 to popnum()) or NULL if bad id */ /* returns a message (id from 1 to popnum()) or NULL if bad id */
int popdelmsg(popsession* session, int id); int popdelmsg(popsession* session, int id);
/* deletes message 'id' on pop server */ /* deletes message 'id' on pop server */
/* returns -1 if server error, 0 else */ /* returns -1 if server error, 0 else */
int popcancel(popsession* session); int popcancel(popsession* session);
/* cancels all previous deletion pn pop server */ /* cancels all previous deletion pn pop server */
/* returns -1 if server error, 0 else */ /* returns -1 if server error, 0 else */
void popend(popsession* session); void popend(popsession* session);
/* quit and destroys pop session */ /* quit and destroys pop session */
#ifdef __cplusplus
}
#endif
#endif #endif
 End of changes. 9 change blocks. 
8 lines changed or deleted 20 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/