mn_basic_ip6_endpoint.hpp
Go to the documentation of this file.
1 /*
2 *This file is part of the Mini Thread Library (https://github.com/RoseLeBlood/MiniThread ).
3 *Copyright (c) 2018 Amber-Sophia Schroeck
4 *
5 *The Mini Thread Library is free software; you can redistribute it and/or modify
6 *it under the terms of the GNU Lesser General Public License as published by
7 *the Free Software Foundation, version 3, or (at your option) any later version.
8 
9 *The Mini Thread Library is distributed in the hope that it will be useful, but
10 *WITHOUT ANY WARRANTY; without even the implied warranty of
11 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 *General Public License for more details.
13 *
14 *You should have received a copy of the GNU Lesser General Public
15 *License along with the Mini Thread Library; if not, see
16 *<https://www.gnu.org/licenses/>.
17 */
18 #ifndef __MINILIB_BASIC_IP6_ENDPOINT_H__
19 #define __MINILIB_BASIC_IP6_ENDPOINT_H__
20 
21 #include "../mn_config.hpp"
22 
23 #if MN_THREAD_CONFIG_NET_IPADDRESS6_ENABLE == MN_THREAD_CONFIG_YES
24 
25 #define MNNET_IPENDPOINT6_ANY(PORT) mn::net::basic_ip6_endpoint(MNNET_IPV6_ADDRESS_ANY, PORT)
26 #define MNNET_IPENDPOINT6_LOOPBACK(PORT) mn::net::basic_ip6_endpoint(MNNET_IPV6_ADDRESS_LOOPBACK, PORT)
27 
28 #define MNNET_IPENDPOINT6(IP, PORT) mn::net::basic_ip6_endpoint(IP, PORT)
29 #define MNNET_IPENDPOINT6_EMPTY MNNET_IPENDPOINT4_ANY(0)
30 
31 
32 #include "mn_basic_endpoint.hpp"
33 #include "mn_basic_ip6_address.hpp"
34 
35 namespace mn {
36  namespace net {
41  class basic_ip6_endpoint : public basic_ip_endpoint<basic_ip6_address, address_family::inet_v6> {
43  public:
44  basic_ip6_endpoint(const uint16_t& port = 0) noexcept;
45  basic_ip6_endpoint(const basic_ip6_address& ip, const uint16_t& port) noexcept;
46  basic_ip6_endpoint(const basic_ip6_endpoint& pOther) noexcept;
47 
52  using base_type::get_port;
57  using base_type::get_host;
61  using base_type::set_port;
66  using base_type::is_multicast;
71  using base_type::is_loopback;
76  using base_type::get_famile;
77 
78  using base_type::operator =;
79  using base_type::operator ==;
80  using base_type::operator !=;
81 
82  using base_type::swap;
83 
88  basic_endpoint* get_copy() override;
89 
95  basic_ip6_address get_ip() __attribute__ ((deprecated)) { return get_host(); }
96  };
97  }
98 }
99 #endif // MN_THREAD_CONFIG_NET_IPADDRESS6_ENABLE
100 
101 #endif // __MINILIB_BASIC_IP6_ENDPOINT_H__
This abstract basic class represents an endpoint/socket address.
Definition: mn_basic_endpoint.hpp:43
This class represents an internet (IP) version 6 host address.
Definition: mn_basic_ip6_address.hpp:49
This class represents an IPv6 endpoint/socket address.
Definition: mn_basic_ip6_endpoint.hpp:41
basic_endpoint * get_copy() override
Get a copy from this.
Definition: mn_basic_ip6_endpoint.cpp:47
basic_ip6_address get_ip() __attribute__((deprecated))
Get the host IP address.
Definition: mn_basic_ip6_endpoint.hpp:95
basic_ip6_endpoint(const uint16_t &port=0) noexcept
Definition: mn_basic_ip6_endpoint.cpp:29
This template basic class represents an ip endpoint/socket address.
Definition: mn_basic_endpoint.hpp:59
address_family get_famile()
Get the address family of the address.
Definition: mn_basic_endpoint.hpp:90
void set_port(const uint16_t &port)
Set a port number, between 0-9999.
Definition: mn_basic_endpoint.hpp:94
uint16_t get_port()
Get the port number.
Definition: mn_basic_endpoint.hpp:80
bool is_multicast()
Is the host address a multicast address.
Definition: mn_basic_endpoint.hpp:104
virtual void swap(self_type &rhs) noexcept
Definition: mn_basic_endpoint.hpp:143
ip_type get_host()
Get the host IP address.
Definition: mn_basic_endpoint.hpp:85
bool is_loopback()
Is the host address a loopaddress.
Definition: mn_basic_endpoint.hpp:109
struct __attribute__((aligned(1))) aligned1
Definition: mn_alignment.hpp:40
Definition: mn_allocator_typetraits.hpp:25