Problem: mask and to_string member functions of tcp_address_mask_t are not referenced

Solution: remove them
This commit is contained in:
Simon Giesecke 2020-09-04 15:24:24 +02:00
parent c6301206dc
commit af7df64ae7
2 changed files with 0 additions and 57 deletions

View File

@ -203,11 +203,6 @@ zmq::tcp_address_mask_t::tcp_address_mask_t () : _address_mask (-1)
memset (&_network_address, 0, sizeof (_network_address));
}
int zmq::tcp_address_mask_t::mask () const
{
return _address_mask;
}
int zmq::tcp_address_mask_t::resolve (const char *name_, bool ipv6_)
{
// Find '/' at the end that separates address from the cidr mask number.
@ -264,53 +259,6 @@ int zmq::tcp_address_mask_t::resolve (const char *name_, bool ipv6_)
return 0;
}
int zmq::tcp_address_mask_t::to_string (std::string &addr_) const
{
if (_network_address.family () != AF_INET
&& _network_address.family () != AF_INET6) {
addr_.clear ();
return -1;
}
if (_address_mask == -1) {
addr_.clear ();
return -1;
}
char hbuf[NI_MAXHOST];
const int rc = getnameinfo (_network_address.as_sockaddr (),
_network_address.sockaddr_len (), hbuf,
sizeof (hbuf), NULL, 0, NI_NUMERICHOST);
if (rc != 0) {
addr_.clear ();
return rc;
}
const size_t max_mask_len = 4;
const char ipv6_prefix[] = "[";
const char ipv6_suffix[] = "]/";
const char ipv4_suffix[] = "/";
char
buf[NI_MAXHOST + sizeof ipv6_prefix + sizeof ipv6_suffix + max_mask_len];
char *pos = buf;
if (_network_address.family () == AF_INET6) {
memcpy (pos, ipv6_prefix, sizeof ipv6_prefix - 1);
pos += sizeof ipv6_prefix - 1;
}
const size_t hbuf_len = strlen (hbuf);
memcpy (pos, hbuf, hbuf_len);
pos += hbuf_len;
if (_network_address.family () == AF_INET6) {
memcpy (pos, ipv6_suffix, sizeof ipv6_suffix - 1);
pos += sizeof ipv6_suffix - 1;
} else {
memcpy (pos, ipv4_suffix, sizeof ipv4_suffix - 1);
pos += sizeof ipv4_suffix - 1;
}
pos += sprintf (pos, "%d", _address_mask);
addr_.assign (buf, pos - buf);
return 0;
}
bool zmq::tcp_address_mask_t::match_address (const struct sockaddr *ss_,
const socklen_t ss_len_) const
{

View File

@ -82,11 +82,6 @@ class tcp_address_mask_t
// Works only with remote hostnames.
int resolve (const char *name_, bool ipv6_);
// The opposite to resolve()
int to_string (std::string &addr_) const;
int mask () const;
bool match_address (const struct sockaddr *ss_, socklen_t ss_len_) const;
private: