1 /*
2  *  Copyright (C) 2004-2008 Christos Tsantilas
3  *
4  *  This program is free software; you can redistribute it and/or
5  *  modify it under the terms of the GNU Lesser General Public
6  *  License as published by the Free Software Foundation; either
7  *  version 2.1 of the License, or (at your option) 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 GNU
12  *  Lesser General Public License for more details.
13  *
14  *  You should have received a copy of the GNU Lesser General Public
15  *  License along with this library; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17  *  MA  02110-1301  USA.
18  */
19 
20 
21 #ifndef __ACCESS_H
22 #define __ACCESS_H
23 
24 #include "c-icap.h"
25 #include "request.h"
26 #include "net_io.h"
27 
28 
29 #ifdef __cplusplus
30 extern "C"
31 {
32 #endif
33 
34 #define CI_ACCESS_ALLOW        1
35 #define CI_ACCESS_UNKNOWN      0
36 #define CI_ACCESS_DENY        -1
37 #define CI_ACCESS_PARTIAL     -2
38 #define CI_ACCESS_HTTP_AUTH   -3
39 
40 
41 /**************************************************/
42 /*Basic authentication method definitions ......  */
43 
44 #define HTTP_MAX_PASS_LEN 256
45 
46 struct http_basic_auth_data {
47     char http_user[MAX_USERNAME_LEN+1];
48     char http_pass[HTTP_MAX_PASS_LEN+1];
49 };
50 
51 
52 int access_reset();
53 int http_authorize(ci_request_t *req, char *method);
54 int http_authenticate(ci_request_t *req, char *method);
55 int access_check_client(ci_request_t *req);
56 int access_check_request(ci_request_t *req);
57 int access_authenticate_request(ci_request_t *req);
58 int access_check_logging(ci_request_t *req);
59 
60 
61 #ifdef __cplusplus
62 }
63 #endif
64 
65 #endif
66 
67