]>
Commit | Line | Data |
---|---|---|
189935b1 | 1 | /************************************************************************ |
2 | * IRC - Internet Relay Chat, include/s_auth.h | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 1, or (at your option) | |
7 | * any later version. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
17 | */ | |
18 | /** @file | |
19 | * @brief Interface for DNS and ident lookups. | |
20 | * @version $Id: s_auth.h,v 1.6 2004/10/05 04:21:37 entrope Exp $ | |
21 | */ | |
22 | #ifndef INCLUDED_s_auth_h | |
23 | #define INCLUDED_s_auth_h | |
24 | #ifndef INCLUDED_sys_types_h | |
25 | #include <sys/types.h> | |
26 | #define INCLUDED_sys_types_h | |
27 | #endif | |
28 | #ifndef INCLUDED_ircd_events_h | |
29 | #include "ircd_events.h" | |
30 | #endif | |
31 | ||
32 | struct Client; | |
33 | ||
34 | /** Stores state of the DNS and RFC 1413 ident lookups for a client. */ | |
35 | struct AuthRequest { | |
36 | struct AuthRequest* next; /**< linked list node ptr */ | |
37 | struct AuthRequest* prev; /**< linked list node ptr */ | |
38 | struct Client* client; /**< pointer to client struct for request */ | |
39 | unsigned int flags; /**< current state of request */ | |
40 | int fd; /**< file descriptor for auth queries */ | |
41 | struct Socket socket; /**< socket descriptor for auth queries */ | |
42 | struct Timer timeout; /**< timeout timer for auth queries */ | |
43 | }; | |
44 | ||
45 | /* | |
46 | * flag values for AuthRequest | |
47 | * NAMESPACE: AM_xxx - Authentication Module | |
48 | */ | |
49 | #define AM_AUTH_CONNECTING 0x01 /**< waiting for ident connect to complete */ | |
50 | #define AM_AUTH_PENDING 0x02 /**< ident connected, waiting for response */ | |
51 | #define AM_DNS_PENDING 0x04 /**< dns request sent, waiting for response */ | |
52 | ||
53 | #define AM_SOCKET 0x40 /**< socket structure not destroyed */ | |
54 | #define AM_TIMEOUT 0x80 /**< timer structure not destroyed */ | |
55 | ||
56 | /** If any of AM_FREE_MASK bits are set, operations are still in progress. */ | |
57 | #define AM_FREE_MASK (AM_SOCKET | AM_TIMEOUT) | |
58 | ||
59 | #define SetDNSPending(x) ((x)->flags |= AM_DNS_PENDING) | |
60 | #define ClearDNSPending(x) ((x)->flags &= ~AM_DNS_PENDING) | |
61 | #define IsDNSPending(x) ((x)->flags & AM_DNS_PENDING) | |
62 | ||
63 | #define SetAuthConnect(x) ((x)->flags |= AM_AUTH_CONNECTING) | |
64 | #define ClearAuthConnect(x) ((x)->flags &= ~AM_AUTH_CONNECTING) | |
65 | #define IsAuthConnect(x) ((x)->flags & AM_AUTH_CONNECTING) | |
66 | ||
67 | #define SetAuthPending(x) ((x)->flags |= AM_AUTH_PENDING) | |
68 | #define ClearAuthPending(x) ((x)->flags &= AM_AUTH_PENDING) | |
69 | #define IsAuthPending(x) ((x)->flags & AM_AUTH_PENDING) | |
70 | ||
71 | #define ClearAuth(x) ((x)->flags &= ~(AM_AUTH_PENDING | AM_AUTH_CONNECTING)) | |
72 | #define IsDoingAuth(x) ((x)->flags & (AM_AUTH_PENDING | AM_AUTH_CONNECTING)) | |
73 | ||
74 | extern void start_auth(struct Client *); | |
75 | extern void read_auth_reply(struct AuthRequest* req); | |
76 | extern void send_auth_query(struct AuthRequest* req); | |
77 | extern void destroy_auth_request(struct AuthRequest *req, int send_reports); | |
78 | ||
79 | #endif /* INCLUDED_s_auth_h */ | |
80 |