]> git.ipfire.org Git - thirdparty/squid.git/blob - src/format/Format.h
Merged from trunk (r12732, v3.3.3+).
[thirdparty/squid.git] / src / format / Format.h
1 #ifndef _SQUID_FORMAT_FORMAT_H
2 #define _SQUID_FORMAT_FORMAT_H
3
4 #include "base/RefCount.h"
5 /*
6 * Squid configuration allows users to define custom formats in
7 * several components.
8 * - logging
9 * - external ACL input
10 * - deny page URL
11 *
12 * These enumerations and classes define the API for parsing of
13 * format directives to define these patterns. Along with output
14 * functionality to produce formatted buffers.
15 */
16
17 class AccessLogEntry;
18 typedef RefCount<AccessLogEntry> AccessLogEntryPointer;
19 class MemBuf;
20 class StoreEntry;
21
22 namespace Format
23 {
24
25 class Token;
26
27 // XXX: inherit from linked list
28 class Format
29 {
30 public:
31 Format(const char *name);
32 ~Format();
33
34 /* very inefficent parser, but who cares, this needs to be simple */
35 /* First off, let's tokenize, we'll optimize in a second pass.
36 * A token can either be a %-prefixed sequence (usually a dynamic
37 * token but it can be an escaped sequence), or a string. */
38 bool parse(const char *def);
39
40 /// assemble the state information into a formatted line.
41 void assemble(MemBuf &mb, const AccessLogEntryPointer &al, int logSequenceNumber) const;
42
43 /// dump this whole list of formats into the provided StoreEntry
44 void dump(StoreEntry * entry, const char *directiveName);
45
46 char *name;
47 Token *format;
48 Format *next;
49 };
50
51 } // namespace Format
52
53 #endif /* _SQUID_FORMAT_FORMAT_H */