xtd 0.2.0
Loading...
Searching...
No Matches
ip_end_point.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "end_point.hpp"
6#include "ip_address.hpp"
7#include "../iequatable.hpp"
8
10namespace xtd {
12 namespace net {
28 class core_export_ ip_end_point : public xtd::net::end_point, public xtd::iequatable<xtd::net::ip_end_point> {
29 public:
31
34 static constexpr xtd::uint16 min_port = 0x0000;
36 static constexpr xtd::uint16 max_port = 0xFFFF;
38
40
46
52
54 ip_end_point() = default;
55 ip_end_point(ip_end_point&&) = default;
56 ip_end_point(const ip_end_point&) = default;
57 auto operator =(ip_end_point&&) ->ip_end_point& = default;
58 auto operator =(const ip_end_point&) ->ip_end_point& = default;
60
62
66 [[nodiscard]] auto address() const noexcept -> const xtd::net::ip_address&;
70 auto address(const xtd::net::ip_address& value) -> ip_end_point&;
71
74 [[nodiscard]] auto port() const noexcept -> xtd::uint16;
77 auto port(xtd::uint16 value) -> ip_end_point&;
79
81
87 [[nodiscard]] auto create(const xtd::net::socket_address& socket_address) const -> xtd::uptr<end_point> override;
88
92 [[nodiscard]] auto equals(const object& obj) const noexcept -> bool override;
96 [[nodiscard]] auto equals(const ip_end_point& other) const noexcept -> bool override;
97
100 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::size override;
101
104 [[nodiscard]] auto serialize() const -> xtd::net::socket_address override;
105
108 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
110
111 private:
112 xtd::net::ip_address address_;
113 xtd::uint16 port_ = 0;
114 };
115 }
116}
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
Identifies a network address. This is an abstract class.
Definition end_point.hpp:27
end_point(xtd::net::sockets::address_family address_family)
Initializes a new instance of the xtd::net::end_point class.
Definition end_point.hpp:67
Provides an Internet Protocol (IP) address.
Definition ip_address.hpp:42
auto create(const xtd::net::socket_address &socket_address) const -> xtd::uptr< end_point > override
Creates an xtd::net::end_point instance from a xtd::net::socket_address instance.
ip_end_point(xtd::uint32 address, xtd::uint16 port)
Initializes a new instance of the xtd::net::ip_end_point class.
auto get_hash_code() const noexcept -> xtd::size override
Serves as a hash function for a particular type.
ip_end_point(const xtd::net::ip_address &address, xtd::uint16 port)
Initializes a new instance of the xtd::net::ip_end_point class.
auto serialize() const -> xtd::net::socket_address override
Serializes endpoint information into a socket_address instance.
static constexpr xtd::uint16 min_port
Specifies the minimum value that can be assigned to the port property. The min_port value is set to 0...
Definition ip_end_point.hpp:34
auto address() const noexcept -> const xtd::net::ip_address &
Gets the IP address of the endpoint.
auto equals(const object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
auto to_string() const noexcept -> xtd::string override
Returns a string that represents the current object.
static constexpr xtd::uint16 max_port
Specifies the maximum value that can be assigned to the port property. The max_port value is set to 0...
Definition ip_end_point.hpp:36
auto port() const noexcept -> xtd::uint16
Gets or sets the port number of the endpoint.
Stores serialized information from end_point derived classes. #par Deinition.
Definition socket_address.hpp:36
Contains xtd::net::end_point class.
#define core_export_
Define shared library export.
Definition core_export.hpp:13
std::uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
xtd::unique_ptr_object< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
std::uint16_t uint16
Represents a 16-bit unsigned integer.
Definition uint16.hpp:23
@ other
The operating system is other.
Definition platform_id.hpp:60
Contains xtd::iequatable interface.
The xtd::net namespace provides a simple programming interface for many of the protocols used on netw...
Definition cookie_exception.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::net::ip_address class.