1 | /* |
1 | /* |
2 | * Copyright © 2005 William Pitcock, et al. |
2 | * Copyright © 2005 William Pitcock, et al. |
3 | * Rights to this code are as documented in doc/pod/license.pod. |
3 | * Rights to this code are as documented in doc/pod/license.pod. |
4 | * |
4 | * |
5 | * Data structures related to network servers. |
5 | * Data structures related to network servers. |
6 | * |
6 | * |
7 | * $Id: servers.h,v 1.2 2007/07/21 01:29:07 pippijn Exp $ |
7 | * $Id: servers.h,v 1.3 2007/08/28 17:08:07 pippijn Exp $ |
8 | */ |
8 | */ |
9 | |
9 | |
10 | #ifndef SERVERS_H |
10 | #ifndef SERVERS_H |
11 | #define SERVERS_H |
11 | #define SERVERS_H |
12 | |
12 | |
13 | /* servers struct */ |
13 | /* servers struct */ |
14 | struct server_t |
14 | class server_t : public zero_initialised |
15 | { |
15 | { |
|
|
16 | struct callbacks |
|
|
17 | { |
|
|
18 | functor::callback1<server_t *> eob; |
|
|
19 | }; |
|
|
20 | |
|
|
21 | public: |
16 | char *name; |
22 | char *name; |
17 | char *desc; |
23 | char *desc; |
18 | char *sid; |
24 | char *sid; |
19 | |
25 | |
20 | unsigned int hops; |
26 | unsigned int hops; |
… | |
… | |
28 | unsigned int flags; |
34 | unsigned int flags; |
29 | |
35 | |
30 | server_t *uplink; /* uplink server */ |
36 | server_t *uplink; /* uplink server */ |
31 | list_t children; /* children linked to me */ |
37 | list_t children; /* children linked to me */ |
32 | list_t userlist; /* users attached to me */ |
38 | list_t userlist; /* users attached to me */ |
|
|
39 | |
|
|
40 | static callbacks callback; |
33 | }; |
41 | }; |
34 | |
42 | |
35 | #define SF_HIDE 0x00000001 |
43 | #define SF_HIDE 0x00000001 |
36 | #define SF_EOB 0x00000002 /* Burst finished (we have all users/channels) -- jilles */ |
44 | #define SF_EOB 0x00000002 /* Burst finished (we have all users/channels) -- jilles */ |
37 | #define SF_EOB2 0x00000004 /* Is EOB but an uplink is not (for P10) */ |
45 | #define SF_EOB2 0x00000004 /* Is EOB but an uplink is not (for P10) */ |
38 | #define SF_JUPE_PENDING 0x00000008 /* Sent SQUIT request, will introduce jupe when it dies (unconnect semantics) */ |
46 | #define SF_JUPE_PENDING 0x00000008 /* Sent SQUIT request, will introduce jupe when it dies (unconnect semantics) */ |
39 | |
47 | |
40 | /* tld list struct */ |
48 | /* tld list struct */ |
41 | struct tld_t |
49 | struct tld_t : zero_initialised |
42 | { |
50 | { |
43 | char *name; |
51 | char *name; |
44 | }; |
52 | }; |
45 | |
53 | |
46 | #define SERVER_NAME(serv) ((serv)->sid[0] ? (serv)->sid : (serv)->name) |
54 | #define SERVER_NAME(serv) ((serv)->sid[0] ? (serv)->sid : (serv)->name) |
47 | #define ME (ircd->uses_uid ? me.numeric : me.name) |
55 | #define ME (ircd->uses_uid ? me.numeric : me.name) |
48 | |
56 | |
49 | /* servers.c */ |
57 | /* servers.c */ |
50 | E dictionary_tree_t *servlist; |
|
|
51 | E list_t tldlist; |
58 | E list_t tldlist; |
52 | |
59 | |
53 | E void init_servers (void); |
60 | E void init_servers (void); |
54 | |
61 | |
55 | E tld_t *tld_add (const char *name); |
62 | E tld_t *tld_add (char const * const name); |
56 | E void tld_delete (const char *name); |
63 | E void tld_delete (char const * const name); |
57 | E tld_t *tld_find (const char *name); |
64 | E tld_t *tld_find (char const * const name); |
58 | |
65 | |
59 | E server_t *server_add (const char *name, unsigned int hops, const char *uplink, const char *id, const char *desc); |
66 | E server_t *server_add (char const * const name, unsigned int hops, char const * const uplink, char const * const id, char const * const desc); |
60 | E void server_delete (const char *name); |
67 | E void server_delete (char const * const name); |
61 | E server_t *server_find (const char *name); |
68 | E server_t *server_find (char const * const name); |
62 | |
69 | |
63 | #endif |
70 | #endif |