Squid Web Cache master
Loading...
Searching...
No Matches
HttpHdrCc.cc File Reference
#include "squid.h"
#include "base/EnumIterator.h"
#include "base/LookupTable.h"
#include "HttpHdrCc.h"
#include "HttpHeader.h"
#include "HttpHeaderStat.h"
#include "HttpHeaderTools.h"
#include "sbuf/SBuf.h"
#include "SquidMath.h"
#include "StatHist.h"
#include "Store.h"
#include "StrList.h"
#include "util.h"
#include <map>
#include <vector>
#include <optional>
#include <ostream>
Include dependency graph for HttpHdrCc.cc:

Go to the source code of this file.

Functions

constexpr const auto & CcAttrs ()
 
static auto ccTypeByName (const SBuf &name)
 
template<typename RawId >
static std::optional< const char * > ccNameByType (const RawId rawId)
 
static HttpHdrCcTypeoperator++ (HttpHdrCcType &aHeader)
 used to walk a table of http_header_cc_type structs
 
void httpHdrCcUpdateStats (const HttpHdrCc *cc, StatHist *hist)
 
void httpHdrCcStatDumper (StoreEntry *sentry, int, double val, double, int count)
 
std::ostream & operator<< (std::ostream &s, HttpHdrCcType c)
 

Variables

constexpr LookupTable< HttpHdrCcType >::Record attrsList []
 

Function Documentation

◆ CcAttrs()

constexpr const auto & CcAttrs ( )
constexpr

Definition at line 50 of file HttpHdrCc.cc.

References attrsList, and CC_ENUM_END.

Referenced by ccNameByType(), and ccTypeByName().

◆ ccNameByType()

template<typename RawId >
static std::optional< const char * > ccNameByType ( const RawId  rawId)
static

Safely converts an integer into a Cache-Control directive name.

Returns
std::nullopt if the given integer is not a valid index of a named attrsList entry

Definition at line 72 of file HttpHdrCc.cc.

References CC_ENUM_END, CcAttrs(), and Less().

Referenced by httpHdrCcStatDumper(), operator<<(), and HttpHdrCc::packInto().

◆ ccTypeByName()

static auto ccTypeByName ( const SBuf name)
static

Definition at line 63 of file HttpHdrCc.cc.

References CC_OTHER, and CcAttrs().

Referenced by HttpHdrCc::parse().

◆ httpHdrCcStatDumper()

void httpHdrCcStatDumper ( StoreEntry sentry,
int  idx,
double  val,
double  size,
int  count 
)

◆ httpHdrCcUpdateStats()

void httpHdrCcUpdateStats ( const HttpHdrCc cc,
StatHist hist 
)

Definition at line 342 of file HttpHdrCc.cc.

References assert, CC_ENUM_END, CC_PUBLIC, StatHist::count(), and HttpHdrCc::isSet().

Referenced by HttpHeader::getCc().

◆ operator++()

static HttpHdrCcType & operator++ ( HttpHdrCcType aHeader)
static

Definition at line 84 of file HttpHdrCc.cc.

References int.

◆ operator<<()

std::ostream & operator<< ( std::ostream &  s,
HttpHdrCcType  c 
)

Definition at line 362 of file HttpHdrCc.cc.

References ccNameByType().

Variable Documentation

◆ attrsList

constexpr LookupTable<HttpHdrCcType>::Record attrsList[]
constexpr
Initial value:
= {
{"no-transform", HttpHdrCcType::CC_NO_TRANSFORM},
{"must-revalidate", HttpHdrCcType::CC_MUST_REVALIDATE},
{"proxy-revalidate", HttpHdrCcType::CC_PROXY_REVALIDATE},
{"only-if-cached", HttpHdrCcType::CC_ONLY_IF_CACHED},
{"stale-if-error", HttpHdrCcType::CC_STALE_IF_ERROR},
}
@ CC_MUST_REVALIDATE
Definition HttpHdrCc.h:26
@ CC_S_MAXAGE
Definition HttpHdrCc.h:29
@ CC_ONLY_IF_CACHED
Definition HttpHdrCc.h:32
@ CC_OTHER
Definition HttpHdrCc.h:35
@ CC_ENUM_END
Definition HttpHdrCc.h:36
@ CC_NO_STORE
Definition HttpHdrCc.h:24
@ CC_PUBLIC
Definition HttpHdrCc.h:21
@ CC_PRIVATE
Definition HttpHdrCc.h:22
@ CC_MAX_STALE
Definition HttpHdrCc.h:30
@ CC_STALE_IF_ERROR
Definition HttpHdrCc.h:33
@ CC_IMMUTABLE
Definition HttpHdrCc.h:34
@ CC_PROXY_REVALIDATE
Definition HttpHdrCc.h:27
@ CC_NO_CACHE
Definition HttpHdrCc.h:23
@ CC_MAX_AGE
Definition HttpHdrCc.h:28
@ CC_NO_TRANSFORM
Definition HttpHdrCc.h:25
@ CC_MIN_FRESH
Definition HttpHdrCc.h:31

Definition at line 30 of file HttpHdrCc.cc.

Referenced by CcAttrs().