]>
Commit | Line | Data |
---|---|---|
212380e3 AC |
1 | /* |
2 | * ircd-ratbox: A slightly useful ircd. | |
3 | * s_serv.h: A header for the server functions. | |
4 | * | |
5 | * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center | |
6 | * Copyright (C) 1996-2002 Hybrid Development Team | |
7 | * Copyright (C) 2002-2004 ircd-ratbox development team | |
8 | * | |
9 | * This program is free software; you can redistribute it and/or modify | |
10 | * it under the terms of the GNU General Public License as published by | |
11 | * the Free Software Foundation; either version 2 of the License, or | |
12 | * (at your option) any later version. | |
13 | * | |
14 | * This program is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | * GNU General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU General Public License | |
20 | * along with this program; if not, write to the Free Software | |
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |
22 | * USA | |
212380e3 AC |
23 | */ |
24 | ||
25 | #ifndef INCLUDED_serv_h | |
26 | #define INCLUDED_serv_h | |
27 | ||
28 | #include "config.h" | |
346fba92 | 29 | #include "capability.h" |
212380e3 AC |
30 | |
31 | /* | |
32 | * The number of seconds between calls to try_connections(). Fiddle with | |
33 | * this ONLY if you KNOW what you're doing! | |
34 | */ | |
35 | #define TRY_CONNECTIONS_TIME 60 | |
36 | ||
212380e3 AC |
37 | /* |
38 | * number of seconds to wait after server starts up, before | |
39 | * starting try_connections() | |
55abcbb2 | 40 | * TOO SOON and you can nick collide like crazy. |
212380e3 AC |
41 | */ |
42 | #define STARTUP_CONNECTIONS_TIME 60 | |
43 | ||
44 | struct Client; | |
45 | struct server_conf; | |
46 | struct Channel; | |
47 | ||
48 | /* Capabilities */ | |
346fba92 | 49 | extern struct CapabilityIndex *serv_capindex; |
486cd344 | 50 | extern struct CapabilityIndex *cli_capindex; |
346fba92 | 51 | |
32df5e96 AC |
52 | /* register client capabilities with this structure for 3.2 enhanced capability negotiation */ |
53 | #define CLICAP_FLAGS_STICKY 0x001 | |
54 | #define CLICAP_FLAGS_REQACK 0x002 | |
55 | ||
56 | struct ClientCapability { | |
38ffccf8 AC |
57 | int (*visible)(struct Client *); /* whether or not to display the capability. set to NULL or true return value = displayed */ |
58 | const char *(*data)(struct Client *); /* any custom data for the capability. set to NULL or return NULL = no data */ | |
32df5e96 AC |
59 | unsigned int flags; |
60 | }; | |
61 | ||
62 | /* builtin client capabilities */ | |
63 | extern unsigned int CLICAP_MULTI_PREFIX; | |
32df5e96 AC |
64 | extern unsigned int CLICAP_ACCOUNT_NOTIFY; |
65 | extern unsigned int CLICAP_EXTENDED_JOIN; | |
66 | extern unsigned int CLICAP_AWAY_NOTIFY; | |
32df5e96 AC |
67 | extern unsigned int CLICAP_USERHOST_IN_NAMES; |
68 | extern unsigned int CLICAP_CAP_NOTIFY; | |
69 | extern unsigned int CLICAP_CHGHOST; | |
be2ce24c | 70 | extern unsigned int CLICAP_ECHO_MESSAGE; |
32df5e96 | 71 | |
346fba92 AC |
72 | /* |
73 | * XXX: this is kind of ugly, but this allows us to have backwards | |
74 | * API-compatibility. | |
75 | */ | |
76 | extern unsigned int CAP_CAP; /* received a CAP to begin with */ | |
77 | extern unsigned int CAP_QS; /* Can handle quit storm removal */ | |
78 | extern unsigned int CAP_EX; /* Can do channel +e exemptions */ | |
79 | extern unsigned int CAP_CHW; /* Can do channel wall @# */ | |
80 | extern unsigned int CAP_IE; /* Can do invite exceptions */ | |
81 | extern unsigned int CAP_KLN; /* Can do KLINE message */ | |
82 | extern unsigned int CAP_ZIP; /* Can do ZIPlinks */ | |
83 | extern unsigned int CAP_KNOCK; /* supports KNOCK */ | |
84 | extern unsigned int CAP_TB; /* supports TBURST */ | |
85 | extern unsigned int CAP_UNKLN; /* supports remote unkline */ | |
86 | extern unsigned int CAP_CLUSTER; /* supports cluster stuff */ | |
87 | extern unsigned int CAP_ENCAP; /* supports ENCAP */ | |
88 | extern unsigned int CAP_TS6; /* supports TS6 or above */ | |
89 | extern unsigned int CAP_SERVICE; /* supports services */ | |
90 | extern unsigned int CAP_RSFNC; /* rserv FNC */ | |
91 | extern unsigned int CAP_SAVE; /* supports SAVE (nick collision FNC) */ | |
92 | extern unsigned int CAP_EUID; /* supports EUID (ext UID + nonencap CHGHOST) */ | |
93 | extern unsigned int CAP_EOPMOD; /* supports EOPMOD (ext +z + ext topic) */ | |
94 | extern unsigned int CAP_BAN; /* supports propagated bans */ | |
95 | extern unsigned int CAP_MLOCK; /* supports MLOCK messages */ | |
96 | ||
97 | /* XXX: added for backwards compatibility. --nenolod */ | |
98 | #define CAP_MASK (capability_index_mask(serv_capindex) & ~(CAP_TS6 | CAP_CAP)) | |
212380e3 AC |
99 | |
100 | #ifdef HAVE_LIBZ | |
101 | #define CAP_ZIP_SUPPORTED CAP_ZIP | |
102 | #else | |
103 | #define CAP_ZIP_SUPPORTED 0 | |
104 | #endif | |
105 | ||
106 | /* | |
107 | * Capability macros. | |
108 | */ | |
109 | #define IsCapable(x, cap) (((x)->localClient->caps & (cap)) == cap) | |
110 | #define NotCapable(x, cap) (((x)->localClient->caps & (cap)) == 0) | |
111 | #define ClearCap(x, cap) ((x)->localClient->caps &= ~(cap)) | |
112 | ||
212380e3 AC |
113 | /* |
114 | * Globals | |
115 | * | |
116 | * | |
117 | * list of recognized server capabilities. "TS" is not on the list | |
118 | * because all servers that we talk to already do TS, and the kludged | |
119 | * extra argument to "PASS" takes care of checking that. -orabidoo | |
120 | */ | |
212380e3 AC |
121 | extern int MaxClientCount; /* GLOBAL - highest number of clients */ |
122 | extern int MaxConnectionCount; /* GLOBAL - highest number of connections */ | |
123 | ||
124 | extern int refresh_user_links; | |
125 | ||
126 | /* | |
55abcbb2 | 127 | * return values for hunt_server() |
212380e3 AC |
128 | */ |
129 | #define HUNTED_NOSUCH (-1) /* if the hunted server is not found */ | |
130 | #define HUNTED_ISME 0 /* if this server should execute the command */ | |
131 | #define HUNTED_PASS 1 /* if message passed onwards successfully */ | |
132 | ||
346fba92 | 133 | extern void init_builtin_capabs(void); |
212380e3 AC |
134 | |
135 | extern int hunt_server(struct Client *client_pt, | |
136 | struct Client *source_pt, | |
137 | const char *command, int server, int parc, const char **parv); | |
346fba92 | 138 | extern void send_capabilities(struct Client *, unsigned int); |
212380e3 AC |
139 | extern const char *show_capabilities(struct Client *client); |
140 | extern void try_connections(void *unused); | |
212380e3 AC |
141 | |
142 | extern int check_server(const char *name, struct Client *server); | |
143 | extern int server_estab(struct Client *client_p); | |
144 | ||
145 | extern int serv_connect(struct server_conf *, struct Client *); | |
146 | ||
147 | #endif /* INCLUDED_s_serv_h */ |