Parsing.cc File Reference
#include "squid.h"
#include "cache_cf.h"
#include "compat/strtoll.h"
#include "ConfigParser.h"
#include "Debug.h"
#include "globals.h"
#include "Parsing.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)
 
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

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 251 of file Parsing.cc.

References Ip::Address::GetHostByName(), NULL, port, Ip::Address::port(), Ip::Address::setAnyAddr(), and xatos().

Referenced by logfile_mod_udp_open(), Log::TcpLogger::Open(), and parse_IpAddress_list().

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 142 of file Parsing.cc.

References DBG_IMPORTANT, DBG_PARSE_NOTE, debugs, i, 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().

int64_t GetInteger64 ( void  )

Parse a 64-bit integer value.

Definition at line 126 of file Parsing.cc.

References ConfigParser::NextToken(), self_destruct(), and xatoll().

Referenced by parse_int64_t(), and ClientDelayConfig::parsePoolRates().

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 172 of file Parsing.cc.

References DBG_CRITICAL, debugs, ConfigParser::NextToken(), p, self_destruct(), and xatoi().

Referenced by parse_refreshpattern().

unsigned short GetShort ( void  )

Definition at line 199 of file Parsing.cc.

References ConfigParser::NextToken(), self_destruct(), and xatos().

Referenced by ConfigParser::ParseUShort().

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

Definition at line 211 of file Parsing.cc.

References int.

Referenced by DelaySpec::parse().

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

Definition at line 231 of file Parsing.cc.

References strtoll().

Referenced by DelaySpec::parse().

double xatof ( const char *  token)
long xatol ( const char *  token)

Definition at line 75 of file Parsing.cc.

References DBG_IMPORTANT, DBG_PARSE_NOTE, debugs, self_destruct(), and xatoll().

Referenced by xatos().

int64_t xatoll ( const char *  token,
int  base,
char  eov 
)
unsigned int xatoui ( const char *  token,
char  eov 
)

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors