chiark / gitweb /
use libinn logging where applicable - debugged
[inn-innduct.git] / storage / interface.h
1 /*  $Id: interface.h 5933 2002-12-07 09:47:17Z rra $
2 **
3 **  Storage Manager interface header
4 */
5
6 #ifndef __INTERFACE_H__
7 #define __INTERFACE_H__
8
9 #include "config.h"
10 #include "storage.h"
11 #include <stdio.h>
12
13 typedef struct {
14     bool        selfexpire;
15     bool        expensivestat;
16 } SMATTRIBUTE;
17
18 typedef struct {
19     const char          *name;
20     unsigned char       type;
21     bool                (*init)(SMATTRIBUTE *attr);
22     TOKEN               (*store)(const ARTHANDLE article, const STORAGECLASS storageclass);
23     ARTHANDLE           *(*retrieve)(const TOKEN token, const RETRTYPE amount);
24     ARTHANDLE           *(*next)(const ARTHANDLE *article, const RETRTYPE amount);
25     void                (*freearticle)(ARTHANDLE *article);
26     bool                (*cancel)(TOKEN token);
27     bool                (*ctl)(PROBETYPE type, TOKEN *token, void *value);
28     bool                (*flushcacheddata)(FLUSHTYPE type);
29     void                (*printfiles)(FILE *, TOKEN, char **xref, int ngroups);
30     void                (*shutdown)(void);
31 } STORAGE_METHOD;
32
33 typedef struct __S_SUB__ {
34     int                 type;        /* Index into storage_methods of the one to use */
35     size_t              minsize;     /* Minimum size to send to this method */
36     size_t              maxsize;     /* Maximum size to send to this method */
37     time_t              minexpire;   /* Minimum expire offset to send method */
38     time_t              maxexpire;   /* Maximum expire offset to send method */
39     int                 numpatterns; /* Number of patterns in patterns */
40     int                 class;       /* Number of the storage class for this subscription */
41     char                *pattern;    /* Wildmat pattern to check against the
42                                         groups to determine if the article
43                                         should go to this method */
44     char                *options;    /* additional options specific to the
45                                         method */
46     bool                exactmatch;  /* all newsgroups to which article belongs
47                                         should match the patterns */
48     struct __S_SUB__   *next;
49 } STORAGE_SUB;
50
51 extern bool SMopenmode;
52 extern bool SMpreopen;
53 char *SMFindBody(char *article, int len);
54 STORAGE_SUB *SMGetConfig(STORAGETYPE type, STORAGE_SUB *sub);
55 STORAGE_SUB *SMgetsub(const ARTHANDLE article);
56 void SMseterror(int errorno, char *error);
57
58 #endif /* __INTERFACE_H__ */