ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/servers.h
Revision: 1.7
Committed: Sat Sep 22 14:27:26 2007 UTC (16 years, 8 months ago) by pippijn
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +13 -6 lines
Log Message:
split up ermyth into ermyth-modules, libermyth (currently just ermyth-util) and ermyth-core

File Contents

# User Rev Content
1 pippijn 1.6 /**
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 pippijn 1.3 * Copyright © 2005 William Pitcock, et al.
10 pippijn 1.2 * Rights to this code are as documented in doc/pod/license.pod.
11 pippijn 1.1 *
12 pippijn 1.7 * $Id: servers.h,v 1.6 2007-09-16 18:54:42 pippijn Exp $
13 pippijn 1.1 */
14    
15     #ifndef SERVERS_H
16     #define SERVERS_H
17    
18 pippijn 1.4 #include <ermyth/callback.h>
19 pippijn 1.7 #include <util/containers.h>
20 pippijn 1.4
21 pippijn 1.1 /* servers struct */
22 pippijn 1.3 class server_t : public zero_initialised
23 pippijn 1.1 {
24 pippijn 1.3 struct callbacks
25     {
26     functor::callback1<server_t *> eob;
27     };
28    
29     public:
30 pippijn 1.1 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 pippijn 1.3
48     static callbacks callback;
49 pippijn 1.1 };
50    
51 pippijn 1.5 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 pippijn 1.1
59     /* tld list struct */
60 pippijn 1.3 struct tld_t : zero_initialised
61 pippijn 1.1 {
62 pippijn 1.7 unsigned index;
63    
64     typedef indexing_vector<tld_t> list_type;
65     static list_type list;
66    
67 pippijn 1.1 char *name;
68     };
69    
70 pippijn 1.7 inline char const *
71     SERVER_NAME (server_t *s)
72     {
73     return s->sid[0] ? s->sid : s->name;
74     }
75 pippijn 1.1 #define ME (ircd->uses_uid ? me.numeric : me.name)
76    
77     E void init_servers (void);
78    
79 pippijn 1.3 E tld_t *tld_add (char const * const name);
80     E void tld_delete (char const * const name);
81     E tld_t *tld_find (char const * const name);
82 pippijn 1.7 E void tld_cleanup ();
83 pippijn 1.3
84     E server_t *server_add (char const * const name, unsigned int hops, char const * const uplink, char const * const id, char const * const desc);
85     E void server_delete (char const * const name);
86 pippijn 1.5 E void server_delete (server_t *s, bool force = false);
87 pippijn 1.3 E server_t *server_find (char const * const name);
88 pippijn 1.1
89     #endif