]>
Commit | Line | Data |
---|---|---|
f5691f9c | 1 | |
2 | /* | |
cc192b50 | 3 | * $Id: AuthUser.h,v 1.6 2007/12/14 23:11:45 amosjeffries Exp $ |
f5691f9c | 4 | * |
5 | * | |
6 | * SQUID Web Proxy Cache http://www.squid-cache.org/ | |
7 | * ---------------------------------------------------------- | |
8 | * | |
9 | * Squid is the result of efforts by numerous individuals from | |
10 | * the Internet community; see the CONTRIBUTORS file for full | |
11 | * details. Many organizations have provided support for Squid's | |
12 | * development; see the SPONSORS file for full details. Squid is | |
13 | * Copyrighted (C) 2001 by the Regents of the University of | |
14 | * California; see the COPYRIGHT file for full details. Squid | |
15 | * incorporates software developed and/or copyrighted by other | |
16 | * sources; see the CREDITS file for full details. | |
17 | * | |
18 | * This program is free software; you can redistribute it and/or modify | |
19 | * it under the terms of the GNU General Public License as published by | |
20 | * the Free Software Foundation; either version 2 of the License, or | |
21 | * (at your option) any later version. | |
22 | * | |
23 | * This program is distributed in the hope that it will be useful, | |
24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
26 | * GNU General Public License for more details. | |
27 | * | |
28 | * You should have received a copy of the GNU General Public License | |
29 | * along with this program; if not, write to the Free Software | |
30 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. | |
31 | * | |
32 | * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org> | |
33 | */ | |
34 | ||
35 | #ifndef SQUID_AUTHUSER_H | |
36 | #define SQUID_AUTHUSER_H | |
37 | ||
cc192b50 | 38 | #include "IPAddress.h" |
39 | ||
9554bbf2 | 40 | class AuthUserRequest; |
41 | ||
f5691f9c | 42 | class AuthUser |
43 | { | |
44 | ||
45 | public: | |
46 | /* extra fields for proxy_auth */ | |
47 | /* auth_type and auth_module are deprecated. Do Not add new users of these fields. | |
48 | * Aim to remove shortly | |
49 | */ | |
50 | /* this determines what scheme owns the user data. */ | |
51 | auth_type_t auth_type; | |
52 | /* the config for this user */ | |
53 | AuthConfig *config; | |
54 | /* we only have one username associated with a given auth_user struct */ | |
55 | auth_user_hash_pointer *usernamehash; | |
56 | /* we may have many proxy-authenticate strings that decode to the same user */ | |
57 | dlink_list proxy_auth_list; | |
58 | dlink_list proxy_match_cache; | |
f5691f9c | 59 | size_t ipcount; |
60 | long expiretime; | |
61 | /* how many references are outstanding to this instance */ | |
62 | size_t references; | |
63 | /* the auth_user_request structures that link to this. Yes it could be a splaytree | |
64 | * but how many requests will a single username have in parallel? */ | |
65 | dlink_list requests; | |
66 | ||
f5691f9c | 67 | static void cacheInit (); |
68 | static void CachedACLsReset(); | |
69 | ||
70 | void absorb(auth_user_t *from); | |
71 | virtual ~AuthUser (); | |
72 | _SQUID_INLINE_ char const *username() const; | |
73 | _SQUID_INLINE_ void username(char const *); | |
74 | void clearIp(); | |
cc192b50 | 75 | void removeIp(IPAddress); |
76 | void addIp(IPAddress); | |
f5691f9c | 77 | _SQUID_INLINE_ void addRequest(AuthUserRequest *); |
78 | ||
79 | void lock() | |
80 | ||
81 | ; | |
82 | void unlock(); | |
83 | ||
84 | void addToNameCache(); | |
85 | ||
86 | protected: | |
87 | AuthUser (AuthConfig *); | |
88 | ||
89 | private: | |
90 | static void cacheCleanup (void *unused); | |
91 | ||
3f5f1a01 | 92 | /* |
93 | * DPW 2007-05-08 | |
94 | * The username_ memory will be allocated via | |
95 | * xstrdup(). It is our responsibility. | |
96 | */ | |
f5691f9c | 97 | char const *username_; |
4c19ba24 | 98 | |
99 | /* what ip addresses has this user been seen at?, plus a list length cache */ | |
100 | dlink_list ip_list; | |
f5691f9c | 101 | }; |
102 | ||
103 | #ifdef _USE_INLINE_ | |
104 | #include "AuthUser.cci" | |
105 | #endif | |
106 | ||
107 | #endif /* SQUID_AUTHUSER_H */ |