chiark / gitweb /
run debian/rules patch
[inn-innduct.git] / include / ov.h
1 #ifndef _OV_H_
2 #define _OV_H_
3
4 #include "storage.h"
5 #include "inn/history.h"
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif /* __cplusplus */
10
11 #define OV_READ  1
12 #define OV_WRITE 2
13
14 typedef enum {OVSPACE, OVSORT, OVCUTOFFLOW, OVGROUPBASEDEXPIRE, OVSTATICSEARCH, OVSTATALL, OVCACHEKEEP, OVCACHEFREE} OVCTLTYPE;
15 #define OV_NOSPACE 100
16 typedef enum {OVNEWSGROUP, OVARRIVED, OVNOSORT} OVSORTTYPE;
17 typedef enum {OVADDCOMPLETED, OVADDFAILED, OVADDGROUPNOMATCH} OVADDRESULT;
18
19 typedef struct _OVGE {
20     bool        delayrm;          /* append tokens to filename if true */
21     bool        usepost;          /* posting date is used to determine expiry
22                                      time if true */
23     bool        quiet;            /* statistics will be suppressed if true */
24     bool        keep;             /* keep article so long as any of crossposted
25                                      newsgroups is not expired if true */
26     bool        earliest;         /* purge article any of crossposted
27                                      newsgroups is expired if true */
28     bool        ignoreselfexpire; /* purge article even if storing method has
29                                      self expiry */
30     char        *filename;        /* used to append tokens to this file if
31                                      delayrm is true */
32     time_t      now;              /* used as current time */
33     float       timewarp;         /* used to bias expiry time */
34 } OVGE;
35
36 extern bool     OVstatall;
37 bool OVopen(int mode);
38 bool OVgroupstats(char *group, int *lo, int *hi, int *count, int *flag);
39 bool OVgroupadd(char *group, ARTNUM lo, ARTNUM hi, char *flag);
40 bool OVgroupdel(char *group);
41 OVADDRESULT OVadd(TOKEN token, char *data, int len, time_t arrived, time_t expires);
42 bool OVcancel(TOKEN token);
43 void *OVopensearch(char *group, int low, int high);
44 bool OVsearch(void *handle, ARTNUM *artnum, char **data, int *len, TOKEN *token, time_t *arrived);
45 void OVclosesearch(void *handle);
46 bool OVgetartinfo(char *group, ARTNUM artnum, TOKEN *token);
47 bool OVexpiregroup(char *group, int *lo, struct history *h);
48 bool OVctl(OVCTLTYPE type, void *val);
49 void OVclose(void);
50
51 /* Overview data manipulation functions. */
52 const struct cvector *overview_fields(void);
53 struct vector *overview_extra_fields(void);
54 struct buffer *overview_build(ARTNUM number, const char *article,
55                               size_t length, const struct vector *extra,
56                               struct buffer *);
57 bool overview_check(const char *data, size_t length, ARTNUM article);
58 int overview_index(const char *field, const struct vector *extra);
59 struct cvector *overview_split(const char *line, size_t length,
60                                ARTNUM *number, struct cvector *vector);
61 char *overview_getheader(const struct cvector *vector, int element,
62                          const struct vector *extra);
63
64 /* offsets into vectors for standard overview headers */
65 enum {
66     OVERVIEW_SUBJECT,
67     OVERVIEW_FROM,
68     OVERVIEW_DATE,
69     OVERVIEW_MESSAGE_ID,
70     OVERVIEW_REFERENCES,
71     OVERVIEW_BYTES,
72     OVERVIEW_LINES,
73     OVERVIEW_MAX
74 };
75
76 #ifdef __cplusplus
77 }
78 #endif /* __cplusplus */
79
80 #endif /* _OV_H_ */