+/*
+ * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
#ifndef _SQUID_FORMAT_TOKEN_H
#define _SQUID_FORMAT_TOKEN_H
-//#include "format/TokenTableEntry.h"
#include "format/ByteCode.h"
+#include "proxyp/Elements.h"
/*
* Squid configuration allows users to define custom formats in
class Token
{
public:
- Token() : type(LFT_NONE),
- label(NULL),
- widthMin(-1),
- widthMax(-1),
- quote(LOG_QUOTE_NONE),
- left(false),
- space(false),
- zero(false),
- divisor(0),
- next(NULL)
- { data.string = NULL; }
-
+ Token();
~Token();
/// Initialize the format token registrations
ByteCode_t type;
const char *label;
- union {
+ struct {
char *string;
+ // TODO: Add ID caching for protocols other than PROXY protocol.
+ /// the cached ID of the parsed header or zero
+ ProxyProtocol::Two::FieldType headerId;
struct {
char *header;
char *element;
char separator;
} header;
- char *timespec;
} data;
int widthMin; ///< minimum field width
int widthMax; ///< maximum field width
bool left;
bool space;
bool zero;
- int divisor;
- Token *next; /* todo: move from linked list to array */
+ int divisor; // class invariant: MUST NOT be zero.
+ Token *next; // TODO: move from linked list to array
private:
const char *scanForToken(TokenTableEntry const table[], const char *cur);
};
-extern const char *log_tags[];
-
} // namespace Format
#endif /* _SQUID_FORMAT_TOKEN_H */
+