21 Internet protocol [internet]

21.1 Header <experimental/internet> synopsis [internet.synop]

namespace std {
namespace experimental {
namespace net {
inline namespace v1 {
namespace ip {

  enum class resolver_errc {
    host_not_found = an implementation-defined non-zero value,   // EAI_NONAME
    try_again = an implementation-defined non-zero value,        // EAI_AGAIN
    service_not_found = an implementation-defined non-zero value // EAI_SERVICE
  };

  const error_category& resolver_category() noexcept;

  error_code make_error_code(resolver_errc e) noexcept;
  error_condition make_error_condition(resolver_errc e) noexcept;

  using port_type = uint_least16_t;
  using scope_id_type = uint_least32_t;

  struct v4_mapped_t {};
  constexpr v4_mapped_t v4_mapped;

  class address;
  class address_v4;
  class address_v6;

  class bad_address_cast;

  // [internet.address.comparisons], address comparisons:
  constexpr bool operator==(const address&, const address&) noexcept;
  constexpr bool operator!=(const address&, const address&) noexcept;
  constexpr bool operator< (const address&, const address&) noexcept;
  constexpr bool operator> (const address&, const address&) noexcept;
  constexpr bool operator<=(const address&, const address&) noexcept;
  constexpr bool operator>=(const address&, const address&) noexcept;

  // [internet.address.v4.comparisons], address_v4 comparisons:
  constexpr bool operator==(const address_v4&, const address_v4&) noexcept;
  constexpr bool operator!=(const address_v4&, const address_v4&) noexcept;
  constexpr bool operator< (const address_v4&, const address_v4&) noexcept;
  constexpr bool operator> (const address_v4&, const address_v4&) noexcept;
  constexpr bool operator<=(const address_v4&, const address_v4&) noexcept;
  constexpr bool operator>=(const address_v4&, const address_v4&) noexcept;

  // [internet.address.v6.comparisons], address_v6 comparisons:
  constexpr bool operator==(const address_v6&, const address_v6&) noexcept;
  constexpr bool operator!=(const address_v6&, const address_v6&) noexcept;
  constexpr bool operator< (const address_v6&, const address_v6&) noexcept;
  constexpr bool operator> (const address_v6&, const address_v6&) noexcept;
  constexpr bool operator<=(const address_v6&, const address_v6&) noexcept;
  constexpr bool operator>=(const address_v6&, const address_v6&) noexcept;

  // [internet.address.creation], address creation:
  address make_address(const char*);
  address make_address(const char*, error_code&) noexcept;
  address make_address(const string&);
  address make_address(const string&, error_code&) noexcept;
  address make_address(string_view);
  address make_address(string_view, error_code&) noexcept;

  // [internet.address.v4.creation], address_v4 creation:
  constexpr address_v4 make_address_v4(const address_v4::bytes_type&);
  constexpr address_v4 make_address_v4(address_v4::uint_type);
  constexpr address_v4 make_address_v4(v4_mapped_t, const address_v6&);
  address_v4 make_address_v4(const char*);
  address_v4 make_address_v4(const char*, error_code&) noexcept;
  address_v4 make_address_v4(const string&);
  address_v4 make_address_v4(const string&, error_code&) noexcept;
  address_v4 make_address_v4(string_view);
  address_v4 make_address_v4(string_view, error_code&) noexcept;

  // [internet.address.v6.creation], address_v6 creation:
  constexpr address_v6 make_address_v6(const address_v6::bytes_type&,
                                       scope_id_type = 0);
  constexpr address_v6 make_address_v6(v4_mapped_t, const address_v4&) noexcept;
  address_v6 make_address_v6(const char*);
  address_v6 make_address_v6(const char*, error_code&) noexcept;
  address_v6 make_address_v6(const string&);
  address_v6 make_address_v6(const string&, error_code&) noexcept;
  address_v6 make_address_v6(string_view);
  address_v6 make_address_v6(string_view, error_code&) noexcept;

  // [internet.address.io], address I/O:
  template<class CharT, class Traits>
    basic_ostream<CharT, Traits>& operator<<(
      basic_ostream<CharT, Traits>&, const address&);

  // [internet.address.v4.io], address_v4 I/O:
  template<class CharT, class Traits>
    basic_ostream<CharT, Traits>& operator<<(
      basic_ostream<CharT, Traits>&, const address_v4&);

  // [internet.address.v6.io], address_v6 I/O:
  template<class CharT, class Traits>
    basic_ostream<CharT, Traits>& operator<<(
      basic_ostream<CharT, Traits>&, const address_v6&);

  template<class> class basic_address_iterator; // not defined
  template<> class basic_address_iterator<address_v4>;
  using address_v4_iterator = basic_address_iterator<address_v4>;
  template<> class basic_address_iterator<address_v6>;
  using address_v6_iterator = basic_address_iterator<address_v6>;

  template<class> class basic_address_range; // not defined
  template<> class basic_address_range<address_v4>;
  using address_v4_range = basic_address_range<address_v4>;
  template<> class basic_address_range<address_v6>;
  using address_v6_range = basic_address_range<address_v6>;

  class network_v4;
  class network_v6;

  // [internet.network.v4.comparisons], network_v4 comparisons:
  bool operator==(const network_v4&, const network_v4&) noexcept;
  bool operator!=(const network_v4&, const network_v4&) noexcept;

  // [internet.network.v6.comparisons], network_v6 comparisons:
  bool operator==(const network_v6&, const network_v6&) noexcept;
  bool operator!=(const network_v6&, const network_v6&) noexcept;

  // [internet.network.v4.creation], network_v4 creation:
  network_v4 make_network_v4(const address_v4&, int);
  network_v4 make_network_v4(const address_v4&, const address_v4&);
  network_v4 make_network_v4(const char*);
  network_v4 make_network_v4(const char*, error_code&) noexcept;
  network_v4 make_network_v4(const string&);
  network_v4 make_network_v4(const string&, error_code&) noexcept;
  network_v4 make_network_v4(string_view);
  network_v4 make_network_v4(string_view, error_code&) noexcept;

  // [internet.network.v6.creation], network_v6 creation:
  network_v6 make_network_v6(const address_v6&, int);
  network_v6 make_network_v6(const char*);
  network_v6 make_network_v6(const char*, error_code&) noexcept;
  network_v6 make_network_v6(const string&);
  network_v6 make_network_v6(const string&, error_code&) noexcept;
  network_v6 make_network_v6(string_view);
  network_v6 make_network_v6(string_view, error_code&) noexcept;

  // [internet.network.v4.io], network_v4 I/O:
  template<class CharT, class Traits>
    basic_ostream<CharT, Traits>& operator<<(
      basic_ostream<CharT, Traits>&, const network_v4&);

  // [internet.network.v6.io], network_v6 I/O:
  template<class CharT, class Traits>
    basic_ostream<CharT, Traits>& operator<<(
      basic_ostream<CharT, Traits>&, const network_v6&);

  template<class InternetProtocol>
    class basic_endpoint;

  // [internet.endpoint.comparisons], basic_endpoint comparisons:
  template<class InternetProtocol>
    bool operator==(const basic_endpoint<InternetProtocol>&,
                    const basic_endpoint<InternetProtocol>&);
  template<class InternetProtocol>
    bool operator!=(const basic_endpoint<InternetProtocol>&,
                    const basic_endpoint<InternetProtocol>&);
  template<class InternetProtocol>
    bool operator< (const basic_endpoint<InternetProtocol>&,
                    const basic_endpoint<InternetProtocol>&);
  template<class InternetProtocol>
    bool operator> (const basic_endpoint<InternetProtocol>&,
                    const basic_endpoint<InternetProtocol>&);
  template<class InternetProtocol>
    bool operator<=(const basic_endpoint<InternetProtocol>&,
                    const basic_endpoint<InternetProtocol>&);
  template<class InternetProtocol>
    bool operator>=(const basic_endpoint<InternetProtocol>&,
                    const basic_endpoint<InternetProtocol>&);

  // [internet.endpoint.io], basic_endpoint I/O:
  template<class CharT, class Traits, class InternetProtocol>
    basic_ostream<CharT, Traits>& operator<<(
      basic_ostream<CharT, Traits>&,
      const basic_endpoint<InternetProtocol>&);

  template<class InternetProtocol>
    class basic_resolver_entry;

  template<class InternetProtocol>
    bool operator==(const basic_resolver_entry<InternetProtocol>&,
                    const basic_resolver_entry<InternetProtocol>&);
  template<class InternetProtocol>
    bool operator!=(const basic_resolver_entry<InternetProtocol>&,
                    const basic_resolver_entry<InternetProtocol>&);

  template<class InternetProtocol>
    class basic_resolver_results;

  template<class InternetProtocol>
    bool operator==(const basic_resolver_results<InternetProtocol>&,
                    const basic_resolver_results<InternetProtocol>&);
  template<class InternetProtocol>
    bool operator!=(const basic_resolver_results<InternetProtocol>&,
                    const basic_resolver_results<InternetProtocol>&);

  class resolver_base;

  template<class InternetProtocol>
    class basic_resolver;

  string host_name();
  string host_name(error_code&);
  template<class Allocator>
    basic_string<char, char_traits<char>, Allocator>
      host_name(const Allocator&);
  template<class Allocator>
    basic_string<char, char_traits<char>, Allocator>
      host_name(const Allocator&, error_code&);

  class tcp;

  // [internet.tcp.comparisons], tcp comparisons:
  bool operator==(const tcp& a, const tcp& b);
  bool operator!=(const tcp& a, const tcp& b);

  class udp;

  // [internet.udp.comparisons], udp comparisons:
  bool operator==(const udp& a, const udp& b);
  bool operator!=(const udp& a, const udp& b);

  class v6_only;

  namespace unicast {

    class hops;

  } // namespace unicast

  namespace multicast {

    class join_group;

    class leave_group;

    class outbound_interface;

    class hops;

    class enable_loopback;

  } // namespace multicast
} // namespace ip
} // inline namespace v1
} // namespace net
} // namespace experimental

  template<> struct is_error_condition_enum<experimental::net::v1::ip::resolver_errc>
    : public true_type {};

  // [internet.hash], hash support
  template<class T> struct hash;
  template<> struct hash<experimental::net::v1::ip::address>;
  template<> struct hash<experimental::net::v1::ip::address_v4>;
  template<> struct hash<experimental::net::v1::ip::address_v6>;

} // namespace std