ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/releases/8.1.0beta5/include/s_serv.h
Revision: 1301
Committed: Sat Mar 10 21:47:17 2012 UTC (14 years, 6 months ago) by michael
Content type: text/x-chdr
Original Path: ircd-hybrid-8/include/s_serv.h
File size: 9735 byte(s)
Log Message:
- add 'dline' and 'undline' operator flags
- implement remote dlines mainly for services purposes, but can be used
  by operators as well
- update example configuration files; remove invalid shared::flags entries

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 #define CAP_SVS 0x00040000 /* supports services */
72 #define CAP_DLN 0x00080000 /* Can do DLINE message */
73 #define CAP_UNDLN 0x00100000 /* Can do UNDLINE message */
74
75 #ifdef HAVE_LIBZ
76 #define CAP_ZIP_SUPPORTED CAP_ZIP
77 #else
78 #define CAP_ZIP_SUPPORTED 0
79 #endif
80
81 #ifdef HAVE_LIBCRYPTO
82 struct EncCapability
83 {
84 const char *name; /* name of capability (cipher name) */
85 unsigned int cap; /* mask value */
86 int keylen; /* keylength (bytes) */
87 int cipherid; /* ID number of cipher type (BF, IDEA, etc.) */
88 };
89
90 /*
91 * Cipher ID numbers
92 * - DO NOT CHANGE THESE! Otherwise you break backwards compatibility
93 * If you wish to add a new cipher, append it to the list. Do not
94 * have it's value replace another.
95 */
96 #define CIPHER_BF 1
97 #define CIPHER_CAST 2
98 #define CIPHER_DES 3
99 #define CIPHER_3DES 4
100 #define CIPHER_IDEA 5
101 #define CIPHER_RC5_8 6
102 #define CIPHER_RC5_12 7
103 #define CIPHER_RC5_16 8
104
105 /* Cipher Capabilities */
106 #define CAP_ENC_BF_128 0x00000001
107 #define CAP_ENC_BF_168 0x00000002
108 #define CAP_ENC_CAST_128 0x00000004
109 #define CAP_ENC_DES_56 0x00000008
110 #define CAP_ENC_3DES_168 0x00000010
111 #define CAP_ENC_IDEA_128 0x00000020
112 #define CAP_ENC_RC5_8_128 0x00000040
113 #define CAP_ENC_RC5_12_128 0x00000080
114 #define CAP_ENC_RC5_16_128 0x00000100
115 #define CAP_ENC_ALL 0xFFFFFFFF
116
117
118 /* */
119 #ifdef HAVE_EVP_BF_CFB
120 #define USE_CIPHER_BF 1
121 /* Check for bug handling variable length blowfish keys */
122 #if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x00000000L
123 #define USE_CIPHER_BF_V 1
124 #else
125 #define USE_CIPHER_BF_V 0
126 #endif
127 #else
128 #define USE_CIPHER_BF_V 0
129 #define USE_CIPHER_BF 0
130 #endif
131 /* Cast */
132 #ifdef HAVE_EVP_CAST5_CFB
133 #define USE_CIPHER_CAST 1
134 #else
135 #define USE_CIPHER_CAST 0
136 #endif
137 /* DES */
138 #ifdef HAVE_EVP_DES_CFB
139 #define USE_CIPHER_DES 1
140 #else
141 #define USE_CIPHER_DES 0
142 #endif
143 /* 3DES */
144 #ifdef HAVE_EVP_DES_EDE3_CFB
145 #define USE_CIPHER_3DES 1
146 #else
147 #define USE_CIPHER_3DES 0
148 #endif
149 /* IDEA */
150 #ifdef HAVE_EVP_IDEA_CFB
151 #define USE_CIPHER_IDEA 1
152 #else
153 #define USE_CIPHER_IDEA 0
154 #endif
155 /* RC5 */
156 #ifdef HAVE_EVP_RC5_32_12_16_CFB
157 #define USE_CIPHER_RC5 1
158 #else
159 #define USE_CIPHER_RC5 0
160 #endif
161
162 /* Only enable ciphers supported by available version of OpenSSL */
163 #define CAP_ENC_MASK \
164 (((USE_CIPHER_BF * CAP_ENC_ALL) & CAP_ENC_BF_128) | \
165 ((USE_CIPHER_BF_V * CAP_ENC_ALL) & CAP_ENC_BF_168) | \
166 ((USE_CIPHER_CAST * CAP_ENC_ALL) & CAP_ENC_CAST_128) | \
167 ((USE_CIPHER_DES * CAP_ENC_ALL) & CAP_ENC_DES_56) | \
168 ((USE_CIPHER_3DES * CAP_ENC_ALL) & CAP_ENC_3DES_168) | \
169 ((USE_CIPHER_IDEA * CAP_ENC_ALL) & CAP_ENC_IDEA_128) | \
170 ((USE_CIPHER_RC5 * CAP_ENC_ALL) & CAP_ENC_RC5_8_128) | \
171 ((USE_CIPHER_RC5 * CAP_ENC_ALL) & CAP_ENC_RC5_12_128) | \
172 ((USE_CIPHER_RC5 * CAP_ENC_ALL) & CAP_ENC_RC5_16_128))
173
174 #define IsCapableEnc(x, cap) ((x)->localClient->enc_caps & (cap))
175 #define SetCapableEnc(x, cap) ((x)->localClient->enc_caps |= (cap))
176 #define ClearCapEnc(x, cap) ((x)->localClient->enc_caps &= ~(cap))
177 #endif /* HAVE_LIBCRYPTO */
178
179 #define CHECK_SERVER_CRYPTLINK 1
180 #define CHECK_SERVER_NOCRYPTLINK 0
181
182 /*
183 * Capability macros.
184 */
185 #define IsCapable(x, cap) ((x)->localClient->caps & (cap))
186 #define SetCapable(x, cap) ((x)->localClient->caps |= (cap))
187 #define ClearCap(x, cap) ((x)->localClient->caps &= ~(cap))
188
189 #define SLINKCMD_SET_ZIP_OUT_LEVEL 1 /* data */
190 #define SLINKCMD_START_ZIP_OUT 2
191 #define SLINKCMD_START_ZIP_IN 3
192 #define SLINKCMD_SET_CRYPT_IN_CIPHER 4 /* data */
193 #define SLINKCMD_SET_CRYPT_IN_KEY 5 /* data */
194 #define SLINKCMD_START_CRYPT_IN 6
195 #define SLINKCMD_SET_CRYPT_OUT_CIPHER 7 /* data */
196 #define SLINKCMD_SET_CRYPT_OUT_KEY 8 /* data */
197 #define SLINKCMD_START_CRYPT_OUT 9
198 #define SLINKCMD_INJECT_RECVQ 10 /* data */
199 #define SLINKCMD_INJECT_SENDQ 11 /* data */
200 #define SLINKCMD_INIT 12
201 #define SLINKCMD_ZIPSTATS 13
202
203 #define SLINKRPL_FLAG_DATA 0x0001 /* reply has data following */
204 #define SLINKRPL_ERROR 1
205 #define SLINKRPL_ZIPSTATS 2
206
207 typedef void SlinkRplHnd(unsigned int replyid, unsigned int datalen,
208 unsigned char *data, struct Client *client_p);
209 struct SlinkRplDef
210 {
211 unsigned int replyid;
212 SlinkRplHnd *handler;
213 unsigned int flags;
214 };
215
216 extern struct SlinkRplDef slinkrpltab[];
217
218 /*
219 * Globals
220 *
221 *
222 * list of recognized server capabilities. "TS" is not on the list
223 * because all servers that we talk to already do TS, and the kludged
224 * extra argument to "PASS" takes care of checking that. -orabidoo
225 */
226 extern struct Capability captab[];
227 #ifdef HAVE_LIBCRYPTO
228 extern struct EncCapability CipherTable[];
229 #endif
230
231 /*
232 * return values for hunt_server()
233 */
234 #define HUNTED_NOSUCH (-1) /* if the hunted server is not found */
235 #define HUNTED_ISME 0 /* if this server should execute the command */
236 #define HUNTED_PASS 1 /* if message passed onwards successfully */
237
238 extern int valid_servname(const char *);
239 extern int check_server(const char *, struct Client *, int);
240 extern int hunt_server(struct Client *, struct Client *,
241 const char *, int, int, char **);
242 extern void add_capability(const char *, int, int);
243 extern int delete_capability(const char *);
244 extern int find_capability(const char *);
245 extern void send_capabilities(struct Client *, struct AccessItem *, int, int);
246 extern void write_links_file(void *);
247 extern void server_estab(struct Client *);
248 extern const char *show_capabilities(struct Client *);
249 extern void try_connections(void *);
250 extern void collect_zipstats(void *);
251 extern void burst_channel(struct Client *client_p, struct Channel *);
252 extern void sendnick_TS(struct Client *, struct Client *);
253 extern int serv_connect(struct AccessItem *, struct Client *);
254 extern struct Client *find_servconn_in_progress(const char *);
255 extern void cryptlink_init(struct Client *, struct ConfItem *, fde_t *);
256 extern void cryptlink_regen_key(void *);
257 extern void cryptlink_error(struct Client *, const char *,
258 const char *, const char *);
259 extern struct EncCapability *check_cipher(struct Client *, struct AccessItem *);
260 extern struct Server *make_server(struct Client *);
261
262 /* XXX don't belong in the now gone md5, but do these belong in s_serv.c ? */
263 extern int base64_block(unsigned char **, char *, int);
264 extern int unbase64_block(unsigned char **, char *, int);
265 #endif /* INCLUDED_s_serv_h */
266

Properties

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