host_rule.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // Official repository: https://github.com/boostorg/url
  8. //
  9. #ifndef BOOST_URL_RFC_DETAIL_HOST_RULE_HPP
  10. #define BOOST_URL_RFC_DETAIL_HOST_RULE_HPP
  11. #include <boost/url/host_type.hpp>
  12. #include <boost/url/error_types.hpp>
  13. #include <boost/url/pct_string_view.hpp>
  14. #include <boost/url/ipv4_address.hpp>
  15. #include <boost/url/ipv6_address.hpp>
  16. namespace boost {
  17. namespace urls {
  18. namespace detail {
  19. /** Rule for host
  20. @par BNF
  21. @code
  22. host = IP-literal / IPv4address / reg-name
  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 host_type,
  29. @ref ipv4_address,
  30. @ref ipv6_address.
  31. */
  32. struct host_rule_t
  33. {
  34. struct value_type
  35. {
  36. urls::host_type host_type =
  37. urls::host_type::none;
  38. core::string_view match;
  39. unsigned char addr[16] = {};
  40. pct_string_view name;
  41. };
  42. auto
  43. parse(
  44. char const*& it,
  45. char const* end
  46. ) const noexcept ->
  47. system::result<value_type>;
  48. };
  49. constexpr host_rule_t host_rule{};
  50. } // detail
  51. } // urls
  52. } // boost
  53. #endif