]>
Commit | Line | Data |
---|---|---|
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 | |
15 | struct trustmigration; | |
16 | ||
be2823bc | 17 | typedef 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 |
25 | typedef 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 CP |
43 | /* trusts.c */ |
44 | char *trusts_timetostr(time_t); | |
2b6e02e2 | 45 | |
5ada3782 | 46 | /* db.c */ |
be2823bc | 47 | extern int trustsdbloaded; |
5ada3782 | 48 | void trusts_reloaddb(void); |
65f34016 CP |
49 | int trusts_parsecidr(const char *, uint32_t *, short *); |
50 | int trusts_str2cidr(const char *, uint32_t *, uint32_t *); | |
51 | char *trusts_cidr2str(uint32_t, uint32_t); | |
5ada3782 CP |
52 | |
53 | /* data.c */ | |
be2823bc | 54 | extern trustgroup *tglist; |
5ada3782 CP |
55 | void trusts_freeall(void); |
56 | trustgroup *tg_getbyid(unsigned int); | |
57 | void th_free(trusthost *); | |
58 | int th_add(trustgroup *, char *, unsigned int, time_t); | |
59 | void tg_free(trustgroup *); | |
60 | int 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 */ | |
63 | typedef void (*TrustMigrationGroup)(void *, unsigned int, char *, unsigned int, unsigned int, unsigned int, unsigned int, time_t, time_t, time_t, char *, char *, char *); | |
64 | typedef void (*TrustMigrationHost)(void *, unsigned int, char *, unsigned int, time_t); | |
65 | typedef void (*TrustMigrationFini)(void *, int); | |
2b6e02e2 | 66 | |
5ada3782 CP |
67 | typedef 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 | ||
79 | typedef void (*TrustDBMigrationCallback)(int, void *); | |
2d4ba67d | 80 | |
2b6e02e2 | 81 | #endif |