Commit d61ffd84 authored by Eric S. Raymond's avatar Eric S. Raymond

Conditional-symbol cleanup and removal of unused code.

The ISC ipv6.h file was unnecessary; it conditionall simulated things
in thw ANSI sockets interface.
parent 6a0113c6
......@@ -18,14 +18,12 @@
# ifdef HAVE_NTP_ADJTIME
extern int ntp_adjtime (struct timex *);
# ifndef HAVE_STRUCT_NTPTIMEVAL
struct ntptimeval
{
struct timeval time; /* current time (ro) */
long int maxerror; /* maximum error (us) (ro) */
long int esterror; /* estimated error (us) (ro) */
};
# endif
# ifndef HAVE_NTP_GETTIME
static inline int
......
/*
* Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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.
*/
/* $Id: ipv6.h,v 1.24 2007/06/19 23:47:18 tbox Exp $ */
#ifndef ISC_IPV6_H
#define ISC_IPV6_H 1
/*!
* Also define LWRES_IPV6_H to keep it from being included if liblwres is
* being used, or redefinition errors will occur.
*/
#define LWRES_IPV6_H 1
/*****
***** Module Info
*****/
/*! \file isc/ipv6.h
* \brief IPv6 definitions for systems which do not support IPv6.
*
* \li MP:
* No impact.
*
* \li Reliability:
* No anticipated impact.
*
* \li Resources:
* N/A.
*
* \li Security:
* No anticipated impact.
*
* \li Standards:
* RFC2553.
*/
/***
*** Imports.
***/
#include <isc/int.h>
#include <isc/platform.h>
/***
*** Types.
***/
struct in6_addr {
union {
isc_uint8_t _S6_u8[16];
isc_uint16_t _S6_u16[8];
isc_uint32_t _S6_u32[4];
} _S6_un;
};
#define s6_addr _S6_un._S6_u8
#define s6_addr8 _S6_un._S6_u8
#define s6_addr16 _S6_un._S6_u16
#define s6_addr32 _S6_un._S6_u32
#define IN6ADDR_ANY_INIT {{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }}}
#define IN6ADDR_LOOPBACK_INIT {{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }}}
LIBISC_EXTERNAL_DATA extern const struct in6_addr in6addr_any;
LIBISC_EXTERNAL_DATA extern const struct in6_addr in6addr_loopback;
struct sockaddr_in6 {
#ifdef ISC_PLATFORM_HAVESALEN
isc_uint8_t sin6_len;
isc_uint8_t sin6_family;
#else
isc_uint16_t sin6_family;
#endif
isc_uint16_t sin6_port;
isc_uint32_t sin6_flowinfo;
struct in6_addr sin6_addr;
isc_uint32_t sin6_scope_id;
};
#ifdef ISC_PLATFORM_HAVESALEN
#define SIN6_LEN 1
#endif
/*%
* Unspecified
*/
#define IN6_IS_ADDR_UNSPECIFIED(a) \
(((a)->s6_addr32[0] == 0) && \
((a)->s6_addr32[1] == 0) && \
((a)->s6_addr32[2] == 0) && \
((a)->s6_addr32[3] == 0))
/*%
* Loopback
*/
#define IN6_IS_ADDR_LOOPBACK(a) \
(((a)->s6_addr32[0] == 0) && \
((a)->s6_addr32[1] == 0) && \
((a)->s6_addr32[2] == 0) && \
((a)->s6_addr32[3] == htonl(1)))
/*%
* IPv4 compatible
*/
#define IN6_IS_ADDR_V4COMPAT(a) \
(((a)->s6_addr32[0] == 0) && \
((a)->s6_addr32[1] == 0) && \
((a)->s6_addr32[2] == 0) && \
((a)->s6_addr32[3] != 0) && \
((a)->s6_addr32[3] != htonl(1)))
/*%
* Mapped
*/
#define IN6_IS_ADDR_V4MAPPED(a) \
(((a)->s6_addr32[0] == 0) && \
((a)->s6_addr32[1] == 0) && \
((a)->s6_addr32[2] == htonl(0x0000ffff)))
/*%
* Multicast
*/
#define IN6_IS_ADDR_MULTICAST(a) \
((a)->s6_addr8[0] == 0xffU)
/*%
* Unicast link / site local.
*/
#define IN6_IS_ADDR_LINKLOCAL(a) \
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
#define IN6_IS_ADDR_SITELOCAL(a) \
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
#endif /* ISC_IPV6_H */
......@@ -85,10 +85,6 @@
#include <netinet6/in6.h> /* Required on BSD/OS for in6_pktinfo. */
#endif
#ifndef ISC_PLATFORM_HAVEIPV6
#include <isc/ipv6.h> /* Contractual promise. */
#endif
#include <isc/lang.h>
#include <isc/types.h>
......
......@@ -47,78 +47,8 @@
#define in6_addr in_addr6
#endif
#ifndef IN6ADDR_ANY_INIT
#define IN6ADDR_ANY_INIT {{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }}
#endif
#ifndef IN6ADDR_LOOPBACK_INIT
#define IN6ADDR_LOOPBACK_INIT {{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }}
#endif
LIBISC_EXTERNAL_DATA extern const struct in6_addr isc_net_in6addrany;
LIBISC_EXTERNAL_DATA extern const struct in6_addr isc_net_in6addrloop;
/*
* Unspecified
*/
#ifndef IN6_IS_ADDR_UNSPECIFIED
#define IN6_IS_ADDR_UNSPECIFIED(a) (\
*((u_long *)((a)->s6_addr) ) == 0 && \
*((u_long *)((a)->s6_addr) + 1) == 0 && \
*((u_long *)((a)->s6_addr) + 2) == 0 && \
*((u_long *)((a)->s6_addr) + 3) == 0 \
)
#endif
/*
* Loopback
*/
#ifndef IN6_IS_ADDR_LOOPBACK
#define IN6_IS_ADDR_LOOPBACK(a) (\
*((u_long *)((a)->s6_addr) ) == 0 && \
*((u_long *)((a)->s6_addr) + 1) == 0 && \
*((u_long *)((a)->s6_addr) + 2) == 0 && \
*((u_long *)((a)->s6_addr) + 3) == htonl(1) \
)
#endif
/*
* IPv4 compatible
*/
#define IN6_IS_ADDR_V4COMPAT(a) (\
*((u_long *)((a)->s6_addr) ) == 0 && \
*((u_long *)((a)->s6_addr) + 1) == 0 && \
*((u_long *)((a)->s6_addr) + 2) == 0 && \
*((u_long *)((a)->s6_addr) + 3) != 0 && \
*((u_long *)((a)->s6_addr) + 3) != htonl(1) \
)
/*
* Mapped
*/
#define IN6_IS_ADDR_V4MAPPED(a) (\
*((u_long *)((a)->s6_addr) ) == 0 && \
*((u_long *)((a)->s6_addr) + 1) == 0 && \
*((u_long *)((a)->s6_addr) + 2) == htonl(0x0000ffff))
/*
* Multicast
*/
#define IN6_IS_ADDR_MULTICAST(a) \
((a)->s6_addr[0] == 0xffU)
/*
* Unicast link / site local.
*/
#ifndef IN6_IS_ADDR_LINKLOCAL
#define IN6_IS_ADDR_LINKLOCAL(a) (\
((a)->s6_addr[0] == 0xfe) && \
(((a)->s6_addr[1] & 0xc0) == 0x80))
#endif
#ifndef IN6_IS_ADDR_SITELOCAL
#define IN6_IS_ADDR_SITELOCAL(a) (\
((a)->s6_addr[0] == 0xfe) && \
(((a)->s6_addr[1] & 0xc0) == 0xc0))
#endif
#endif /* ISC_IPV6_H */
......@@ -100,7 +100,6 @@
#include <isc/types.h>
#include <ws2tcpip.h>
#include <isc/ipv6.h>
/*
* This is here because named client, interfacemgr.c, etc. use the name as
......
......@@ -311,10 +311,6 @@ SOURCE=..\include\isc\interfaceiter.h
# End Source File
# Begin Source File
SOURCE=..\include\isc\ipv6.h
# End Source File
# Begin Source File
SOURCE=..\include\isc\iterated_hash.h
# End Source File
# Begin Source File
......
......@@ -31,15 +31,15 @@
#ifdef HAVE_MACHINE_SOUNDCARD_H
# include <machine/soundcard.h>
# define PCM_STYLE_SOUND
# define USE_PCM_STYLE_SOUND
#else
# ifdef HAVE_SYS_SOUNDCARD_H
# include <sys/soundcard.h>
# define PCM_STYLE_SOUND
# define USE_PCM_STYLE_SOUND
# endif
#endif
#ifdef PCM_STYLE_SOUND
#ifdef USE_PCM_STYLE_SOUND
# include <ctype.h>
#endif
......@@ -49,7 +49,7 @@
#ifdef HAVE_SYS_AUDIOIO_H
static struct audio_device device; /* audio device ident */
#endif /* HAVE_SYS_AUDIOIO_H */
#ifdef PCM_STYLE_SOUND
#ifdef USE_PCM_STYLE_SOUND
# define INIT_FILE "/etc/ntp.audio"
int agc = SOUND_MIXER_WRITE_RECLEV; /* or IGAIN or LINE */
int monitor = SOUND_MIXER_WRITE_VOLUME; /* or OGAIN */
......@@ -58,12 +58,12 @@ int recmask = 0;
char cf_c_dev[100], cf_i_dev[100], cf_agc[100], cf_monitor[100];
const char *m_names[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES;
#else /* not PCM_STYLE_SOUND */
#else /* not USE_PCM_STYLE_SOUND */
static struct audio_info info; /* audio device info */
#endif /* not PCM_STYLE_SOUND */
#endif /* not USE_PCM_STYLE_SOUND */
static int ctl_fd; /* audio control file descriptor */
#ifdef PCM_STYLE_SOUND
#ifdef USE_PCM_STYLE_SOUND
static void audio_config_read (int, const char **, const char **);
static int mixer_name (const char *, int);
......@@ -192,7 +192,7 @@ audio_config_read(
fclose(fd);
return;
}
#endif /* PCM_STYLE_SOUND */
#endif /* USE_PCM_STYLE_SOUND */
/*
* audio_init - open and initialize audio device
......@@ -212,7 +212,7 @@ audio_init(
int unit /* device unit (0-3) */
)
{
#ifdef PCM_STYLE_SOUND
#ifdef USE_PCM_STYLE_SOUND
# define ACTL_DEV "/dev/mixer%d"
char actl_dev[30];
# ifdef HAVE_STRUCT_SND_SIZE
......@@ -225,14 +225,14 @@ audio_init(
int fd;
int rval;
const char *actl =
#ifdef PCM_STYLE_SOUND
#ifdef USE_PCM_STYLE_SOUND
actl_dev
#else
"/dev/audioctl"
#endif
;
#ifdef PCM_STYLE_SOUND
#ifdef USE_PCM_STYLE_SOUND
snprintf(actl_dev, sizeof(actl_dev), ACTL_DEV, unit);
audio_config_read(unit, &actl, &dname);
......@@ -266,7 +266,7 @@ audio_init(
/*
* Set audio device parameters.
*/
#ifdef PCM_STYLE_SOUND
#ifdef USE_PCM_STYLE_SOUND
printf("audio_init: <%s> bufsiz %d\n", dname, bufsiz);
rval = fd;
......@@ -337,7 +337,7 @@ audio_init(
cf_monitor, devmask);
}
#else /* not PCM_STYLE_SOUND */
#else /* not USE_PCM_STYLE_SOUND */
AUDIO_INITINFO(&info);
info.play.gain = AUDIO_MAX_GAIN;
info.play.port = AUDIO_SPEAKER;
......@@ -352,7 +352,7 @@ audio_init(
return(rval);
}
rval = fd;
#endif /* not PCM_STYLE_SOUND */
#endif /* not USE_PCM_STYLE_SOUND */
return (rval);
}
......@@ -371,7 +371,7 @@ audio_gain(
static int o_mongain = -1;
static int o_port = -1;
#ifdef PCM_STYLE_SOUND
#ifdef USE_PCM_STYLE_SOUND
int l, r;
rval = 0;
......@@ -441,7 +441,7 @@ audio_gain(
# endif
o_port = port;
}
#else /* not PCM_STYLE_SOUND */
#else /* not USE_PCM_STYLE_SOUND */
ioctl(ctl_fd, (int)AUDIO_GETINFO, (char *)&info);
info.record.encoding = AUDIO_ENCODING_ULAW;
info.record.error = 0;
......@@ -456,7 +456,7 @@ audio_gain(
return (rval);
}
rval = info.record.error;
#endif /* not PCM_STYLE_SOUND */
#endif /* not USE_PCM_STYLE_SOUND */
return (rval);
}
......@@ -470,14 +470,14 @@ audio_gain(
void
audio_show(void)
{
#ifdef PCM_STYLE_SOUND
#ifdef USE_PCM_STYLE_SOUND
int recsrc = 0;
printf("audio_show: ctl_fd %d\n", ctl_fd);
if (ioctl(ctl_fd, SOUND_MIXER_READ_RECSRC, &recsrc) == -1)
printf("SOUND_MIXER_READ_RECSRC: %s\n", strerror(errno));
#else /* not PCM_STYLE_SOUND */
#else /* not USE_PCM_STYLE_SOUND */
# ifdef HAVE_SYS_AUDIOIO_H
ioctl(ctl_fd, (int)AUDIO_GETDEV, &device);
printf("audio: name %s, version %s, config %s\n",
......@@ -494,7 +494,7 @@ audio_show(void)
info.record.samples, info.record.eof,
info.record.pause, info.record.error,
info.record.waiting, info.record.balance);
#endif /* not PCM_STYLE_SOUND */
#endif /* not USE_PCM_STYLE_SOUND */
}
#else
int audio_bs;
......
......@@ -37,7 +37,7 @@
#include "ieee754io.h"
static unsigned char get_byte (unsigned char *, offsets_t, int *);
#ifdef __not_yet__
#ifdef __UNUSED__
static void put_byte (unsigned char *, offsets_t, int *, unsigned char);
#endif
......@@ -133,7 +133,7 @@ get_byte(
return val;
}
#ifdef __not_yet__
#ifdef __UNUSED__
static void
put_byte(
unsigned char *bufp,
......
......@@ -135,20 +135,6 @@ struct mx4200unit {
static char pmvxg[] = "PMVXG";
/* XXX should be somewhere else */
#ifdef __GNUC__
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
#ifndef __attribute__
#define __attribute__(args)
#endif /* __attribute__ */
#endif /* __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) */
#else
#ifndef __attribute__
#define __attribute__(args)
#endif /* __attribute__ */
#endif /* __GNUC__ */
/* XXX end */
/*
* Function prototypes
*/
......
......@@ -126,7 +126,7 @@ static void praecis_parse(struct recvbuf *rbufp, struct peer *peer);
* They are taken from Markus Prosch
*/
#ifdef PALISADE_SENDCMD_RESURRECTED
#ifdef __UNUSED__
/*
* sendcmd - Build data packet for sending
*/
......@@ -140,7 +140,7 @@ sendcmd (
*(buffer->data + 1) = (unsigned char)c;
buffer->size = 2;
}
#endif /* PALISADE_SENDCMD_RESURRECTED */
#endif /* __UNUSED_ */
/*
* sendsupercmd - Build super data packet for sending
......
......@@ -177,7 +177,7 @@ static short getint (uint8_t *);
static int32_t getlong (uint8_t *);
#endif
#ifdef PALISADE_SENDCMD_RESURRECTED
#ifdef __UNUSED__
static void sendcmd (struct packettx *buffer, int c);
#endif
static void sendsupercmd (struct packettx *buffer, int c1, int c2);
......
......@@ -613,10 +613,6 @@
RelativePath="..\..\..\include\iosignal.h"
>
</File>
<File
RelativePath="..\..\..\lib\isc\win32\include\isc\ipv6.h"
>
</File>
<File
RelativePath="..\..\..\include\lib_strbuf.h"
>
......
......@@ -749,10 +749,6 @@
RelativePath="..\..\..\include\iosignal.h"
>
</File>
<File
RelativePath="..\include\isc\ipv6.h"
>
</File>
<File
RelativePath="..\..\..\ntpd\jupiter.h"
>
......
......@@ -728,10 +728,6 @@
RelativePath="..\..\..\..\include\iosignal.h"
>
</File>
<File
RelativePath="..\..\..\..\lib\isc\win32\include\isc\ipv6.h"
>
</File>
<File
RelativePath="..\..\..\..\include\lib_strbuf.h"
>
......
......@@ -464,10 +464,6 @@
RelativePath="..\..\..\..\include\iosignal.h"
>
</File>
<File
RelativePath="..\..\..\..\lib\isc\win32\include\isc\ipv6.h"
>
</File>
<File
RelativePath="..\..\..\..\ntpd\jupiter.h"
>
......
......@@ -360,7 +360,6 @@
<ClInclude Include="..\..\..\..\lib\isc\include\isc\socket.h" />
<ClInclude Include="..\..\..\..\lib\isc\include\isc\task.h" />
<ClInclude Include="..\..\..\..\lib\isc\win32\include\isc\condition.h" />
<ClInclude Include="..\..\..\..\lib\isc\win32\include\isc\ipv6.h" />
<ClInclude Include="..\..\..\..\lib\isc\win32\include\isc\mutex.h" />
<ClInclude Include="..\..\..\..\lib\isc\win32\include\isc\net.h" />
<ClInclude Include="..\..\..\..\lib\isc\win32\include\isc\platform.h" />
......
......@@ -358,9 +358,6 @@
<ClInclude Include="..\..\..\..\include\iosignal.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\lib\isc\win32\include\isc\ipv6.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\lib_strbuf.h">
<Filter>Header Files</Filter>
</ClInclude>
......
......@@ -373,7 +373,6 @@
<ClInclude Include="..\..\..\..\lib\isc\include\isc\result.h" />
<ClInclude Include="..\..\..\..\lib\isc\include\isc\socket.h" />
<ClInclude Include="..\..\..\..\lib\isc\win32\include\isc\int.h" />
<ClInclude Include="..\..\..\..\lib\isc\win32\include\isc\ipv6.h" />
<ClInclude Include="..\..\..\..\lib\isc\win32\include\isc\net.h" />
<ClInclude Include="..\..\..\..\lib\isc\win32\include\isc\netdb.h" />
<ClInclude Include="..\..\..\..\lib\isc\win32\include\isc\platform.h" />
......
......@@ -320,9 +320,6 @@
<ClInclude Include="..\..\..\..\include\iosignal.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\lib\isc\win32\include\isc\ipv6.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\ntpd\jupiter.h">
<Filter>Header Files</Filter>
</ClInclude>
......
......@@ -44,7 +44,7 @@ timespecTest::my_tick_to_tsf(
// precision float calculations or, if available, 64bit integer
// arithmetic. This should give the precise fraction, rounded to
// the nearest representation.
#ifdef HAVE_U_INT64
#ifdef HAVE_UINT64_T
return u_int32(((u_int64(ticks) << 32) + 500000000) / 1000000000);
#else
return u_int32(double(ticks) * 4.294967296 + 0.5);
......@@ -59,7 +59,7 @@ timespecTest::my_tsf_to_tick(
)
{
// Inverse operation: converts fraction to microseconds.
#ifdef HAVE_U_INT64
#ifdef HAVE_UINT64_T
return u_int32((u_int64(tsf) * 1000000000 + 0x80000000) >> 32);
#else
return u_int32(double(tsf) / 4.294967296 + 0.5);
......
......@@ -44,7 +44,7 @@ timevalTest::my_tick_to_tsf(
// precision float calculations or, if available, 64bit integer
// arithmetic. This should give the precise fraction, rounded to
// the nearest representation.
#ifdef HAVE_U_INT64
#ifdef HAVE_UINT64_T
return u_int32(((u_int64(ticks) << 32) + 500000) / 1000000);
#else
return u_int32(double(ticks) * 4294.967296 + 0.5);
......@@ -59,7 +59,7 @@ timevalTest::my_tsf_to_tick(
)
{
// Inverse operation: converts fraction to microseconds.
#ifdef HAVE_U_INT64
#ifdef HAVE_UINT64_T
return u_int32((u_int64(tsf) * 1000000 + 0x80000000) >> 32);
#else
return u_int32(double(tsf) / 4294.967296 + 0.5);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment