Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-04 09:07:17

0001 //
0002 // Copyright (c) 2022 Vinnie Falco (vinnie.falco@gmail.com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // Official repository: https://github.com/boostorg/url
0008 //
0009 
0010 #ifndef BOOST_URL_RFC_IPV6_ADDRESS_RULE_HPP
0011 #define BOOST_URL_RFC_IPV6_ADDRESS_RULE_HPP
0012 
0013 #include <boost/url/detail/config.hpp>
0014 #include <boost/url/ipv6_address.hpp>
0015 #include <boost/url/error_types.hpp>
0016 
0017 namespace boost {
0018 namespace urls {
0019 namespace implementation_defined {
0020 struct ipv6_address_rule_t
0021 {
0022     using value_type =
0023         ipv6_address;
0024 
0025     BOOST_URL_DECL
0026     auto
0027     parse(
0028         char const*& it,
0029         char const* end
0030             ) const noexcept ->
0031         system::result<ipv6_address>;
0032 };
0033 } // implementation_defined
0034 
0035 /** Rule for An IP version 6 style address
0036 
0037     @par Value Type
0038     @code
0039     using value_type = ipv6_address;
0040     @endcode
0041 
0042     @par Example
0043     Rules are used with the function @ref grammar::parse.
0044     @code
0045     system::result< ipv6_address > rv = grammar::parse( "2001:0db8:85a3:0000:0000:8a2e:0370:7334", ipv6_address_rule );
0046     @endcode
0047 
0048     @par BNF
0049     @code
0050     IPv6address =                            6( h16 ":" ) ls32
0051                 /                       "::" 5( h16 ":" ) ls32
0052                 / [               h16 ] "::" 4( h16 ":" ) ls32
0053                 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
0054                 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
0055                 / [ *3( h16 ":" ) h16 ] "::"    h16 ":"   ls32
0056                 / [ *4( h16 ":" ) h16 ] "::"              ls32
0057                 / [ *5( h16 ":" ) h16 ] "::"              h16
0058                 / [ *6( h16 ":" ) h16 ] "::"
0059 
0060     ls32        = ( h16 ":" h16 ) / IPv4address
0061                 ; least-significant 32 bits of address
0062 
0063     h16         = 1*4HEXDIG
0064                 ; 16 bits of address represented in hexadecimal
0065     @endcode
0066 
0067     @par Specification
0068     @li <a href="https://datatracker.ietf.org/doc/html/rfc4291"
0069         >IP Version 6 Addressing Architecture (rfc4291)</a>
0070     @li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
0071         >3.2.2. Host (rfc3986)</a>
0072 
0073     @see
0074         @ref ipv6_address,
0075         @ref parse_ipv6_address,
0076         @ref grammar::parse.
0077 */
0078 constexpr implementation_defined::ipv6_address_rule_t ipv6_address_rule{};
0079 
0080 } // urls
0081 } // boost
0082 
0083 #endif