]>
Commit | Line | Data |
---|---|---|
eb1f6bfa | 1 | // |
7962bc6a | 2 | // $Id$ |
eb1f6bfa | 3 | // |
0b96a9b3 | 4 | // Author: Jens-S. V?ckler <voeckler@rvs.uni-hannover.de> |
eb1f6bfa AJ |
5 | // |
6 | // File: conffile.hh | |
7 | // Fri Sep 15 2000 | |
8 | // | |
9 | // (c) 2000 Lehrgebiet Rechnernetze und Verteilte Systeme | |
0b96a9b3 | 10 | // Universit?t Hannover, Germany |
eb1f6bfa AJ |
11 | // |
12 | // Permission to use, copy, modify, distribute, and sell this software | |
13 | // and its documentation for any purpose is hereby granted without fee, | |
14 | // provided that (i) the above copyright notices and this permission | |
15 | // notice appear in all copies of the software and related documentation, | |
16 | // and (ii) the names of the Lehrgebiet Rechnernetze und Verteilte | |
17 | // Systeme and the University of Hannover may not be used in any | |
18 | // advertising or publicity relating to the software without the | |
19 | // specific, prior written permission of Lehrgebiet Rechnernetze und | |
20 | // Verteilte Systeme and the University of Hannover. | |
21 | // | |
22 | // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, | |
23 | // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY | |
24 | // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. | |
25 | // | |
26 | // IN NO EVENT SHALL THE LEHRGEBIET RECHNERNETZE UND VERTEILTE SYSTEME OR | |
27 | // THE UNIVERSITY OF HANNOVER BE LIABLE FOR ANY SPECIAL, INCIDENTAL, | |
28 | // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES | |
29 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT | |
30 | // ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, | |
31 | // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |
32 | // SOFTWARE. | |
33 | // | |
eb1f6bfa AJ |
34 | // Revision 1.2 2000/09/21 10:17:17 cached |
35 | // namespace std:: needed for Sun WS compiler. | |
36 | // | |
37 | // Revision 1.1 2000/09/21 09:45:14 voeckler | |
38 | // Initial revision | |
39 | // | |
40 | // | |
41 | #ifndef _CONFFILE_HH | |
42 | #define _CONFFILE_HH | |
43 | ||
59a09b98 | 44 | #if !defined(__cplusplus) |
eb1f6bfa AJ |
45 | #if defined(__GNUC__) || defined(__GNUG__) |
46 | #pragma interface | |
47 | #else | |
59a09b98 FC |
48 | #ifndef HAVE_BOOL |
49 | #define HAVE_BOOL | |
eb1f6bfa AJ |
50 | typedef int bool; |
51 | #define false 0 | |
52 | #define true 1 | |
53 | #endif | |
54 | #endif | |
59a09b98 | 55 | #endif /* __cplusplus */ |
eb1f6bfa AJ |
56 | |
57 | ||
58 | #ifndef DEFAULT_SQUID_CONF | |
59 | #define DEFAULT_SQUID_CONF "/usr/local/squid/etc/squid.conf" | |
60 | #endif // DEFAULT_SQUID_CONF | |
61 | ||
62 | #include <stdio.h> // FILE* | |
63 | #include <vector> // minimum STL container | |
64 | ||
65 | struct CacheDir { | |
66 | enum CacheDirType { CDT_NONE, CDT_UFS, CDT_AUFS, CDT_DISKD, CDT_OTHER }; | |
67 | ||
68 | const char* base; | |
69 | CacheDirType type; | |
70 | size_t size; | |
71 | unsigned level[2]; | |
72 | }; | |
73 | ||
74 | typedef std::vector<CacheDir> CacheDirVector; | |
75 | ||
76 | int | |
77 | readConfigFile( CacheDirVector& cachedir, | |
78 | const char* fn = DEFAULT_SQUID_CONF, | |
79 | FILE* debug = 0 ); | |
80 | // purpose: read squid.conf file and extract cache_dir entries | |
81 | // paramtr: cachedir (OUT): vector with an entry for each cache_dir found | |
82 | // fn (IN): file name of squid.conf to use | |
83 | // debug (IO): if not null, place debug information there | |
84 | // returns: number of entries, or negative to warn of errors | |
85 | ||
86 | #endif // _CONFFILE_HH |