~ubuntu-branches/ubuntu/quantal/apt-cacher-ng/quantal-backports

« back to all changes in this revision

Viewing changes to include/acfg.h

  • Committer: Package Import Robot
  • Author(s): Eduard Bloch
  • Date: 2011-11-26 13:09:45 UTC
  • mfrom: (1.1.30) (29.1.18 sid)
  • Revision ID: package-import@ubuntu.com-20111126130945-acifclz6ksfl8607
Tags: 0.6.10-1
New upstream version

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
#include "config.h"
6
6
#include "meta.h"
 
7
#include <bitset>
7
8
 
8
9
class hostdata;
9
10
 
10
11
static const int RESERVED_DEFVAL = -4223;
11
12
 
 
13
 
 
14
struct ltstring
 
15
{
 
16
  bool operator()(const mstring &s1, const mstring &s2) const
 
17
  {
 
18
    return strcasecmp(s1.c_str(), s2.c_str()) < 0;
 
19
  }
 
20
};
 
21
 
 
22
typedef MYMAP<mstring, mstring, ltstring> NoCaseStringMap;
 
23
 
12
24
namespace acfg
13
25
{
14
26
 
15
 
extern mstring cachedir, logdir, confdir, fifopath, user, group, pidfile, 
 
27
extern mstring cachedir, logdir, confdir, fifopath, user, group, pidfile, suppdir,
16
28
reportpage, vfilepat, pfilepat, wfilepat, agentname, remoteport, adminauth, bindaddr, port, sUmask,
17
 
dontcacherq, dontcachetgt, dontcache, mirrorsrcs, requestapx;
 
29
tmpDontcacherq, tmpDontcachetgt, tmpDontcache, mirrorsrcs, requestapx;
18
30
 
19
 
extern int debug, offlinemode, foreground, verbose, stupidfs, forcemanaged, 
20
 
verboselog, extreshhold, exfailabort, tpstandbymax, tpthreadmax, dnscachetime, dlbufsize,
21
 
exporigin, logxff, oldupdate, recompbz2, nettimeout, updinterval, forwardsoap, dirperms, fileperms;
 
31
extern int debug, numcores, offlinemode, foreground, verbose, stupidfs, forcemanaged, keepnver,
 
32
verboselog, extreshhold, exfailabort, tpstandbymax, tpthreadmax, dnscachetime, dlbufsize, usewrap,
 
33
exporigin, logxff, oldupdate, recompbz2, nettimeout, updinterval, forwardsoap, dirperms, fileperms,
 
34
maxtempdelay;
22
35
 
23
36
// processed config settings
24
37
extern tHttpUrl proxy_info;
25
38
extern mstring agentheader;
26
39
 
 
40
extern int conprotos[2];
 
41
 
27
42
bool SetOption(const mstring &line, bool bQuiet=false);
28
43
void ReadConfigDirectory(const char*);
29
44
 
36
51
                                
37
52
const mstring * GetRepNameAndPathResidual(const tHttpUrl & in, mstring & sRetPathResidual);
38
53
 
39
 
/*
40
 
struct tBackendDesc : public tHttpUrl
41
 
{
42
 
        struct tHookHandler
43
 
        {
44
 
                virtual void PostponeDownCmd()=0;
45
 
                virtual void UpCmd()=0;
46
 
                virtual void PreUpCmd()=0;
47
 
        };
48
 
        tHookHandler *m_pHooks;
49
 
        inline tBackendDesc(const tHttpUrl& src) : tHttpUrl(src), m_pHooks(NULL) {};
50
 
        inline tBackendDesc() : m_pHooks(NULL) {};
51
 
};
52
 
*/
53
 
 
54
54
struct tRepoData
55
55
{
56
56
        MYSTD::vector<tHttpUrl> m_backends;
63
63
        };
64
64
        IHookHandler *m_pHooks;
65
65
        tStrVec m_keyfiles;
 
66
        tHttpUrl m_deltasrc;
66
67
        tRepoData() : m_pHooks(NULL) {};
67
68
        virtual ~tRepoData();
68
69
};
69
70
 
70
 
const tRepoData * GetBackendVec(const mstring * vname);
 
71
const tRepoData * GetBackendVec(cmstring &vname);
71
72
 
72
73
time_t ExecutePostponed();
73
74
 
74
75
extern tStrMap localdirs;
75
76
extern NoCaseStringMap mimemap;
 
77
#define TCP_PORT_MAX 65536
 
78
extern MYSTD::bitset<TCP_PORT_MAX> *pUserPorts;
76
79
 
77
80
extern mstring cacheDirSlash; // guaranteed to have a trailing path separator
78
81
 
 
82
mstring EncodeBase64Auth(const cmstring & s);
79
83
} // namespace acfg
80
84
 
81
85
namespace rechecks
82
86
{
83
 
typedef enum {
84
 
        FILE_PKG,
85
 
        FILE_INDEX,
86
 
        FILE_INVALID
87
 
} eFileKind;
88
 
eFileKind GetFiletype(const mstring &);
 
87
#define FILE_PKG 0
 
88
#define FILE_INDEX 1
 
89
#define FILE_INVALID 2
 
90
unsigned int GetFiletype(const mstring &);
89
91
bool MatchWhitelist(const mstring &);
90
92
bool MatchUncacheableRequest(const mstring &);
91
93
bool MatchUncacheableTarget(const mstring &);
 
94
 
 
95
bool CompileExpressions();
92
96
}
93
97
 
94
98
#endif