1 |
/* |
2 |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
* |
4 |
* Copyright (C) 1999-2013 by the Hybrid Development Team. |
5 |
* |
6 |
* This program is free software; you can redistribute it and/or modify |
7 |
* it under the terms of the GNU General Public License as published by |
8 |
* the Free Software Foundation; either version 2 of the License, or |
9 |
* (at your option) any later version. |
10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
19 |
* USA |
20 |
*/ |
21 |
|
22 |
/*! \file s_auth.h |
23 |
* \brief Interface for DNS and ident lookups. |
24 |
* \version $Id$ |
25 |
*/ |
26 |
|
27 |
#ifndef INCLUDED_s_auth_h |
28 |
#define INCLUDED_s_auth_h |
29 |
|
30 |
/* |
31 |
* flag values for AuthRequest |
32 |
* NAMESPACE: AM_xxx - Authentication Module |
33 |
*/ |
34 |
#define AM_AUTH_CONNECTING 0x01 /**< Waiting for ident connect to complete */ |
35 |
#define AM_AUTH_PENDING 0x02 /**< Ident connected, waiting for response */ |
36 |
#define AM_DNS_PENDING 0x04 /**< Dns request sent, waiting for response */ |
37 |
#define AM_SOCKET 0x40 /**< Socket structure not destroyed */ |
38 |
#define AM_TIMEOUT 0x80 /**< Timer structure not destroyed */ |
39 |
|
40 |
/** If any of AM_FREE_MASK bits are set, operations are still in progress. */ |
41 |
#define AM_FREE_MASK (AM_SOCKET | AM_TIMEOUT) |
42 |
|
43 |
#define SetDNSPending(x) ((x)->flags |= AM_DNS_PENDING) |
44 |
#define ClearDNSPending(x) ((x)->flags &= ~AM_DNS_PENDING) |
45 |
#define IsDNSPending(x) ((x)->flags & AM_DNS_PENDING) |
46 |
|
47 |
#define SetAuthConnect(x) ((x)->flags |= AM_AUTH_CONNECTING) |
48 |
#define ClearAuthConnect(x) ((x)->flags &= ~AM_AUTH_CONNECTING) |
49 |
#define IsAuthConnect(x) ((x)->flags & AM_AUTH_CONNECTING) |
50 |
|
51 |
#define SetAuthPending(x) ((x)->flags |= AM_AUTH_PENDING) |
52 |
#define ClearAuthPending(x) ((x)->flags &= AM_AUTH_PENDING) |
53 |
#define IsAuthPending(x) ((x)->flags & AM_AUTH_PENDING) |
54 |
|
55 |
#define ClearAuth(x) ((x)->flags &= ~(AM_AUTH_PENDING | AM_AUTH_CONNECTING)) |
56 |
#define IsDoingAuth(x) ((x)->flags & (AM_AUTH_PENDING | AM_AUTH_CONNECTING)) |
57 |
|
58 |
struct Client; |
59 |
|
60 |
/** Stores state of the DNS and RFC 1413 ident lookups for a client. */ |
61 |
struct AuthRequest |
62 |
{ |
63 |
struct Client *client; /**< Pointer to client struct for request */ |
64 |
unsigned int flags; /**< Current state of request */ |
65 |
int fd; /**< File descriptor for auth queries */ |
66 |
struct Socket socket; /**< Socket descriptor for auth queries */ |
67 |
struct Timer timeout; /**< Timeout timer for auth queries */ |
68 |
}; |
69 |
|
70 |
extern void destroy_auth_request(struct AuthRequest *, int); |
71 |
extern void start_auth(struct Client *); |
72 |
extern void release_auth_client(struct Client *); |
73 |
|
74 |
#endif /* INCLUDED_s_auth_h */ |