ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/servers.h
Revision: 1.6
Committed: Sun Sep 16 18:54:42 2007 UTC (16 years, 8 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.5: +9 -4 lines
Log Message:
#defines to enum

File Contents

# Content
1 /**
2 * servers.h: Data structures related to network servers.
3 *
4 * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team
5 * Rights to this code are as documented in COPYING.
6 *
7 *
8 * Portions of this file were derived from sources bearing the following license:
9 * Copyright © 2005 William Pitcock, et al.
10 * Rights to this code are as documented in doc/pod/license.pod.
11 *
12 * $Id: servers.h,v 1.5 2007-09-09 20:05:51 pippijn Exp $
13 */
14
15 #ifndef SERVERS_H
16 #define SERVERS_H
17
18 #include <ermyth/callback.h>
19 #include <common/util.h>
20
21 /* servers struct */
22 class server_t : public zero_initialised
23 {
24 struct callbacks
25 {
26 functor::callback1<server_t *> eob;
27 };
28
29 public:
30 char *name;
31 char *desc;
32 char *sid;
33
34 unsigned int hops;
35 unsigned int users;
36 unsigned int invis;
37 unsigned int opers;
38 unsigned int away;
39
40 time_t connected_since;
41
42 unsigned int flags;
43
44 server_t *uplink; /* uplink server */
45 list_t children; /* children linked to me */
46 list_t userlist; /* users attached to me */
47
48 static callbacks callback;
49 };
50
51 enum server_flag
52 {
53 SF_HIDE = 1 << 0,
54 SF_EOB = 1 << 1, /* Burst finished (we have all users/channels) -- jilles */
55 SF_EOB2 = 1 << 2, /* Is EOB but an uplink is not (for P10) */
56 SF_JUPE_PENDING = 1 << 3 /* Sent SQUIT request, will introduce jupe when it dies (unconnect semantics) */
57 };
58
59 /* tld list struct */
60 struct tld_t : zero_initialised
61 {
62 char *name;
63 };
64
65 #define SERVER_NAME(serv) ((serv)->sid[0] ? (serv)->sid : (serv)->name)
66 #define ME (ircd->uses_uid ? me.numeric : me.name)
67
68 /* servers.c */
69 E list_t tldlist;
70
71 E void init_servers (void);
72
73 E tld_t *tld_add (char const * const name);
74 E void tld_delete (char const * const name);
75 E tld_t *tld_find (char const * const name);
76
77 E server_t *server_add (char const * const name, unsigned int hops, char const * const uplink, char const * const id, char const * const desc);
78 E void server_delete (char const * const name);
79 E void server_delete (server_t *s, bool force = false);
80 E server_t *server_find (char const * const name);
81
82 #endif