WebSocket++  0.8.3-dev
C++ websocket client/server library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Functions
websocketpp::uri_helper Namespace Reference

A group of helper methods for parsing and validating URIs against RFC 3986. More...

Functions

bool unreserved (char c)
 RFC3986 unreserved character test. More...
 
bool gen_delim (char c)
 RFC3986 generic delimiter character test. More...
 
bool sub_delim (char c)
 RFC3986 subcomponent delimiter character test. More...
 
bool hexdigit (char c)
 RFC3986 hex digit character test. More...
 
bool scheme (char c)
 RFC3986 scheme character test. More...
 
bool digit (char c)
 RFC3986 digit character test. More...
 
bool digit (std::string::const_iterator it)
 RFC3986 digit character test (iterator version) More...
 
bool pct_encoded (std::string::const_iterator it)
 RFC3986 per cent encoded character test. More...
 
bool dec_octet (std::string::const_iterator start, std::string::const_iterator end)
 Tests a range for a valid IPv4 decimal octet. More...
 
bool ipv4_literal (std::string::const_iterator start, std::string::const_iterator end)
 Tests a range for a valid IPv4 literal. More...
 
bool hex4 (std::string::const_iterator start, std::string::const_iterator end)
 Tests a range for a valid IPv6 hex quad. More...
 
bool ipv6_literal (std::string::const_iterator start, std::string::const_iterator end)
 Tests a range for a valid IPv6 literal. More...
 
bool reg_name (char c)
 Tests a character for validity for a registry name. More...
 
bool reg_name (std::string::const_iterator start, std::string::const_iterator end)
 Tests a range for validity for a registry name. More...
 

Detailed Description

A group of helper methods for parsing and validating URIs against RFC 3986.

Function Documentation

◆ dec_octet()

bool websocketpp::uri_helper::dec_octet ( std::string::const_iterator  start,
std::string::const_iterator  end 
)
inline

Tests a range for a valid IPv4 decimal octet.

Since
0.8.3
Parameters
startAn iterator to the first character of the range to check (inclusive)
startAn iterator to the last character of the range to check (exclusive)
Returns
True if the range represents a valid IPv4 decimal octet (0-255)

Definition at line 223 of file uri.hpp.

◆ digit() [1/2]

bool websocketpp::uri_helper::digit ( char  c)
inline

RFC3986 digit character test.

Since
0.8.3
Parameters
cthe char to test
Returns
True if the character is considered a digit (0-9)

Definition at line 184 of file uri.hpp.

◆ digit() [2/2]

bool websocketpp::uri_helper::digit ( std::string::const_iterator  it)
inline

RFC3986 digit character test (iterator version)

Since
0.8.3
Parameters
cthe char to test
Returns
True if the character is considered a digit (0-9)

Definition at line 195 of file uri.hpp.

◆ gen_delim()

bool websocketpp::uri_helper::gen_delim ( char  c)
inline

RFC3986 generic delimiter character test.

Parameters
cthe char to test
Returns
True if the character is considered a generic delimiter

Definition at line 78 of file uri.hpp.

◆ hex4()

bool websocketpp::uri_helper::hex4 ( std::string::const_iterator  start,
std::string::const_iterator  end 
)
inline

Tests a range for a valid IPv6 hex quad.

Since
0.8.3
Parameters
startAn iterator to the first character of the range to check (inclusive)
startAn iterator to the last character of the range to check (exclusive)
Returns
True if the range represents a valid IPv6 hex quad

Definition at line 279 of file uri.hpp.

◆ hexdigit()

bool websocketpp::uri_helper::hexdigit ( char  c)
inline

RFC3986 hex digit character test.

Case insensitive

Since
0.8.3
Parameters
cthe char to test
Returns
True if the character is considered a hexadecimal digit

Definition at line 128 of file uri.hpp.

◆ ipv4_literal()

bool websocketpp::uri_helper::ipv4_literal ( std::string::const_iterator  start,
std::string::const_iterator  end 
)
inline

Tests a range for a valid IPv4 literal.

Since
0.8.3
Parameters
startAn iterator to the first character of the range to check (inclusive)
startAn iterator to the last character of the range to check (exclusive)
Returns
True if the range represents a valid IPv4 literal address

Definition at line 250 of file uri.hpp.

◆ ipv6_literal()

bool websocketpp::uri_helper::ipv6_literal ( std::string::const_iterator  start,
std::string::const_iterator  end 
)
inline

Tests a range for a valid IPv6 literal.

Since
0.8.3
Parameters
startAn iterator to the first character of the range to check (inclusive)
startAn iterator to the last character of the range to check (exclusive)
Returns
True if the range represents a valid IPv6 literal

Definition at line 299 of file uri.hpp.

◆ pct_encoded()

bool websocketpp::uri_helper::pct_encoded ( std::string::const_iterator  it)
inline

RFC3986 per cent encoded character test.

caller must range check (only caller knows the actual range) caller must check for leading %

Since
0.8.3
Parameters
itAn iterator to the first character after the % sign
Returns
True if both the character pointed at by the iterator and the next one represent a valid RFC3986 percent encoding

Definition at line 211 of file uri.hpp.

◆ reg_name() [1/2]

bool websocketpp::uri_helper::reg_name ( char  c)
inline

Tests a character for validity for a registry name.

will fail on %, which is valid, but only when used as a part of a multiple character escape sequence. Since this test checks a single character it can't tell whether a % character is valid so it returns false. The caller needs to catch and handle s in another way.

Since
0.8.3
Parameters
cThe character to test
Returns
True if the range represents a valid IPv6 literal

Definition at line 361 of file uri.hpp.

◆ reg_name() [2/2]

bool websocketpp::uri_helper::reg_name ( std::string::const_iterator  start,
std::string::const_iterator  end 
)
inline

Tests a range for validity for a registry name.

Since
0.8.3
Parameters
startAn iterator to the first character of the range to check (inclusive)
startAn iterator to the last character of the range to check (exclusive)
Returns
True if the range represents a valid registry name

Definition at line 373 of file uri.hpp.

◆ scheme()

bool websocketpp::uri_helper::scheme ( char  c)
inline

RFC3986 scheme character test.

Since
0.8.3
Parameters
cthe char to test
Returns
True if the character is considered a valid character for a uri scheme

Definition at line 165 of file uri.hpp.

◆ sub_delim()

bool websocketpp::uri_helper::sub_delim ( char  c)
inline

RFC3986 subcomponent delimiter character test.

Since
0.8.3
Parameters
cthe char to test
Returns
True if the character is considered a subcomponent delimiter

Definition at line 100 of file uri.hpp.

◆ unreserved()

bool websocketpp::uri_helper::unreserved ( char  c)
inline

RFC3986 unreserved character test.

Since
0.8.3
Parameters
cthe char to test
Returns
True if the character is considered unreserved

Definition at line 61 of file uri.hpp.