#include "squid.h"
#include "cache_cf.h"
#include "compat/strtoll.h"
#include "ConfigParser.h"
#include "debug/Stream.h"
#include "globals.h"
#include "Parsing.h"
#include "sbuf/Stream.h"
Go to the source code of this file.
Functions | |
double | xatof (const char *token) |
int | xatoi (const char *token) |
unsigned int | xatoui (const char *token, char eov) |
long | xatol (const char *token) |
int64_t | xatoll (const char *token, int base, char eov) |
uint64_t | xatoull (const char *token, int base, char eov) |
unsigned short | xatos (const char *token) |
int64_t | GetInteger64 (void) |
int | GetInteger (void) |
double | GetPercentage (bool limit) |
unsigned short | GetShort (void) |
bool | StringToInt (const char *s, int &result, const char **p, int base) |
bool | StringToInt64 (const char *s, int64_t &result, const char **p, int base) |
bool | GetHostWithPort (char *token, Ip::Address *ipa) |
Function Documentation
◆ GetHostWithPort()
bool GetHostWithPort | ( | char * | token, |
Ip::Address * | ipa | ||
) |
Parse a socket address (host:port), fill the given Ip::Address object
- Return values
-
false Failure. true Success. Destroys token during parse.
Definition at line 257 of file Parsing.cc.
References Ip::Address::GetHostByName(), port, Ip::Address::port(), Ip::Address::setAnyAddr(), and xatos().
Referenced by logfile_mod_udp_open(), Log::TcpLogger::Open(), and parse_IpAddress_list().
◆ GetInteger()
int GetInteger | ( | void | ) |
Parses an integer value. Uses a method that obeys hexadecimal 0xN syntax needed for certain bitmasks. self_destruct() will be called to abort when invalid tokens are encountered.
Definition at line 148 of file Parsing.cc.
References DBG_IMPORTANT, DBG_PARSE_NOTE, debugs, int, ConfigParser::NextToken(), self_destruct(), and xatoll().
Referenced by parse_icap_service_failure_limit(), parse_int(), parse_refreshpattern(), parse_wccp2_service(), parse_wccp2_service_info(), ConfigParser::ParseBool(), ClientDelayConfig::parsePoolRates(), Rock::SwapDir::parseSize(), and Fs::Ufs::UFSSwapDir::parseSizeL1L2().
◆ GetInteger64()
int64_t GetInteger64 | ( | void | ) |
Parse a 64-bit integer value.
Definition at line 132 of file Parsing.cc.
References ConfigParser::NextToken(), self_destruct(), and xatoll().
Referenced by parse_int64_t(), and ClientDelayConfig::parsePoolRates().
◆ GetPercentage()
double GetPercentage | ( | bool | limit = true | ) |
Parse a percentage value, e.g., 20%. The behavior of this function is similar as GetInteger(). The difference is that the token might contain '' as percentage symbol (%), and we may further check whether the value is in the range of [0, 100]. For example, 20% and 20 are both valid tokens, while 101%, 101, -1 are invalid.
- Parameters
-
limit whether to check the value is within 0-100% limit
- Returns
- the percentage as a decimal number. ie 100% = 1.00, 50% = 0.5
Definition at line 178 of file Parsing.cc.
References DBG_CRITICAL, debugs, ConfigParser::NextToken(), self_destruct(), and xatoi().
Referenced by parse_refreshpattern().
◆ GetShort()
unsigned short GetShort | ( | void | ) |
Definition at line 205 of file Parsing.cc.
References ConfigParser::NextToken(), self_destruct(), and xatos().
Referenced by ConfigParser::ParseUShort().
◆ StringToInt()
◆ StringToInt64()
bool StringToInt64 | ( | const char * | s, |
int64_t & | result, | ||
const char ** | p, | ||
int | base | ||
) |
◆ xatof()
double xatof | ( | const char * | token | ) |
Definition at line 25 of file Parsing.cc.
References DBG_IMPORTANT, DBG_PARSE_NOTE, debugs, and self_destruct().
Referenced by parseBytesLine(), parseBytesLine64(), parseBytesLineSigned(), parseTimeLine(), and ParseUrlRewriteTimeout().
◆ xatoi()
int xatoi | ( | const char * | token | ) |
Definition at line 44 of file Parsing.cc.
References DBG_IMPORTANT, DBG_PARSE_NOTE, debugs, int, self_destruct(), and xatoll().
Referenced by ConfigureCurrentKid(), GetPercentage(), Ssl::CertValidationHelper::Init(), mainHandleCommandLineOption(), Store::Disk::optionReadOnlyParse(), ACLRandom::parse(), ACLMaxUserIP::parse(), Security::PeerOptions::parse(), parse_cache_log_message(), parse_peer(), parse_refreshpattern(), parse_wccp2_service_ports(), and parseBytesOptionValue().
◆ xatol()
long xatol | ( | const char * | token | ) |
Definition at line 72 of file Parsing.cc.
References DBG_IMPORTANT, DBG_PARSE_NOTE, debugs, self_destruct(), and xatoll().
Referenced by xatos().
◆ xatoll()
int64_t xatoll | ( | const char * | token, |
int | base, | ||
char | eov | ||
) |
Definition at line 86 of file Parsing.cc.
References DBG_IMPORTANT, DBG_PARSE_NOTE, debugs, self_destruct(), and strtoll().
Referenced by GetInteger(), GetInteger64(), MessageDelayConfig::parseResponseDelayPool(), xatoi(), xatol(), xatoui(), and xatoull().
◆ xatos()
unsigned short xatos | ( | const char * | token | ) |
Definition at line 114 of file Parsing.cc.
References DBG_IMPORTANT, DBG_PARSE_NOTE, debugs, port, self_destruct(), and xatol().
Referenced by GetHostWithPort(), GetService(), GetShort(), ACLIntRange::parse(), parse_port_option(), parsePortSpecification(), and MessageDelayConfig::parseResponseDelayPool().
◆ xatoui()
unsigned int xatoui | ( | const char * | token, |
char | eov | ||
) |
Definition at line 58 of file Parsing.cc.
References Here, int, ToSBuf(), and xatoll().
Referenced by parse_port_option(), Helper::ChildConfig::parseConfig(), ParseDebugMessageId(), and FormattedLog::parseOptions().
◆ xatoull()
uint64_t xatoull | ( | const char * | token, |
int | base, | ||
char | eov | ||
) |
Definition at line 105 of file Parsing.cc.
References Here, ToSBuf(), and xatoll().
Referenced by parse_cache_log_message().