]>
Commit | Line | Data |
---|---|---|
212380e3 AC |
1 | /* |
2 | * ircd-ratbox: A slightly useful ircd. | |
3 | * s_auth.h: A header for the ident 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 | |
23 | * | |
24 | * $Id: s_auth.h 6 2005-09-10 01:02:21Z nenolod $ | |
25 | */ | |
26 | ||
27 | #ifndef INCLUDED_s_auth_h | |
28 | #define INCLUDED_s_auth_h | |
29 | ||
30 | #include "config.h" | |
31 | #include "res.h" | |
32 | /* | |
33 | * How many auth allocations to allocate in a block. I'm guessing that | |
34 | * a good number here is 64, because these are temporary and don't live | |
35 | * as long as clients do. | |
36 | * -- adrian | |
37 | */ | |
38 | #define AUTH_BLOCK_SIZE 64 | |
39 | ||
40 | struct Client; | |
41 | ||
42 | struct AuthRequest | |
43 | { | |
5b96d9a6 | 44 | rb_dlink_node node; |
212380e3 AC |
45 | struct Client *client; /* pointer to client struct for request */ |
46 | struct DNSQuery dns_query; /* DNS Query */ | |
47 | unsigned int flags; /* current state of request */ | |
c6f49c9a | 48 | rb_fde_t *F; /* file descriptor for auth queries */ |
212380e3 | 49 | time_t timeout; /* time when query expires */ |
212380e3 AC |
50 | }; |
51 | ||
52 | /* | |
53 | * flag values for AuthRequest | |
54 | * NAMESPACE: AM_xxx - Authentication Module | |
55 | */ | |
56 | #define AM_AUTH_CONNECTING (1 << 0) | |
57 | #define AM_AUTH_PENDING (1 << 1) | |
58 | #define AM_DNS_PENDING (1 << 2) | |
59 | ||
60 | #define SetDNSPending(x) ((x)->flags |= AM_DNS_PENDING) | |
61 | #define ClearDNSPending(x) ((x)->flags &= ~AM_DNS_PENDING) | |
62 | #define IsDNSPending(x) ((x)->flags & AM_DNS_PENDING) | |
63 | ||
64 | #define SetAuthConnect(x) ((x)->flags |= AM_AUTH_CONNECTING) | |
65 | #define ClearAuthConnect(x) ((x)->flags &= ~AM_AUTH_CONNECTING) | |
66 | #define IsAuthConnect(x) ((x)->flags & AM_AUTH_CONNECTING) | |
67 | ||
68 | #define SetAuthPending(x) ((x)->flags |= AM_AUTH_PENDING) | |
69 | #define ClearAuthPending(x) ((x)->flags &= AM_AUTH_PENDING) | |
70 | #define IsAuthPending(x) ((x)->flags & AM_AUTH_PENDING) | |
71 | ||
72 | #define ClearAuth(x) ((x)->flags &= ~(AM_AUTH_PENDING | AM_AUTH_CONNECTING)) | |
73 | #define IsDoingAuth(x) ((x)->flags & (AM_AUTH_PENDING | AM_AUTH_CONNECTING)) | |
74 | /* #define SetGotId(x) ((x)->flags |= FLAGS_GOTID) */ | |
75 | ||
76 | ||
77 | ||
78 | extern void start_auth(struct Client *); | |
79 | extern void send_auth_query(struct AuthRequest *req); | |
80 | extern void remove_auth_request(struct AuthRequest *req); | |
81 | extern void init_auth(void); | |
82 | extern void delete_auth_queries(struct Client *); | |
83 | ||
84 | #endif /* INCLUDED_s_auth_h */ |