chiark / gitweb /
fix warnings
[nntp-merge-chiark.git] / nntp-merge.h
1 /**/
2
3 #ifndef NNTP_MERGE_H
4 #define NNTP_MERGE_H
5
6 #define MAX_COMMAND 2048
7 #define MAX_RESPONSE 2048
8 #define MAX_XREFLINE 5120
9 #define MAX_SECRET 64
10 #define SESAMEFILE "/etc/news/sesame"
11
12 struct permission {
13   struct permission *next;
14   int authd;
15   char *name;
16 };
17
18 struct serverinfo {
19   struct serverinfo *next; /* only used during setup */
20   int searchthis;
21   int program;
22   const char *nickname;
23   const char *hostname;
24   unsigned short port;
25   const char *send;
26   FILE *rfile, *wfile, *tempfile;
27 };
28
29 struct groupinfo {
30   struct serverinfo *readfrom;
31   struct serverinfo *postto[10];
32   int offset;
33   struct permission *restrictto, *readonlyto;
34 };
35
36 struct cmdinfo {
37   const char *command;
38   void (*call)(char *arg, const struct cmdinfo*);
39   int einfo;
40 };
41
42 void cmd_post(char *arg, const struct cmdinfo *cip);
43
44 void die(const char *msg);
45
46 void readconfig(void);
47 struct groupinfo *findgroup(const char *groupname);
48 struct permission *findpermit(const char *name);
49
50 void *xmalloc(size_t);
51 char *xstrdup(const char *);
52
53 void closeserver(struct serverinfo *server);
54 int stripcommand(char *buf);
55 int decoderesponse(char response[MAX_RESPONSE+3], unsigned long *rvp,
56                    struct serverinfo *server);
57 int servercommand(struct serverinfo *server,
58                   const char command[], char response[MAX_RESPONSE+3],
59                   int flags);
60 void serverdataerr(struct serverinfo *si);
61 int copydatafile(FILE *from, FILE *to);
62 int stillrestricted(struct permission **pip);
63
64 extern struct permission *permissions, *restrictpost;
65 extern struct serverinfo *servers;
66 extern struct sockaddr_in peername;
67
68 extern char *myfqdn, *myxref, *lastdoneauth;
69 extern const char *theirfqdn;
70
71 #endif /* NNTP_MERGE_H */