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