]>
Commit | Line | Data |
---|---|---|
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 | { | |
44 | rb_dlink_node node; | |
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 */ | |
48 | int fd; /* file descriptor for auth queries */ | |
49 | time_t timeout; /* time when query expires */ | |
50 | #ifdef IPV6 | |
51 | int ip6_int; | |
52 | #endif | |
53 | }; | |
54 | ||
55 | /* | |
56 | * flag values for AuthRequest | |
57 | * NAMESPACE: AM_xxx - Authentication Module | |
58 | */ | |
59 | #define AM_AUTH_CONNECTING (1 << 0) | |
60 | #define AM_AUTH_PENDING (1 << 1) | |
61 | #define AM_DNS_PENDING (1 << 2) | |
62 | ||
63 | #define SetDNSPending(x) ((x)->flags |= AM_DNS_PENDING) | |
64 | #define ClearDNSPending(x) ((x)->flags &= ~AM_DNS_PENDING) | |
65 | #define IsDNSPending(x) ((x)->flags & AM_DNS_PENDING) | |
66 | ||
67 | #define SetAuthConnect(x) ((x)->flags |= AM_AUTH_CONNECTING) | |
68 | #define ClearAuthConnect(x) ((x)->flags &= ~AM_AUTH_CONNECTING) | |
69 | #define IsAuthConnect(x) ((x)->flags & AM_AUTH_CONNECTING) | |
70 | ||
71 | #define SetAuthPending(x) ((x)->flags |= AM_AUTH_PENDING) | |
72 | #define ClearAuthPending(x) ((x)->flags &= AM_AUTH_PENDING) | |
73 | #define IsAuthPending(x) ((x)->flags & AM_AUTH_PENDING) | |
74 | ||
75 | #define ClearAuth(x) ((x)->flags &= ~(AM_AUTH_PENDING | AM_AUTH_CONNECTING)) | |
76 | #define IsDoingAuth(x) ((x)->flags & (AM_AUTH_PENDING | AM_AUTH_CONNECTING)) | |
77 | /* #define SetGotId(x) ((x)->flags |= FLAGS_GOTID) */ | |
78 | ||
79 | ||
80 | ||
81 | extern void start_auth(struct Client *); | |
82 | extern void send_auth_query(struct AuthRequest *req); | |
83 | extern void remove_auth_request(struct AuthRequest *req); | |
84 | extern void init_auth(void); | |
85 | extern void delete_auth_queries(struct Client *); | |
86 | ||
87 | #endif /* INCLUDED_s_auth_h */ |