6 #include "../nick/nick.h"
7 #include "../lib/sstring.h"
9 #define MIGRATION_STOPPED -1
10 #define MIGRATION_LASTERROR -2
12 #define CONTACTLEN 100
13 #define COMMENTLEN 300
14 #define TRUSTNAMELEN 100
15 #define TRUSTHOSTLEN 100
18 struct trustmigration
;
22 typedef struct trusthost
{
26 unsigned int maxusage
;
30 struct trustgroup
*group
;
34 struct trusthost
*next
;
37 typedef struct trustgroup
{
41 unsigned int trustedfor
;
43 unsigned int maxperident
;
44 unsigned int maxusage
;
47 time_t lastmaxuserreset
;
48 sstring
*createdby
, *contact
, *comment
;
53 struct trustgroup
*next
;
55 void *exts
[MAXTGEXTS
];
58 #define nextbytrust(x) (nick *)((x)->exts[trusts_nextuserext])
59 #define gettrusthost(x) (trusthost *)((x)->exts[trusts_thext])
60 #define setnextbytrust(x, y) (x)->exts[trusts_nextuserext] = (y)
61 #define settrusthost(x, y) (x)->exts[trusts_thext] = (y)
64 extern int trusts_thext
, trusts_nextuserext
;
65 int findtgext(const char *);
66 int registertgext(const char *);
67 void releasetgext(int);
70 extern int trustsdbloaded
;
71 int trusts_loaddb(void);
72 void trusts_closedb(int);
75 char *trusts_timetostr(time_t);
76 int trusts_parsecidr(const char *, uint32_t *, short *);
77 int trusts_str2cidr(const char *, uint32_t *, uint32_t *);
78 char *trusts_cidr2str(uint32_t, uint32_t);
81 extern trustgroup
*tglist
;
82 trustgroup
*tg_getbyid(unsigned int);
83 void th_free(trusthost
*);
84 int th_add(trustgroup
*, unsigned int, char *, unsigned int, time_t);
85 void tg_free(trustgroup
*);
86 int tg_add(unsigned int, char *, unsigned int, int, unsigned int, unsigned int, time_t, time_t, time_t, char *, char *, char *);
87 trusthost
*th_getbyhost(uint32_t host
);
90 typedef void (*TrustMigrationGroup
)(void *, unsigned int, char *, unsigned int, unsigned int, unsigned int, unsigned int, time_t, time_t, time_t, char *, char *, char *);
91 typedef void (*TrustMigrationHost
)(void *, unsigned int, char *, unsigned int, time_t);
92 typedef void (*TrustMigrationFini
)(void *, int);
94 typedef struct trustmigration
{
99 TrustMigrationGroup group
;
100 TrustMigrationHost host
;
101 TrustMigrationFini fini
;
106 typedef void (*TrustDBMigrationCallback
)(int, void *);