ip_literal_rule.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
  3. // Copyright (c) 2022 Alan de Freitas (vinnie dot falco at gmail dot com)
  4. //
  5. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  6. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. //
  8. // Official repository: https://github.com/boostorg/url
  9. //
  10. #ifndef BOOST_URL_RFC_DETAIL_IP_LITERAL_RULE_HPP
  11. #define BOOST_URL_RFC_DETAIL_IP_LITERAL_RULE_HPP
  12. #include <boost/url/detail/config.hpp>
  13. #include <boost/url/ipv6_address.hpp>
  14. #include <boost/url/error_types.hpp>
  15. #include <boost/core/detail/string_view.hpp>
  16. namespace boost {
  17. namespace urls {
  18. namespace detail {
  19. /** Rule for IP-literal
  20. @par BNF
  21. @code
  22. IP-literal = "[" ( IPv6address / IPv6addrz / IPvFuture ) "]"
  23. @endcode
  24. @par Specification
  25. @li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
  26. >3.2.2. Host (rfc3986)</a>
  27. @see
  28. @ref ipv6_address.
  29. */
  30. struct ip_literal_rule_t
  31. {
  32. struct value_type
  33. {
  34. bool is_ipv6 = false;
  35. ipv6_address ipv6;
  36. core::string_view ipvfuture;
  37. };
  38. auto
  39. parse(
  40. char const*& it,
  41. char const* end
  42. ) const noexcept ->
  43. system::result<value_type>;
  44. };
  45. constexpr ip_literal_rule_t ip_literal_rule{};
  46. } // detail
  47. } // urls
  48. } // boost
  49. #endif