sockaddr.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 1999-2007, 2010-2012, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id$ */
/*! \file */
#include <config.h>
#include <stdio.h>
#include <isc/sockaddr.h>
return (isc_sockaddr_compare(a, b, ISC_SOCKADDR_CMPADDR|
}
return (isc_sockaddr_compare(a, b, ISC_SOCKADDR_CMPADDR|
}
unsigned int flags)
{
return (ISC_FALSE);
/*
* We don't just memcmp because the sin_zero field isn't always
* zero.
*/
return (ISC_FALSE);
case AF_INET:
if ((flags & ISC_SOCKADDR_CMPADDR) != 0 &&
return (ISC_FALSE);
if ((flags & ISC_SOCKADDR_CMPPORT) != 0 &&
return (ISC_FALSE);
break;
case AF_INET6:
if ((flags & ISC_SOCKADDR_CMPADDR) != 0 &&
return (ISC_FALSE);
#ifdef ISC_PLATFORM_HAVESCOPEID
/*
* If ISC_SOCKADDR_CMPSCOPEZERO is set then don't return
* ISC_FALSE if one of the scopes in zero.
*/
if ((flags & ISC_SOCKADDR_CMPSCOPE) != 0 &&
((flags & ISC_SOCKADDR_CMPSCOPEZERO) == 0 ||
return (ISC_FALSE);
#endif
if ((flags & ISC_SOCKADDR_CMPPORT) != 0 &&
return (ISC_FALSE);
break;
default:
return (ISC_FALSE);
}
return (ISC_TRUE);
}
unsigned int prefixlen)
{
isc_netaddr_fromsockaddr(&na, a);
isc_netaddr_fromsockaddr(&nb, b);
}
char pbuf[sizeof("65000")];
unsigned int plen;
/*
* Do the port first, giving us the opportunity to check for
* unsupported address families before calling
* isc_netaddr_fromsockaddr().
*/
case AF_INET:
break;
case AF_INET6:
break;
#ifdef ISC_PLAFORM_HAVESYSUNH
case AF_UNIX:
return (ISC_R_NOSPACE);
/*
* Null terminate after used region.
*/
return (ISC_R_SUCCESS);
#endif
default:
return (ISC_R_FAILURE);
}
if (result != ISC_R_SUCCESS)
return (result);
return (ISC_R_NOSPACE);
/*
* Null terminate after used region.
*/
return (ISC_R_SUCCESS);
}
void
if (size == 0U)
return;
if (result != ISC_R_SUCCESS) {
/*
* The message is the same as in netaddr.c.
*/
"<unknown address, family %u>"),
}
}
unsigned int
unsigned int length = 0;
const unsigned char *s = NULL;
unsigned int h = 0;
unsigned int p = 0;
case AF_INET:
break;
case AF_INET6:
s = (const unsigned char *)in6;
if (IN6_IS_ADDR_V4MAPPED(in6)) {
s += 12;
} else
break;
default:
"unknown address family: %d"),
p = 0;
}
if (!address_only)
h = isc_hash_function(&p, sizeof(p), ISC_TRUE, &h);
return (h);
}
void
{
#ifdef ISC_PLATFORM_HAVESALEN
#endif
}
void
{
#ifdef ISC_PLATFORM_HAVESALEN
#endif
}
void
{
#ifdef ISC_PLATFORM_HAVESALEN
#endif
}
void
switch (pf) {
case AF_INET:
break;
case AF_INET6:
break;
default:
INSIST(0);
}
}
void
{
#ifdef ISC_PLATFORM_HAVESALEN
#endif
}
void
{
#ifdef ISC_PLATFORM_HAVESALEN
#endif
}
int
/*
* Get the protocol family of 'sockaddr'.
*/
/*
* Assume that PF_xxx == AF_xxx for all AF and PF.
*/
#else
case AF_INET:
return (PF_INET);
case AF_INET6:
return (PF_INET6);
default:
"unknown address family: %d"),
}
#endif
}
void
{
case AF_INET:
#ifdef ISC_PLATFORM_HAVESALEN
#endif
break;
case AF_INET6:
#ifdef ISC_PLATFORM_HAVESALEN
#endif
#ifdef ISC_PLATFORM_HAVESCOPEID
#endif
break;
default:
INSIST(0);
}
}
void
case AF_INET:
break;
case AF_INET6:
break;
default:
"unknown address family: %d"),
}
}
case AF_INET:
break;
case AF_INET6:
break;
default:
"unknown address family: %d"),
}
return (port);
}
return (isc_netaddr_ismulticast(&netaddr));
}
return (ISC_FALSE);
}
return (isc_netaddr_isexperimental(&netaddr));
}
return (ISC_FALSE);
}
return (isc_netaddr_issitelocal(&netaddr));
}
return (ISC_FALSE);
}
return (isc_netaddr_islinklocal(&netaddr));
}
return (ISC_FALSE);
}
return (isc_netaddr_isnetzero(&netaddr));
}
return (ISC_FALSE);
}
#ifdef ISC_PLATFORM_HAVESYSUNH
return (ISC_R_NOSPACE);
#ifdef ISC_PLATFORM_HAVESALEN
#endif
return (ISC_R_SUCCESS);
#else
return (ISC_R_NOTIMPLEMENTED);
#endif
}