]> jfr.im git - irc/quakenet/newserv.git/blame - trusts/trusts.h
Move formatting functions to formats.c
[irc/quakenet/newserv.git] / trusts / trusts.h
CommitLineData
2b6e02e2
CP
1#ifndef __TRUSTS_H
2#define __TRUSTS_H
3
4#include <time.h>
65f34016 5#include <stdint.h>
2b6e02e2
CP
6#include "../lib/sstring.h"
7
8#define MIGRATION_STOPPED -1
9
10#define CONTACTLEN 100
11#define COMMENTLEN 300
be2823bc
CP
12#define TRUSTNAMELEN 100
13#define TRUSTHOSTLEN 100
2b6e02e2
CP
14
15struct trustmigration;
16
be2823bc 17typedef struct trusthost {
65f34016 18 uint32_t ip, mask;
be2823bc
CP
19 unsigned int maxseen;
20 time_t lastseen;
21
22 struct trusthost *next;
23} trusthost;
24
2b6e02e2
CP
25typedef struct trustgroup {
26 unsigned int id;
27
28 sstring *name;
29 unsigned int trustedfor;
30 int mode;
31 unsigned int maxperident;
be2823bc 32 unsigned int maxseen;
2b6e02e2 33 time_t expires;
be2823bc 34 time_t lastseen;
2b6e02e2 35 time_t lastmaxuserreset;
2b6e02e2
CP
36 sstring *createdby, *contact, *comment;
37
be2823bc
CP
38 trusthost *hosts;
39
2b6e02e2
CP
40 struct trustgroup *next;
41} trustgroup;
42
5ada3782 43/* db.c */
be2823bc 44extern int trustsdbloaded;
5ada3782 45void trusts_reloaddb(void);
8a95d3e4
CP
46
47/* formats.c */
48char *trusts_timetostr(time_t);
65f34016
CP
49int trusts_parsecidr(const char *, uint32_t *, short *);
50int trusts_str2cidr(const char *, uint32_t *, uint32_t *);
51char *trusts_cidr2str(uint32_t, uint32_t);
5ada3782
CP
52
53/* data.c */
be2823bc 54extern trustgroup *tglist;
5ada3782
CP
55void trusts_freeall(void);
56trustgroup *tg_getbyid(unsigned int);
57void th_free(trusthost *);
58int th_add(trustgroup *, char *, unsigned int, time_t);
59void tg_free(trustgroup *);
60int tg_add(unsigned int, char *, unsigned int, int, unsigned int, unsigned int, time_t, time_t, time_t, char *, char *, char *);
61
62/* migration.c */
63typedef void (*TrustMigrationGroup)(void *, unsigned int, char *, unsigned int, unsigned int, unsigned int, unsigned int, time_t, time_t, time_t, char *, char *, char *);
64typedef void (*TrustMigrationHost)(void *, unsigned int, char *, unsigned int, time_t);
65typedef void (*TrustMigrationFini)(void *, int);
2b6e02e2 66
5ada3782
CP
67typedef struct trustmigration {
68 int count, cur;
69 void *schedule;
70 void *tag;
71
72 TrustMigrationGroup group;
73 TrustMigrationHost host;
74 TrustMigrationFini fini;
75} trustmigration;
76
77/* db-migration.c */
78
79typedef void (*TrustDBMigrationCallback)(int, void *);
2d4ba67d 80
2b6e02e2 81#endif