libzmq
src
ip_resolver.hpp
Go to the documentation of this file.
1
/* SPDX-License-Identifier: MPL-2.0 */
2
3
#ifndef __ZMQ_IP_RESOLVER_HPP_INCLUDED__
4
#define __ZMQ_IP_RESOLVER_HPP_INCLUDED__
5
6
#if !defined ZMQ_HAVE_WINDOWS
7
#include <sys/socket.h>
8
#include <netinet/in.h>
9
#include <netdb.h>
10
#endif
11
12
#include "
address.hpp
"
13
14
namespace
zmq
15
{
16
union
ip_addr_t
17
{
18
sockaddr
generic
;
19
sockaddr_in
ipv4
;
20
sockaddr_in6
ipv6
;
21
22
int
family
()
const
;
23
bool
is_multicast
()
const
;
24
uint16_t
port
()
const
;
25
26
const
struct
sockaddr *
as_sockaddr
()
const
;
27
zmq_socklen_t
sockaddr_len
()
const
;
28
29
void
set_port
(uint16_t);
30
31
static
ip_addr_t
any
(
int
family_);
32
};
33
34
class
ip_resolver_options_t
35
{
36
public
:
37
ip_resolver_options_t
();
38
39
ip_resolver_options_t
&bindable (
bool
bindable_);
40
ip_resolver_options_t
&allow_nic_name (
bool
allow_);
41
ip_resolver_options_t
&ipv6 (
bool
ipv6_);
42
ip_resolver_options_t
&expect_port (
bool
expect_);
43
ip_resolver_options_t
&allow_dns (
bool
allow_);
44
ip_resolver_options_t
&allow_path (
bool
allow_);
45
46
bool
bindable ();
47
bool
allow_nic_name ();
48
bool
ipv6 ();
49
bool
expect_port ();
50
bool
allow_dns ();
51
bool
allow_path ();
52
53
private
:
54
bool
_bindable_wanted
;
55
bool
_nic_name_allowed
;
56
bool
_ipv6_wanted
;
57
bool
_port_expected
;
58
bool
_dns_allowed
;
59
bool
_path_allowed
;
60
};
61
62
class
ip_resolver_t
63
{
64
public
:
65
ip_resolver_t
(
ip_resolver_options_t
opts_);
66
virtual
~ip_resolver_t
(){};
67
68
int
resolve
(
ip_addr_t
*ip_addr_,
const
char
*
name_
);
69
70
protected
:
71
// Virtual functions that are overridden in tests
72
virtual
int
do_getaddrinfo (
const
char
*node_,
73
const
char
*service_,
74
const
struct
addrinfo *hints_,
75
struct
addrinfo **res_);
76
77
virtual
void
do_freeaddrinfo (
struct
addrinfo *res_);
78
79
virtual
unsigned
int
do_if_nametoindex (
const
char
*ifname_);
80
81
private
:
82
ip_resolver_options_t
_options
;
83
84
int
resolve_nic_name (
ip_addr_t
*ip_addr_,
const
char
*nic_);
85
int
resolve_getaddrinfo (
ip_addr_t
*ip_addr_,
const
char
*addr_);
86
87
#if defined ZMQ_HAVE_WINDOWS
88
int
get_interface_name (
unsigned
long
index_
,
char
**dest_)
const
;
89
int
wchar_to_utf8 (
const
WCHAR *src_,
char
**dest_)
const
;
90
#endif
91
};
92
}
93
94
#endif
zmq::ip_addr_t::ipv6
sockaddr_in6 ipv6
Definition:
ip_resolver.hpp:20
zmq::ip_addr_t::any
static ip_addr_t any(int family_)
Definition:
ip_resolver.cpp:68
zmq::ip_resolver_t::_options
ip_resolver_options_t _options
Definition:
ip_resolver.hpp:82
resolve
ROSCPP_DECL std::string resolve(const std::string &name, bool remap=true)
zmq
Definition:
zmq.hpp:229
zmq::ip_addr_t::ipv4
sockaddr_in ipv4
Definition:
ip_resolver.hpp:19
zmq::ip_addr_t
Definition:
ip_resolver.hpp:16
zmq::ip_resolver_options_t::_path_allowed
bool _path_allowed
Definition:
ip_resolver.hpp:59
zmq::ip_resolver_options_t::_port_expected
bool _port_expected
Definition:
ip_resolver.hpp:57
name_
string name_
Definition:
googletest.cc:182
address.hpp
index_
int index_
Definition:
gmock-matchers_test.cc:6752
zmq::ip_resolver_options_t::_dns_allowed
bool _dns_allowed
Definition:
ip_resolver.hpp:58
zmq::ip_resolver_options_t::_nic_name_allowed
bool _nic_name_allowed
Definition:
ip_resolver.hpp:55
zmq::ip_resolver_t
Definition:
ip_resolver.hpp:62
zmq::ip_addr_t::set_port
void set_port(uint16_t)
Definition:
ip_resolver.cpp:58
zmq::ip_addr_t::as_sockaddr
const struct sockaddr * as_sockaddr() const
Definition:
ip_resolver.cpp:47
zmq::ip_addr_t::sockaddr_len
zmq_socklen_t sockaddr_len() const
Definition:
ip_resolver.cpp:52
zmq::ip_addr_t::family
int family() const
Definition:
ip_resolver.cpp:23
zmq::ip_resolver_options_t
Definition:
ip_resolver.hpp:34
zmq::zmq_socklen_t
socklen_t zmq_socklen_t
Definition:
address.hpp:107
zmq::ip_addr_t::port
uint16_t port() const
Definition:
ip_resolver.cpp:39
zmq::ip_addr_t::is_multicast
bool is_multicast() const
Definition:
ip_resolver.cpp:28
zmq::ip_resolver_t::~ip_resolver_t
virtual ~ip_resolver_t()
Definition:
ip_resolver.hpp:66
zmq::ip_resolver_options_t::_ipv6_wanted
bool _ipv6_wanted
Definition:
ip_resolver.hpp:56
zmq::ip_resolver_options_t::_bindable_wanted
bool _bindable_wanted
Definition:
ip_resolver.hpp:54
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:54