sockaddr.c revision 6e49e91bd08778d7eae45a2229dcf41ed97cc636
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include <config.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <isc/assertions.h>
#include <isc/sockaddr.h>
{
return (ISC_FALSE);
/*
* We don't just memcmp because the sin_zero field isn't always
* zero.
*/
return (ISC_FALSE);
case AF_INET:
return (ISC_FALSE);
return (ISC_FALSE);
break;
case AF_INET6:
return (ISC_FALSE);
return (ISC_FALSE);
break;
default:
return (ISC_FALSE);
}
return (ISC_TRUE);
}
/*
* Compare just the addresses (ignore ports)
*/
{
return (ISC_FALSE);
return (ISC_FALSE);
case AF_INET:
return (ISC_FALSE);
break;
case AF_INET6:
return (ISC_FALSE);
break;
default:
return (ISC_FALSE);
}
return (ISC_TRUE);
}
/*
* Compare just a prefix of the addresses (ignore ports and
* low address bits)
*/
unsigned int prefixlen)
{
isc_netaddr_fromsockaddr(&na, a);
isc_netaddr_fromsockaddr(&nb, b);
}
char abuf[sizeof "xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255"];
unsigned int alen;
char pbuf[sizeof "65000"];
unsigned int plen;
const struct sockaddr_in *sin;
const struct sockaddr_in6 *sin6;
case AF_INET:
break;
case AF_INET6:
break;
default:
return (ISC_R_NOTIMPLEMENTED);
}
return (ISC_R_NOSPACE);
/* Null terminate after used region. */
return (ISC_R_SUCCESS);
}
unsigned int
unsigned int length;
const unsigned char *s;
unsigned int h = 0;
unsigned int g;
/*
* Provide a hash value for 'sockaddr'.
*/
if (address_only) {
case AF_INET:
case AF_INET6:
break;
default:
"unknown address family: %d",
}
} else {
}
while (length > 0) {
h = ( h << 4 ) + *s;
if ((g = ( h & 0xf0000000 )) != 0) {
h = h ^ (g >> 24);
h = h ^ g;
}
s++;
length--;
}
return (h);
}
void
{
#ifdef ISC_PLATFORM_HAVESALEN
#endif
}
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_INET);
default:
}
#endif
}
void
{
case AF_INET:
#ifdef ISC_PLATFORM_HAVESALEN
#endif
break;
case AF_INET6:
#ifdef ISC_PLATFORM_HAVESALEN
#endif
break;
default:
INSIST(0);
}
}
void
case AF_INET:
break;
case AF_INET6:
break;
default:
}
}
case AF_INET:
break;
case AF_INET6:
break;
default:
}
return (port);
}