]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/format/Token.h
Maintenance: Remove FIXME and \todo labels (#647)
[thirdparty/squid.git] / src / format / Token.h
index 7579191f5a50c11692d8721ecde17f3f00af495c..77697b7a3d1229fdc7507798b129a30964ecc562 100644 (file)
@@ -1,8 +1,16 @@
+/*
+ * 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
@@ -27,18 +35,7 @@ class TokenTableEntry;
 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
@@ -52,15 +49,17 @@ public:
 
     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
@@ -68,15 +67,14 @@ public:
     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 */
+