Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

popserver.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  * $Id: popserver.h,v 1.10 2004/04/08 09:13:23 gareuselesinge Exp $
00003  * This file is part of liberopops (http://liberopops.sf.net)                 *
00004  * This file is distributed under the terms of GNU GPL license.               *
00005  ******************************************************************************/
00006 
00007 
00008 /******************************************************************************/
00014 /******************************************************************************/
00015 
00016 
00017 #ifndef POPSERVER_H
00018 #define POPSERVER_H
00019 
00020 #ifndef WIN32
00021         #include <sys/types.h>
00022         #include <netinet/in.h>
00023 #else
00024         #include <winsock.h>
00025         #define uid_t int
00026         #define gid_t int
00027 #endif
00028 
00029 #include "popstate.h"
00030 
00032 enum asyncstate_e {ASYNCOP_NEW,ASYNCOP_OLD};
00033 
00035 struct asyncop_t
00036         {
00038         enum asyncstate_e state;
00040         int header_done;
00042         long int current_lines;
00044         //char last3[4];
00046         //char last4[4];
00048         void* other;
00049         };
00050 
00052 
00053 #define POPSERVER_ERR_OK        0
00054 #define POPSERVER_ERR_SYNTAX    1
00055 #define POPSERVER_ERR_NETWORK   2
00056 #define POPSERVER_ERR_AUTH      3
00057 #define POPSERVER_ERR_INTERNAL  4
00058 #define POPSERVER_ERR_NOMSG     5
00059 #define POPSERVER_ERR_LOCKED    6
00060 #define POPSERVER_ERR_EOF       7
00061 #define POPSERVER_ERR_TOOFAST   8
00062 #define POPSERVER_ERR_UNKNOWN   9
00063 
00064 
00066 
00067 #define POPSERVER_FLAG_STANDARD 0
00068 #define POPSERVER_FLAG_NOTOP    1
00069 
00070 
00083 struct popserver_functions_t
00084         {
00086         int (*user)(struct popstate_t*p,char* username);
00088         int (*pass)(struct popstate_t*p,char* password);
00090         int (*quit)(struct popstate_t*p);
00092         int (*quit_update)(struct popstate_t*p);
00098         int (*top)(struct popstate_t*p,
00099                 long int msg,long int lines,char **buffer,struct asyncop_t *a);
00101         int (*retr)(struct popstate_t*p,int msg,char **buffer,
00102                 struct asyncop_t *a);
00107         int (*stat)(struct popstate_t*p,int *messages,int* size);
00109         int (*uidl)(struct popstate_t*p,int msg,char **buffer);
00111         int (*uidl_all)(struct popstate_t*p,char **buffer);
00113         int (*list)(struct popstate_t*p,int msg,char **buffer);
00115         int (*list_all)(struct popstate_t*p,char **buffer);
00117         int (*rset)(struct popstate_t*p);
00119         int (*dele)(struct popstate_t*p,int msg);
00121         int (*noop)(struct popstate_t*p);
00122 
00125         void *(*new_other)(void);
00128         void (*delete_other)(void *);
00129         };
00130 
00139 void popserver_start(struct popserver_functions_t* f, 
00140         struct in_addr address, unsigned short port, int maxthreads,
00141         int(*set_rights)(uid_t,gid_t),uid_t uid,gid_t gid,int flag);
00142 
00143 #endif
00144 

Generated on Wed May 5 15:48:03 2004 for LiberoPOPs by doxygen 1.3.6-20040222