ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-7.3/include/s_serv.h
Revision: 1119
Committed: Fri Jan 7 22:01:47 2011 UTC (13 years, 2 months ago) by michael
Content type: text/x-chdr
File size: 9503 byte(s)
Log Message:
- removed HUB capability, which was a LL leftover

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * s_serv.h: A header for the server functions.
4 *
5 * Copyright (C) 2002 by the past and present ircd coders, and others.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
21 *
22 * $Id$
23 */
24
25 #ifndef INCLUDED_serv_h
26 #define INCLUDED_serv_h
27 #include "config.h"
28
29 /* collect ziplinks compression ratios/etc every minute */
30 #define ZIPSTATS_TIME 60
31
32 struct ConfItem;
33
34 /*
35 * number of seconds to wait after server starts up, before
36 * starting try_connections()
37 * TOO SOON and you can nick collide like crazy.
38 */
39 #define STARTUP_CONNECTIONS_TIME 60
40
41 struct Client;
42 struct AccessItem;
43 struct Channel;
44
45 /* Capabilities */
46 struct Capability
47 {
48 dlink_node node;
49 char *name; /* name of capability */
50 unsigned int cap; /* mask value */
51 };
52
53 #define CAP_CAP 0x00000001 /* received a CAP to begin with */
54 #define CAP_QS 0x00000002 /* Can handle quit storm removal */
55 #define CAP_EX 0x00000004 /* Can do channel +e exemptions */
56 #define CAP_CHW 0x00000008 /* Can do channel wall @# */
57 #define CAP_IE 0x00000010 /* Can do invite exceptions */
58 #define CAP_EOB 0x00000020 /* Can do EOB message */
59 #define CAP_KLN 0x00000040 /* Can do KLINE message */
60 #define CAP_GLN 0x00000080 /* Can do GLINE message */
61 #define CAP_TS6 0x00000100 /* Can do TS6 */
62 #define CAP_ZIP 0x00000200 /* Can do ZIPlinks */
63 #define CAP_ENC 0x00000400 /* Can do ENCrypted links */
64 #define CAP_KNOCK 0x00000800 /* supports KNOCK */
65 #define CAP_TB 0x00001000 /* supports TB */
66 #define CAP_UNKLN 0x00002000 /* Can do UNKLINE message */
67 #define CAP_CLUSTER 0x00004000 /* supports server clustering */
68 #define CAP_ENCAP 0x00008000 /* supports ENCAP message */
69 #define CAP_HOPS 0x00010000 /* supports HALFOPS */
70 #define CAP_TBURST 0x00020000 /* supports TBURST */
71
72 #ifdef HAVE_LIBZ
73 #define CAP_ZIP_SUPPORTED CAP_ZIP
74 #else
75 #define CAP_ZIP_SUPPORTED 0
76 #endif
77
78 #ifdef HAVE_LIBCRYPTO
79 struct EncCapability
80 {
81 const char *name; /* name of capability (cipher name) */
82 unsigned int cap; /* mask value */
83 int keylen; /* keylength (bytes) */
84 int cipherid; /* ID number of cipher type (BF, IDEA, etc.) */
85 };
86
87 /*
88 * Cipher ID numbers
89 * - DO NOT CHANGE THESE! Otherwise you break backwards compatibility
90 * If you wish to add a new cipher, append it to the list. Do not
91 * have it's value replace another.
92 */
93 #define CIPHER_BF 1
94 #define CIPHER_CAST 2
95 #define CIPHER_DES 3
96 #define CIPHER_3DES 4
97 #define CIPHER_IDEA 5
98 #define CIPHER_RC5_8 6
99 #define CIPHER_RC5_12 7
100 #define CIPHER_RC5_16 8
101
102 /* Cipher Capabilities */
103 #define CAP_ENC_BF_128 0x00000001
104 #define CAP_ENC_BF_168 0x00000002
105 #define CAP_ENC_CAST_128 0x00000004
106 #define CAP_ENC_DES_56 0x00000008
107 #define CAP_ENC_3DES_168 0x00000010
108 #define CAP_ENC_IDEA_128 0x00000020
109 #define CAP_ENC_RC5_8_128 0x00000040
110 #define CAP_ENC_RC5_12_128 0x00000080
111 #define CAP_ENC_RC5_16_128 0x00000100
112 #define CAP_ENC_ALL 0xFFFFFFFF
113
114
115 /* */
116 #ifdef HAVE_EVP_BF_CFB
117 #define USE_CIPHER_BF 1
118 /* Check for bug handling variable length blowfish keys */
119 #if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x00000000L
120 #define USE_CIPHER_BF_V 1
121 #else
122 #define USE_CIPHER_BF_V 0
123 #endif
124 #else
125 #define USE_CIPHER_BF_V 0
126 #define USE_CIPHER_BF 0
127 #endif
128 /* Cast */
129 #ifdef HAVE_EVP_CAST5_CFB
130 #define USE_CIPHER_CAST 1
131 #else
132 #define USE_CIPHER_CAST 0
133 #endif
134 /* DES */
135 #ifdef HAVE_EVP_DES_CFB
136 #define USE_CIPHER_DES 1
137 #else
138 #define USE_CIPHER_DES 0
139 #endif
140 /* 3DES */
141 #ifdef HAVE_EVP_DES_EDE3_CFB
142 #define USE_CIPHER_3DES 1
143 #else
144 #define USE_CIPHER_3DES 0
145 #endif
146 /* IDEA */
147 #ifdef HAVE_EVP_IDEA_CFB
148 #define USE_CIPHER_IDEA 1
149 #else
150 #define USE_CIPHER_IDEA 0
151 #endif
152 /* RC5 */
153 #ifdef HAVE_EVP_RC5_32_12_16_CFB
154 #define USE_CIPHER_RC5 1
155 #else
156 #define USE_CIPHER_RC5 0
157 #endif
158
159 /* Only enable ciphers supported by available version of OpenSSL */
160 #define CAP_ENC_MASK \
161 (((USE_CIPHER_BF * CAP_ENC_ALL) & CAP_ENC_BF_128) | \
162 ((USE_CIPHER_BF_V * CAP_ENC_ALL) & CAP_ENC_BF_168) | \
163 ((USE_CIPHER_CAST * CAP_ENC_ALL) & CAP_ENC_CAST_128) | \
164 ((USE_CIPHER_DES * CAP_ENC_ALL) & CAP_ENC_DES_56) | \
165 ((USE_CIPHER_3DES * CAP_ENC_ALL) & CAP_ENC_3DES_168) | \
166 ((USE_CIPHER_IDEA * CAP_ENC_ALL) & CAP_ENC_IDEA_128) | \
167 ((USE_CIPHER_RC5 * CAP_ENC_ALL) & CAP_ENC_RC5_8_128) | \
168 ((USE_CIPHER_RC5 * CAP_ENC_ALL) & CAP_ENC_RC5_12_128) | \
169 ((USE_CIPHER_RC5 * CAP_ENC_ALL) & CAP_ENC_RC5_16_128))
170
171 #define IsCapableEnc(x, cap) ((x)->localClient->enc_caps & (cap))
172 #define SetCapableEnc(x, cap) ((x)->localClient->enc_caps |= (cap))
173 #define ClearCapEnc(x, cap) ((x)->localClient->enc_caps &= ~(cap))
174 #endif /* HAVE_LIBCRYPTO */
175
176 #define CHECK_SERVER_CRYPTLINK 1
177 #define CHECK_SERVER_NOCRYPTLINK 0
178
179 /*
180 * Capability macros.
181 */
182 #define IsCapable(x, cap) ((x)->localClient->caps & (cap))
183 #define SetCapable(x, cap) ((x)->localClient->caps |= (cap))
184 #define ClearCap(x, cap) ((x)->localClient->caps &= ~(cap))
185
186 #define SLINKCMD_SET_ZIP_OUT_LEVEL 1 /* data */
187 #define SLINKCMD_START_ZIP_OUT 2
188 #define SLINKCMD_START_ZIP_IN 3
189 #define SLINKCMD_SET_CRYPT_IN_CIPHER 4 /* data */
190 #define SLINKCMD_SET_CRYPT_IN_KEY 5 /* data */
191 #define SLINKCMD_START_CRYPT_IN 6
192 #define SLINKCMD_SET_CRYPT_OUT_CIPHER 7 /* data */
193 #define SLINKCMD_SET_CRYPT_OUT_KEY 8 /* data */
194 #define SLINKCMD_START_CRYPT_OUT 9
195 #define SLINKCMD_INJECT_RECVQ 10 /* data */
196 #define SLINKCMD_INJECT_SENDQ 11 /* data */
197 #define SLINKCMD_INIT 12
198 #define SLINKCMD_ZIPSTATS 13
199
200 #define SLINKRPL_FLAG_DATA 0x0001 /* reply has data following */
201 #define SLINKRPL_ERROR 1
202 #define SLINKRPL_ZIPSTATS 2
203
204 typedef void SlinkRplHnd(unsigned int replyid, unsigned int datalen,
205 unsigned char *data, struct Client *client_p);
206 struct SlinkRplDef
207 {
208 unsigned int replyid;
209 SlinkRplHnd *handler;
210 unsigned int flags;
211 };
212
213 extern struct SlinkRplDef slinkrpltab[];
214
215 /*
216 * Globals
217 *
218 *
219 * list of recognized server capabilities. "TS" is not on the list
220 * because all servers that we talk to already do TS, and the kludged
221 * extra argument to "PASS" takes care of checking that. -orabidoo
222 */
223 extern struct Capability captab[];
224 #ifdef HAVE_LIBCRYPTO
225 extern struct EncCapability CipherTable[];
226 #endif
227
228 /*
229 * return values for hunt_server()
230 */
231 #define HUNTED_NOSUCH (-1) /* if the hunted server is not found */
232 #define HUNTED_ISME 0 /* if this server should execute the command */
233 #define HUNTED_PASS 1 /* if message passed onwards successfully */
234
235 extern int valid_servname(const char *);
236 extern int check_server(const char *, struct Client *, int);
237 extern int hunt_server(struct Client *, struct Client *,
238 const char *, int, int, char **);
239 extern void add_capability(const char *, int, int);
240 extern int delete_capability(const char *);
241 extern int find_capability(const char *);
242 extern void send_capabilities(struct Client *, struct AccessItem *, int, int);
243 extern void write_links_file(void *);
244 extern void server_estab(struct Client *);
245 extern const char *show_capabilities(struct Client *);
246 extern void try_connections(void *);
247 extern void collect_zipstats(void *);
248 extern void burst_channel(struct Client *client_p, struct Channel *);
249 extern void sendnick_TS(struct Client *, struct Client *);
250 extern int serv_connect(struct AccessItem *, struct Client *);
251 extern struct Client *find_servconn_in_progress(const char *);
252 extern void cryptlink_init(struct Client *, struct ConfItem *, fde_t *);
253 extern void cryptlink_regen_key(void *);
254 extern void cryptlink_error(struct Client *, const char *,
255 const char *, const char *);
256 extern struct EncCapability *check_cipher(struct Client *, struct AccessItem *);
257 extern struct Server *make_server(struct Client *);
258
259 /* XXX don't belong in the now gone md5, but do these belong in s_serv.c ? */
260 extern int base64_block(unsigned char **, char *, int);
261 extern int unbase64_block(unsigned char **, char *, int);
262 #endif /* INCLUDED_s_serv_h */
263

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision