libspopc.h   libspopc.h 
/* this is libspopc.h file. /* this is libspopc.h file, part of the libspopc library sources
* this is part of the libspopc library sources * copyright
* copyright * released under the terms of the GNU Lesser General Public Licence.
* released under the terms of GNU LGPL *
* (GNU Lesser General Public Licence). * libspopc offers simple API for a pop3 client.
* 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/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-13
01 USA
*/ */
#ifndef LIBSPOPC_H #ifndef LIBSPOPC_H
#define LIBSPOPC_H #define LIBSPOPC_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32 #ifdef WIN32
skipping to change at line 27 skipping to change at line 41
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32 #ifdef WIN32
#include <winsock.h> #include <winsock.h>
#else #else
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h> #include <netdb.h>
#endif #endif
/* thread-safe version of libspopc (>0.8) */
/* call this function before to use any routine from libspopc */
int libspopc_init(void);
/* call this function when you do not use anymore libspopc routines */
int libspopc_clean(void);
/* those functions are mandatory if libspopc has
* been built with the _REENTRANT cflag */
#ifdef USE_SSL #ifdef USE_SSL
#include <openssl/ssl.h> #include <openssl/ssl.h>
/************************************************************************** **** /************************************************************************** ****
* If compiled with SSL support, the low-level functions will act on a * If compiled with SSL support, the low-level functions will act on a
* "pop3sock" structure, which contains the socket, SSL instance and contex t * "pop3sock" structure, which contains the socket, SSL instance and contex t
* for the connection. This structure is dynamically allocated and initiali zed * for the connection. This structure is dynamically allocated and initiali zed
* when you do pop3_prepare() or popbegin(), and is cleaned-up and destroye d in * when you do pop3_prepare() or popbegin(), and is cleaned-up and destroye d in
* pop3_disconnect() or popend(). * pop3_disconnect() or popend().
skipping to change at line 66 skipping to change at line 88
* Hint: If you have a recent version of curl/libcurl installed, you can tr y * Hint: If you have a recent version of curl/libcurl installed, you can tr y
* setting this to the output of: "curl-config --ca" * setting this to the output of: "curl-config --ca"
************************************************************************** ****/ ************************************************************************** ****/
void pop3_cert_setup(const char *certfile); void pop3_cert_setup(const char *certfile);
/************************************************************************** **** /************************************************************************** ****
* pop3_ssl_never() disable the use of SSL on any port, even 995. * pop3_ssl_never() disable the use of SSL on any port, even 995.
* pop3_ssl_auto() enable the use of SSL only on port 995. (default) * pop3_ssl_auto() enable the use of SSL only on port 995. (default)
* pop3_ssl_always() enable the use of SSL on any port, even 110. * pop3_ssl_always() enable the use of SSL on any port, even 110.
* *
* These functions set a global variable, and should be called before * These functions set a library-wide variable, and should be called before
* pop3_prepare() or popbegin() if you want to modify libspopc behaviour. * pop3_prepare() or popbegin() if you want to modify libspopc behaviour.
* By default, not calling any of these, the behaviour of libspopc follows * By default, not calling any of these, the behaviour of libspopc follows
* the same as pop3_ssl_auto() for backward compatibility reason. * the same as pop3_ssl_auto() for backward compatibility reason.
************************************************************************** ****/ ************************************************************************** ****/
void pop3_ssl_never(void); void pop3_ssl_never(void);
void pop3_ssl_auto(void); void pop3_ssl_auto(void);
void pop3_ssl_always(void); void pop3_ssl_always(void);
#else /* Non-SSL */ #else /* Non-SSL */
skipping to change at line 161 skipping to change at line 183
char* pop3_apop(pop3sock_t sock, const char* name, const char* digest); char* pop3_apop(pop3sock_t sock, const char* name, const char* digest);
/* performs a "APOP" secure pop query and returns server's <512 bytes respo nse */ /* performs a "APOP" secure pop query and returns server's <512 bytes respo nse */
/********************* /*********************
* parsing utilities * * parsing utilities *
*********************/ *********************/
#define DOTBEGIN(s) ((s)[0]=='\n'&&(s)[1]=='.') #define DOTBEGIN(s) ((s)[0]=='\n'&&(s)[1]=='.')
int dotline(char* buf); int dotline(char* buf);
/* returns 1 if buf contains a "\n.\n" or "\n.\0" or \r.(etc) substring */ /* returns 1 if 'buf' contains a "\n.\n" or "\n.\0" or \r.(etc) substring * /
/* buf must be terminated by '\0' */ /* buf must be terminated by '\0' */
int pop3_error(char* string); int pop3_error(char* string);
/* returns 1 if pop server error reply (i.e : -ERR ...) */ /* returns 1 on pop server error reply (i.e : -ERR ...) */
/************************************ /************************************
* reply re-formatting, after query * * reply re-formatting, after query *
************************************/ ************************************/
char* nextline(char* string); char* nextline(char* string);
/* returns a pointer to the next line of given string */ /* returns a pointer to the next line of given string */
char* retr2msg(char* data); char* retr2msg(char* data);
/* returns formatted mail from a pop RETR X query */ /* returns formatted mail from a pop RETR X query */
/* must only be called on data returned by pop3_retr() */ /* must only be called on data returned by pop3_retr() */
skipping to change at line 193 skipping to change at line 215
/* array[0] holds id of the array's last element */ /* array[0] holds id of the array's last element */
/* must only be called on data received by a pop3_list(sock,0) request */ /* must only be called on data received by a pop3_list(sock,0) request */
void freelistarray(int* array); void freelistarray(int* array);
/* free the message sizes array created by list2array */ /* free the message sizes array created by list2array */
int listi2size(char* resp); int listi2size(char* resp);
/* grep the given size (in bytes) in resp after a pop3_list(sock,ID) reques t */ /* grep the given size (in bytes) in resp after a pop3_list(sock,ID) reques t */
/* do not use after a pop3_list(sock,0) ! */ /* do not use after a pop3_list(sock,0) ! */
int stat2last(char* resp); int stat2num(char* resp);
/* returns the last message's id on pop server */ /* returns the number of downloadable messages on pop server */
int stat2bytes(char* resp); int stat2bytes(char* resp);
/* returns the sumsize in bytes of all stored messages on server */ /* returns the sumsize in bytes of all stored messages on server */
/* must only be called just after a pop3_stat() request */ /* must only be called just after a pop3_stat() request */
char** uidl2array(char* resp); char** uidl2array(char* resp);
/* WARNING: mus not be called after a mail deletion */ /* WARNING: mus not be called after a mail deletion */
/* returns an array of unique strings for each message id */ /* returns an array of unique strings for each message id */
/* array[0] gives array's last id */ /* array[0] gives array's last id */
/* must only be called just after a pop3_uidl(sock,0) request */ /* must only be called just after a pop3_uidl(sock,0) request */
skipping to change at line 273 skipping to change at line 295
int popnum(popsession* session); int popnum(popsession* session);
/* gives the current number of stored message. it is != to poplast() */ /* gives the current number of stored message. it is != to poplast() */
char* popbegin(const char* servername,const char* user, const char* pass, p opsession** 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 between 1 and poplast()) or NULL if bad id */ /* returns the header of a message (id between 1 and poplast()) or NULL on bad id */
char* popgetmsg(popsession* session, int id); char* popgetmsg(popsession* session, int id);
/* returns a message (id between 1 and poplast()) or NULL if bad id */ /* returns a message (id between 1 and poplast()) or NULL on 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 on server error, 0 else */
int popchkmsg(popsession* session, int id);
/* tells if a message is still accessible on the server (not deleted) */
/* returns 1 of so, or 0 if message has been marked for deletion */
int popcancel(popsession* session); int popcancel(popsession* session);
/* cancels all previous deletion on pop server */ /* cancels all previous deletion on pop server */
/* returns -1 if server error, 0 else */ /* returns -1 on server error, 0 else */
void popend(popsession* session); void popend(popsession* session);
/* quit and destroys pop session */ /* quit and destroys pop session */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 12 change blocks. 
15 lines changed or deleted 42 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/