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
00038 #include <limits.h>
00039 #include <oop.h>
00040
00047 enum nm_flags {
00048 NM_FLAG_SYNCHRONOUS= 1,
00049 NM_FLAG_ASYNCHRONOUS = 2
00050 };
00051
00059 enum nm_error {
00060 NM_ERROR_SYSTEM = 256,
00061 NM_ERROR_EXPLANATION = 512,
00062 NM_ERROR_SUCCESS = 0,
00063 NM_ERROR_NOCONFIG = 1,
00064 NM_ERROR_INVPAR = 2,
00065 NM_ERROR_MEMORY = 3,
00066 NM_ERROR_INVNAME = 4,
00067 NM_ERROR_DLFAIL = 5,
00068 NM_ERROR_NOTIMPL = 6,
00069 NM_ERROR_NOFILE = 7,
00070 NM_ERROR_FORK = 8,
00071 NM_ERROR_ALREADY = 9,
00072 NM_ERROR_CONTEXT = 10,
00073 NM_ERROR_INTERNAL = 11,
00074 NM_ERROR_SERVFAIL = 12,
00075 NM_ERROR_SERVNOTFOUND = 13,
00076 };
00077
00082 enum nm_query {
00083 NM_QUERY_CUR = 1,
00084 NM_QUERY_NEW = 2,
00085 NM_QUERY_NCUR = 4,
00086 NM_QUERY_NNEW = 8
00087 };
00088
00093 struct nm_spool;
00094
00098 struct nm_status {
00099 int cur;
00100 int new;
00101 };
00102
00105 struct nm_info {
00106 char name[NAME_MAX];
00107 char path[PATH_MAX];
00108 char type[32];
00109 char text[128];
00110 enum nm_flags flags;
00111 };
00112
00113
00119 typedef void (*nm_enum_cb_t) (char *spool, void*user);
00120
00126 typedef void (*nm_query_cb_t) (struct nm_spool *s, struct nm_status *status, void *user);
00127
00131 extern void* (*nm_malloc)(size_t);
00132
00137 extern void* (*nm_realloc)(void *,size_t);
00138
00143 extern void (*nm_free)(void *);
00144
00149 extern char *nm_explanation;
00150
00154 extern enum nm_error nm_errno;
00155
00156
00165 struct nm_spool* nm_open(char *spool);
00166
00170 void nm_close(struct nm_spool *s);
00171
00181 int nm_query(struct nm_spool *s, enum nm_query query, struct nm_status *status);
00182
00194 int nm_query_submit(struct nm_spool *s, enum nm_query query, oop_source *oop, nm_query_cb_t cb, void *user);
00195
00203 int nm_configure(struct nm_spool *s);
00204
00210 int nm_info(struct nm_spool *s, struct nm_info *info);
00211
00219 int nm_list(nm_enum_cb_t cb, void*user);
00220
00228 char *nm_strerror(enum nm_error n, int e, char *explanation);
00229
00234 void nm_perror(char *s);
00235
00236 #endif