Parsing.cc File Reference
#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"
Include dependency graph for Parsing.cc:

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
falseFailure.
trueSuccess. 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
limitwhether 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()

bool StringToInt ( const char *  s,
int result,
const char **  p,
int  base 
)

Definition at line 217 of file Parsing.cc.

References int.

Referenced by DelaySpec::parse().

◆ StringToInt64()

bool StringToInt64 ( const char *  s,
int64_t &  result,
const char **  p,
int  base 
)

Definition at line 237 of file Parsing.cc.

References strtoll().

Referenced by DelaySpec::parse().

◆ xatof()

double xatof ( const char *  token)

◆ xatoi()

◆ 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 
)

◆ xatos()

◆ xatoui()

unsigned int xatoui ( const char *  token,
char  eov 
)

◆ 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().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors