Token.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2025 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 
9 #include "squid.h"
10 #include "format/Config.h"
11 #include "format/Token.h"
12 #include "format/TokenTableEntry.h"
13 #include "globals.h"
14 #include "parser/Tokenizer.h"
15 #include "proxyp/Elements.h"
16 #include "sbuf/Stream.h"
17 #include "SquidConfig.h"
18 #include "Store.h"
19 
20 // Due to token overlaps between 1 and 2 letter tokens (Bug 3310)
21 // We split the token table into sets determined by the token length
22 namespace Format
23 {
24 
27 
31 
35 
40 
42 
44 
45  TokenTableEntry(nullptr, LFT_NONE) /* this must be last */
46 };
47 
50 
55  /*TokenTableEntry( "lA", LFT_LOCAL_NAME ), */
56 
60 
67 
71  TokenTableEntry("busy_time", LFT_BUSY_TIME),
72 
75 
78  /*TokenTableEntry( "ur", LFT_USER_REALM ), */
79  /*TokenTableEntry( "us", LFT_USER_SCHEME ), */
81 
85  /*TokenTableEntry( "Ht", LFT_HTTP_STATUS ), */
87 
90 
92 
99  /*TokenTableEntry(">rq", LFT_CLIENT_REQ_QUERY),*/
101 
103  TokenTableEntry("ru", LFT_REQUEST_URI), /* doesn't include the query-string */
105  /* TokenTableEntry( "rq", LFT_REQUEST_QUERY ), * / / * the query-string, INCLUDING the leading ? */
108 
115  /*TokenTableEntry("<rq", LFT_SERVER_REQ_QUERY),*/
117 
120  /*TokenTableEntry( ">sb", LFT_REQUEST_SIZE_BODY ), */
121  /*TokenTableEntry( ">sB", LFT_REQUEST_SIZE_BODY_NO_TE ), */
122 
123  TokenTableEntry("<st", LFT_ADAPTED_REPLY_SIZE_TOTAL), // XXX: adapted should be code: <sta
126  TokenTableEntry("<sh", LFT_ADAPTED_REPLY_SIZE_HEADERS ), // XXX: adapted should be code: <sha
127  /*TokenTableEntry( "<sb", LFT_REPLY_SIZE_BODY ), */
128  /*TokenTableEntry( "<sB", LFT_REPLY_SIZE_BODY_NO_TE ), */
129 
130  TokenTableEntry("st", LFT_CLIENT_IO_SIZE_TOTAL), // XXX: total from client should be stC ??
131  /*TokenTableEntry("stP", LFT_SERVER_IO_SIZE_TOTAL),*/
132 
133  TokenTableEntry("et", LFT_TAG),
136 
137  TokenTableEntry(nullptr, LFT_NONE) /* this must be last */
138 };
139 
142  TokenTableEntry("byte", LFT_BYTE),
148  TokenTableEntry(">handshake", LFT_CLIENT_HANDSHAKE),
149  TokenTableEntry("err_code", LFT_SQUID_ERROR ),
150  TokenTableEntry("err_detail", LFT_SQUID_ERROR_DETAIL ),
151  TokenTableEntry("request_attempts", LFT_SQUID_REQUEST_ATTEMPTS),
152  TokenTableEntry("note", LFT_NOTE ),
153  TokenTableEntry("credentials", LFT_CREDENTIALS),
154  TokenTableEntry("master_xaction", LFT_MASTER_XACTION),
155  /*
156  * Legacy external_acl_type format tokens
157  */
161  TokenTableEntry("EXT_LOG", LFT_EXT_LOG),
162  TokenTableEntry("EXT_TAG", LFT_TAG),
163  TokenTableEntry("EXT_USER", LFT_USER_EXTERNAL),
173  TokenTableEntry("SRCPORT", LFT_CLIENT_PORT),
174  TokenTableEntry("SRC", LFT_CLIENT_IP_ADDRESS), // keep after longer SRC* tokens
175  TokenTableEntry("TAG", LFT_TAG),
177 #if USE_OPENSSL
180 #endif
181  TokenTableEntry(nullptr, LFT_NONE) /* this must be last */
182 };
183 
186  TokenTableEntry(nullptr, LFT_NONE) /* this must be last */
187 };
188 
191  TokenTableEntry(nullptr, LFT_NONE) /* this must be last */
192 };
193 
194 #if USE_ADAPTATION
199  TokenTableEntry(nullptr, LFT_NONE) /* this must be last */
200 };
201 #endif
202 
203 #if ICAP_CLIENT
204 static TokenTableEntry TokenTableIcap[] = {
206  TokenTableEntry("tt", LFT_ICAP_TOTAL_TIME),
207  TokenTableEntry("<last_h", LFT_ADAPTATION_LAST_HEADER), // deprecated
208 
209  TokenTableEntry("<A", LFT_ICAP_ADDR),
210  TokenTableEntry("<service_name", LFT_ICAP_SERV_NAME),
211  TokenTableEntry("ru", LFT_ICAP_REQUEST_URI),
212  TokenTableEntry("rm", LFT_ICAP_REQUEST_METHOD),
213  TokenTableEntry(">st", LFT_ICAP_BYTES_SENT),
214  TokenTableEntry("<st", LFT_ICAP_BYTES_READ),
215  TokenTableEntry("<bs", LFT_ICAP_BODY_BYTES_READ),
216 
217  TokenTableEntry(">h", LFT_ICAP_REQ_HEADER),
218  TokenTableEntry("<h", LFT_ICAP_REP_HEADER),
219 
220  TokenTableEntry("tr", LFT_ICAP_TR_RESPONSE_TIME),
221  TokenTableEntry("tio", LFT_ICAP_IO_TIME),
222  TokenTableEntry("to", LFT_ICAP_OUTCOME),
223  TokenTableEntry("Hs", LFT_ICAP_STATUS_CODE),
224 
225  TokenTableEntry(nullptr, LFT_NONE) /* this must be last */
226 };
227 #endif
228 
229 #if USE_OPENSSL
230 // TLS/SSL (tls:: or ssl::) tokens
232  TokenTableEntry("bump_mode", LFT_SSL_BUMP_MODE),
233  TokenTableEntry(">cert_subject", LFT_SSL_USER_CERT_SUBJECT),
234  TokenTableEntry(">cert_issuer", LFT_SSL_USER_CERT_ISSUER),
240  TokenTableEntry(">negotiated_version", LFT_TLS_CLIENT_NEGOTIATED_VERSION),
241  TokenTableEntry("<negotiated_version", LFT_TLS_SERVER_NEGOTIATED_VERSION),
242  TokenTableEntry(">negotiated_cipher", LFT_TLS_CLIENT_NEGOTIATED_CIPHER),
243  TokenTableEntry("<negotiated_cipher", LFT_TLS_SERVER_NEGOTIATED_CIPHER),
244  TokenTableEntry(">received_hello_version", LFT_TLS_CLIENT_RECEIVED_HELLO_VERSION),
245  TokenTableEntry("<received_hello_version", LFT_TLS_SERVER_RECEIVED_HELLO_VERSION),
246  TokenTableEntry(">received_supported_version", LFT_TLS_CLIENT_SUPPORTED_VERSION),
247  TokenTableEntry("<received_supported_version", LFT_TLS_SERVER_SUPPORTED_VERSION),
248  TokenTableEntry(nullptr, LFT_NONE)
249 };
250 #endif
251 } // namespace Format
252 
254 void
256 {
257  // TODO standard log tokens
258 
259 #if USE_ADAPTATION
261 #endif
262 #if ICAP_CLIENT
264 #endif
265 #if USE_OPENSSL
268 #endif
271 }
272 
275 const char *
277 {
278  for (TokenTableEntry const *lte = table; lte->configTag != nullptr; ++lte) {
279  debugs(46, 8, "compare tokens '" << lte->configTag << "' with '" << cur << "'");
280  if (strncmp(lte->configTag, cur, strlen(lte->configTag)) == 0) {
281  type = lte->tokenType;
282  label = lte->configTag;
283  debugs(46, 7, "Found token '" << label << "'");
284  return cur + strlen(lte->configTag);
285  }
286  }
287  return cur;
288 }
289 
290 // TODO: Reduce code duplication across this and other custom integer parsers.
292 template <typename Integer>
293 static Integer
294 ParseUnsignedDecimalInteger(const char *description, const SBuf &rawInput)
295 {
296  constexpr auto minValue = std::numeric_limits<Integer>::min();
297  constexpr auto maxValue = std::numeric_limits<Integer>::max();
298 
299  Parser::Tokenizer tok(rawInput);
300  if (tok.skip('0')) {
301  if (!tok.atEnd()) {
302  // e.g., 077, 0xFF, 0b101, or 0.1
303  throw TextException(ToSBuf("Malformed ", description,
304  ": Expected a decimal integer without leading zeros but got '",
305  rawInput, "'"), Here());
306  }
307  // for simplicity, we currently assume that zero is always in range
308  static_assert(minValue <= 0);
309  static_assert(0 <= maxValue);
310  return Integer(0);
311  }
312  // else the value might still be zero (e.g., -0)
313 
314  // check that our caller is compatible with Tokenizer::int64() use below
315  using ParsedInteger = int64_t;
316  static_assert(minValue >= std::numeric_limits<ParsedInteger>::min());
317  static_assert(maxValue <= std::numeric_limits<ParsedInteger>::max());
318 
319  ParsedInteger rawValue = 0;
320  if (!tok.int64(rawValue, 10, false)) {
321  // e.g., FF, -1, or 18446744073709551616
322  // TODO: Provide better diagnostic for values exceeding int64_t maximum.
323  throw TextException(ToSBuf("Malformed ", description,
324  ": Expected an unsigned decimal integer but got '",
325  rawInput, "'"), Here());
326  }
327 
328  if (!tok.atEnd()) {
329  // e.g., 1,000, 1.0, or 1e6
330  throw TextException(ToSBuf("Malformed ", description,
331  ": Trailing garbage after ", rawValue, " in '",
332  rawInput, "'"), Here());
333  }
334 
335  if (rawValue > maxValue) {
336  throw TextException(ToSBuf("Malformed ", description,
337  ": Expected an integer value not exceeding ", maxValue,
338  " but got ", rawValue), Here());
339  }
340 
341  if (rawValue < minValue) {
342  throw TextException(ToSBuf("Malformed ", description,
343  ": Expected an integer value not below ", minValue,
344  " but got ", rawValue), Here());
345  }
346 
347  return Integer(rawValue);
348 }
349 
350 /* parses a single token. Returns the token length in characters,
351  * and fills in the lt item with the token information.
352  * def is for sure null-terminated
353  */
354 int
355 Format::Token::parse(const char *def, Quoting *quoting)
356 {
357  const char *cur = def;
358 
359  auto l = strcspn(cur, "%");
360 
361  if (l > 0) {
362  char *cp;
363  /* it's a string for sure, until \0 or the next % */
364  cp = (char *)xmalloc(l + 1);
365  xstrncpy(cp, cur, l + 1);
366  type = LFT_STRING;
367  data.string = cp;
368 
369  while (l > 0) {
370  switch (*cur) {
371 
372  case '"':
373 
374  if (*quoting == LOG_QUOTE_NONE)
375  *quoting = LOG_QUOTE_QUOTES;
376  else if (*quoting == LOG_QUOTE_QUOTES)
377  *quoting = LOG_QUOTE_NONE;
378 
379  break;
380 
381  case '[':
382  if (*quoting == LOG_QUOTE_NONE)
383  *quoting = LOG_QUOTE_MIMEBLOB;
384 
385  break;
386 
387  case ']':
388  if (*quoting == LOG_QUOTE_MIMEBLOB)
389  *quoting = LOG_QUOTE_NONE;
390 
391  break;
392  }
393 
394  ++cur;
395  --l;
396  }
397 
398  } else if (*cur) {
399 
400  ++cur;
401 
402  // select quoting style for his particular token
403  switch (*cur) {
404 
405  case '"':
406  quote = LOG_QUOTE_QUOTES;
407  ++cur;
408  break;
409 
410  case '\'':
411  quote = LOG_QUOTE_RAW;
412  ++cur;
413  break;
414 
415  case '[':
416  quote = LOG_QUOTE_MIMEBLOB;
417  ++cur;
418  break;
419 
420  case '#':
421  quote = LOG_QUOTE_URL;
422  ++cur;
423  break;
424 
425  case '/':
426  quote = LOG_QUOTE_SHELL;
427  ++cur;
428  break;
429 
430  default:
431  quote = *quoting;
432  break;
433  }
434 
435  if (*cur == '-') {
436  left = true;
437  ++cur;
438  }
439 
440  if (*cur == '0') {
441  zero = true;
442  ++cur;
443  }
444 
445  char *endp;
446  if (xisdigit(*cur)) {
447  widthMin = strtol(cur, &endp, 10);
448  cur = endp;
449  }
450 
451  if (*cur == '.' && xisdigit(*(++cur))) {
452  widthMax = strtol(cur, &endp, 10);
453  cur = endp;
454  }
455 
456  // when {arg} field is before the token (old logformat syntax)
457  if (*cur == '{') {
458  char *cp;
459  ++cur;
460  l = strcspn(cur, "}");
461  cp = (char *)xmalloc(l + 1);
462  xstrncpy(cp, cur, l + 1);
463  data.string = cp;
464  cur += l;
465 
466  if (*cur == '}')
467  ++cur;
468  }
469 
470  type = LFT_NONE;
471 
472  // Scan each registered token namespace
473  debugs(46, 9, "check for token in " << TheConfig.tokens.size() << " namespaces.");
474  for (const auto &itr : TheConfig.tokens) {
475  debugs(46, 7, "check for possible " << itr.prefix << ":: token");
476  const size_t len = itr.prefix.length();
477  if (itr.prefix.cmp(cur, len) == 0 && cur[len] == ':' && cur[len+1] == ':') {
478  debugs(46, 5, "check for " << itr.prefix << ":: token in '" << cur << "'");
479  const char *old = cur;
480  cur = scanForToken(itr.tokenSet, cur+len+2);
481  if (old != cur) // found
482  break;
483  else // reset to start of namespace
484  cur = cur - len - 2;
485  }
486  }
487 
488  if (type == LFT_NONE) {
489  // For upward compatibility, assume "http::" prefix as default prefix
490  // for all log access formatting codes, except those starting with a
491  // "%" or a known namespace. (ie "icap::", "adapt::")
492  if (strncmp(cur,"http::", 6) == 0 && *(cur+6) != '%' )
493  cur += 6;
494 
495  // NP: scan the sets of tokens in decreasing size to guarantee no
496  // mistakes made with overlapping names. (Bug 3310)
497 
498  // Scan for various long tokens
499  debugs(46, 5, "scan for possible Misc token");
500  cur = scanForToken(TokenTableMisc, cur);
501  // scan for 2-char tokens
502  if (type == LFT_NONE) {
503  debugs(46, 5, "scan for possible 2C token");
504  cur = scanForToken(TokenTable2C, cur);
505  }
506  // finally scan for 1-char tokens.
507  if (type == LFT_NONE) {
508  debugs(46, 5, "scan for possible 1C token");
509  cur = scanForToken(TokenTable1C, cur);
510  }
511  }
512 
513  if (type == LFT_NONE)
514  throw TexcHere(ToSBuf("Unsupported %code: '", def, "'"));
515 
516  // when {arg} field is after the token (old external_acl_type token syntax)
517  // but accept only if there was none before the token
518  if (*cur == '{' && !data.string) {
519  char *cp;
520  ++cur;
521  l = strcspn(cur, "}");
522  cp = (char *)xmalloc(l + 1);
523  xstrncpy(cp, cur, l + 1);
524  data.string = cp;
525  cur += l;
526 
527  if (*cur == '}')
528  ++cur;
529  }
530 
531  if (*cur == ' ') {
532  space = true;
533  ++cur;
534  }
535  }
536 
537  switch (type) {
538 
539  case LFT_BYTE:
540  if (!data.string)
541  throw TextException("logformat %byte requires a parameter (e.g., %byte{10})", Here());
542  // TODO: Convert Format::Token::data.string to SBuf.
543  if (const auto v = ParseUnsignedDecimalInteger<uint8_t>("logformat %byte{value}", SBuf(data.string)))
544  data.byteValue = v;
545  else
546  throw TextException("logformat %byte{n} does not support zero n values yet", Here());
547  break;
548 
549 #if USE_ADAPTATION
551 #endif
552 
553 #if ICAP_CLIENT
554  case LFT_ICAP_REQ_HEADER:
555 
556  case LFT_ICAP_REP_HEADER:
557 #endif
558 
560 
561  case LFT_REQUEST_HEADER:
562 
563  case LFT_REPLY_HEADER:
564 
565  case LFT_NOTE:
566 
568 
569  if (data.string) {
570  char *header = data.string;
571  const auto initialType = type;
572 
573  const auto pseudoHeader = header[0] == ':';
574  char *cp = strchr(pseudoHeader ? header+1 : header, ':');
575 
576  if (cp) {
577  *cp = '\0';
578  ++cp;
579 
580  if (*cp == ',' || *cp == ';' || *cp == ':') {
581  data.header.separator = *cp;
582  ++cp;
583  } else {
584  data.header.separator = ',';
585  }
586 
587  data.header.element = cp;
588 
589  switch (type) {
590  case LFT_REQUEST_HEADER:
592  break;
593 
596  break;
597 
598  case LFT_REPLY_HEADER:
599  type = LFT_REPLY_HEADER_ELEM;
600  break;
601 #if USE_ADAPTATION
604  break;
605 #endif
606 #if ICAP_CLIENT
607  case LFT_ICAP_REQ_HEADER:
609  break;
610  case LFT_ICAP_REP_HEADER:
612  break;
613 #endif
616  break;
617  default:
618  break;
619  }
620  }
621 
622  if (!*header)
623  throw TexcHere(ToSBuf("Can't parse configuration token: '", def, "': missing header name"));
624 
625  if (initialType == LFT_PROXY_PROTOCOL_RECEIVED_HEADER)
626  data.headerId = ProxyProtocol::FieldNameToFieldType(SBuf(header));
627  else if (pseudoHeader)
628  throw TexcHere(ToSBuf("Pseudo headers are not supported in this context; got: '", def, "'"));
629 
630  data.header.header = header;
631  } else {
632  switch (type) {
633  case LFT_REQUEST_HEADER:
635  break;
636 
639  break;
640 
641  case LFT_REPLY_HEADER:
642  type = LFT_REPLY_ALL_HEADERS;
643  break;
644 #if USE_ADAPTATION
647  break;
648 #endif
649 #if ICAP_CLIENT
650  case LFT_ICAP_REQ_HEADER:
652  break;
653  case LFT_ICAP_REP_HEADER:
655  break;
656 #endif
659  break;
660  default:
661  break;
662  }
664  }
665 
666  break;
667 
671  case LFT_DNS_WAIT_TIME:
672 #if ICAP_CLIENT
674  case LFT_ICAP_IO_TIME:
675  case LFT_ICAP_TOTAL_TIME:
676 #endif
677  case LFT_TIME_START:
678  case LFT_TIME_SUBSECOND:
679  divisor = 1000;
680 
681  if (widthMax > 0) {
682  divisor = 1000000;
683 
684  for (int i = widthMax; i > 0; --i)
685  divisor /= 10;
686 
687  if (!divisor)
688  divisor = 1;
689  }
690  break;
691 
693  debugs(46, DBG_PARSE_NOTE(DBG_IMPORTANT), "WARNING: The \"Hs\" formatting code is deprecated. Use the \">Hs\" instead.");
695  break;
696 
698  debugs(46, DBG_PARSE_NOTE(DBG_IMPORTANT), "WARNING: The \"oa\" formatting code is deprecated. Use the \"<la\" instead.");
699  type = LFT_SERVER_LOCAL_IP;
700  break;
701 
703  debugs(46, DBG_PARSE_NOTE(DBG_IMPORTANT), "WARNING: The \"rp\" formatting code is deprecated. Use the \">rp\" instead.");
704  type = LFT_CLIENT_REQ_URLPATH;
705  break;
706 
708  debugs(46, DBG_PARSE_NOTE(DBG_IMPORTANT), "WARNING: The \">v\" formatting code is deprecated. Use the \">rv\" instead.");
709  type = LFT_REQUEST_VERSION;
710  break;
711 
712 #if !USE_SQUID_EUI
713  case LFT_CLIENT_EUI:
714  debugs(46, DBG_CRITICAL, "WARNING: The \">eui\" formatting code requires EUI features which are disabled in this Squid.");
715  break;
716 #endif
717 
718 #if USE_OPENSSL
723  break;
724 #endif
725 
727  debugs(46, DBG_PARSE_NOTE(DBG_IMPORTANT), "WARNING: The \"rG\" formatting code is deprecated. Use \"note{urlgroup}\" instead.");
728  type = LFT_NOTE;
729  data.string = xstrdup("urlgroup");
730  data.header.header = data.string;
731  break;
732 
733  default:
734  break;
735  }
736 
737  return (cur - def);
738 }
739 
741  label(nullptr),
742  widthMin(-1),
743  widthMax(-1),
744  quote(LOG_QUOTE_NONE),
745  left(false),
746  space(false),
747  zero(false),
748  divisor(1),
749  next(nullptr)
750 {
751  data.string = nullptr;
752  data.header.header = nullptr;
753  data.header.element = nullptr;
754  data.header.separator = ',';
756  data.byteValue = 0;
757 }
758 
760 {
761  label = nullptr; // drop reference to global static.
762  safe_free(data.string);
763  while (next) {
764  Token *tokens = next;
765  next = next->next;
766  tokens->next = nullptr;
767  delete tokens;
768  }
769 }
770 
@ LFT_ICAP_TR_RESPONSE_TIME
Definition: ByteCode.h:213
@ LFT_LOCAL_LISTENING_IP
Definition: ByteCode.h:56
@ LFT_TRANSPORT_CLIENT_CONNECTION_ID
Definition: ByteCode.h:51
@ LFT_TLS_CLIENT_NEGOTIATED_VERSION
Definition: ByteCode.h:229
@ LFT_EXT_ACL_USER_CERT_RAW
Definition: ByteCode.h:245
@ LFT_SQUID_ERROR_DETAIL
Definition: ByteCode.h:175
@ LFT_CLIENT_LOCAL_PORT
Definition: ByteCode.h:46
@ LFT_ICAP_REQUEST_METHOD
Definition: ByteCode.h:200
#define Here()
source code location of the caller
Definition: Here.h:15
@ LFT_ICAP_SERV_NAME
Definition: ByteCode.h:198
@ LFT_ICAP_BODY_BYTES_READ
Definition: ByteCode.h:203
@ LFT_CLIENT_REQ_URLSCHEME
Definition: ByteCode.h:75
@ LFT_SSL_SERVER_CERT_ERRORS
Definition: ByteCode.h:227
@ LFT_USER_NAME
Definition: ByteCode.h:151
#define DBG_CRITICAL
Definition: Stream.h:37
@ LFT_ADAPTATION_LAST_ALL_HEADERS
Definition: ByteCode.h:190
#define xmalloc
@ LOG_QUOTE_URL
Definition: ByteCode.h:266
@ LFT_ICAP_IO_TIME
Definition: ByteCode.h:214
@ LFT_ADAPTATION_LAST_HEADER
Definition: ByteCode.h:188
static TokenTableEntry TokenTableTransport[]
Definition: Token.cc:189
@ LFT_TAG
Definition: ByteCode.h:180
@ LFT_TOTAL_SERVER_SIDE_RESPONSE_TIME
Definition: ByteCode.h:168
static TokenTableEntry TokenTable2C[]
2-char tokens
Definition: Token.cc:49
const char * scanForToken(TokenTableEntry const table[], const char *cur)
Definition: Token.cc:276
static TokenTableEntry TokenTableSsl[]
Definition: Token.cc:231
@ LFT_ICAP_REQ_HEADER_ELEM
Definition: ByteCode.h:206
static TokenTableEntry TokenTableIcap[]
ICAP (icap::) tokens.
Definition: Token.cc:205
@ LFT_CLIENT_LOCAL_IP
Definition: ByteCode.h:45
@ LFT_PROXY_PROTOCOL_RECEIVED_HEADER
Definition: ByteCode.h:256
@ LFT_CLIENT_EUI
Definition: ByteCode.h:42
@ LFT_SSL_USER_CERT_SUBJECT
Definition: ByteCode.h:222
@ LFT_REQUEST_VERSION
Definition: ByteCode.h:88
@ LFT_SERVER_LOCAL_IP_OLD_27
Definition: ByteCode.h:67
int log_mime_hdrs
Definition: SquidConfig.h:286
@ LFT_USER_LOGIN
Definition: ByteCode.h:152
@ LFT_TLS_CLIENT_SUPPORTED_VERSION
Definition: ByteCode.h:235
@ LFT_SERVER_REQ_URLDOMAIN
Definition: ByteCode.h:105
@ LFT_SSL_SERVER_CERT_ISSUER
Definition: ByteCode.h:226
@ LOG_QUOTE_RAW
Definition: ByteCode.h:268
int parse(const char *def, enum Quoting *quote)
Definition: Token.cc:355
@ LFT_EXT_LOG
Definition: ByteCode.h:181
Definition: SBuf.h:93
@ LFT_REQUEST_METHOD
Definition: ByteCode.h:83
@ LFT_SQUID_REQUEST_ATTEMPTS
Definition: ByteCode.h:177
@ LFT_SQUID_ERROR
Definition: ByteCode.h:174
#define xstrdup
@ LFT_CLIENT_REQ_URI
Definition: ByteCode.h:74
const A & max(A const &lhs, A const &rhs)
@ LFT_SERVER_LOCAL_IP
Definition: ByteCode.h:66
@ LFT_MIME_TYPE
Definition: ByteCode.h:179
@ LFT_USER_EXTERNAL
Definition: ByteCode.h:155
char * xstrncpy(char *dst, const char *src, size_t n)
Definition: xstring.cc:37
@ LFT_REQUEST_URLGROUP_OLD_2X
Definition: ByteCode.h:89
static TokenTableEntry TokenTableAdapt[]
Definition: Token.cc:195
@ LFT_SQUID_STATUS
Definition: ByteCode.h:173
@ LFT_REQUEST_HEADER
Definition: ByteCode.h:92
@ LFT_SERVER_REQ_URLSCHEME
Definition: ByteCode.h:104
struct tok * next
Definition: parse.c:165
One entry in a table of format tokens.
@ LFT_TIME_LOCALTIME
Definition: ByteCode.h:161
@ LFT_ADAPTED_REQUEST_HEADER
Definition: ByteCode.h:97
@ LFT_SERVER_IP_ADDRESS
Definition: ByteCode.h:61
@ LFT_TIME_START
Definition: ByteCode.h:163
static TokenTableEntry TokenTableMisc[]
Miscellaneous >2 byte tokens.
Definition: Token.cc:141
@ LFT_ICAP_TOTAL_TIME
Definition: ByteCode.h:195
@ LOG_QUOTE_NONE
Definition: ByteCode.h:263
@ LFT_TLS_SERVER_NEGOTIATED_CIPHER
Definition: ByteCode.h:232
@ LFT_REPLY_HIGHOFFSET
Definition: ByteCode.h:142
@ LFT_CLIENT_FQDN
Definition: ByteCode.h:40
@ LFT_SERVER_LOCAL_PORT
Definition: ByteCode.h:68
#define TexcHere(msg)
legacy convenience macro; it is not difficult to type Here() now
Definition: TextException.h:63
@ LFT_SSL_USER_CERT_ISSUER
Definition: ByteCode.h:223
@ LFT_ADAPTATION_LAST_HEADER_ELEM
Definition: ByteCode.h:189
@ LFT_ICAP_STATUS_CODE
Definition: ByteCode.h:216
@ LFT_PEER_RESPONSE_TIME
Definition: ByteCode.h:167
@ LFT_SERVER_REQ_VERSION
Definition: ByteCode.h:109
Two::FieldType FieldNameToFieldType(const SBuf &nameOrId)
Definition: Elements.cc:102
@ LFT_REQUEST_URLPATH_OLD_31
Definition: ByteCode.h:85
@ LFT_TIME_GMT
Definition: ByteCode.h:162
@ LFT_TLS_CLIENT_RECEIVED_HELLO_VERSION
Definition: ByteCode.h:233
@ LFT_SERVER_LOCAL_NFMARK
Definition: ByteCode.h:70
static Integer ParseUnsignedDecimalInteger(const char *description, const SBuf &rawInput)
interprets input as an unsigned decimal integer that fits the specified Integer type
Definition: Token.cc:294
@ LOG_QUOTE_SHELL
Definition: ByteCode.h:267
@ LFT_MASTER_XACTION
Definition: ByteCode.h:241
struct tok tokens[]
Definition: parse.c:168
static TokenTableEntry TokenTableProxyProtocol[]
Definition: Token.cc:184
@ LFT_CLIENT_REQUEST_SIZE_TOTAL
Definition: ByteCode.h:112
@ LFT_TLS_SERVER_NEGOTIATED_VERSION
Definition: ByteCode.h:230
bool logTlsServerHelloDetails
Definition: SquidConfig.h:341
@ LFT_BUSY_TIME
Definition: ByteCode.h:170
@ LFT_ICAP_BYTES_READ
Definition: ByteCode.h:202
@ LFT_ADAPTATION_ALL_XACT_TIMES
Definition: ByteCode.h:187
@ LFT_ICAP_REP_HEADER
Definition: ByteCode.h:209
#define DBG_PARSE_NOTE(x)
Definition: Stream.h:42
@ LFT_TLS_CLIENT_NEGOTIATED_CIPHER
Definition: ByteCode.h:231
FmtConfig TheConfig
Definition: Config.cc:14
@ LFT_HTTP_SENT_STATUS_CODE_OLD_30
Definition: ByteCode.h:124
@ LFT_REQUEST_URI
Definition: ByteCode.h:84
@ LFT_SERVER_REQ_URLPATH
Definition: ByteCode.h:107
@ LFT_HTTP_BODY_BYTES_READ
Definition: ByteCode.h:128
@ LFT_TLS_SERVER_SUPPORTED_VERSION
Definition: ByteCode.h:236
@ LFT_DNS_WAIT_TIME
Definition: ByteCode.h:169
@ LFT_STRING
Definition: ByteCode.h:34
@ LFT_ICAP_OUTCOME
Definition: ByteCode.h:215
@ LFT_CLIENT_REQUEST_SIZE_HEADERS
Definition: ByteCode.h:113
@ LFT_EXT_ACL_CLIENT_EUI64
Definition: ByteCode.h:251
@ LFT_EXT_ACL_USER_CERTCHAIN_RAW
Definition: ByteCode.h:246
@ LFT_CLIENT_REQ_METHOD
Definition: ByteCode.h:73
#define safe_free(x)
Definition: xalloc.h:73
@ LFT_CLIENT_REQ_URLPATH
Definition: ByteCode.h:78
@ LFT_REQUEST_ALL_HEADERS
Definition: ByteCode.h:94
@ LFT_REPLY_HEADER
Definition: ByteCode.h:131
static TokenTableEntry TokenTable1C[]
1-char tokens.
Definition: Token.cc:26
@ LFT_SERVER_LOCAL_TOS
Definition: ByteCode.h:69
@ LFT_EXT_ACL_DATA
Definition: ByteCode.h:253
static void Init()
Initialize the format token registrations.
Definition: Token.cc:255
std::list< TokenNamespace > tokens
list of token namespaces registered
Definition: Config.h:49
@ LFT_ICAP_REP_ALL_HEADERS
Definition: ByteCode.h:211
#define xisdigit(x)
Definition: xis.h:18
@ LFT_TIME_TO_HANDLE_REQUEST
Definition: ByteCode.h:166
@ LFT_ICAP_REQ_ALL_HEADERS
Definition: ByteCode.h:207
@ LFT_ICAP_REQ_HEADER
Definition: ByteCode.h:205
@ LFT_ICAP_REP_HEADER_ELEM
Definition: ByteCode.h:210
@ LFT_CLIENT_IP_ADDRESS
Definition: ByteCode.h:39
@ LFT_REPLY_OBJECTSIZE
Definition: ByteCode.h:143
int cur
Definition: ModDevPoll.cc:69
@ LFT_ADAPTED_REPLY_SIZE_TOTAL
Definition: ByteCode.h:141
@ LFT_ADAPTATION_SUM_XACT_TIMES
Definition: ByteCode.h:186
@ LFT_CLIENT_PORT
Definition: ByteCode.h:41
@ LFT_SERVER_REQ_URLPORT
Definition: ByteCode.h:106
@ LFT_EXT_ACL_NAME
Definition: ByteCode.h:252
@ LFT_ADAPTED_REPLY_SIZE_HEADERS
Definition: ByteCode.h:144
@ LFT_TLS_SERVER_RECEIVED_HELLO_VERSION
Definition: ByteCode.h:234
struct Format::Token::@49 data
@ LFT_PROXY_PROTOCOL_RECEIVED_ALL_HEADERS
Definition: ByteCode.h:258
@ LFT_SEQUENCE_NUMBER
Definition: ByteCode.h:183
@ LFT_REPLY_ALL_HEADERS
Definition: ByteCode.h:133
@ LFT_ADAPTED_REQUEST_HEADER_ELEM
Definition: ByteCode.h:98
@ LFT_SERVER_PORT
Definition: ByteCode.h:63
Definition: parse.c:160
@ LOG_QUOTE_QUOTES
Definition: ByteCode.h:264
@ LFT_ADAPTED_REQUEST_ALL_HEADERS
Definition: ByteCode.h:99
an std::runtime_error with thrower location info
Definition: TextException.h:20
@ LFT_CLIENT_REQ_VERSION
Definition: ByteCode.h:80
@ LOG_QUOTE_MIMEBLOB
Definition: ByteCode.h:265
@ LFT_PROXY_PROTOCOL_RECEIVED_HEADER_ELEM
Definition: ByteCode.h:257
@ LFT_CLIENT_REQ_URLDOMAIN
Definition: ByteCode.h:76
SBuf ToSBuf(Args &&... args)
slowly stream-prints all arguments into a freshly allocated SBuf
Definition: Stream.h:63
@ LFT_CLIENT_LOCAL_NFMARK
Definition: ByteCode.h:49
@ LFT_HTTP_SENT_STATUS_CODE
Definition: ByteCode.h:125
#define DBG_IMPORTANT
Definition: Stream.h:38
@ LFT_TIME_SECONDS_SINCE_EPOCH
Definition: ByteCode.h:159
@ LFT_REQUEST_HEADER_ELEM
Definition: ByteCode.h:93
@ LFT_SSL_SERVER_CERT_WHOLE
Definition: ByteCode.h:228
@ LFT_REQUEST_VERSION_OLD_2X
Definition: ByteCode.h:87
@ LFT_SERVER_REQ_METHOD
Definition: ByteCode.h:102
@ LFT_CLIENT_IO_SIZE_TOTAL
Definition: ByteCode.h:148
@ LFT_SSL_BUMP_MODE
Definition: ByteCode.h:221
@ LFT_PERCENT
Definition: ByteCode.h:240
@ LFT_BYTE
Definition: ByteCode.h:36
@ LFT_CLIENT_REQ_URLPORT
Definition: ByteCode.h:77
@ LFT_REPLY_HEADER_ELEM
Definition: ByteCode.h:132
@ LFT_HTTP_RECEIVED_STATUS_CODE
Definition: ByteCode.h:126
@ LFT_NONE
Definition: ByteCode.h:31
@ LFT_SSL_CLIENT_SNI
Definition: ByteCode.h:224
@ LFT_CLIENT_HANDSHAKE
Definition: ByteCode.h:53
@ LFT_NOTE
Definition: ByteCode.h:239
@ LFT_CREDENTIALS
Definition: ByteCode.h:218
struct SquidConfig::@90 onoff
@ LFT_SERVER_REQ_URI
Definition: ByteCode.h:103
void registerTokens(const SBuf &nsName, TokenTableEntry const *tokenArray)
Definition: Config.cc:17
@ LFT_ICAP_REQUEST_URI
Definition: ByteCode.h:199
@ LFT_TIME_SUBSECOND
Definition: ByteCode.h:160
@ LFT_SSL_SERVER_CERT_SUBJECT
Definition: ByteCode.h:225
@ LFT_ICAP_ADDR
Definition: ByteCode.h:197
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:192
const A & min(A const &lhs, A const &rhs)
@ LFT_CLIENT_LOCAL_TOS
Definition: ByteCode.h:48
@ LFT_SERVER_FQDN_OR_PEER_NAME
Definition: ByteCode.h:62
@ LFT_LOCAL_LISTENING_PORT
Definition: ByteCode.h:57
@ LFT_EXT_ACL_CLIENT_EUI48
Definition: ByteCode.h:250
@ LFT_ICAP_BYTES_SENT
Definition: ByteCode.h:201
class SquidConfig Config
Definition: SquidConfig.cc:12
Quoting
Quoting style for a format output.
Definition: ByteCode.h:262
@ LFT_SQUID_HIERARCHY
Definition: ByteCode.h:176

 

Introduction

Documentation

Support

Miscellaneous