]>
Commit | Line | Data |
---|---|---|
bbc27441 AJ |
1 | /* |
2 | * Copyright (C) 1996-2014 The Squid Software Foundation and contributors | |
3 | * | |
4 | * Squid software is distributed under GPLv2+ license and includes | |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
7 | */ | |
8 | ||
38e16f92 AJ |
9 | #ifndef _SQUID_FORMAT_FORMAT_H |
10 | #define _SQUID_FORMAT_FORMAT_H | |
11 | ||
8bf217bd | 12 | #include "base/RefCount.h" |
2eceb328 | 13 | #include "ConfigParser.h" |
bbc27441 | 14 | |
38e16f92 AJ |
15 | /* |
16 | * Squid configuration allows users to define custom formats in | |
17 | * several components. | |
18 | * - logging | |
19 | * - external ACL input | |
20 | * - deny page URL | |
21 | * | |
22 | * These enumerations and classes define the API for parsing of | |
23 | * format directives to define these patterns. Along with output | |
24 | * functionality to produce formatted buffers. | |
25 | */ | |
26 | ||
27 | class AccessLogEntry; | |
41ebd397 | 28 | typedef RefCount<AccessLogEntry> AccessLogEntryPointer; |
38e16f92 AJ |
29 | class MemBuf; |
30 | class StoreEntry; | |
31 | ||
32 | namespace Format | |
33 | { | |
34 | ||
35 | class Token; | |
36 | ||
37 | // XXX: inherit from linked list | |
38 | class Format | |
39 | { | |
40 | public: | |
41 | Format(const char *name); | |
2eceb328 | 42 | virtual ~Format(); |
38e16f92 AJ |
43 | |
44 | /* very inefficent parser, but who cares, this needs to be simple */ | |
45 | /* First off, let's tokenize, we'll optimize in a second pass. | |
46 | * A token can either be a %-prefixed sequence (usually a dynamic | |
47 | * token but it can be an escaped sequence), or a string. */ | |
f4698e0b | 48 | bool parse(const char *def); |
38e16f92 AJ |
49 | |
50 | /// assemble the state information into a formatted line. | |
41ebd397 | 51 | void assemble(MemBuf &mb, const AccessLogEntryPointer &al, int logSequenceNumber) const; |
38e16f92 AJ |
52 | |
53 | /// dump this whole list of formats into the provided StoreEntry | |
5f621cd0 | 54 | void dump(StoreEntry * entry, const char *directiveName); |
38e16f92 AJ |
55 | |
56 | char *name; | |
57 | Token *format; | |
58 | Format *next; | |
59 | }; | |
60 | ||
61 | } // namespace Format | |
62 | ||
63 | #endif /* _SQUID_FORMAT_FORMAT_H */ |