]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/format/Token.h
2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
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.
9 #ifndef _SQUID_FORMAT_TOKEN_H
10 #define _SQUID_FORMAT_TOKEN_H
12 #include "format/ByteCode.h"
13 #include "proxyp/Elements.h"
16 * Squid configuration allows users to define custom formats in
19 * - external ACL input
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.
30 class TokenTableEntry
;
32 #define LOG_BUF_SZ (MAX_URL<<2)
34 // XXX: inherit from linked list
41 /// Initialize the format token registrations
44 /** parses a single token. Returns the token length in characters,
45 * and fills in this item with the token information.
46 * def is for sure null-terminated.
48 int parse(const char *def
, enum Quoting
*quote
);
54 // TODO: Add ID caching for protocols other than PROXY protocol.
55 /// the cached ID of the parsed header or zero
56 ProxyProtocol::Two::FieldType headerId
;
64 int widthMin
; ///< minimum field width
65 int widthMax
; ///< maximum field width
70 int divisor
; // class invariant: MUST NOT be zero.
71 Token
*next
; // TODO: move from linked list to array
74 const char *scanForToken(TokenTableEntry
const table
[], const char *cur
);
79 #endif /* _SQUID_FORMAT_TOKEN_H */