00001 #ifndef foonewmailhfoo
00002 #define foonewmailhfoo
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00056 #include <limits.h>
00057 #include <oop.h>
00058
00065 enum nm_flags {
00066 NM_FLAG_SYNCHRONOUS= 1,
00067 NM_FLAG_ASYNCHRONOUS = 2
00068 };
00069
00077 enum nm_error {
00078 NM_ERROR_SYSTEM = 256,
00079 NM_ERROR_EXPLANATION = 512,
00080 NM_ERROR_SUCCESS = 0,
00081 NM_ERROR_NOCONFIG = 1,
00082 NM_ERROR_INVPAR = 2,
00083 NM_ERROR_MEMORY = 3,
00084 NM_ERROR_INVNAME = 4,
00085 NM_ERROR_DLFAIL = 5,
00086 NM_ERROR_NOTIMPL = 6,
00087 NM_ERROR_NOFILE = 7,
00088 NM_ERROR_FORK = 8,
00089 NM_ERROR_ALREADY = 9,
00090 NM_ERROR_CONTEXT = 10,
00091 NM_ERROR_INTERNAL = 11,
00092 NM_ERROR_SERVFAIL = 12,
00093 NM_ERROR_SERVNOTFOUND = 13,
00094 };
00095
00100 enum nm_query {
00101 NM_QUERY_CUR = 1,
00102 NM_QUERY_NEW = 2,
00103 NM_QUERY_NCUR = 4,
00104 NM_QUERY_NNEW = 8
00105 };
00106
00111 struct nm_spool;
00112
00116 struct nm_status {
00117 int cur;
00118 int new;
00119 };
00120
00123 struct nm_info {
00124 char name[NAME_MAX];
00125 char path[PATH_MAX];
00126 char type[32];
00127 char text[128];
00128 enum nm_flags flags;
00129 };
00130
00131
00137 typedef void (*nm_enum_cb_t) (const char *spool, void*user);
00138
00144 typedef void (*nm_query_cb_t) (struct nm_spool *s, struct nm_status *status, void *user);
00145
00149 extern void* (*nm_malloc)(size_t);
00150
00155 extern void* (*nm_realloc)(void *,size_t);
00156
00161 extern void (*nm_free)(void *);
00162
00167 extern const char *nm_explanation;
00168
00172 extern enum nm_error nm_errno;
00173
00174
00183 struct nm_spool* nm_open(const char *spool);
00184
00188 void nm_close(struct nm_spool *s);
00189
00199 int nm_query(struct nm_spool *s, enum nm_query query, struct nm_status *status);
00200
00212 int nm_query_submit(struct nm_spool *s, enum nm_query query, oop_source *oop, nm_query_cb_t cb, void *user);
00213
00221 int nm_configure(struct nm_spool *s);
00222
00228 int nm_info(struct nm_spool *s, struct nm_info *info);
00229
00237 int nm_list(nm_enum_cb_t cb, void *user);
00238
00246 const char *nm_strerror(enum nm_error n, int e, const char *explanation);
00247
00252 void nm_perror(const char *s);
00253
00254 #endif