| 1 |
/********************************************************************\ |
|---|
| 2 |
* This program is free software; you can redistribute it and/or * |
|---|
| 3 |
* modify it under the terms of the GNU General Public License as * |
|---|
| 4 |
* published by the Free Software Foundation; either version 2 of * |
|---|
| 5 |
* the License, or (at your option) any later version. * |
|---|
| 6 |
* * |
|---|
| 7 |
* This program is distributed in the hope that it will be useful, * |
|---|
| 8 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
|---|
| 9 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
|---|
| 10 |
* GNU General Public License for more details. * |
|---|
| 11 |
* * |
|---|
| 12 |
* You should have received a copy of the GNU General Public License* |
|---|
| 13 |
* along with this program; if not, contact: * |
|---|
| 14 |
* * |
|---|
| 15 |
* Free Software Foundation Voice: +1-617-542-5942 * |
|---|
| 16 |
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * |
|---|
| 17 |
* Boston, MA 02111-1307, USA gnu@gnu.org * |
|---|
| 18 |
* * |
|---|
| 19 |
\********************************************************************/ |
|---|
| 20 |
|
|---|
| 21 |
/* $Id: auth.h 1104 2006-10-09 00:58:46Z acv $ */ |
|---|
| 22 |
/** @file auth.h |
|---|
| 23 |
@brief Authentication handling thread |
|---|
| 24 |
@author Copyright (C) 2004 Alexandre Carmel-Veilleux <acv@miniguru.ca> |
|---|
| 25 |
*/ |
|---|
| 26 |
|
|---|
| 27 |
#ifndef _AUTH_H_ |
|---|
| 28 |
#define _AUTH_H_ |
|---|
| 29 |
|
|---|
| 30 |
/** |
|---|
| 31 |
* @brief Authentication codes returned by auth server. |
|---|
| 32 |
* |
|---|
| 33 |
* Authentication result codes returned by auth_server_request() corresponding |
|---|
| 34 |
* to result code from the central server itself. |
|---|
| 35 |
*/ |
|---|
| 36 |
typedef enum { |
|---|
| 37 |
AUTH_ERROR = -1, /**< An error occured during the validation process*/ |
|---|
| 38 |
AUTH_DENIED = 0, /**< Client was denied by the auth server */ |
|---|
| 39 |
AUTH_ALLOWED = 1, /**< Client was granted access by the auth server */ |
|---|
| 40 |
AUTH_MEMBER = 2, /**< Client was granted access as a member by the auth server */ |
|---|
| 41 |
AUTH_VALIDATION = 5, /**< A misnomer. Client is in 15 min probation to validate his new account */ |
|---|
| 42 |
AUTH_VALIDATION_FAILED = 6, /**< Client had X minutes to validate account by email and didn't = too late */ |
|---|
| 43 |
AUTH_LOCKED = 254 /**< Account has been locked */ |
|---|
| 44 |
} t_authcode; |
|---|
| 45 |
|
|---|
| 46 |
/** |
|---|
| 47 |
* @brief This structure contains all the information returned by the authentication server |
|---|
| 48 |
*/ |
|---|
| 49 |
typedef struct _t_authresponse { |
|---|
| 50 |
t_authcode authcode; /**< Authentication code returned by the server */ |
|---|
| 51 |
} t_authresponse; |
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
/** @brief Authenticate a single client against the central server */ |
|---|
| 55 |
void authenticate_client(request *); |
|---|
| 56 |
|
|---|
| 57 |
/** @brief Periodically check if connections expired */ |
|---|
| 58 |
void thread_client_timeout_check(void *arg); |
|---|
| 59 |
|
|---|
| 60 |
#endif |
|---|