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.4 2007-08-30 19:56:19 pippijn Exp $ |
8 |
*/ |
9 |
|
10 |
#ifndef SERVERS_H |
11 |
#define SERVERS_H |
12 |
|
13 |
#include <ermyth/callback.h> |
14 |
#include <common/util.h> |
15 |
|
16 |
/* servers struct */ |
17 |
class server_t : public zero_initialised |
18 |
{ |
19 |
struct callbacks |
20 |
{ |
21 |
functor::callback1<server_t *> eob; |
22 |
}; |
23 |
|
24 |
public: |
25 |
char *name; |
26 |
char *desc; |
27 |
char *sid; |
28 |
|
29 |
unsigned int hops; |
30 |
unsigned int users; |
31 |
unsigned int invis; |
32 |
unsigned int opers; |
33 |
unsigned int away; |
34 |
|
35 |
time_t connected_since; |
36 |
|
37 |
unsigned int flags; |
38 |
|
39 |
server_t *uplink; /* uplink server */ |
40 |
list_t children; /* children linked to me */ |
41 |
list_t userlist; /* users attached to me */ |
42 |
|
43 |
static callbacks callback; |
44 |
}; |
45 |
|
46 |
enum server_flag |
47 |
{ |
48 |
SF_HIDE = 1 << 0, |
49 |
SF_EOB = 1 << 1, /* Burst finished (we have all users/channels) -- jilles */ |
50 |
SF_EOB2 = 1 << 2, /* Is EOB but an uplink is not (for P10) */ |
51 |
SF_JUPE_PENDING = 1 << 3 /* Sent SQUIT request, will introduce jupe when it dies (unconnect semantics) */ |
52 |
}; |
53 |
|
54 |
/* tld list struct */ |
55 |
struct tld_t : zero_initialised |
56 |
{ |
57 |
char *name; |
58 |
}; |
59 |
|
60 |
#define SERVER_NAME(serv) ((serv)->sid[0] ? (serv)->sid : (serv)->name) |
61 |
#define ME (ircd->uses_uid ? me.numeric : me.name) |
62 |
|
63 |
/* servers.c */ |
64 |
E list_t tldlist; |
65 |
|
66 |
E void init_servers (void); |
67 |
|
68 |
E tld_t *tld_add (char const * const name); |
69 |
E void tld_delete (char const * const name); |
70 |
E tld_t *tld_find (char const * const name); |
71 |
|
72 |
E server_t *server_add (char const * const name, unsigned int hops, char const * const uplink, char const * const id, char const * const desc); |
73 |
E void server_delete (char const * const name); |
74 |
E void server_delete (server_t *s, bool force = false); |
75 |
E server_t *server_find (char const * const name); |
76 |
|
77 |
#endif |