aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/ntp/include
diff options
context:
space:
mode:
authorOllivier Robert <roberto@FreeBSD.org>2008-08-22 15:58:00 +0000
committerOllivier Robert <roberto@FreeBSD.org>2008-08-22 15:58:00 +0000
commitea906c4152774dff300bb26fbfc1e4188351c89a (patch)
tree2b9fb7f64eacb322e95695e412c923e97ba33e88 /contrib/ntp/include
parent65cf8f06911ae22f7b08b1ffd4e386e43e718e87 (diff)
parentff717da2cf625e3d07537a93a4c240692fa55bd6 (diff)
downloadsrc-ea906c4152774dff300bb26fbfc1e4188351c89a.tar.gz
src-ea906c4152774dff300bb26fbfc1e4188351c89a.zip
Merge ntpd & friends 4.2.4p5 from vendor/ntp/dist into head. Next commit
will update usr.sbin/ntp to match this. MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=182007
Diffstat (limited to 'contrib/ntp/include')
-rw-r--r--contrib/ntp/include/Makefile.am7
-rw-r--r--contrib/ntp/include/Makefile.in236
-rw-r--r--contrib/ntp/include/adjtime.h6
-rw-r--r--contrib/ntp/include/ascii.h39
-rw-r--r--contrib/ntp/include/autogen-version.def2
-rw-r--r--contrib/ntp/include/binio.h39
-rw-r--r--contrib/ntp/include/copyright.def18
-rw-r--r--contrib/ntp/include/debug-opt.def34
-rw-r--r--contrib/ntp/include/homerc.def9
-rw-r--r--contrib/ntp/include/ieee754io.h39
-rw-r--r--contrib/ntp/include/isc/Makefile.am3
-rw-r--r--contrib/ntp/include/isc/Makefile.in172
-rw-r--r--contrib/ntp/include/isc/buffer.h800
-rw-r--r--contrib/ntp/include/isc/interfaceiter.h2
-rw-r--r--contrib/ntp/include/isc/ipv6.h32
-rw-r--r--contrib/ntp/include/isc/msgs.h22
-rw-r--r--contrib/ntp/include/isc/net.h71
-rw-r--r--contrib/ntp/include/isc/netaddr.h34
-rw-r--r--contrib/ntp/include/isc/netscope.h40
-rw-r--r--contrib/ntp/include/isc/region.h95
-rw-r--r--contrib/ntp/include/isc/result.h25
-rw-r--r--contrib/ntp/include/isc/sockaddr.h6
-rw-r--r--contrib/ntp/include/l_stdlib.h13
-rw-r--r--contrib/ntp/include/mbg_gps166.h54
-rw-r--r--contrib/ntp/include/ntp.h243
-rw-r--r--contrib/ntp/include/ntp_config.h37
-rw-r--r--contrib/ntp/include/ntp_control.h44
-rw-r--r--contrib/ntp/include/ntp_crypto.h22
-rw-r--r--contrib/ntp/include/ntp_debug.h26
-rw-r--r--contrib/ntp/include/ntp_filegen.h2
-rw-r--r--contrib/ntp/include/ntp_fp.h7
-rw-r--r--contrib/ntp/include/ntp_machine.h16
-rw-r--r--contrib/ntp/include/ntp_random.h14
-rw-r--r--contrib/ntp/include/ntp_refclock.h26
-rw-r--r--contrib/ntp/include/ntp_request.h44
-rw-r--r--contrib/ntp/include/ntp_rfc2553.h188
-rw-r--r--contrib/ntp/include/ntp_stdlib.h10
-rw-r--r--contrib/ntp/include/ntp_tty.h13
-rw-r--r--contrib/ntp/include/ntp_types.h7
-rw-r--r--contrib/ntp/include/ntpd.h103
-rw-r--r--contrib/ntp/include/parse.h54
-rw-r--r--contrib/ntp/include/parse_conf.h47
-rw-r--r--contrib/ntp/include/recvbuff.h24
-rw-r--r--contrib/ntp/include/timepps-SCO.h503
-rw-r--r--contrib/ntp/include/timepps-Solaris.h501
-rw-r--r--contrib/ntp/include/timepps-SunOS.h504
-rw-r--r--contrib/ntp/include/trimble.h39
-rw-r--r--contrib/ntp/include/version.def1
48 files changed, 3704 insertions, 569 deletions
diff --git a/contrib/ntp/include/Makefile.am b/contrib/ntp/include/Makefile.am
index 8f8b934afeb4..1fbe6fcfe35f 100644
--- a/contrib/ntp/include/Makefile.am
+++ b/contrib/ntp/include/Makefile.am
@@ -1,7 +1,7 @@
#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies
AUTOMAKE_OPTIONS = ../util/ansi2knr
ETAGS_ARGS = $(srcdir)/Makefile.am
-#EXTRA_DIST = TAGS
+EXTRA_DIST = autogen-version.def copyright.def debug-opt.def homerc.def version.def
SUBDIRS = isc
@@ -28,6 +28,7 @@ noinst_HEADERS = \
ntp_control.h \
ntp_crypto.h \
ntp_datum.h \
+ ntp_debug.h \
ntp_filegen.h \
ntp_fp.h \
ntp_if.h \
@@ -36,6 +37,7 @@ noinst_HEADERS = \
ntp_malloc.h \
ntp_md5.h \
ntp_proto.h \
+ ntp_random.h \
ntp_refclock.h \
ntp_request.h \
ntp_rfc2553.h \
@@ -54,5 +56,8 @@ noinst_HEADERS = \
parse_conf.h \
recvbuff.h \
rsa_md5.h \
+ timepps-SCO.h \
+ timepps-Solaris.h \
+ timepps-SunOS.h \
trimble.h
diff --git a/contrib/ntp/include/Makefile.in b/contrib/ntp/include/Makefile.in
index d0a688243ec3..b65fac865075 100644
--- a/contrib/ntp/include/Makefile.in
+++ b/contrib/ntp/include/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.7.7 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -21,7 +21,6 @@ pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
-
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
@@ -37,16 +36,44 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-target_triplet = @target@
+subdir = include
+DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/libopts/m4/libopts.m4 \
+ $(top_srcdir)/m4/define_dir.m4 \
+ $(top_srcdir)/m4/hs_ulong_const.m4 \
+ $(top_srcdir)/m4/os_cflags.m4 $(top_srcdir)/version.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
+AR = @AR@
ARLIB_DIR = @ARLIB_DIR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BINSUBDIR = @BINSUBDIR@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -54,10 +81,15 @@ CHUTEST = @CHUTEST@
CLKTEST = @CLKTEST@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DCFD = @DCFD@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -65,30 +97,39 @@ EF_LIBS = @EF_LIBS@
EF_PROGS = @EF_PROGS@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
INSTALL_DATA = @INSTALL_DATA@
+INSTALL_LIBOPTS_FALSE = @INSTALL_LIBOPTS_FALSE@
+INSTALL_LIBOPTS_TRUE = @INSTALL_LIBOPTS_TRUE@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LCRYPTO = @LCRYPTO@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
+LIBOPTS_CFLAGS = @LIBOPTS_CFLAGS@
+LIBOPTS_DIR = @LIBOPTS_DIR@
+LIBOPTS_LDADD = @LIBOPTS_LDADD@
LIBPARSE = @LIBPARSE@
LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MAKE_ADJTIMED = @MAKE_ADJTIMED@
+MAKE_CHECK_LAYOUT = @MAKE_CHECK_LAYOUT@
MAKE_CHECK_Y2K = @MAKE_CHECK_Y2K@
MAKE_LIBNTPSIM = @MAKE_LIBNTPSIM@
MAKE_LIBPARSE = @MAKE_LIBPARSE@
MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@
MAKE_NTPDSIM = @MAKE_NTPDSIM@
MAKE_NTPTIME = @MAKE_NTPTIME@
-MAKE_NTP_KEYGEN = @MAKE_NTP_KEYGEN@
MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@
-MAKE_SNTP = @MAKE_SNTP@
MAKE_TICKADJ = @MAKE_TICKADJ@
MAKE_TIMETRIM = @MAKE_TIMETRIM@
+NEED_LIBOPTS_FALSE = @NEED_LIBOPTS_FALSE@
+NEED_LIBOPTS_TRUE = @NEED_LIBOPTS_TRUE@
OBJEXT = @OBJEXT@
OPENSSL = @OPENSSL@
OPENSSL_INC = @OPENSSL_INC@
@@ -111,14 +152,21 @@ STRIP = @STRIP@
TESTDCF = @TESTDCF@
U = @U@
VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@@ -139,6 +187,7 @@ libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
+mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -146,19 +195,13 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
-target = @target@
target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_os = @target_os@
-target_vendor = @target_vendor@
#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies
AUTOMAKE_OPTIONS = ../util/ansi2knr
ETAGS_ARGS = $(srcdir)/Makefile.am
-
-#EXTRA_DIST = TAGS
+EXTRA_DIST = autogen-version.def copyright.def debug-opt.def homerc.def version.def
SUBDIRS = isc
-
noinst_HEADERS = \
adjtime.h \
audio.h \
@@ -182,6 +225,7 @@ noinst_HEADERS = \
ntp_control.h \
ntp_crypto.h \
ntp_datum.h \
+ ntp_debug.h \
ntp_filegen.h \
ntp_fp.h \
ntp_if.h \
@@ -190,6 +234,7 @@ noinst_HEADERS = \
ntp_malloc.h \
ntp_md5.h \
ntp_proto.h \
+ ntp_random.h \
ntp_refclock.h \
ntp_request.h \
ntp_rfc2553.h \
@@ -208,33 +253,52 @@ noinst_HEADERS = \
parse_conf.h \
recvbuff.h \
rsa_md5.h \
+ timepps-SCO.h \
+ timepps-Solaris.h \
+ timepps-SunOS.h \
trimble.h
-subdir = include
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-DIST_SOURCES =
-HEADERS = $(noinst_HEADERS)
-
-
-RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
- ps-recursive install-info-recursive uninstall-info-recursive \
- all-recursive install-data-recursive install-exec-recursive \
- installdirs-recursive install-recursive uninstall-recursive \
- check-recursive installcheck-recursive
-DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.in \
- Makefile.am
-DIST_SUBDIRS = $(SUBDIRS)
all: all-recursive
.SUFFIXES:
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \
cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu include/Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+ $(AUTOMAKE) --foreign include/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
@@ -244,7 +308,13 @@ uninstall-info-am:
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
- @set fnord $$MAKEFLAGS; amf=$$2; \
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -256,7 +326,7 @@ $(RECURSIVE_TARGETS):
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ || eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -264,7 +334,13 @@ $(RECURSIVE_TARGETS):
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
- @set fnord $$MAKEFLAGS; amf=$$2; \
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -285,7 +361,7 @@ maintainer-clean-recursive:
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ || eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -296,14 +372,6 @@ ctags-recursive:
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
-ETAGS = etags
-ETAGSFLAGS =
-
-CTAGS = ctags
-CTAGSFLAGS =
-
-tags: TAGS
-
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -312,19 +380,22 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
+tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
- if (etags --etags-include --version) >/dev/null 2>&1; then \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
+ empty_fix=.; \
else \
include_option=--include; \
+ empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
- test -f $$subdir/TAGS && \
+ test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
@@ -334,10 +405,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
- test -z "$(ETAGS_ARGS)$$tags$$unique" \
- || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique
-
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
@@ -360,10 +432,6 @@ GTAGS:
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-
-top_distdir = ..
-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
@@ -377,7 +445,7 @@ distdir: $(DISTFILES)
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
- $(mkinstalldirs) "$(distdir)$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
@@ -392,15 +460,17 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
- list='$(SUBDIRS)'; for subdir in $$list; do \
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
- test -d $(distdir)/$$subdir \
- || mkdir $(distdir)/$$subdir \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
|| exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$(top_distdir)" \
- distdir=../$(distdir)/$$subdir \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
distdir) \
|| exit 1; \
fi; \
@@ -410,7 +480,6 @@ check: check-recursive
all-am: Makefile $(HEADERS)
installdirs: installdirs-recursive
installdirs-am:
-
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
@@ -422,7 +491,7 @@ install-am: all-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- INSTALL_STRIP_FLAG=-s \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
@@ -430,23 +499,26 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
- -rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
-clean-am: clean-generic mostlyclean-am
+clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-tags
+distclean-am: clean-am distclean-generic distclean-libtool \
+ distclean-tags
dvi: dvi-recursive
dvi-am:
+html: html-recursive
+
info: info-recursive
info-am:
@@ -467,7 +539,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
-mostlyclean-am: mostlyclean-generic
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
@@ -481,20 +553,18 @@ uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
- clean-generic clean-recursive ctags ctags-recursive distclean \
- distclean-generic distclean-recursive distclean-tags distdir \
- dvi dvi-am dvi-recursive info info-am info-recursive install \
- install-am install-data install-data-am install-data-recursive \
- install-exec install-exec-am install-exec-recursive \
- install-info install-info-am install-info-recursive install-man \
- install-recursive install-strip installcheck installcheck-am \
- installdirs installdirs-am installdirs-recursive \
- maintainer-clean maintainer-clean-generic \
- maintainer-clean-recursive mostlyclean mostlyclean-generic \
- mostlyclean-recursive pdf pdf-am pdf-recursive ps ps-am \
- ps-recursive tags tags-recursive uninstall uninstall-am \
- uninstall-info-am uninstall-info-recursive uninstall-recursive
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libtool clean-recursive ctags \
+ ctags-recursive distclean distclean-generic distclean-libtool \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-generic mostlyclean-libtool \
+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/contrib/ntp/include/adjtime.h b/contrib/ntp/include/adjtime.h
index b6e2a3e99541..74d91eb2719d 100644
--- a/contrib/ntp/include/adjtime.h
+++ b/contrib/ntp/include/adjtime.h
@@ -39,10 +39,6 @@
#include "ntp_types.h"
-#ifdef __QNXNTO__
-int adjtime( const struct timeval * oldtime, struct timeval * newtime );
-#else /* not __QNXNTO__ */
-
#define KEY 659847L
typedef union {
@@ -65,5 +61,3 @@ typedef union {
*/
#define DELTA1 0
#define DELTA2 1
-
-#endif /* not __QNXNTO__ */
diff --git a/contrib/ntp/include/ascii.h b/contrib/ntp/include/ascii.h
index c679362c1226..a7890917cf89 100644
--- a/contrib/ntp/include/ascii.h
+++ b/contrib/ntp/include/ascii.h
@@ -1,9 +1,36 @@
/*
- * /src/NTP/ntp-4/include/ascii.h,v 4.1 1998/07/11 10:05:22 kardel RELEASE_19990228_A
+ * /src/NTP/ntp4-dev/include/ascii.h,v 4.4 2005/04/16 17:32:10 kardel RELEASE_20050508_A
+ *
+ * ascii.h,v 4.4 2005/04/16 17:32:10 kardel RELEASE_20050508_A
*
* $Created: Sun Jul 20 11:42:53 1997 $
*
- * Copyright (C) 1997 by Frank Kardel
+ * Copyright (c) 1997-2005 by Frank Kardel <kardel <AT> ntp.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
*/
#ifndef ASCII_H
#define ASCII_H
@@ -48,7 +75,15 @@
#endif
/*
+ * History:
+ *
* ascii.h,v
+ * Revision 4.4 2005/04/16 17:32:10 kardel
+ * update copyright
+ *
+ * Revision 4.3 2004/11/14 15:29:41 kardel
+ * support PPSAPI, upgrade Copyright to Berkeley style
+ *
* Revision 4.1 1998/07/11 10:05:22 kardel
* Release 4.0.73d reconcilation
*
diff --git a/contrib/ntp/include/autogen-version.def b/contrib/ntp/include/autogen-version.def
new file mode 100644
index 000000000000..89439830eb87
--- /dev/null
+++ b/contrib/ntp/include/autogen-version.def
@@ -0,0 +1,2 @@
+#assert (version-compare >= autogen-version "5.9.1")
+guard-option-names;
diff --git a/contrib/ntp/include/binio.h b/contrib/ntp/include/binio.h
index 49feee9a21c9..56e671fdb2fe 100644
--- a/contrib/ntp/include/binio.h
+++ b/contrib/ntp/include/binio.h
@@ -1,9 +1,36 @@
/*
- * /src/NTP/ntp-4/include/binio.h,v 4.2 1998/06/28 16:52:15 kardel RELEASE_19990228_A
+ * /src/NTP/ntp4-dev/include/binio.h,v 4.5 2005/04/16 17:32:10 kardel RELEASE_20050508_A
+ *
+ * binio.h,v 4.5 2005/04/16 17:32:10 kardel RELEASE_20050508_A
*
* $Created: Sun Jul 20 13:03:05 1997 $
*
- * Copyright (C) 1997-1998 by Frank Kardel
+ * Copyright (c) 1997-2005 by Frank Kardel <kardel <AT> ntp.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
*/
#ifndef BINIO_H
#define BINIO_H
@@ -22,7 +49,15 @@ void put_msb_long P((unsigned char **, long));
#endif
/*
+ * History:
+ *
* binio.h,v
+ * Revision 4.5 2005/04/16 17:32:10 kardel
+ * update copyright
+ *
+ * Revision 4.4 2004/11/14 15:29:41 kardel
+ * support PPSAPI, upgrade Copyright to Berkeley style
+ *
* Revision 4.2 1998/06/28 16:52:15 kardel
* added binio MSB prototypes for {get,put}_msb_{short,long}
*
diff --git a/contrib/ntp/include/copyright.def b/contrib/ntp/include/copyright.def
new file mode 100644
index 000000000000..f86034bc3acf
--- /dev/null
+++ b/contrib/ntp/include/copyright.def
@@ -0,0 +1,18 @@
+/* -*- Mode: Text -*- */
+
+copyright = {
+ date = "1970-2008";
+ owner = "David L. Mills and/or others";
+ eaddr = "http://bugs.ntp.isc.org, bugs@ntp.org";
+ type = note;
+ text = "see html/copyright.html";
+};
+
+long-opts;
+config-header = config.h;
+environrc;
+
+version = `
+eval VERSION=\`sed -e 's/.*,\\[//' -e 's/\\].*//' < ../version.m4\`
+[ -z "${VERSION}" ] && echo "Cannot determine VERSION" && kill -TERM $AG_pid
+echo $VERSION`;
diff --git a/contrib/ntp/include/debug-opt.def b/contrib/ntp/include/debug-opt.def
new file mode 100644
index 000000000000..2c3da2a635bd
--- /dev/null
+++ b/contrib/ntp/include/debug-opt.def
@@ -0,0 +1,34 @@
+
+include = <<- _EOF_
+ #ifdef __windows
+ extern int atoi(const char*);
+ #else
+ # include <stdlib.h>
+ #endif
+ _EOF_;
+
+flag = {
+ name = debug-level;
+ value = d;
+ max = NOLIMIT;
+ ifdef = DEBUG;
+ nopreset;
+ descrip = "Increase output debug message level";
+ doc = <<- _EndOfDoc_
+ Increase the debugging message output level.
+ _EndOfDoc_;
+};
+
+flag = {
+ name = set-debug-level;
+ value = D;
+ max = NOLIMIT;
+ ifdef = DEBUG;
+ descrip = "Set the output debug message level";
+ arg-type = string;
+ flag-code = 'DESC(DEBUG_LEVEL).optOccCt = atoi( pOptDesc->pzLastArg );';
+ doc = <<- _EndOfDoc_
+ Set the output debugging level. Can be supplied multiple times,
+ but each overrides the previous value(s).
+ _EndOfDoc_;
+};
diff --git a/contrib/ntp/include/homerc.def b/contrib/ntp/include/homerc.def
new file mode 100644
index 000000000000..18b4dcb74a98
--- /dev/null
+++ b/contrib/ntp/include/homerc.def
@@ -0,0 +1,9 @@
+/* -*- Mode: Text -*- */
+
+#ifndef __windows__
+rcfile = ".ntprc";
+#else
+rcfile = "ntp.ini";
+#endif
+
+homerc = $HOME, ".";
diff --git a/contrib/ntp/include/ieee754io.h b/contrib/ntp/include/ieee754io.h
index f691acc3c2ae..6906731cbfb4 100644
--- a/contrib/ntp/include/ieee754io.h
+++ b/contrib/ntp/include/ieee754io.h
@@ -1,9 +1,36 @@
/*
- * /src/NTP/ntp-4/include/ieee754io.h,v 4.0 1998/04/10 19:50:40 kardel RELEASE_19990228_A
+ * /src/NTP/ntp4-dev/include/ieee754io.h,v 4.3 2005/04/16 17:32:10 kardel RELEASE_20050508_A
+ *
+ * ieee754io.h,v 4.3 2005/04/16 17:32:10 kardel RELEASE_20050508_A
*
* $Created: Sun Jul 13 12:22:11 1997 $
*
- * Copyright (C) 1997 by Frank Kardel
+ * Copyright (c) 1997-2005 by Frank Kardel <kardel <AT> ntp.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
*/
#ifndef IEEE754IO_H
#define IEEE754IO_H
@@ -30,7 +57,15 @@ int put_ieee754 P((unsigned char **bufpp, int size, l_fp *lfpp, offsets_t offset
#endif
/*
+ * History:
+ *
* ieee754io.h,v
+ * Revision 4.3 2005/04/16 17:32:10 kardel
+ * update copyright
+ *
+ * Revision 4.2 2004/11/14 15:29:41 kardel
+ * support PPSAPI, upgrade Copyright to Berkeley style
+ *
* Revision 4.0 1998/04/10 19:50:40 kardel
* Start 4.0 release version numbering
*
diff --git a/contrib/ntp/include/isc/Makefile.am b/contrib/ntp/include/isc/Makefile.am
index a5b253c9ddc6..3d8c2a47f90e 100644
--- a/contrib/ntp/include/isc/Makefile.am
+++ b/contrib/ntp/include/isc/Makefile.am
@@ -7,6 +7,7 @@ noinst_HEADERS = \
app.h \
assertions.h \
boolean.h \
+ buffer.h \
error.h \
formatcheck.h \
int.h \
@@ -22,11 +23,13 @@ noinst_HEADERS = \
mutex.h \
net.h \
netaddr.h \
+ netscope.h \
offset.h \
once.h \
platform.h \
print.h \
result.h \
+ region.h \
sockaddr.h \
strerror.h \
string.h \
diff --git a/contrib/ntp/include/isc/Makefile.in b/contrib/ntp/include/isc/Makefile.in
index 3270f4a9f726..26ea36f2acff 100644
--- a/contrib/ntp/include/isc/Makefile.in
+++ b/contrib/ntp/include/isc/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.7.7 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -21,7 +21,6 @@ pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
-
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
@@ -37,16 +36,37 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-target_triplet = @target@
+subdir = include/isc
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/libopts/m4/libopts.m4 \
+ $(top_srcdir)/m4/define_dir.m4 \
+ $(top_srcdir)/m4/hs_ulong_const.m4 \
+ $(top_srcdir)/m4/os_cflags.m4 $(top_srcdir)/version.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
+AR = @AR@
ARLIB_DIR = @ARLIB_DIR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BINSUBDIR = @BINSUBDIR@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -54,10 +74,15 @@ CHUTEST = @CHUTEST@
CLKTEST = @CLKTEST@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DCFD = @DCFD@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -65,30 +90,39 @@ EF_LIBS = @EF_LIBS@
EF_PROGS = @EF_PROGS@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
INSTALL_DATA = @INSTALL_DATA@
+INSTALL_LIBOPTS_FALSE = @INSTALL_LIBOPTS_FALSE@
+INSTALL_LIBOPTS_TRUE = @INSTALL_LIBOPTS_TRUE@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LCRYPTO = @LCRYPTO@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
+LIBOPTS_CFLAGS = @LIBOPTS_CFLAGS@
+LIBOPTS_DIR = @LIBOPTS_DIR@
+LIBOPTS_LDADD = @LIBOPTS_LDADD@
LIBPARSE = @LIBPARSE@
LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MAKE_ADJTIMED = @MAKE_ADJTIMED@
+MAKE_CHECK_LAYOUT = @MAKE_CHECK_LAYOUT@
MAKE_CHECK_Y2K = @MAKE_CHECK_Y2K@
MAKE_LIBNTPSIM = @MAKE_LIBNTPSIM@
MAKE_LIBPARSE = @MAKE_LIBPARSE@
MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@
MAKE_NTPDSIM = @MAKE_NTPDSIM@
MAKE_NTPTIME = @MAKE_NTPTIME@
-MAKE_NTP_KEYGEN = @MAKE_NTP_KEYGEN@
MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@
-MAKE_SNTP = @MAKE_SNTP@
MAKE_TICKADJ = @MAKE_TICKADJ@
MAKE_TIMETRIM = @MAKE_TIMETRIM@
+NEED_LIBOPTS_FALSE = @NEED_LIBOPTS_FALSE@
+NEED_LIBOPTS_TRUE = @NEED_LIBOPTS_TRUE@
OBJEXT = @OBJEXT@
OPENSSL = @OPENSSL@
OPENSSL_INC = @OPENSSL_INC@
@@ -111,14 +145,21 @@ STRIP = @STRIP@
TESTDCF = @TESTDCF@
U = @U@
VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@@ -139,6 +180,7 @@ libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
+mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -146,21 +188,17 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
-target = @target@
target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_os = @target_os@
-target_vendor = @target_vendor@
#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies
AUTOMAKE_OPTIONS = ../util/ansi2knr
ETAGS_ARGS = $(srcdir)/Makefile.am
-
#EXTRA_DIST = TAGS
noinst_HEADERS = \
app.h \
assertions.h \
boolean.h \
+ buffer.h \
error.h \
formatcheck.h \
int.h \
@@ -176,44 +214,62 @@ noinst_HEADERS = \
mutex.h \
net.h \
netaddr.h \
+ netscope.h \
offset.h \
once.h \
platform.h \
print.h \
result.h \
+ region.h \
sockaddr.h \
strerror.h \
string.h \
types.h \
util.h
-subdir = include/isc
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-DIST_SOURCES =
-HEADERS = $(noinst_HEADERS)
-
-DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.in Makefile.am
all: all-am
.SUFFIXES:
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/isc/Makefile'; \
cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu include/isc/Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+ $(AUTOMAKE) --foreign include/isc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
uninstall-info-am:
-ETAGS = etags
-ETAGSFLAGS =
-
-CTAGS = ctags
-CTAGSFLAGS =
-
-tags: TAGS
-
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -222,6 +278,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
+tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
@@ -233,10 +290,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
- test -z "$(ETAGS_ARGS)$$tags$$unique" \
- || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique
-
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
@@ -259,10 +317,6 @@ GTAGS:
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-
-top_distdir = ../..
-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
@@ -276,7 +330,7 @@ distdir: $(DISTFILES)
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
- $(mkinstalldirs) "$(distdir)$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
@@ -294,7 +348,6 @@ distdir: $(DISTFILES)
check-am: all-am
check: check-am
all-am: Makefile $(HEADERS)
-
installdirs:
install: install-am
install-exec: install-exec-am
@@ -307,7 +360,7 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- INSTALL_STRIP_FLAG=-s \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
@@ -315,24 +368,26 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
- -rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic mostlyclean-am
+clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
-
-distclean-am: clean-am distclean-generic distclean-tags
+distclean-am: clean-am distclean-generic distclean-libtool \
+ distclean-tags
dvi: dvi-am
dvi-am:
+html: html-am
+
info: info-am
info-am:
@@ -349,12 +404,11 @@ installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
-
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-generic
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
@@ -366,14 +420,16 @@ ps-am:
uninstall-am: uninstall-info-am
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic ctags \
- distclean distclean-generic distclean-tags distdir dvi dvi-am \
- info info-am install install-am install-data install-data-am \
- install-exec install-exec-am install-info install-info-am \
- install-man install-strip installcheck installcheck-am \
- installdirs maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
- uninstall uninstall-am uninstall-info-am
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool ctags distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/contrib/ntp/include/isc/buffer.h b/contrib/ntp/include/isc/buffer.h
new file mode 100644
index 000000000000..47c8f0c95d41
--- /dev/null
+++ b/contrib/ntp/include/isc/buffer.h
@@ -0,0 +1,800 @@
+/*
+ * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1998-2002 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 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: buffer.h,v 1.39.12.2 2004/03/08 09:04:51 marka Exp $ */
+
+#ifndef ISC_BUFFER_H
+#define ISC_BUFFER_H 1
+
+/*****
+ ***** Module Info
+ *****/
+
+/*
+ * Buffers
+ *
+ * A buffer is a region of memory, together with a set of related subregions.
+ * Buffers are used for parsing and I/O operations.
+ *
+ * The 'used region' and the 'available' region are disjoint, and their
+ * union is the buffer's region. The used region extends from the beginning
+ * of the buffer region to the last used byte. The available region
+ * extends from one byte greater than the last used byte to the end of the
+ * buffer's region. The size of the used region can be changed using various
+ * buffer commands. Initially, the used region is empty.
+ *
+ * The used region is further subdivided into two disjoint regions: the
+ * 'consumed region' and the 'remaining region'. The union of these two
+ * regions is the used region. The consumed region extends from the beginning
+ * of the used region to the byte before the 'current' offset (if any). The
+ * 'remaining' region the current pointer to the end of the used
+ * region. The size of the consumed region can be changed using various
+ * buffer commands. Initially, the consumed region is empty.
+ *
+ * The 'active region' is an (optional) subregion of the remaining region.
+ * It extends from the current offset to an offset in the remaining region
+ * that is selected with isc_buffer_setactive(). Initially, the active region
+ * is empty. If the current offset advances beyond the chosen offset, the
+ * active region will also be empty.
+ *
+ * /------------entire length---------------\
+ * /----- used region -----\/-- available --\
+ * +----------------------------------------+
+ * | consumed | remaining | |
+ * +----------------------------------------+
+ * a b c d e
+ *
+ * a == base of buffer.
+ * b == current pointer. Can be anywhere between a and d.
+ * c == active pointer. Meaningful between b and d.
+ * d == used pointer.
+ * e == length of buffer.
+ *
+ * a-e == entire length of buffer.
+ * a-d == used region.
+ * a-b == consumed region.
+ * b-d == remaining region.
+ * b-c == optional active region.
+ *
+ * The following invariants are maintained by all routines:
+ *
+ * length > 0
+ *
+ * base is a valid pointer to length bytes of memory
+ *
+ * 0 <= used <= length
+ *
+ * 0 <= current <= used
+ *
+ * 0 <= active <= used
+ * (although active < current implies empty active region)
+ *
+ * MP:
+ * Buffers have no synchronization. Clients must ensure exclusive
+ * access.
+ *
+ * Reliability:
+ * No anticipated impact.
+ *
+ * Resources:
+ * Memory: 1 pointer + 6 unsigned integers per buffer.
+ *
+ * Security:
+ * No anticipated impact.
+ *
+ * Standards:
+ * None.
+ */
+
+/***
+ *** Imports
+ ***/
+
+#include <isc/lang.h>
+#include <isc/magic.h>
+#include <isc/types.h>
+
+/*
+ * To make many functions be inline macros (via #define) define this.
+ * If it is undefined, a function will be used.
+ */
+#define ISC_BUFFER_USEINLINE
+
+ISC_LANG_BEGINDECLS
+
+/***
+ *** Magic numbers
+ ***/
+#define ISC_BUFFER_MAGIC 0x42756621U /* Buf!. */
+#define ISC_BUFFER_VALID(b) ISC_MAGIC_VALID(b, ISC_BUFFER_MAGIC)
+
+/*
+ * The following macros MUST be used only on valid buffers. It is the
+ * caller's responsibility to ensure this by using the ISC_BUFFER_VALID
+ * check above, or by calling another isc_buffer_*() function (rather than
+ * another macro.)
+ */
+
+/*
+ * Fundamental buffer elements. (A through E in the introductory comment.)
+ */
+#define isc_buffer_base(b) ((void *)(b)->base) /*a*/
+#define isc_buffer_current(b) \
+ ((void *)((unsigned char *)(b)->base + (b)->current)) /*b*/
+#define isc_buffer_active(b) \
+ ((void *)((unsigned char *)(b)->base + (b)->active)) /*c*/
+#define isc_buffer_used(b) \
+ ((void *)((unsigned char *)(b)->base + (b)->used)) /*d*/
+#define isc_buffer_length(b) ((b)->length) /*e*/
+
+/*
+ * Derived lengths. (Described in the introductory comment.)
+ */
+#define isc_buffer_usedlength(b) ((b)->used) /* d-a */
+#define isc_buffer_consumedlength(b) ((b)->current) /* b-a */
+#define isc_buffer_remaininglength(b) ((b)->used - (b)->current) /* d-b */
+#define isc_buffer_activelength(b) ((b)->active - (b)->current) /* c-b */
+#define isc_buffer_availablelength(b) ((b)->length - (b)->used) /* e-d */
+
+/*
+ * Note that the buffer structure is public. This is principally so buffer
+ * operations can be implemented using macros. Applications are strongly
+ * discouraged from directly manipulating the structure.
+ */
+
+struct isc_buffer {
+ unsigned int magic;
+ void *base;
+ /* The following integers are byte offsets from 'base'. */
+ unsigned int length;
+ unsigned int used;
+ unsigned int current;
+ unsigned int active;
+ /* linkable */
+ ISC_LINK(isc_buffer_t) link;
+ /* private internal elements */
+ isc_mem_t *mctx;
+};
+
+/***
+ *** Functions
+ ***/
+
+isc_result_t
+isc_buffer_allocate(isc_mem_t *mctx, isc_buffer_t **dynbuffer,
+ unsigned int length);
+/*
+ * Allocate a dynamic linkable buffer which has "length" bytes in the
+ * data region.
+ *
+ * Requires:
+ * "mctx" is valid.
+ *
+ * "dynbuffer" is non-NULL, and "*dynbuffer" is NULL.
+ *
+ * Returns:
+ * ISC_R_SUCCESS - success
+ * ISC_R_NOMEMORY - no memory available
+ *
+ * Note:
+ * Changing the buffer's length field is not permitted.
+ */
+
+void
+isc_buffer_free(isc_buffer_t **dynbuffer);
+/*
+ * Release resources allocated for a dynamic buffer.
+ *
+ * Requires:
+ * "dynbuffer" is not NULL.
+ *
+ * "*dynbuffer" is a valid dynamic buffer.
+ *
+ * Ensures:
+ * "*dynbuffer" will be NULL on return, and all memory associated with
+ * the dynamic buffer is returned to the memory context used in
+ * isc_buffer_allocate().
+ */
+
+void
+isc__buffer_init(isc_buffer_t *b, const void *base, unsigned int length);
+/*
+ * Make 'b' refer to the 'length'-byte region starting at base.
+ *
+ * Requires:
+ *
+ * 'length' > 0
+ *
+ * 'base' is a pointer to a sequence of 'length' bytes.
+ *
+ */
+
+void
+isc__buffer_invalidate(isc_buffer_t *b);
+/*
+ * Make 'b' an invalid buffer.
+ *
+ * Requires:
+ * 'b' is a valid buffer.
+ *
+ * Ensures:
+ * If assertion checking is enabled, future attempts to use 'b' without
+ * calling isc_buffer_init() on it will cause an assertion failure.
+ */
+
+void
+isc__buffer_region(isc_buffer_t *b, isc_region_t *r);
+/*
+ * Make 'r' refer to the region of 'b'.
+ *
+ * Requires:
+ *
+ * 'b' is a valid buffer.
+ *
+ * 'r' points to a region structure.
+ */
+
+void
+isc__buffer_usedregion(isc_buffer_t *b, isc_region_t *r);
+/*
+ * Make 'r' refer to the used region of 'b'.
+ *
+ * Requires:
+ *
+ * 'b' is a valid buffer.
+ *
+ * 'r' points to a region structure.
+ */
+
+void
+isc__buffer_availableregion(isc_buffer_t *b, isc_region_t *r);
+/*
+ * Make 'r' refer to the available region of 'b'.
+ *
+ * Requires:
+ *
+ * 'b' is a valid buffer.
+ *
+ * 'r' points to a region structure.
+ */
+
+void
+isc__buffer_add(isc_buffer_t *b, unsigned int n);
+/*
+ * Increase the 'used' region of 'b' by 'n' bytes.
+ *
+ * Requires:
+ *
+ * 'b' is a valid buffer
+ *
+ * used + n <= length
+ *
+ */
+
+void
+isc__buffer_subtract(isc_buffer_t *b, unsigned int n);
+/*
+ * Decrease the 'used' region of 'b' by 'n' bytes.
+ *
+ * Requires:
+ *
+ * 'b' is a valid buffer
+ *
+ * used >= n
+ *
+ */
+
+void
+isc__buffer_clear(isc_buffer_t *b);
+/*
+ * Make the used region empty.
+ *
+ * Requires:
+ *
+ * 'b' is a valid buffer
+ *
+ * Ensures:
+ *
+ * used = 0
+ *
+ */
+
+void
+isc__buffer_consumedregion(isc_buffer_t *b, isc_region_t *r);
+/*
+ * Make 'r' refer to the consumed region of 'b'.
+ *
+ * Requires:
+ *
+ * 'b' is a valid buffer.
+ *
+ * 'r' points to a region structure.
+ */
+
+void
+isc__buffer_remainingregion(isc_buffer_t *b, isc_region_t *r);
+/*
+ * Make 'r' refer to the remaining region of 'b'.
+ *
+ * Requires:
+ *
+ * 'b' is a valid buffer.
+ *
+ * 'r' points to a region structure.
+ */
+
+void
+isc__buffer_activeregion(isc_buffer_t *b, isc_region_t *r);
+/*
+ * Make 'r' refer to the active region of 'b'.
+ *
+ * Requires:
+ *
+ * 'b' is a valid buffer.
+ *
+ * 'r' points to a region structure.
+ */
+
+void
+isc__buffer_setactive(isc_buffer_t *b, unsigned int n);
+/*
+ * Sets the end of the active region 'n' bytes after current.
+ *
+ * Requires:
+ *
+ * 'b' is a valid buffer.
+ *
+ * current + n <= used
+ */
+
+void
+isc__buffer_first(isc_buffer_t *b);
+/*
+ * Make the consumed region empty.
+ *
+ * Requires:
+ *
+ * 'b' is a valid buffer
+ *
+ * Ensures:
+ *
+ * current == 0
+ *
+ */
+
+void
+isc__buffer_forward(isc_buffer_t *b, unsigned int n);
+/*
+ * Increase the 'consumed' region of 'b' by 'n' bytes.
+ *
+ * Requires:
+ *
+ * 'b' is a valid buffer
+ *
+ * current + n <= used
+ *
+ */
+
+void
+isc__buffer_back(isc_buffer_t *b, unsigned int n);
+/*
+ * Decrease the 'consumed' region of 'b' by 'n' bytes.
+ *
+ * Requires:
+ *
+ * 'b' is a valid buffer
+ *
+ * n <= current
+ *
+ */
+
+void
+isc_buffer_compact(isc_buffer_t *b);
+/*
+ * Compact the used region by moving the remaining region so it occurs
+ * at the start of the buffer. The used region is shrunk by the size of
+ * the consumed region, and the consumed region is then made empty.
+ *
+ * Requires:
+ *
+ * 'b' is a valid buffer
+ *
+ * Ensures:
+ *
+ * current == 0
+ *
+ * The size of the used region is now equal to the size of the remaining
+ * region (as it was before the call). The contents of the used region
+ * are those of the remaining region (as it was before the call).
+ */
+
+isc_uint8_t
+isc_buffer_getuint8(isc_buffer_t *b);
+/*
+ * Read an unsigned 8-bit integer from 'b' and return it.
+ *
+ * Requires:
+ *
+ * 'b' is a valid buffer.
+ *
+ * The length of the available region of 'b' is at least 1.
+ *
+ * Ensures:
+ *
+ * The current pointer in 'b' is advanced by 1.
+ *
+ * Returns:
+ *
+ * A 8-bit unsigned integer.
+ */
+
+void
+isc__buffer_putuint8(isc_buffer_t *b, isc_uint8_t val);
+/*
+ * Store an unsigned 8-bit integer from 'val' into 'b'.
+ *
+ * Requires:
+ * 'b' is a valid buffer.
+ *
+ * The length of the unused region of 'b' is at least 1.
+ *
+ * Ensures:
+ * The used pointer in 'b' is advanced by 1.
+ */
+
+isc_uint16_t
+isc_buffer_getuint16(isc_buffer_t *b);
+/*
+ * Read an unsigned 16-bit integer in network byte order from 'b', convert
+ * it to host byte order, and return it.
+ *
+ * Requires:
+ *
+ * 'b' is a valid buffer.
+ *
+ * The length of the available region of 'b' is at least 2.
+ *
+ * Ensures:
+ *
+ * The current pointer in 'b' is advanced by 2.
+ *
+ * Returns:
+ *
+ * A 16-bit unsigned integer.
+ */
+
+void
+isc__buffer_putuint16(isc_buffer_t *b, isc_uint16_t val);
+/*
+ * Store an unsigned 16-bit integer in host byte order from 'val'
+ * into 'b' in network byte order.
+ *
+ * Requires:
+ * 'b' is a valid buffer.
+ *
+ * The length of the unused region of 'b' is at least 2.
+ *
+ * Ensures:
+ * The used pointer in 'b' is advanced by 2.
+ */
+
+isc_uint32_t
+isc_buffer_getuint32(isc_buffer_t *b);
+/*
+ * Read an unsigned 32-bit integer in network byte order from 'b', convert
+ * it to host byte order, and return it.
+ *
+ * Requires:
+ *
+ * 'b' is a valid buffer.
+ *
+ * The length of the available region of 'b' is at least 4.
+ *
+ * Ensures:
+ *
+ * The current pointer in 'b' is advanced by 4.
+ *
+ * Returns:
+ *
+ * A 32-bit unsigned integer.
+ */
+
+void
+isc__buffer_putuint32(isc_buffer_t *b, isc_uint32_t val);
+/*
+ * Store an unsigned 32-bit integer in host byte order from 'val'
+ * into 'b' in network byte order.
+ *
+ * Requires:
+ * 'b' is a valid buffer.
+ *
+ * The length of the unused region of 'b' is at least 4.
+ *
+ * Ensures:
+ * The used pointer in 'b' is advanced by 4.
+ */
+
+void
+isc__buffer_putmem(isc_buffer_t *b, const unsigned char *base,
+ unsigned int length);
+/*
+ * Copy 'length' bytes of memory at 'base' into 'b'.
+ *
+ * Requires:
+ * 'b' is a valid buffer.
+ *
+ * 'base' points to 'length' bytes of valid memory.
+ *
+ */
+
+void
+isc__buffer_putstr(isc_buffer_t *b, const char *source);
+/*
+ * Copy 'source' into 'b', not including terminating NUL.
+ *
+ * Requires:
+ * 'b' is a valid buffer.
+ *
+ * 'source' to be a valid NULL terminated string.
+ *
+ * strlen(source) <= isc_buffer_available(b)
+ */
+
+isc_result_t
+isc_buffer_copyregion(isc_buffer_t *b, const isc_region_t *r);
+/*
+ * Copy the contents of 'r' into 'b'.
+ *
+ * Requires:
+ * 'b' is a valid buffer.
+ *
+ * 'r' is a valid region.
+ *
+ * Returns:
+ *
+ * ISC_R_SUCCESS
+ * ISC_R_NOSPACE The available region of 'b' is not
+ * big enough.
+ */
+
+ISC_LANG_ENDDECLS
+
+/*
+ * Inline macro versions of the functions. These should never be called
+ * directly by an application, but will be used by the functions within
+ * buffer.c. The callers should always use "isc_buffer_*()" names, never
+ * ones beginning with "isc__"
+ */
+
+/*
+ * XXXDCL Something more could be done with initializing buffers that
+ * point to const data. For example, a new function, isc_buffer_initconst,
+ * could be used, and a new boolean flag in the buffer structure could
+ * indicate whether the buffer was initialized with that function.
+ * (isc_bufer_init itself would be reprototyped to *not* have its "base"
+ * parameter be const.) Then if the boolean were true, the isc_buffer_put*
+ * functions could assert a contractual requirement for a non-const buffer.
+ * One drawback is that the isc_buffer_* functions (macros) that return
+ * pointers would still need to return non-const pointers to avoid compiler
+ * warnings, so it would be up to code that uses them to have to deal
+ * with the possibility that the buffer was initialized as const --
+ * a problem that they *already* have to deal with but have absolutely
+ * no ability to. With a new isc_buffer_isconst() function returning
+ * true/false, they could at least assert a contractual requirement for
+ * non-const buffers when needed.
+ */
+#define ISC__BUFFER_INIT(_b, _base, _length) \
+ do { \
+ union { \
+ const void * konst; \
+ void * var; \
+ } _u; \
+ _u.konst = (_base); \
+ (_b)->base = _u.var; \
+ (_b)->length = (_length); \
+ (_b)->used = 0; \
+ (_b)->current = 0; \
+ (_b)->active = 0; \
+ (_b)->mctx = NULL; \
+ ISC_LINK_INIT(_b, link); \
+ (_b)->magic = ISC_BUFFER_MAGIC; \
+ } while (0)
+
+#define ISC__BUFFER_INVALIDATE(_b) \
+ do { \
+ (_b)->magic = 0; \
+ (_b)->base = NULL; \
+ (_b)->length = 0; \
+ (_b)->used = 0; \
+ (_b)->current = 0; \
+ (_b)->active = 0; \
+ } while (0)
+
+#define ISC__BUFFER_REGION(_b, _r) \
+ do { \
+ (_r)->base = (_b)->base; \
+ (_r)->length = (_b)->length; \
+ } while (0)
+
+#define ISC__BUFFER_USEDREGION(_b, _r) \
+ do { \
+ (_r)->base = (_b)->base; \
+ (_r)->length = (_b)->used; \
+ } while (0)
+
+#define ISC__BUFFER_AVAILABLEREGION(_b, _r) \
+ do { \
+ (_r)->base = isc_buffer_used(_b); \
+ (_r)->length = isc_buffer_availablelength(_b); \
+ } while (0)
+
+#define ISC__BUFFER_ADD(_b, _n) \
+ do { \
+ (_b)->used += (_n); \
+ } while (0)
+
+#define ISC__BUFFER_SUBTRACT(_b, _n) \
+ do { \
+ (_b)->used -= (_n); \
+ if ((_b)->current > (_b)->used) \
+ (_b)->current = (_b)->used; \
+ if ((_b)->active > (_b)->used) \
+ (_b)->active = (_b)->used; \
+ } while (0)
+
+#define ISC__BUFFER_CLEAR(_b) \
+ do { \
+ (_b)->used = 0; \
+ (_b)->current = 0; \
+ (_b)->active = 0; \
+ } while (0)
+
+#define ISC__BUFFER_CONSUMEDREGION(_b, _r) \
+ do { \
+ (_r)->base = (_b)->base; \
+ (_r)->length = (_b)->current; \
+ } while (0)
+
+#define ISC__BUFFER_REMAININGREGION(_b, _r) \
+ do { \
+ (_r)->base = isc_buffer_current(_b); \
+ (_r)->length = isc_buffer_remaininglength(_b); \
+ } while (0)
+
+#define ISC__BUFFER_ACTIVEREGION(_b, _r) \
+ do { \
+ if ((_b)->current < (_b)->active) { \
+ (_r)->base = isc_buffer_current(_b); \
+ (_r)->length = isc_buffer_activelength(_b); \
+ } else { \
+ (_r)->base = NULL; \
+ (_r)->length = 0; \
+ } \
+ } while (0)
+
+#define ISC__BUFFER_SETACTIVE(_b, _n) \
+ do { \
+ (_b)->active = (_b)->current + (_n); \
+ } while (0)
+
+#define ISC__BUFFER_FIRST(_b) \
+ do { \
+ (_b)->current = 0; \
+ } while (0)
+
+#define ISC__BUFFER_FORWARD(_b, _n) \
+ do { \
+ (_b)->current += (_n); \
+ } while (0)
+
+#define ISC__BUFFER_BACK(_b, _n) \
+ do { \
+ (_b)->current -= (_n); \
+ } while (0)
+
+#define ISC__BUFFER_PUTMEM(_b, _base, _length) \
+ do { \
+ memcpy(isc_buffer_used(_b), (_base), (_length)); \
+ (_b)->used += (_length); \
+ } while (0)
+
+#define ISC__BUFFER_PUTSTR(_b, _source) \
+ do { \
+ unsigned int _length; \
+ unsigned char *_cp; \
+ _length = strlen(_source); \
+ _cp = isc_buffer_used(_b); \
+ memcpy(_cp, (_source), _length); \
+ (_b)->used += (_length); \
+ } while (0)
+
+#define ISC__BUFFER_PUTUINT8(_b, _val) \
+ do { \
+ unsigned char *_cp; \
+ isc_uint8_t _val2 = (_val); \
+ _cp = isc_buffer_used(_b); \
+ (_b)->used++; \
+ _cp[0] = _val2 & 0x00ff; \
+ } while (0)
+
+#define ISC__BUFFER_PUTUINT16(_b, _val) \
+ do { \
+ unsigned char *_cp; \
+ isc_uint16_t _val2 = (_val); \
+ _cp = isc_buffer_used(_b); \
+ (_b)->used += 2; \
+ _cp[0] = (unsigned char)((_val2 & 0xff00U) >> 8); \
+ _cp[1] = (unsigned char)(_val2 & 0x00ffU); \
+ } while (0)
+
+#define ISC__BUFFER_PUTUINT32(_b, _val) \
+ do { \
+ unsigned char *_cp; \
+ isc_uint32_t _val2 = (_val); \
+ _cp = isc_buffer_used(_b); \
+ (_b)->used += 4; \
+ _cp[0] = (unsigned char)((_val2 & 0xff000000) >> 24); \
+ _cp[1] = (unsigned char)((_val2 & 0x00ff0000) >> 16); \
+ _cp[2] = (unsigned char)((_val2 & 0x0000ff00) >> 8); \
+ _cp[3] = (unsigned char)((_val2 & 0x000000ff)); \
+ } while (0)
+
+#if defined(ISC_BUFFER_USEINLINE)
+#define isc_buffer_init ISC__BUFFER_INIT
+#define isc_buffer_invalidate ISC__BUFFER_INVALIDATE
+#define isc_buffer_region ISC__BUFFER_REGION
+#define isc_buffer_usedregion ISC__BUFFER_USEDREGION
+#define isc_buffer_availableregion ISC__BUFFER_AVAILABLEREGION
+#define isc_buffer_add ISC__BUFFER_ADD
+#define isc_buffer_subtract ISC__BUFFER_SUBTRACT
+#define isc_buffer_clear ISC__BUFFER_CLEAR
+#define isc_buffer_consumedregion ISC__BUFFER_CONSUMEDREGION
+#define isc_buffer_remainingregion ISC__BUFFER_REMAININGREGION
+#define isc_buffer_activeregion ISC__BUFFER_ACTIVEREGION
+#define isc_buffer_setactive ISC__BUFFER_SETACTIVE
+#define isc_buffer_first ISC__BUFFER_FIRST
+#define isc_buffer_forward ISC__BUFFER_FORWARD
+#define isc_buffer_back ISC__BUFFER_BACK
+#define isc_buffer_putmem ISC__BUFFER_PUTMEM
+#define isc_buffer_putstr ISC__BUFFER_PUTSTR
+#define isc_buffer_putuint8 ISC__BUFFER_PUTUINT8
+#define isc_buffer_putuint16 ISC__BUFFER_PUTUINT16
+#define isc_buffer_putuint32 ISC__BUFFER_PUTUINT32
+#else
+#define isc_buffer_init isc__buffer_init
+#define isc_buffer_invalidate isc__buffer_invalidate
+#define isc_buffer_region isc__buffer_region
+#define isc_buffer_usedregion isc__buffer_usedregion
+#define isc_buffer_availableregion isc__buffer_availableregion
+#define isc_buffer_add isc__buffer_add
+#define isc_buffer_subtract isc__buffer_subtract
+#define isc_buffer_clear isc__buffer_clear
+#define isc_buffer_consumedregion isc__buffer_consumedregion
+#define isc_buffer_remainingregion isc__buffer_remainingregion
+#define isc_buffer_activeregion isc__buffer_activeregion
+#define isc_buffer_setactive isc__buffer_setactive
+#define isc_buffer_first isc__buffer_first
+#define isc_buffer_forward isc__buffer_forward
+#define isc_buffer_back isc__buffer_back
+#define isc_buffer_putmem isc__buffer_putmem
+#define isc_buffer_putstr isc__buffer_putstr
+#define isc_buffer_putuint8 isc__buffer_putuint8
+#define isc_buffer_putuint16 isc__buffer_putuint16
+#define isc_buffer_putuint32 isc__buffer_putuint32
+#endif
+
+#endif /* ISC_BUFFER_H */
diff --git a/contrib/ntp/include/isc/interfaceiter.h b/contrib/ntp/include/isc/interfaceiter.h
index fbd1b8224615..f2d11ba8a432 100644
--- a/contrib/ntp/include/isc/interfaceiter.h
+++ b/contrib/ntp/include/isc/interfaceiter.h
@@ -59,6 +59,8 @@ struct isc_interface {
isc_netaddr_t dstaddress; /* Destination address
(point-to-point only). */
isc_uint32_t flags; /* Flags; see below. */
+ unsigned int ifindex; /* Interface Index */
+ unsigned int scopeid; /* Scope id for Multicasting */
};
/* Interface flags. */
diff --git a/contrib/ntp/include/isc/ipv6.h b/contrib/ntp/include/isc/ipv6.h
index 18893b7003ce..007de7c0dd37 100644
--- a/contrib/ntp/include/isc/ipv6.h
+++ b/contrib/ntp/include/isc/ipv6.h
@@ -1,21 +1,21 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1999-2002 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.
+ * 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.19 2002/04/03 06:38:33 marka Exp $ */
+/* $Id: ipv6.h,v 1.17.12.4 2004/03/09 05:21:09 marka Exp $ */
#ifndef ISC_IPV6_H
#define ISC_IPV6_H 1
@@ -59,7 +59,7 @@
/*
* We probably don't need this on NTP
*/
-#ifdef ISC_ONLY_IPV6
+#ifdef ISC_ONLY_IPV6
/***
*** Types.
***/
@@ -76,8 +76,8 @@ struct in6_addr {
#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 }}}
+#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;
@@ -102,12 +102,13 @@ struct sockaddr_in6 {
/*
* Unspecified
*/
+#ifndef IN6_IS_ADDR_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))
-
+#endif
/*
* Loopback
*/
@@ -138,9 +139,10 @@ struct sockaddr_in6 {
/*
* Multicast
*/
+#ifndef IN6_IS_ADDR_MULTICAST
#define IN6_IS_ADDR_MULTICAST(a) \
((a)->s6_addr8[0] == 0xffU)
-
+#endif
/*
* Unicast link / site local.
*/
diff --git a/contrib/ntp/include/isc/msgs.h b/contrib/ntp/include/isc/msgs.h
index b166199e8f0d..967005bf3531 100644
--- a/contrib/ntp/include/isc/msgs.h
+++ b/contrib/ntp/include/isc/msgs.h
@@ -1,21 +1,21 @@
/*
- * Copyright (C) 2000, 2001 Internet Software Consortium.
+ * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000-2003 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.
+ * 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: msgs.h,v 1.7 2002/05/27 00:40:18 marka Exp $ */
+/* $Id: msgs.h,v 1.5.2.2.8.3 2004/03/06 08:14:44 marka Exp $ */
#ifndef ISC_MSGS_H
#define ISC_MSGS_H 1
@@ -48,6 +48,7 @@
#define ISC_MSGSET_TASK 18
#define ISC_MSGSET_TIMER 19
#define ISC_MSGSET_UTIL 20
+#define ISC_MSGSET_IFITERGETIFADDRS 21
/*
* Message numbers. They are only required to be unique per message set,
@@ -176,6 +177,7 @@
#define ISC_MSG_UTILWAIT 1710 /* "WAIT" */
#define ISC_MSG_WAITED 1711 /* "WAITED" */
+#define ISC_MSG_GETIFADDRS 1801 /* "getting interface addresses: ..." */
#endif /* ISC_MSGS_H */
diff --git a/contrib/ntp/include/isc/net.h b/contrib/ntp/include/isc/net.h
index 25924febca38..dae59780b69b 100644
--- a/contrib/ntp/include/isc/net.h
+++ b/contrib/ntp/include/isc/net.h
@@ -1,21 +1,21 @@
/*
- * Copyright (C) 1999-2001 Internet Software Consortium.
+ * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1999-2003 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.
+ * 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: net.h,v 1.34 2002/04/03 06:38:38 marka Exp $ */
+/* $Id: net.h,v 1.31.2.2.10.8 2004/04/29 01:31:23 marka Exp $ */
#ifndef ISC_NET_H
#define ISC_NET_H 1
@@ -75,6 +75,8 @@
#include <sys/types.h>
#include <sys/socket.h> /* Contractual promise. */
+#include <net/if.h>
+
#include <netinet/in.h> /* Contractual promise. */
#include <arpa/inet.h> /* Contractual promise. */
#ifdef ISC_PLATFORM_NEEDNETINETIN6H
@@ -230,6 +232,10 @@ typedef isc_uint16_t in_port_t;
(((isc_uint32_t)(i) & ISC__IPADDR(0xf0000000)) \
== ISC__IPADDR(0xe0000000))
+#define ISC_IPADDR_ISEXPERIMENTAL(i) \
+ (((isc_uint32_t)(i) & ISC__IPADDR(0xf0000000)) \
+ == ISC__IPADDR(0xf0000000))
+
/***
*** Functions.
***/
@@ -245,6 +251,7 @@ isc_net_probeipv4(void);
*
* ISC_R_SUCCESS IPv4 is supported.
* ISC_R_NOTFOUND IPv4 is not supported.
+ * ISC_R_DISABLED IPv4 is disabled.
* ISC_R_UNEXPECTED
*/
@@ -257,25 +264,63 @@ isc_net_probeipv6(void);
*
* ISC_R_SUCCESS IPv6 is supported.
* ISC_R_NOTFOUND IPv6 is not supported.
+ * ISC_R_DISABLED IPv6 is disabled.
* ISC_R_UNEXPECTED
*/
+isc_result_t
+isc_net_probe_ipv6only(void);
+/*
+ * Check if the system's kernel supports the IPV6_V6ONLY socket option.
+ *
+ * Returns:
+ *
+ * ISC_R_SUCCESS the option is supported for both TCP and UDP.
+ * ISC_R_NOTFOUND IPv6 itself or the option is not supported.
+ * ISC_R_UNEXPECTED
+ */
+
+isc_result_t
+isc_net_probe_ipv6pktinfo(void);
+/*
+ * Check if the system's kernel supports the IPV6_(RECV)PKTINFO socket option
+ * for UDP sockets.
+ *
+ * Returns:
+ *
+ * ISC_R_SUCCESS the option is supported.
+ * ISC_R_NOTFOUND IPv6 itself or the option is not supported.
+ * ISC_R_UNEXPECTED
+ */
+
+void
+isc_net_disableipv4(void);
+
+void
+isc_net_disableipv6(void);
+
+void
+isc_net_enableipv4(void);
+
+void
+isc_net_enableipv6(void);
+
+#ifdef ISC_PLATFORM_NEEDNTOP
const char *
isc_net_ntop(int af, const void *src, char *dst, size_t size);
-#ifdef ISC_PLATFORM_NEEDNTOP
#define inet_ntop isc_net_ntop
#endif
+#ifdef ISC_PLATFORM_NEEDPTON
int
isc_net_pton(int af, const char *src, void *dst);
-#ifdef ISC_PLATFORM_NEEDPTON
#undef inet_pton
#define inet_pton isc_net_pton
#endif
+#ifdef ISC_PLATFORM_NEEDATON
int
isc_net_aton(const char *cp, struct in_addr *addr);
-#ifdef ISC_PLATFORM_NEEDATON
#define inet_aton isc_net_aton
#endif
diff --git a/contrib/ntp/include/isc/netaddr.h b/contrib/ntp/include/isc/netaddr.h
index 811e8dd48e0c..e209a9fa7749 100644
--- a/contrib/ntp/include/isc/netaddr.h
+++ b/contrib/ntp/include/isc/netaddr.h
@@ -1,21 +1,21 @@
/*
+ * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1998-2002 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.
+ * 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: netaddr.h,v 1.21 2002/04/03 06:38:35 marka Exp $ */
+/* $Id: netaddr.h,v 1.18.12.7 2004/03/08 09:04:52 marka Exp $ */
#ifndef ISC_NETADDR_H
#define ISC_NETADDR_H 1
@@ -23,9 +23,6 @@
#include <isc/lang.h>
#include <isc/net.h>
#include <isc/types.h>
-#include "ntp_rfc2553.h"
-
-
ISC_LANG_BEGINDECLS
@@ -35,6 +32,7 @@ struct isc_netaddr {
struct in_addr in;
struct in6_addr in6;
} type;
+ isc_uint32_t zone;
};
isc_boolean_t
@@ -98,6 +96,12 @@ void
isc_netaddr_fromin6(isc_netaddr_t *netaddr, const struct in6_addr *ina6);
void
+isc_netaddr_setzone(isc_netaddr_t *netaddr, isc_uint32_t zone);
+
+isc_uint32_t
+isc_netaddr_getzone(const isc_netaddr_t *netaddr);
+
+void
isc_netaddr_any(isc_netaddr_t *netaddr);
/*
* Return the IPv4 wildcard address.
@@ -116,6 +120,12 @@ isc_netaddr_ismulticast(isc_netaddr_t *na);
*/
isc_boolean_t
+isc_netaddr_isexperimental(isc_netaddr_t *na);
+/*
+ * Returns ISC_TRUE if the address is a experimental (CLASS E) address.
+ */
+
+isc_boolean_t
isc_netaddr_islinklocal(isc_netaddr_t *na);
/*
* Returns ISC_TRUE if the address is a link local address.
diff --git a/contrib/ntp/include/isc/netscope.h b/contrib/ntp/include/isc/netscope.h
new file mode 100644
index 000000000000..7cc0f182d742
--- /dev/null
+++ b/contrib/ntp/include/isc/netscope.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2002 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 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: netscope.h,v 1.4.142.5 2004/03/08 09:04:52 marka Exp $ */
+
+#ifndef ISC_NETSCOPE_H
+#define ISC_NETSCOPE_H 1
+
+ISC_LANG_BEGINDECLS
+
+/*
+ * Convert a string of an IPv6 scope zone to zone index. If the conversion
+ * succeeds, 'zoneid' will store the index value.
+ * XXXJT: when a standard interface for this purpose is defined,
+ * we should use it.
+ *
+ * Returns:
+ * ISC_R_SUCCESS: conversion succeeds
+ * ISC_R_FAILURE: conversion fails
+ */
+isc_result_t
+isc_netscope_pton(int af, char *scopename, void *addr, isc_uint32_t *zoneid);
+
+ISC_LANG_ENDDECLS
+
+#endif /* ISC_NETADDR_H */
diff --git a/contrib/ntp/include/isc/region.h b/contrib/ntp/include/isc/region.h
new file mode 100644
index 000000000000..5622394aaf43
--- /dev/null
+++ b/contrib/ntp/include/isc/region.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1998-2002 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 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: region.h,v 1.16.12.3 2004/03/08 09:04:53 marka Exp $ */
+
+#ifndef ISC_REGION_H
+#define ISC_REGION_H 1
+
+#include <isc/types.h>
+
+struct isc_region {
+ unsigned char * base;
+ unsigned int length;
+};
+
+struct isc_textregion {
+ char * base;
+ unsigned int length;
+};
+
+/* XXXDCL questionable ... bears discussion. we have been putting off
+ * discussing the region api.
+ */
+struct isc_constregion {
+ const void * base;
+ unsigned int length;
+};
+
+struct isc_consttextregion {
+ const char * base;
+ unsigned int length;
+};
+
+/*
+ * The region structure is not opaque, and is usually directly manipulated.
+ * Some macros are defined below for convenience.
+ */
+
+#define isc_region_consume(r,l) \
+ do { \
+ isc_region_t *_r = (r); \
+ unsigned int _l = (l); \
+ INSIST(_r->length >= _l); \
+ _r->base += _l; \
+ _r->length -= _l; \
+ } while (0)
+
+#define isc_textregion_consume(r,l) \
+ do { \
+ isc_textregion_t *_r = (r); \
+ unsigned int _l = (l); \
+ INSIST(_r->length >= _l); \
+ _r->base += _l; \
+ _r->length -= _l; \
+ } while (0)
+
+#define isc_constregion_consume(r,l) \
+ do { \
+ isc_constregion_t *_r = (r); \
+ unsigned int _l = (l); \
+ INSIST(_r->length >= _l); \
+ _r->base += _l; \
+ _r->length -= _l; \
+ } while (0)
+
+int
+isc_region_compare(isc_region_t *r1, isc_region_t *r2);
+/*
+ * Compares the contents of two regions
+ *
+ * Requires:
+ * 'r1' is a valid region
+ * 'r2' is a valid region
+ *
+ * Returns:
+ * < 0 if r1 is lexicographically less than r2
+ * = 0 if r1 is lexicographically identical to r2
+ * > 0 if r1 is lexicographically greater than r2
+ */
+
+#endif /* ISC_REGION_H */
diff --git a/contrib/ntp/include/isc/result.h b/contrib/ntp/include/isc/result.h
index bf6b99258732..93f7cefbd658 100644
--- a/contrib/ntp/include/isc/result.h
+++ b/contrib/ntp/include/isc/result.h
@@ -1,21 +1,21 @@
/*
- * Copyright (C) 1998-2001 Internet Software Consortium.
+ * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 1998-2001, 2003 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.
+ * 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: result.h,v 1.59 2001/11/30 01:02:17 gson Exp $ */
+/* $Id: result.h,v 1.57.2.2.8.5 2004/05/15 03:46:13 jinmei Exp $ */
#ifndef ISC_RESULT_H
#define ISC_RESULT_H 1
@@ -80,11 +80,14 @@
#define ISC_R_CONNECTIONRESET 54 /* connection reset */
#define ISC_R_SOFTQUOTA 55 /* soft quota reached */
#define ISC_R_BADNUMBER 56 /* not a valid number */
+#define ISC_R_DISABLED 57 /* disabled */
+#define ISC_R_MAXSIZE 58 /* max size */
+#define ISC_R_BADADDRESSFORM 59 /* invalid address format */
/*
* Not a result code: the number of results.
*/
-#define ISC_R_NRESULTS 57
+#define ISC_R_NRESULTS 60
ISC_LANG_BEGINDECLS
diff --git a/contrib/ntp/include/isc/sockaddr.h b/contrib/ntp/include/isc/sockaddr.h
index 5257b059de01..635af38117bf 100644
--- a/contrib/ntp/include/isc/sockaddr.h
+++ b/contrib/ntp/include/isc/sockaddr.h
@@ -174,6 +174,12 @@ isc_sockaddr_ismulticast(isc_sockaddr_t *sa);
*/
isc_boolean_t
+isc_sockaddr_isexperimental(isc_sockaddr_t *sa);
+/*
+ * Returns ISC_TRUE if the address is a experimental (CLASS E) address.
+ */
+
+isc_boolean_t
isc_sockaddr_islinklocal(isc_sockaddr_t *sa);
/*
* Returns ISC_TRUE if the address is a link local addresss.
diff --git a/contrib/ntp/include/l_stdlib.h b/contrib/ntp/include/l_stdlib.h
index 3f242b7994a0..58bbeedc2123 100644
--- a/contrib/ntp/include/l_stdlib.h
+++ b/contrib/ntp/include/l_stdlib.h
@@ -104,10 +104,6 @@ extern int mkstemp P((char *));
extern char *mktemp P((char *));
#endif
-#ifdef DECL_MRAND48_0
-extern long mrand48 P((void));
-#endif
-
#ifdef DECL_NLIST_0
struct nlist;
extern int nlist P((const char *, struct nlist *));
@@ -156,10 +152,6 @@ extern int snprintf P((char *, size_t, const char *, ...));
extern int vsnprintf P((char *, size_t, const char *, va_list));
#endif
-#ifdef DECL_SRAND48_0
-extern void srand48 P((long));
-#endif
-
#ifdef DECL_STDIO_0
#if defined(FILE) || defined(BUFSIZ)
extern int _flsbuf P((int, FILE *));
@@ -276,10 +268,7 @@ extern int fork P((void));
extern int getdtablesize P((void));
extern int qsort (void *, int , int,
int P((*compar)(void *, void *)));
-extern long random P((void));
-extern long mrand48 P((void));
extern int setpgrp P((int, int));
-extern void srandom P((unsigned int));
extern void bcopy P((const char *, char *, int));
#endif
@@ -481,8 +470,6 @@ extern int execve P((char *, char **,char **));
extern int fork P((void));
extern int getdtablesize P((void));
extern int ran P((void));
-extern int rand P((void));
-extern void srand P((unsigned int));
#ifdef _TIME_H_
extern int gettimeofday P((struct timeval *, struct timezone *));
extern int settimeofday P((struct timeval *, struct timezone *));
diff --git a/contrib/ntp/include/mbg_gps166.h b/contrib/ntp/include/mbg_gps166.h
index 71107517e9d2..edaae9df20d1 100644
--- a/contrib/ntp/include/mbg_gps166.h
+++ b/contrib/ntp/include/mbg_gps166.h
@@ -1,9 +1,39 @@
/*
- * /src/NTP/ntp-4/include/mbg_gps166.h,v 4.1 1998/06/12 15:07:30 kardel RELEASE_19990228_A
+ * /src/NTP/REPOSITORY/ntp4-dev/include/mbg_gps166.h,v 4.7 2006/06/22 18:41:43 kardel RELEASE_20060622_A
+ *
+ * mbg_gps166.h,v 4.7 2006/06/22 18:41:43 kardel RELEASE_20060622_A
*
* $Created: Sun Jul 20 09:20:50 1997 $
*
- * Copyright (C) 1997, 1998 by Frank Kardel
+ * File GPSSERIO.H Copyright (c) by Meinberg Funkuhren (www.meinberg.de)
+ *
+ * Linkage to PARSE:
+ * Copyright (c) 1997-2005 by Frank Kardel <kardel <AT> ntp.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
*/
#ifndef MBG_GPS166_H
#define MBG_GPS166_H
@@ -11,7 +41,7 @@
/***************************************************************************/
/* */
-/* File: GPSSERIO.H 4.1 */
+/* File: GPSSERIO.H 4.1 */
/* */
/* Project: Common C Library */
/* */
@@ -494,8 +524,8 @@ typedef struct {
} IONO;
-void mbg_tm_str P((unsigned char **, TM *));
-void mbg_tgps_str P((unsigned char **, T_GPS *));
+void mbg_tm_str P((char **, TM *, int));
+void mbg_tgps_str P((char **, T_GPS *, int));
void get_mbg_header P((unsigned char **, GPS_MSG_HDR *));
void put_mbg_header P((unsigned char **, GPS_MSG_HDR *));
void get_mbg_sw_rev P((unsigned char **, SW_REV *));
@@ -522,7 +552,21 @@ unsigned long mbg_csum P((unsigned char *, unsigned int));
#endif
/*
+ * History:
+ *
* mbg_gps166.h,v
+ * Revision 4.7 2006/06/22 18:41:43 kardel
+ * clean up signedness (gcc 4)
+ *
+ * Revision 4.6 2005/10/07 22:11:56 kardel
+ * bounded buffer implementation
+ *
+ * Revision 4.5.2.1 2005/09/25 10:23:48 kardel
+ * support bounded buffers
+ *
+ * Revision 4.5 2005/06/25 10:58:45 kardel
+ * add missing log keywords
+ *
* Revision 4.1 1998/06/12 15:07:30 kardel
* fixed prototyping
*
diff --git a/contrib/ntp/include/ntp.h b/contrib/ntp/include/ntp.h
index 1ce302b7be98..dad9de136701 100644
--- a/contrib/ntp/include/ntp.h
+++ b/contrib/ntp/include/ntp.h
@@ -9,6 +9,10 @@
#ifdef OPENSSL
#include "ntp_crypto.h"
#endif /* OPENSSL */
+#include <ntp_random.h>
+
+#include <isc/boolean.h>
+#include <isc/list.h>
/*
* Calendar arithmetic - contributed by G. Healton
@@ -99,7 +103,7 @@ typedef char s_char;
/*
* Poll interval parameters
*/
-#define NTP_UNREACH 16 /* poll interval backoff count */
+#define NTP_UNREACH 24 /* poll unreach threshold */
#define NTP_MINPOLL 4 /* log2 min poll interval (16 s) */
#define NTP_MINDPOLL 6 /* log2 default min poll (64 s) */
#define NTP_MAXDPOLL 10 /* log2 default max poll (~17 m) */
@@ -111,7 +115,6 @@ typedef char s_char;
/*
* Clock filter algorithm tuning parameters
*/
-#define MINDISPERSE .01 /* min dispersion */
#define MAXDISPERSE 16. /* max dispersion */
#define NTP_SHIFT 8 /* clock filter stages */
#define NTP_FWEIGHT .5 /* clock filter weight */
@@ -119,28 +122,29 @@ typedef char s_char;
/*
* Selection algorithm tuning parameters
*/
-#define NTP_MINCLOCK 4 /* minimum survivors */
-#define NTP_MAXCLOCK 50 /* maximum candidates */
-#define MAXDISTANCE 1. /* max root distance */
+#define NTP_MINCLOCK 3 /* min survivors */
+#define NTP_MAXCLOCK 10 /* max candidates */
+#define NTP_MAXASSOC 50 /* max associations */
+#define MINDISPERSE .005 /* min dispersion increment */
+#define MAXDISTANCE 1. /* max root distance (select threshold) */
#define CLOCK_SGATE 3. /* popcorn spike gate */
#define HUFFPUFF 900 /* huff-n'-puff sample interval (s) */
-#define HYST .5 /* anti-clockhop hysteresis */
-#define HYST_TC .875 /* anti-clockhop hysteresis decay */
+#define MAXHOP 2 /* anti-clockhop threshold */
#define MAX_TTL 8 /* max ttl mapping vector size */
-#define NTP_MAXEXTEN 1024 /* maximum extension field size */
+#define BEACON 7200 /* manycast beacon interval */
+#define NTP_MAXEXTEN 1024 /* max extension field size */
/*
* Miscellaneous stuff
*/
-#define NTP_MAXKEY 65535 /* maximum authentication key number */
+#define NTP_MAXKEY 65535 /* max authentication key number */
/*
* Limits of things
*/
#define MAXFILENAME 128 /* max length of file name */
#define MAXHOSTNAME 512 /* max length of host/node name */
-#define NTP_MAXSTRLEN 256 /* maximum string length */
-#define MAXINTERFACES 512 /* max number of interfaces */
+#define NTP_MAXSTRLEN 256 /* max string length */
/*
* Operations for jitter calculations (these use doubles).
@@ -169,47 +173,77 @@ typedef char s_char;
*/
struct interface {
SOCKET fd; /* socket this is opened on */
- SOCKET bfd; /* socket for receiving broadcasts */
+ SOCKET bfd; /* socket for receiving broadcasts */
struct sockaddr_storage sin; /* interface address */
- struct sockaddr_storage bcast; /* broadcast address */
- struct sockaddr_storage mask; /* interface mask */
- char name[32]; /* name of interface */
- int flags; /* interface flags */
- int last_ttl; /* last TTL specified */
- u_int addr_refid; /* IPv4 addr or IPv6 hash */
- int num_mcast; /* No. of IP addresses in multicast socket */
- volatile long received; /* number of incoming packets */
- long sent; /* number of outgoing packets */
- long notsent; /* number of send failures */
+ struct sockaddr_storage bcast; /* broadcast address */
+ struct sockaddr_storage mask; /* interface mask */
+ char name[32]; /* name of interface */
+ short family; /* Address family */
+ int flags; /* interface flags */
+ int last_ttl; /* last TTL specified */
+ u_int32 addr_refid; /* IPv4 addr or IPv6 hash */
+ int num_mcast; /* No. of IP addresses in multicast socket */
+ u_long starttime; /* current_time as of creation of interface structure */
+ volatile long received; /* number of incoming packets */
+ long sent; /* number of outgoing packets */
+ long notsent; /* number of send failures */
+ u_int scopeid; /* Scope used for Multicasting */
+ u_int ifindex; /* interface index */
+ u_int ifnum; /* sequential interface instance count */
+ u_char phase; /* phase in update cycle */
+ isc_boolean_t ignore_packets; /* Specify whether the packet should be ignored */
+ ISC_LIST(struct peer) peers; /* list of peers for the interface */
+ u_int peercnt; /* number of peers referencinf this interface - informational only */
+ ISC_LINK(struct interface) link; /* interface list */
};
/*
* Flags for interfaces
*/
-#define INT_UP 1 /* Interface is up */
-#define INT_PPP 2 /* Point-to-point interface */
-#define INT_LOOPBACK 4 /* the loopback interface */
-#define INT_BROADCAST 8 /* can broadcast out this interface */
-#define INT_MULTICAST 16 /* multicasting enabled */
-#define INT_BCASTOPEN 32 /* broadcast socket is open */
-
+#define INT_UP 0x001 /* Interface is up */
+#define INT_PPP 0x002 /* Point-to-point interface */
+#define INT_LOOPBACK 0x004 /* the loopback interface */
+#define INT_BROADCAST 0x008 /* can broadcast out this interface */
+#define INT_MULTICAST 0x010 /* can multicast out this interface */
+#define INT_BCASTOPEN 0x020 /* broadcast socket is open */
+#define INT_MCASTOPEN 0x040 /* multicasting enabled */
+#define INT_WILDCARD 0x080 /* wildcard interface - usually skipped */
+#define INT_MCASTIF 0x100 /* bound directly to MCAST address */
/*
* Define flasher bits (tests 1 through 11 in packet procedure)
* These reveal the state at the last grumble from the peer and are
* most handy for diagnosing problems, even if not strictly a state
* variable in the spec. These are recorded in the peer structure.
+ *
+ * Packet errors
*/
-#define TEST1 0x0001 /* duplicate packet received */
-#define TEST2 0x0002 /* bogus packet received */
+#define TEST1 0X0001 /* duplicate packet */
+#define TEST2 0x0002 /* bogus packet */
#define TEST3 0x0004 /* protocol unsynchronized */
#define TEST4 0x0008 /* access denied */
-#define TEST5 0x0010 /* authentication failed */
-#define TEST6 0x0020 /* peer clock unsynchronized */
-#define TEST7 0x0040 /* peer stratum out of bounds */
-#define TEST8 0x0080 /* root delay/dispersion bounds check */
-#define TEST9 0x0100 /* peer delay/dispersion bounds check */
-#define TEST10 0x0200 /* autokey failed */
-#define TEST11 0x0400 /* proventic not confirmed */
+#define TEST5 0x0010 /* authentication error */
+#define TEST6 0x0020 /* bad synch or stratum */
+#define TEST7 0x0040 /* bad header data */
+#define TEST8 0x0080 /* autokey error */
+#define TEST9 0x0100 /* crypto error */
+#define PKT_TEST_MASK (TEST1 | TEST2 | TEST3 | TEST4 | TEST5 |\
+ TEST6 | TEST7 | TEST8 | TEST9)
+/*
+ * Peer errors
+ */
+#define TEST10 0x0200 /* peer bad synch or stratum */
+#define TEST11 0x0400 /* peer distance exceeded */
+#define TEST12 0x0800 /* peer synchronization loop */
+#define TEST13 0x1000 /* peer unreacable */
+#define PEER_TEST_MASK (TEST10 | TEST11 | TEST12 | TEST13)
+
+/*
+ * Authentication codes
+ */
+#define AUTH_NONE 0 /* no authentication */
+#define AUTH_OK 1 /* authentication OK */
+#define AUTH_ERROR 2 /* authentication error */
+#define AUTH_CRYPTO 3 /* crypto-NAK */
/*
* The peer structure. Holds state information relating to the guys
@@ -221,14 +255,13 @@ struct peer {
struct peer *ass_next; /* link pointer in associd hash */
struct sockaddr_storage srcadr; /* address of remote host */
struct interface *dstadr; /* pointer to address on local host */
+ ISC_LINK(struct peer) ilink; /* interface link list */
associd_t associd; /* association ID */
u_char version; /* version number */
u_char hmode; /* local association mode */
u_char hpoll; /* local poll interval */
- u_char kpoll; /* last poll interval */
u_char minpoll; /* min poll interval */
u_char maxpoll; /* max poll interval */
- u_char burst; /* packets remaining in burst */
u_int flags; /* association flags */
u_char cast_flags; /* additional flags */
u_int flash; /* protocol error test tally bits */
@@ -239,10 +272,12 @@ struct peer {
/*
* Variables used by reference clock support
*/
+#ifdef REFCLOCK
struct refclockproc *procptr; /* refclock structure pointer */
u_char refclktype; /* reference clock type */
u_char refclkunit; /* reference clock unit number */
u_char sstclktype; /* clock type for system status word */
+#endif /* REFCLOCK */
/*
* Variables set by received packet
@@ -250,8 +285,10 @@ struct peer {
u_char leap; /* local leap indicator */
u_char pmode; /* remote association mode */
u_char stratum; /* remote stratum */
- s_char precision; /* remote clock precision */
u_char ppoll; /* remote poll interval */
+ s_char precision; /* remote clock precision */
+ double rootdelay; /* roundtrip delay to primary clock */
+ double rootdispersion; /* dispersion to primary clock */
u_int32 refid; /* remote reference ID */
l_fp reftime; /* update epoch */
@@ -275,7 +312,6 @@ struct peer {
BIGNUM *grpkey; /* GQ group key */
struct value cookval; /* cookie values */
struct value recval; /* receive autokey values */
- struct value tai_leap; /* leapseconds values */
struct exten *cmmd; /* extension pointer */
/*
@@ -285,6 +321,7 @@ struct peer {
int keynumber; /* current key number */
struct value encrypt; /* send encrypt values */
struct value sndval; /* send autokey values */
+ struct value tai_leap; /* send leapsecond table */
#else /* OPENSSL */
#define clear_to_zero status
#endif /* OPENSSL */
@@ -295,7 +332,8 @@ struct peer {
u_char status; /* peer status */
u_char reach; /* reachability register */
u_long epoch; /* reference epoch */
- u_short filter_nextpt; /* index into filter shift register */
+ u_int burst; /* packets remaining in burst */
+ u_int filter_nextpt; /* index into filter shift register */
double filter_delay[NTP_SHIFT]; /* delay shift register */
double filter_offset[NTP_SHIFT]; /* offset shift register */
double filter_disp[NTP_SHIFT]; /* dispersion shift register */
@@ -309,24 +347,18 @@ struct peer {
double jitter; /* peer jitter (squares) */
double disp; /* peer dispersion */
double estbdelay; /* clock offset to broadcast server */
- double hyst; /* anti-clockhop hysteresis */
-
- /*
- * Variables set by received packet
- */
- double rootdelay; /* roundtrip delay to primary clock */
- double rootdispersion; /* dispersion to primary clock */
/*
* End of clear-to-zero area
*/
u_long update; /* receive epoch */
-#define end_clear_to_zero update
u_int unreach; /* unreachable count */
+#define end_clear_to_zero unreach
u_long outdate; /* send time last packet */
u_long nextdate; /* send time next packet */
- u_long nextaction; /* peer local activity timeout (refclocks mainly) */
+ u_long nextaction; /* peer local activity timeout (refclocks) */
void (*action) P((struct peer *)); /* action timeout function */
+
/*
* Statistic counters
*/
@@ -340,9 +372,8 @@ struct peer {
u_long badauth; /* packets cryptosum failed */
u_long bogusorg; /* packets bogus origin */
u_long oldpkt; /* packets duplicate packet */
- u_long seldisptoolarge; /* packets dispersion to large*/
+ u_long seldisptoolarge; /* packets dispersion too large */
u_long selbroken; /* not used */
- u_long rank; /* number of times selected or in cluster */
};
/*
@@ -354,17 +385,27 @@ struct peer {
#define LEAP_NOTINSYNC 0x3 /* overload, clock is free running */
/*
- * Values for peer.mode
+ * Values for peer mode and packet mode. Only the modes through
+ * MODE_BROADCAST and MODE_BCLIENT appear in the transition
+ * function. MODE_CONTROL and MODE_PRIVATE can appear in packets,
+ * but those never survive to the transition function.
+ * is a
*/
#define MODE_UNSPEC 0 /* unspecified (old version) */
-#define MODE_ACTIVE 1 /* symmetric active */
-#define MODE_PASSIVE 2 /* symmetric passive */
+#define MODE_ACTIVE 1 /* symmetric active mode */
+#define MODE_PASSIVE 2 /* symmetric passive mode */
#define MODE_CLIENT 3 /* client mode */
#define MODE_SERVER 4 /* server mode */
#define MODE_BROADCAST 5 /* broadcast mode */
-#define MODE_CONTROL 6 /* control mode packet */
-#define MODE_PRIVATE 7 /* implementation defined function */
-#define MODE_BCLIENT 8 /* broadcast client mode */
+/*
+ * These can appear in packets
+ */
+#define MODE_CONTROL 6 /* control mode */
+#define MODE_PRIVATE 7 /* private mode */
+/*
+ * This is a madeup mode for broadcast client.
+ */
+#define MODE_BCLIENT 6 /* broadcast client mode */
/*
* Values for peer.stratum, sys_stratum
@@ -387,8 +428,11 @@ struct peer {
#define FLAG_PREFER 0x0080 /* this is the preferred peer */
#define FLAG_BURST 0x0100 /* burst mode */
#define FLAG_IBURST 0x0200 /* initial burst mode */
-#define FLAG_NOSELECT 0x0400 /* this is a "noselect" peer */
+#define FLAG_NOSELECT 0x0400 /* never select */
#define FLAG_ASSOC 0x0800 /* autokey request */
+#define FLAG_FIXPOLL 0x1000 /* stick at minpoll */
+#define FLAG_TRUE 0x2000 /* select truechimer */
+#define FLAG_PREEMPT 0x4000 /* preemptable association */
/*
* Definitions for the clear() routine. We use memset() to clear
@@ -430,13 +474,13 @@ struct peer {
#define REFCLK_GPSTM_TRUE 15 /* OLD TrueTime GPS/TM-TMD Receiver */
#define REFCLK_IRIG_BANCOMM 16 /* Bancomm GPS/IRIG Interface */
#define REFCLK_GPS_DATUM 17 /* Datum Programmable Time System */
-#define REFCLK_NIST_ACTS 18 /* NIST Auto Computer Time Service */
+#define REFCLK_ACTS 18 /* Generic Auto Computer Time Service */
#define REFCLK_WWV_HEATH 19 /* Heath GC1000 WWV/WWVH Receiver */
#define REFCLK_GPS_NMEA 20 /* NMEA based GPS clock */
#define REFCLK_GPS_VME 21 /* TrueTime GPS-VME Interface */
#define REFCLK_ATOM_PPS 22 /* 1-PPS Clock Discipline */
-#define REFCLK_PTB_ACTS 23 /* PTB Auto Computer Time Service */
-#define REFCLK_USNO 24 /* Naval Observatory dialup */
+#define REFCLK_PTB_ACTS 23 /* replaced by REFCLK_ACTS */
+#define REFCLK_USNO 24 /* replaced by REFCLK_ACTS */
#define REFCLK_GPS_HP 26 /* HP 58503A Time/Frequency Receiver */
#define REFCLK_ARCRON_MSF 27 /* ARCRON MSF radio clock. */
#define REFCLK_SHM 28 /* clock attached thru shared memory */
@@ -483,7 +527,7 @@ struct peer {
(sizeof(struct sockaddr_in)) : (sizeof(struct sockaddr_in6)))
#define ANYSOCK(sock) \
- memset(((struct sockaddr_in *)sock), 0, \
+ memset(((struct sockaddr_storage *)sock), 0, \
sizeof(struct sockaddr_storage))
#define ANY_INTERFACE_CHOOSE(sock) \
@@ -656,29 +700,15 @@ struct pkt {
* To speed lookups, peers are hashed by the low order bits of the
* remote IP address. These definitions relate to that.
*/
-#define HASH_SIZE 128
-#define HASH_MASK (HASH_SIZE-1)
-#define HASH_ADDR(src) sock_hash(src)
+#define NTP_HASH_SIZE 128
+#define NTP_HASH_MASK (NTP_HASH_SIZE-1)
+#define NTP_HASH_ADDR(src) sock_hash(src)
/*
- * How we randomize polls. The poll interval is a power of two.
- * We chose a random value which is between 1/4 and 3/4 of the
- * poll interval we would normally use and which is an even multiple
- * of the EVENT_TIMEOUT. The random number routine, given an argument
- * spread value of n, returns an integer between 0 and (1<<n)-1. This
- * is shifted by EVENT_TIMEOUT and added to the base value.
+ * How we randomize polls. The poll interval is a power of two. We chose
+ * a random interval which is this value plus-minus one second.
*/
-#if defined(HAVE_MRAND48)
-# define RANDOM (mrand48())
-# define SRANDOM(x) (srand48(x))
-#else
-# define RANDOM (random())
-# define SRANDOM(x) (srandom(x))
-#endif
-
-#define RANDPOLL(x) ((1 << (x)) - 1 + (RANDOM & 0x3))
-#define RANDOM_SPREAD(poll) ((poll) - (EVENT_TIMEOUT+1))
-#define RANDOM_POLL(poll, rval) ((((rval)+1)<<EVENT_TIMEOUT) + (1<<((poll)-2)))
+#define RANDPOLL(x) ((1 << (x)) - 1 + (ntp_random() & 0x3))
/*
* min, min3 and max. Makes it easier to transliterate the spec without
@@ -706,12 +736,18 @@ struct pkt {
#define PROTO_PPS 12
#define PROTO_CAL 13
#define PROTO_MINCLOCK 14
-#define PROTO_MINSANE 15
-#define PROTO_FLOOR 16
-#define PROTO_CEILING 17
-#define PROTO_COHORT 18
-#define PROTO_CALLDELAY 19
-#define PROTO_ADJ 20
+#define PROTO_MAXCLOCK 15
+#define PROTO_MINSANE 16
+#define PROTO_FLOOR 17
+#define PROTO_CEILING 18
+#define PROTO_COHORT 19
+#define PROTO_CALLDELAY 20
+#define PROTO_MINDISP 21
+#define PROTO_MAXDIST 22
+#define PROTO_ADJ 23
+#define PROTO_MAXHOP 24
+#define PROTO_BEACON 25
+#define PROTO_ORPHAN 26
/*
* Configuration items for the loop filter
@@ -726,6 +762,7 @@ struct pkt {
#define LOOP_ALLAN 8 /* set minimum Allan intercept */
#define LOOP_HUFFPUFF 9 /* set huff-n'-puff filter length */
#define LOOP_FREQ 10 /* set initial frequency */
+#define LOOP_KERN_CLEAR 11 /* reset kernel pll parameters */
/*
* Configuration items for the stats printer
@@ -839,6 +876,7 @@ struct restrictlist6 {
#define RESTRICT_FLAGS 1 /* add flags to restrict entry */
#define RESTRICT_UNFLAG 2 /* remove flags from restrict entry */
#define RESTRICT_REMOVE 3 /* remove a restrict entry */
+#define RESTRICT_REMOVEIF 4 /* remove an interface restrict entry */
/*
* Endpoint structure for the select algorithm
@@ -849,22 +887,17 @@ struct endpoint {
};
/*
- * Defines for association matching
- */
-#define AM_MODES 10 /* total number of modes */
-#define NO_PEER 0 /* action when no peer is found */
-
-/*
* Association matching AM[] return codes
*/
-#define AM_ERR -1
-#define AM_NOMATCH 0
-#define AM_PROCPKT 1
-#define AM_FXMIT 2
-#define AM_MANYCAST 3
-#define AM_NEWPASS 4
-#define AM_NEWBCL 5
-#define AM_POSSBCL 6
+#define AM_ERR -1 /* error */
+#define AM_NOMATCH 0 /* no match */
+#define AM_PROCPKT 1 /* server/symmetric packet */
+#define AM_BCST 2 /* broadcast packet */
+#define AM_FXMIT 3 /* client packet */
+#define AM_MANYCAST 4 /* manycast packet */
+#define AM_NEWPASS 5 /* new passive */
+#define AM_NEWBCL 6 /* new broadcast */
+#define AM_POSSBCL 7 /* discard broadcast */
/* NetInfo configuration locations */
#ifdef HAVE_NETINFO
diff --git a/contrib/ntp/include/ntp_config.h b/contrib/ntp/include/ntp_config.h
index 01478d2b6b07..66d4f9f9027c 100644
--- a/contrib/ntp/include/ntp_config.h
+++ b/contrib/ntp/include/ntp_config.h
@@ -28,7 +28,7 @@
#define CONFIG_AUTHENTICATE 7
#define CONFIG_KEYS 8
#define CONFIG_REVOKE 9
-#define CONFIG_PPS 10
+#define CONFIG_CDELAY 10
#define CONFIG_RESTRICT 11
#define CONFIG_BDELAY 12
#define CONFIG_TRUSTEDKEY 13
@@ -56,7 +56,7 @@
#define CONFIG_TTL 35
#define CONFIG_INCLUDEFILE 36
#define CONFIG_KEYSDIR 37
-#define CONFIG_CDELAY 38
+#define CONFIG_END 38
#ifdef OPENSSL
#define CONFIG_CRYPTO 39
#endif /* OPENSSL */
@@ -75,6 +75,9 @@
#define CONF_MOD_TTL 9
#define CONF_MOD_MODE 10
#define CONF_MOD_NOSELECT 11
+#define CONF_MOD_TRUE 12
+#define CONF_MOD_PREEMPT 13
+#define CONF_MOD_DYNAMIC 14
/*
* "restrict" modifier keywords
@@ -122,13 +125,6 @@
#define CONF_FGEN_FLAG_DISABLE 6
/*
- * "pps" modifier keywords
- */
-#define CONF_PPS_ASSERT 1
-#define CONF_PPS_CLEAR 2
-#define CONF_PPS_HARDPPS 3
-
-/*
* "discard" modifier keywords
*/
#define CONF_DISCARD_AVERAGE 1
@@ -150,10 +146,16 @@
* "tos" modifier keywords
*/
#define CONF_TOS_MINCLOCK 1
-#define CONF_TOS_MINSANE 2
-#define CONF_TOS_FLOOR 3
-#define CONF_TOS_CEILING 4
-#define CONF_TOS_COHORT 5
+#define CONF_TOS_MAXCLOCK 2
+#define CONF_TOS_MINSANE 3
+#define CONF_TOS_FLOOR 4
+#define CONF_TOS_CEILING 5
+#define CONF_TOS_COHORT 6
+#define CONF_TOS_MINDISP 7
+#define CONF_TOS_MAXDIST 8
+#define CONF_TOS_MAXHOP 9
+#define CONF_TOS_BEACON 10
+#define CONF_TOS_ORPHAN 11
#ifdef OPENSSL
/*
@@ -165,10 +167,11 @@
#define CONF_CRYPTO_CERT 4
#define CONF_CRYPTO_RAND 5
#define CONF_CRYPTO_KEYS 6
-#define CONF_CRYPTO_IFFPAR 7
-#define CONF_CRYPTO_GQPAR 8
-#define CONF_CRYPTO_MVPAR 9
-#define CONF_CRYPTO_PW 10
+#define CONF_CRYPTO_IDENT 7
+#define CONF_CRYPTO_IFFPAR 8
+#define CONF_CRYPTO_GQPAR 9
+#define CONF_CRYPTO_MVPAR 10
+#define CONF_CRYPTO_PW 11
#endif /* OPENSSL */
/*
diff --git a/contrib/ntp/include/ntp_control.h b/contrib/ntp/include/ntp_control.h
index c75d38b31ad6..c299794534b3 100644
--- a/contrib/ntp/include/ntp_control.h
+++ b/contrib/ntp/include/ntp_control.h
@@ -158,22 +158,25 @@ struct ntp_control {
#define CS_OFFSET 11
#define CS_DRIFT 12
#define CS_JITTER 13
-#define CS_CLOCK 14
-#define CS_PROCESSOR 15
-#define CS_SYSTEM 16
-#define CS_VERSION 17
-#define CS_STABIL 18
-#define CS_VARLIST 19
+#define CS_ERROR 14
+#define CS_CLOCK 15
+#define CS_PROCESSOR 16
+#define CS_SYSTEM 17
+#define CS_VERSION 18
+#define CS_STABIL 19
+#define CS_VARLIST 20
#ifdef OPENSSL
-#define CS_FLAGS 20
-#define CS_HOST 21
-#define CS_PUBLIC 22
-#define CS_CERTIF 23
-#define CS_REVTIME 24
-#define CS_LEAPTAB 25
-#define CS_TAI 26
-#define CS_DIGEST 27
-#define CS_MAXCODE CS_DIGEST
+#define CS_FLAGS 21
+#define CS_HOST 22
+#define CS_PUBLIC 23
+#define CS_CERTIF 24
+#define CS_REVTIME 25
+#define CS_LEAPTAB 26
+#define CS_TAI 27
+#define CS_DIGEST 28
+#define CS_IDENT 29
+#define CS_REVOKE 30
+#define CS_MAXCODE CS_REVOKE
#else
#define CS_MAXCODE CS_VARLIST
#endif /* OPENSSL */
@@ -202,7 +205,7 @@ struct ntp_control {
#define CP_REC 19
#define CP_XMT 20
#define CP_REACH 21
-#define CP_VALID 22
+#define CP_UNREACH 22
#define CP_TIMER 23
#define CP_DELAY 24
#define CP_OFFSET 25
@@ -217,11 +220,11 @@ struct ntp_control {
#define CP_FILTERROR 34
#define CP_FLASH 35
#define CP_TTL 36
-#define CP_RANK 37
-#define CP_VARLIST 38
+#define CP_VARLIST 37
#ifdef OPENSSL
-#define CP_FLAGS 39
-#define CP_HOST 40
+#define CP_FLAGS 38
+#define CP_HOST 39
+#define CP_VALID 40
#define CP_INITSEQ 41
#define CP_INITKEY 42
#define CP_INITTSP 43
@@ -266,6 +269,7 @@ struct ctl_trap {
u_char tr_flags; /* trap flags */
u_char tr_version; /* version number of trapper */
};
+extern struct ctl_trap ctl_trap[];
/*
* Flag bits
diff --git a/contrib/ntp/include/ntp_crypto.h b/contrib/ntp/include/ntp_crypto.h
index fb1955ce4064..14795e72dfbf 100644
--- a/contrib/ntp/include/ntp_crypto.h
+++ b/contrib/ntp/include/ntp_crypto.h
@@ -31,9 +31,10 @@
/*
* Flags used for certificate management
*/
-#define CERT_SIGN 0x01 /* certificate is signed */
-#define CERT_TRUST 0x02 /* certificate is trusted */
-#define CERT_PRIV 0x04 /* certificate is private */
+#define CERT_TRUST 0x01 /* certificate is trusted */
+#define CERT_SIGN 0x02 /* certificate is signed */
+#define CERT_VALID 0x04 /* certificate is valid */
+#define CERT_PRIV 0x08 /* certificate is private */
#define CERT_ERROR 0x80 /* certificate has errors */
/*
@@ -63,17 +64,19 @@
#define XEVNT_LEN XEVNT_CMD(1) /* bad field format or length */
#define XEVNT_TSP XEVNT_CMD(2) /* bad timestamp */
#define XEVNT_FSP XEVNT_CMD(3) /* bad filestamp */
-#define XEVNT_PUB XEVNT_CMD(4) /* bad procedure or data */
+#define XEVNT_PUB XEVNT_CMD(4) /* bad or missing public key */
#define XEVNT_MD XEVNT_CMD(5) /* unsupported digest type */
#define XEVNT_KEY XEVNT_CMD(6) /* unsupported identity type */
#define XEVNT_SGL XEVNT_CMD(7) /* bad signature length */
#define XEVNT_SIG XEVNT_CMD(8) /* signature not verified */
#define XEVNT_VFY XEVNT_CMD(9) /* certificate not verified */
-#define XEVNT_PER XEVNT_CMD(10) /* certificate expired */
+#define XEVNT_PER XEVNT_CMD(10) /* host certificate expired */
#define XEVNT_CKY XEVNT_CMD(11) /* bad or missing cookie */
#define XEVNT_DAT XEVNT_CMD(12) /* bad or missing leapseconds table */
#define XEVNT_CRT XEVNT_CMD(13) /* bad or missing certificate */
-#define XEVNT_ID XEVNT_CMD(14) /* bad or missing identification */
+#define XEVNT_ID XEVNT_CMD(14) /* bad or missing group key */
+#define XEVNT_ERR XEVNT_CMD(15) /* protocol error */
+#define XEVNT_SRV XEVNT_CMD(16) /* server certificate expired */
/*
* Configuration codes
@@ -90,6 +93,7 @@
#define CRYPTO_CONF_GQPAR 9 /* GQ parameters file name */
#define CRYPTO_CONF_MVPAR 10 /* GQ parameters file name */
#define CRYPTO_CONF_PW 11 /* private key password */
+#define CRYPTO_CONF_IDENT 12 /* specify identity scheme */
/*
* Miscellaneous crypto stuff
@@ -98,6 +102,7 @@
#define NTP_AUTOMAX 13 /* log2 default max session key life */
#define KEY_REVOKE 16 /* log2 default key revoke timeout */
#define NTP_MAXEXTEN 1024 /* maximum extension field size */
+#define TAI_1972 10 /* initial TAI offset (s) */
/*
* The autokey structure holds the values used to authenticate key IDs.
@@ -145,8 +150,8 @@ struct cert_info {
int nid; /* signature/digest ID */
const EVP_MD *digest; /* message digest algorithm */
u_long serial; /* serial number */
- tstamp_t first; /* valid not before */
- tstamp_t last; /* valid not after */
+ tstamp_t first; /* not valid before */
+ tstamp_t last; /* not valid after */
char *subject; /* subject common name */
char *issuer; /* issuer common name */
u_char *grpkey; /* GQ group key */
@@ -162,5 +167,4 @@ extern u_int crypto_flags; /* status word */
extern struct value hostval; /* host name/value */
extern struct cert_info *cinfo; /* host certificate information */
extern struct value tai_leap; /* leapseconds table */
-extern u_int sys_tai; /* current UTC offset from TAI */
#endif /* OPENSSL */
diff --git a/contrib/ntp/include/ntp_debug.h b/contrib/ntp/include/ntp_debug.h
new file mode 100644
index 000000000000..376b24b957db
--- /dev/null
+++ b/contrib/ntp/include/ntp_debug.h
@@ -0,0 +1,26 @@
+/*
+ * $Header$
+ *
+ * $Created: Sat Aug 20 14:23:01 2005 $
+ *
+ * Copyright (C) 2005 by Frank Kardel
+ */
+#ifndef NTP_DEBUG_H
+#define NTP_DEBUG_H
+
+/*
+ * macros for debugging output - cut down on #ifdef pollution in the code
+ */
+
+#ifdef DEBUG
+#define DPRINTF(_lvl_, _arg_) \
+ if (debug >= (_lvl_)) \
+ printf _arg_;
+#else
+#define DPRINTF(_lvl_, _arg_)
+#endif
+
+#endif
+/*
+ * $Log$
+ */
diff --git a/contrib/ntp/include/ntp_filegen.h b/contrib/ntp/include/ntp_filegen.h
index 8217dbc11670..836ec04ec0f9 100644
--- a/contrib/ntp/include/ntp_filegen.h
+++ b/contrib/ntp/include/ntp_filegen.h
@@ -48,4 +48,4 @@ typedef struct FILEGEN
extern void filegen_setup P((FILEGEN *, u_long));
extern void filegen_config P((FILEGEN *, char *, u_int, u_int));
extern FILEGEN *filegen_get P((char *));
-extern void filegen_register P((const char *, FILEGEN *));
+extern void filegen_register P((char *, const char *, FILEGEN *));
diff --git a/contrib/ntp/include/ntp_fp.h b/contrib/ntp/include/ntp_fp.h
index 256bab830a04..307ab102dd4b 100644
--- a/contrib/ntp/include/ntp_fp.h
+++ b/contrib/ntp/include/ntp_fp.h
@@ -7,9 +7,10 @@
#include <sys/types.h>
#include <sys/socket.h>
-#include "ntp_rfc2553.h"
#include <netinet/in.h>
+#include "ntp_rfc2553.h"
+
#include "ntp_types.h"
/*
@@ -281,7 +282,7 @@ typedef u_int32 u_fp;
#define L_SUBUF(r, uf) M_SUBUF((r)->l_ui, (r)->l_uf, (uf))
#define L_ADDF(r, f) M_ADDF((r)->l_ui, (r)->l_uf, (f))
#define L_RSHIFT(v) M_RSHIFT((v)->l_i, (v)->l_uf)
-#define L_RSHIFTU(v) M_RSHIFT((v)->l_ui, (v)->l_uf)
+#define L_RSHIFTU(v) M_RSHIFTU((v)->l_ui, (v)->l_uf)
#define L_LSHIFT(v) M_LSHIFT((v)->l_ui, (v)->l_uf)
#define L_CLR(v) ((v)->l_ui = (v)->l_uf = 0)
@@ -358,6 +359,8 @@ extern void get_systime P((l_fp *));
extern int step_systime P((double));
extern int adj_systime P((double));
+extern struct tm * ntp2unix_tm P((u_long ntp, int local));
+
#define lfptoa(_fpv, _ndec) mfptoa((_fpv)->l_ui, (_fpv)->l_uf, (_ndec))
#define lfptoms(_fpv, _ndec) mfptoms((_fpv)->l_ui, (_fpv)->l_uf, (_ndec))
diff --git a/contrib/ntp/include/ntp_machine.h b/contrib/ntp/include/ntp_machine.h
index 65ef5be88e3d..2a3b6e6a6c67 100644
--- a/contrib/ntp/include/ntp_machine.h
+++ b/contrib/ntp/include/ntp_machine.h
@@ -54,8 +54,6 @@ HOW TO GET IP INTERFACE INFORMATION
the stream in an I_STR ioctl. This ususally also implies
USE_STREAMS_DEVICE FOR IF_CONFIG. Dell UNIX is a notable exception.
- STREAMS_TLI - use ioctl(I_STR) to implement ioctl(SIOCGIFCONF)
-
WHAT DOES IOCTL(SIOCGIFCONF) RETURN IN THE BUFFER
UNIX V.4 machines implement a sockets library on top of streams.
@@ -81,11 +79,6 @@ MISC
RETSIGTYPE - Define signal function type.
NO_SIGNED_CHAR_DECL - No "signed char" see include/ntp.h
LOCK_PROCESS - Have plock.
- UDP_WILDCARD_DELIVERY
- - these systems deliver broadcast packets to the wildcard
- port instead to a port bound to the interface bound
- to the correct broadcast address - are these
- implementations broken or did the spec change ?
*/
/*
@@ -99,6 +92,10 @@ MISC
#endif /* not __STDC__ and not HAVE_PROTOTYPES */
#endif /* P */
+#if !defined(HAVE_NTP_ADJTIME) && defined(HAVE___ADJTIMEX)
+# define ntp_adjtime __adjtimex
+#endif
+
#if 0
/*
@@ -244,6 +241,7 @@ typedef unsigned long u_long;
#ifndef SYS_WINNT
# define SOCKET int
# define INVALID_SOCKET -1
+# define SOCKET_ERROR -1
# define closesocket close
#endif
/*
@@ -272,8 +270,6 @@ typedef unsigned long u_long;
# define unlink _unlink
# define fileno _fileno
# define write _write
-# define vsnprintf _vsnprintf
-# define snprintf _snprintf
#ifndef close
# define close _close
#endif
@@ -355,8 +351,6 @@ extern void alarm P((int seconds));
#define getclock clock_gettime
#define fcntl ioctl
#define _getch getchar
-#define random rand
-#define srandom srand
/* define this away for vxWorks */
#define openlog(x,y)
diff --git a/contrib/ntp/include/ntp_random.h b/contrib/ntp/include/ntp_random.h
new file mode 100644
index 000000000000..766dcc376096
--- /dev/null
+++ b/contrib/ntp/include/ntp_random.h
@@ -0,0 +1,14 @@
+
+#include <ntp_types.h>
+
+long ntp_random P((void));
+void ntp_srandom P((unsigned long));
+void ntp_srandomdev P((void));
+char * ntp_initstate P((unsigned long, /* seed for R.N.G. */
+ char *, /* pointer to state array */
+ long /* # bytes of state info */
+ ));
+char * ntp_setstate P((char *)); /* pointer to state array */
+
+
+
diff --git a/contrib/ntp/include/ntp_refclock.h b/contrib/ntp/include/ntp_refclock.h
index 5e33a8ce25a1..d63f3af38ead 100644
--- a/contrib/ntp/include/ntp_refclock.h
+++ b/contrib/ntp/include/ntp_refclock.h
@@ -65,6 +65,7 @@ struct clktype {
const char *clocktype; /* long description */
const char *abbrev; /* short description */
};
+extern struct clktype clktypes[];
/*
* Configuration flag values
@@ -163,13 +164,16 @@ struct refclockbug {
* modules to be installed/loaded in the kernel. If specified, but not
* installed, the code runs as if unspecified.
*/
-#define LDISC_STD 0x0 /* standard */
-#define LDISC_CLK 0x1 /* tty_clk \n intercept */
-#define LDISC_CLKPPS 0x2 /* tty_clk \377 intercept */
-#define LDISC_ACTS 0x4 /* tty_clk #* intercept */
-#define LDISC_CHU 0x8 /* depredated */
+#define LDISC_STD 0x00 /* standard */
+#define LDISC_CLK 0x01 /* tty_clk \n intercept */
+#define LDISC_CLKPPS 0x02 /* tty_clk \377 intercept */
+#define LDISC_ACTS 0x04 /* tty_clk #* intercept */
+#define LDISC_CHU 0x08 /* depredated */
#define LDISC_PPS 0x10 /* ppsclock, ppsapi */
#define LDISC_RAW 0x20 /* raw binary */
+#define LDISC_ECHO 0x40 /* enable echo */
+#define LDISC_REMOTE 0x80 /* remote mode */
+#define LDISC_7O1 0x100 /* 7-bit, odd parity for Z3801A */
struct refclockproc {
struct refclockio io; /* I/O handler structure */
@@ -234,7 +238,7 @@ struct refclock {
struct refclockstat *, struct peer *));
void (*clock_init) P((void));
void (*clock_buginfo) P((int, struct refclockbug *, struct peer *));
- u_long clock_flags;
+ void (*clock_timer) P((int, struct peer *));
};
/*
@@ -254,14 +258,16 @@ extern void refclock_buginfo P((struct sockaddr_storage *,
extern void refclock_control P((struct sockaddr_storage *,
struct refclockstat *,
struct refclockstat *));
-extern int refclock_open P((char *, int, int));
+extern int refclock_open P((char *, u_int, u_int));
+extern int refclock_setup P((int, u_int, u_int));
+extern void refclock_timer P((struct peer *));
extern void refclock_transmit P((struct peer *));
-extern int refclock_ioctl P((int, int));
+extern int refclock_ioctl P((int, u_int));
extern int refclock_process P((struct refclockproc *));
extern void refclock_process_offset P((struct refclockproc *, l_fp, l_fp, double));
extern void refclock_report P((struct peer *, int));
-extern int refclock_gtlin P((struct recvbuf *, char *, int,
- l_fp *));
+extern int refclock_gtlin P((struct recvbuf *, char *, int, l_fp *));
+extern int refclock_gtraw P((struct recvbuf *, char *, int, l_fp *));
#endif /* REFCLOCK */
#endif /* NTP_REFCLOCK_H */
diff --git a/contrib/ntp/include/ntp_request.h b/contrib/ntp/include/ntp_request.h
index 8166a4df2c5f..eb13fadb8fec 100644
--- a/contrib/ntp/include/ntp_request.h
+++ b/contrib/ntp/include/ntp_request.h
@@ -112,6 +112,15 @@
*/
/*
+ * union of raw addresses to save space
+ */
+union addrun
+{
+ struct in6_addr addr6;
+ struct in_addr addr;
+};
+
+/*
* A request packet. These are almost a fixed length.
*/
struct req_pkt {
@@ -275,6 +284,8 @@ struct resp_pkt {
#define REQ_SET_PRECISION 41 /* (not used) */
#define REQ_MON_GETLIST_1 42 /* return collected v1 monitor data */
#define REQ_HOSTNAME_ASSOCID 43 /* Here is a hostname + assoc_id */
+#define REQ_IF_STATS 44 /* get interface statistics */
+#define REQ_IF_RELOAD 45 /* reload interface list */
/* Determine size of pre-v6 version of structures */
#define v4sizeof(type) offsetof(type, v6_flag)
@@ -290,6 +301,7 @@ struct resp_pkt {
#define INFO_FLAG_AUTHENABLE 0x20
#define INFO_FLAG_SEL_CANDIDATE 0x40
#define INFO_FLAG_SHORTLIST 0x80
+#define INFO_FLAG_IBURST 0x100
/*
* Flags in the system information returns
@@ -517,7 +529,7 @@ struct info_mem_stats {
u_int32 findpeer_calls;
u_int32 allocations;
u_int32 demobilizations;
- u_char hashcount[HASH_SIZE];
+ u_char hashcount[NTP_HASH_SIZE];
};
@@ -872,6 +884,36 @@ struct info_kernel {
};
/*
+ * interface statistics
+ */
+struct info_if_stats {
+ union addrun unaddr; /* address */
+ union addrun unbcast; /* broadcast */
+ union addrun unmask; /* mask */
+ u_int32 v6_flag; /* is this v6 */
+ char name[32]; /* name of interface */
+ int32 flags; /* interface flags */
+ int32 last_ttl; /* last TTL specified */
+ int32 num_mcast; /* No. of IP addresses in multicast socket */
+ int32 received; /* number of incoming packets */
+ int32 sent; /* number of outgoing packets */
+ int32 notsent; /* number of send failures */
+ int32 uptime; /* number of seconds this interface was active */
+ u_int32 scopeid; /* Scope used for Multicasting */
+ u_int32 ifindex; /* interface index - from system */
+ u_int32 ifnum; /* sequential interface number */
+ u_int32 peercnt; /* number of peers referencinf this interface - informational only */
+ u_short family; /* Address family */
+ u_char ignore_packets; /* Specify whether the packet should be ignored */
+ u_char action; /* reason the item is listed */
+ int32 _filler0; /* pad to a 64 bit size boundary */
+};
+
+#define IFS_EXISTS 1 /* just exists */
+#define IFS_CREATED 2 /* was just created */
+#define IFS_DELETED 3 /* was just delete */
+
+/*
* Info returned with IP -> hostname lookup
*/
/* 144 might need to become 32, matching data[] member of req_pkt */
diff --git a/contrib/ntp/include/ntp_rfc2553.h b/contrib/ntp/include/ntp_rfc2553.h
index 28ff004b8808..662b118942f6 100644
--- a/contrib/ntp/include/ntp_rfc2553.h
+++ b/contrib/ntp/include/ntp_rfc2553.h
@@ -68,54 +68,89 @@
#ifndef _NTP_RFC2553_H_
#define _NTP_RFC2553_H_
-#if defined(_SS_MAXSIZE) || defined(_SS_SIZE)
-#define HAVE_IPV6
-#else
+/*
+ * Ensure that we include the configuration file before we check
+ * for IPV6
+ */
+#include <config.h>
+
+#include <netdb.h>
-#include <sys/types.h>
#include "ntp_types.h"
+/*
+ * Don't include any additional IPv6 definitions
+ * We are defining our own here.
+ */
+#define ISC_IPV6_H 1
+
+ /*
+ * If various macros are not defined we need to define them
+ */
+
#ifndef AF_INET6
#define AF_INET6 AF_MAX
#define PF_INET6 AF_INET6
#endif
-#ifndef HAVE_TYPE_U_INT8_T
-typedef u_char u_int8_t;
-typedef u_short u_int16_t;
-typedef u_int32 u_int32_t;
-#endif /* HAVE_TYPE_U_INT8_T */
+#if !defined(_SS_MAXSIZE) && !defined(_SS_ALIGNSIZE)
-#ifndef HAVE_TYPE_U_INT64_T
-typedef struct u_int64_t { u_int32 val[2]; } u_int64_t;
-#endif /* HAVE_TYPE_U_INT64_T */
+#define _SS_MAXSIZE 128
+#define _SS_ALIGNSIZE (sizeof(ntp_uint64_t))
+#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
+#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(u_char) - sizeof(ntp_u_int8_t))
+#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(u_char) - sizeof(ntp_u_int8_t) - \
+ _SS_PAD1SIZE - _SS_ALIGNSIZE)
+#else
+#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(short))
+#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(short) - \
+ _SS_PAD1SIZE - _SS_ALIGNSIZE)
+#endif /* HAVE_SA_LEN_IN_STRUCT_SOCKADDR */
+#endif
/*
- * IPv6 address
+ * If we don't have the sockaddr_storage structure
+ * we need to define it
*/
-#ifdef SYS_WINNT
-#define in6_addr in_addr6
+
+#ifndef HAVE_STRUCT_SOCKADDR_STORAGE
+struct sockaddr_storage {
+#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
+ ntp_u_int8_t ss_len; /* address length */
+ ntp_u_int8_t ss_family; /* address family */
#else
+ short ss_family; /* address family */
+#endif
+ char __ss_pad1[_SS_PAD1SIZE];
+ ntp_uint64_t __ss_align; /* force desired structure storage alignment */
+ char __ss_pad2[_SS_PAD2SIZE];
+};
+#endif
+
/*
- * Don't include any additional IPv6 definitions
- * We are defining our own here.
+ * Finally if the platform doesn't support IPv6 we need some
+ * additional definitions
*/
-#define ISC_IPV6_H 1
-struct in6_addr {
- union {
- u_int8_t __u6_addr8[16];
- u_int16_t __u6_addr16[8];
- u_int32_t __u6_addr32[4];
- } __u6_addr; /* 128-bit IP6 address */
-};
+/*
+ * Flag values for getaddrinfo()
+ */
+#ifndef AI_NUMERICHOST
+#define AI_PASSIVE 0x00000001 /* get address to use bind() */
+#define AI_CANONNAME 0x00000002 /* fill ai_canonname */
+#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */
+/* valid flags for addrinfo */
+#define AI_MASK \
+ (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_ADDRCONFIG)
-#define s6_addr __u6_addr.__u6_addr8
+#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */
#endif
+#ifndef ISC_PLATFORM_HAVEIPV6
/*
* Definition of some useful macros to handle IP6 addresses
*/
+#ifdef ISC_PLATFORM_NEEDIN6ADDRANY
#ifdef SYS_WINNT
#define IN6ADDR_ANY_INIT {{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }}
#else
@@ -123,22 +158,44 @@ struct in6_addr {
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
#endif
+#endif
+
+/*
+ * IPv6 address
+ */
+#ifdef SYS_WINNT
+#define in6_addr in_addr6
+#else
+
+struct in6_addr {
+ union {
+ ntp_u_int8_t __u6_addr8[16];
+ ntp_u_int16_t __u6_addr16[8];
+ ntp_u_int32_t __u6_addr32[4];
+ } __u6_addr; /* 128-bit IP6 address */
+};
+
+#define s6_addr __u6_addr.__u6_addr8
+#endif
+
+#if defined(ISC_PLATFORM_HAVEIPV6) && defined(ISC_PLATFORM_NEEDIN6ADDRANY)
extern const struct in6_addr in6addr_any;
+#endif
#define SIN6_LEN
#ifndef HAVE_SOCKADDR_IN6
struct sockaddr_in6 {
#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
- u_int8_t sin6_len; /* length of this struct(sa_family_t)*/
- u_int8_t sin6_family; /* AF_INET6 (sa_family_t) */
+ ntp_u_int8_t sin6_len; /* length of this struct(sa_family_t)*/
+ ntp_u_int8_t sin6_family; /* AF_INET6 (sa_family_t) */
#else
short sin6_family; /* AF_INET6 (sa_family_t) */
#endif
- u_int16_t sin6_port; /* Transport layer port # (in_port_t)*/
- u_int32_t sin6_flowinfo; /* IP6 flow information */
+ ntp_u_int16_t sin6_port; /* Transport layer port # (in_port_t)*/
+ ntp_u_int32_t sin6_flowinfo; /* IP6 flow information */
struct in6_addr sin6_addr; /* IP6 address */
- u_int32_t sin6_scope_id; /* scope zone index */
+ ntp_u_int32_t sin6_scope_id; /* scope zone index */
};
#endif
@@ -147,10 +204,10 @@ struct sockaddr_in6 {
*/
#ifndef IN6_IS_ADDR_UNSPECIFIED
#define IN6_IS_ADDR_UNSPECIFIED(a) \
- ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
- (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
- (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
- (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == 0))
+ ((*(const ntp_u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
+ (*(const ntp_u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
+ (*(const ntp_u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
+ (*(const ntp_u_int32_t *)(const void *)(&(a)->s6_addr[12]) == 0))
#endif
/*
* Multicast
@@ -158,33 +215,20 @@ struct sockaddr_in6 {
#ifndef IN6_IS_ADDR_MULTICAST
#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff)
#endif
-
/*
- * RFC 2553: protocol-independent placeholder for socket addresses
+ * Unicast link / site local.
*/
-#define _SS_MAXSIZE 128
-#define _SS_ALIGNSIZE (sizeof(u_int64_t))
-#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
-#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(u_char) - sizeof(u_int8_t))
-#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(u_char) - sizeof(u_int8_t) - \
- _SS_PAD1SIZE - _SS_ALIGNSIZE)
-#else
-#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(short))
-#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(short) - \
- _SS_PAD1SIZE - _SS_ALIGNSIZE)
-#endif /* HAVE_SA_LEN_IN_STRUCT_SOCKADDR */
+#ifndef IN6_IS_ADDR_LINKLOCAL
+#define IN6_IS_ADDR_LINKLOCAL(a) (\
+(*((u_long *)((a)->s6_addr) ) == 0xfe) && \
+((*((u_long *)((a)->s6_addr) + 1) & 0xc0) == 0x80))
+#endif
-struct sockaddr_storage {
-#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
- u_int8_t ss_len; /* address length */
- u_int8_t ss_family; /* address family */
-#else
- short ss_family; /* address family */
+#ifndef IN6_IS_ADDR_SITELOCAL
+#define IN6_IS_ADDR_SITELOCAL(a) (\
+(*((u_long *)((a)->s6_addr) ) == 0xfe) && \
+((*((u_long *)((a)->s6_addr) + 1) & 0xc0) == 0xc0))
#endif
- char __ss_pad1[_SS_PAD1SIZE];
- u_int64_t __ss_align; /* force desired structure storage alignment */
- char __ss_pad2[_SS_PAD2SIZE];
-};
struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
@@ -215,40 +259,34 @@ struct addrinfo {
#define EAI_PROTOCOL 13
#define EAI_MAX 14
-/*
- * Flag values for getaddrinfo()
- */
-#define AI_PASSIVE 0x00000001 /* get address to use bind() */
-#define AI_CANONNAME 0x00000002 /* fill ai_canonname */
-#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */
-/* valid flags for addrinfo */
-#define AI_MASK \
- (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_ADDRCONFIG)
-#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */
+int getaddrinfo P((const char *, const char *,
+ const struct addrinfo *, struct addrinfo **));
+int getnameinfo P((const struct sockaddr *, u_int, char *,
+ size_t, char *, size_t, int));
+void freeaddrinfo P((struct addrinfo *));
+char *gai_strerror P((int));
/*
* Constants for getnameinfo()
*/
+#ifndef NI_MAXHOST
#define NI_MAXHOST 1025
#define NI_MAXSERV 32
+#endif
/*
* Flag values for getnameinfo()
*/
+#ifndef NI_NUMERICHOST
#define NI_NOFQDN 0x00000001
#define NI_NUMERICHOST 0x00000002
#define NI_NAMEREQD 0x00000004
#define NI_NUMERICSERV 0x00000008
#define NI_DGRAM 0x00000010
#define NI_WITHSCOPEID 0x00000020
+#endif
-int getaddrinfo P((const char *, const char *,
- const struct addrinfo *, struct addrinfo **));
-int getnameinfo P((const struct sockaddr *, u_int, char *,
- size_t, char *, size_t, int));
-void freeaddrinfo P((struct addrinfo *));
-char *gai_strerror P((int));
+#endif /* ISC_PLATFORM_HAVEIPV6 */
-#endif /* _SS_MAXSIZE */
#endif /* !_NTP_RFC2553_H_ */
diff --git a/contrib/ntp/include/ntp_stdlib.h b/contrib/ntp/include/ntp_stdlib.h
index 3dc6fe041857..c389d1ecc98b 100644
--- a/contrib/ntp/include/ntp_stdlib.h
+++ b/contrib/ntp/include/ntp_stdlib.h
@@ -47,7 +47,6 @@ extern int authreadkeys P((const char *));
extern void authtrust P((keyid_t, u_long));
extern int authusekey P((keyid_t, int, const u_char *));
-extern u_long calleapwhen P((u_long));
extern u_long calyearstart P((u_long));
extern const char *clockname P((int));
extern int clocktime P((int, int, int, int, int, u_long, u_long *, u_int32 *));
@@ -60,7 +59,6 @@ extern void * emalloc P((u_int));
extern int ntp_getopt P((int, char **, const char *));
extern void init_auth P((void));
extern void init_lib P((void));
-extern void init_random P((void));
extern struct savekey *auth_findkey P((keyid_t));
extern int auth_moremem P((void));
extern int ymd2yd P((int, int, int));
@@ -102,7 +100,7 @@ extern const char * FindConfig P((const char *));
extern void signal_no_reset P((int, RETSIGTYPE (*func)(int)));
-extern void getauthkeys P((char *));
+extern void getauthkeys P((const char *));
extern void auth_agekeys P((void));
extern void rereadkeys P((void));
@@ -133,12 +131,6 @@ extern keyid_t cache_keyid; /* key identifier */
extern u_char * cache_key; /* key pointer */
extern u_int cache_keylen; /* key length */
-/* clocktypes.c */
-#ifdef NTP_REFCLOCK_H
-struct clktype;
-extern struct clktype clktypes[];
-#endif
-
/* getopt.c */
extern char * ntp_optarg; /* global argument pointer */
extern int ntp_optind; /* global argv index */
diff --git a/contrib/ntp/include/ntp_tty.h b/contrib/ntp/include/ntp_tty.h
index 3e12c8d3ea7f..9833119238f4 100644
--- a/contrib/ntp/include/ntp_tty.h
+++ b/contrib/ntp/include/ntp_tty.h
@@ -52,17 +52,4 @@
#define BSD_TTYS
#endif /* SYSV_TTYS STREAM BSD_TTYS */
-/*
- * Line discipline flags. These require line discipline or streams
- * modules to be installed/loaded in the kernel. If specified, but not
- * installed, the code runs as if unspecified.
- */
-#define LDISC_STD 0x0 /* standard */
-#define LDISC_CLK 0x1 /* tty_clk \n intercept */
-#define LDISC_CLKPPS 0x2 /* tty_clk \377 intercept */
-#define LDISC_ACTS 0x4 /* tty_clk #* intercept */
-#define LDISC_CHU 0x8 /* depredated */
-#define LDISC_PPS 0x10 /* ppsclock, ppsapi */
-#define LDISC_RAW 0x20 /* raw binary */
-
#endif /* NTP_TTY_H */
diff --git a/contrib/ntp/include/ntp_types.h b/contrib/ntp/include/ntp_types.h
index 348e95ec162d..0b575c8c6ae3 100644
--- a/contrib/ntp/include/ntp_types.h
+++ b/contrib/ntp/include/ntp_types.h
@@ -4,6 +4,7 @@
* as int and u_int.
* For 32 bit systems, define them as long and u_long
*/
+#include <sys/types.h>
#include "ntp_machine.h"
#ifndef _NTP_TYPES_
@@ -65,6 +66,12 @@ typedef unsigned int u_int;
# include "Bletch: what's 32 bits on this machine?"
#endif /* not sizeof(int) == 4 */
+typedef u_char ntp_u_int8_t;
+typedef u_short ntp_u_int16_t;
+typedef u_int32 ntp_u_int32_t;
+
+typedef struct ntp_uint64_t { u_int32 val[2]; } ntp_uint64_t;
+
typedef unsigned short associd_t; /* association ID */
typedef u_int32 keyid_t; /* cryptographic key ID */
typedef u_int32 tstamp_t; /* NTP seconds timestamp */
diff --git a/contrib/ntp/include/ntpd.h b/contrib/ntp/include/ntpd.h
index 54d3e13c24ee..d0957191becb 100644
--- a/contrib/ntp/include/ntpd.h
+++ b/contrib/ntp/include/ntpd.h
@@ -5,20 +5,12 @@
#include "ntp_syslog.h"
#include "ntp_fp.h"
#include "ntp.h"
+#include "ntp_debug.h"
#include "ntp_select.h"
#include "ntp_malloc.h"
#include "ntp_refclock.h"
#include "recvbuff.h"
-#ifdef SYS_WINNT
-#define exit service_exit
-extern void service_exit (int);
-/* declare the service threads */
-void service_main (DWORD, LPTSTR *);
-void service_ctrl (DWORD);
-void worker_thread (void *);
-#define sleep(x) Sleep((DWORD) x * 1000 /* milliseconds */ );
-#endif /* SYS_WINNT */
/* ntp_config.c */
extern void getconfig P((int, char **));
@@ -63,7 +55,7 @@ struct ctl_var {
extern char * add_var P((struct ctl_var **, u_long, u_short));
extern void free_varlist P((struct ctl_var *));
extern void set_var P((struct ctl_var **, const char *, u_long, u_short));
-extern void set_sys_var P((char *, u_long, u_short));
+extern void set_sys_var P((const char *, u_long, u_short));
/* ntp_intres.c */
extern void ntp_res_name P((struct sockaddr_storage, u_short));
@@ -71,9 +63,23 @@ extern void ntp_res_recv P((void));
extern void ntp_intres P((void));
/* ntp_io.c */
+typedef struct interface_info {
+ struct interface *interface;
+ u_char action;
+} interface_info_t;
+
+typedef void (*interface_receiver_t)(void *, interface_info_t *);
+
+extern volatile int disable_dynamic_updates;
+
+extern void interface_enumerate P((interface_receiver_t, void *));
extern struct interface *findinterface P((struct sockaddr_storage *));
extern struct interface *findbcastinter P((struct sockaddr_storage *));
+extern void enable_broadcast P((struct interface *, struct sockaddr_storage *));
+extern void enable_multicast_if P((struct interface *, struct sockaddr_storage *));
+extern void interface_dump P((struct interface *));
+extern void interface_update P((interface_receiver_t, void *));
extern void init_io P((void));
extern void input_handler P((l_fp *));
extern void io_clr_stats P((void));
@@ -82,12 +88,19 @@ extern void io_unsetbclient P((void));
extern void io_multicast_add P((struct sockaddr_storage));
extern void io_multicast_del P((struct sockaddr_storage));
extern void kill_asyncio P((int));
-
extern void sendpkt P((struct sockaddr_storage *, struct interface *, int, struct pkt *, int));
+#ifdef DEBUG
+extern void collect_timing P((struct recvbuf *, const char *, int, l_fp *));
+#endif
#ifdef HAVE_SIGNALED_IO
extern void wait_for_signal P((void));
extern void unblock_io_and_alarm P((void));
extern void block_io_and_alarm P((void));
+#define UNBLOCK_IO_AND_ALARM() unblock_io_and_alarm()
+#define BLOCK_IO_AND_ALARM() block_io_and_alarm()
+#else
+#define UNBLOCK_IO_AND_ALARM()
+#define BLOCK_IO_AND_ALARM()
#endif
/* ntp_leap.c */
@@ -104,42 +117,47 @@ extern int leap_actual P((int));
/* ntp_loopfilter.c */
extern void init_loopfilter P((void));
-extern int local_clock P((struct peer *, double, double));
+extern int local_clock P((struct peer *, double));
extern void adj_host_clock P((void));
extern void loop_config P((int, double));
extern void huffpuff P((void));
+extern u_long sys_clocktime;
+extern u_long sys_tai;
/* ntp_monitor.c */
extern void init_mon P((void));
extern void mon_start P((int));
extern void mon_stop P((int));
-extern void ntp_monitor P((struct recvbuf *));
+extern int ntp_monitor P((struct recvbuf *));
+extern void ntp_monclearinterface P((struct interface *interface));
/* ntp_peer.c */
extern void init_peer P((void));
extern struct peer *findexistingpeer P((struct sockaddr_storage *, struct peer *, int));
-extern struct peer *findpeer P((struct sockaddr_storage *, struct interface *, int, int, int *));
+extern struct peer *findpeer P((struct sockaddr_storage *, struct interface *, int, int *));
extern struct peer *findpeerbyassoc P((u_int));
+extern void set_peerdstadr P((struct peer *peer, struct interface *interface));
extern struct peer *newpeer P((struct sockaddr_storage *, struct interface *, int, int, int, int, u_int, u_char, int, keyid_t));
extern void peer_all_reset P((void));
extern void peer_clr_stats P((void));
extern struct peer *peer_config P((struct sockaddr_storage *, struct interface *, int, int, int, int, u_int, int, keyid_t, u_char *));
extern void peer_reset P((struct peer *));
extern int peer_unconfig P((struct sockaddr_storage *, struct interface *, int));
+extern void refresh_all_peerinterfaces P((void));
extern void unpeer P((struct peer *));
extern void clear_all P((void));
+
#ifdef OPENSSL
extern void expire_all P((void));
#endif /* OPENSSL */
extern struct peer *findmanycastpeer P((struct recvbuf *));
-extern void resetmanycast P((void));
/* ntp_crypto.c */
#ifdef OPENSSL
extern int crypto_recv P((struct peer *, struct recvbuf *));
extern int crypto_xmit P((struct pkt *, struct sockaddr_storage *, int, struct exten *, keyid_t));
extern keyid_t session_key P((struct sockaddr_storage *, struct sockaddr_storage *, keyid_t, keyid_t, u_long));
-extern void make_keylist P((struct peer *, struct interface *));
+extern int make_keylist P((struct peer *, struct interface *));
extern void key_expire P((struct peer *));
extern void crypto_update P((void));
extern void crypto_config P((int, char *));
@@ -148,13 +166,21 @@ extern u_int crypto_ident P((struct peer *));
extern struct exten *crypto_args P((struct peer *, u_int, char *));
extern int crypto_public P((struct peer *, u_char *, u_int));
extern void value_free P((struct value *));
+extern char *iffpar_file;
+extern EVP_PKEY *iffpar_pkey;
+extern char *gqpar_file;
+extern EVP_PKEY *gqpar_pkey;
+extern char *mvpar_file;
+extern EVP_PKEY *mvpar_pkey;
+extern struct value tai_leap;
#endif /* OPENSSL */
/* ntp_proto.c */
extern void transmit P((struct peer *));
extern void receive P((struct recvbuf *));
+extern void peer_crypto_clear P((struct peer *peer));
extern void peer_clear P((struct peer *, char *));
-extern void process_packet P((struct peer *, struct pkt *, l_fp *));
+extern void process_packet P((struct peer *, struct pkt *));
extern void clock_select P((void));
extern void kod_proto P((void));
@@ -187,7 +213,7 @@ extern void process_private P((struct recvbuf *, int));
/* ntp_restrict.c */
extern void init_restrict P((void));
-extern int restrictions P((struct sockaddr_storage *));
+extern int restrictions P((struct sockaddr_storage *, int));
extern void hack_restrict P((int, struct sockaddr_storage *, struct sockaddr_storage *, int, int));
/* ntp_timer.c */
@@ -195,6 +221,9 @@ extern void init_timer P((void));
extern void reinit_timer P((void));
extern void timer P((void));
extern void timer_clr_stats P((void));
+extern void timer_interfacetimeout P((u_long));
+extern volatile int interface_interval;
+
#ifdef OPENSSL
extern char *sys_hostname;
extern l_fp sys_revoketime;
@@ -202,15 +231,19 @@ extern l_fp sys_revoketime;
/* ntp_util.c */
extern void init_util P((void));
-extern void hourly_stats P((void));
-extern void stats_config P((int, char *));
+extern void write_stats P((void));
+extern void stats_config P((int, const char *));
extern void record_peer_stats P((struct sockaddr_storage *, int, double, double, double, double));
extern void record_loop_stats P((double, double, double, double, int));
extern void record_clock_stats P((struct sockaddr_storage *, const char *));
extern void record_raw_stats P((struct sockaddr_storage *, struct sockaddr_storage *, l_fp *, l_fp *, l_fp *, l_fp *));
extern void record_sys_stats P((void));
extern void record_crypto_stats P((struct sockaddr_storage *, const char *));
+#ifdef DEBUG
+extern void record_timing_stats P((const char *));
+#endif
extern int sock_hash P((struct sockaddr_storage *));
+extern double old_drift;
/*
* Variable declarations for ntpd.
@@ -218,18 +251,13 @@ extern int sock_hash P((struct sockaddr_storage *));
/* ntp_config.c */
extern char const * progname;
-extern char sys_phone[][MAXDIAL]; /* ACTS phone numbers */
-extern char pps_device[]; /* PPS device name */
+extern char *sys_phone[]; /* ACTS phone numbers */
#if defined(HAVE_SCHED_SETSCHEDULER)
extern int config_priority_override;
extern int config_priority;
#endif
/* ntp_control.c */
-#if 0
-struct ctl_trap;
-extern struct ctl_trap ctl_trap[];
-#endif
extern int num_ctl_traps;
extern keyid_t ctl_auth_keyid; /* keyid used for authenticating write requests */
@@ -255,6 +283,11 @@ extern u_long numasyncmsgs; /* number of async messages we've sent */
/* ntp_intres.c */
extern keyid_t req_keyid; /* request keyid */
extern char * req_file; /* name of the file with configuration info */
+#ifdef SYS_WINNT
+extern HANDLE ResolverEventHandle;
+#else
+extern int resolver_pipe_fd[2]; /* used to let the resolver process alert the parent process */
+#endif /* SYS_WINNT */
/*
* Other statistics of possible interest
@@ -306,7 +339,6 @@ extern int cal_enable; /* refclock calibrate enable */
extern int allow_panic; /* allow panic correction */
extern int mode_ntpdate; /* exit on first clock set */
extern int peer_ntpdate; /* count of ntpdate peers */
-extern int forground_process; /* run the process in the forground */
/*
* Clock state machine variables
@@ -317,8 +349,8 @@ extern int tc_counter; /* poll-adjust counter */
extern u_long last_time; /* time of last clock update (s) */
extern double last_offset; /* last clock offset (s) */
extern double allan_xpt; /* Allan intercept (s) */
-extern double sys_error; /* system RMS error (s) */
-extern double sys_jitter; /* system RMS jitter (s) */
+extern double clock_jitter; /* clock jitter (s) */
+extern double sys_jitter; /* system jitter (s) */
/* ntp_monitor.c */
extern struct mon_data mon_mru_list;
@@ -341,8 +373,8 @@ extern u_long assocpeer_calls; /* number of calls to findpeerbyassoc */
extern u_long peer_allocations; /* number of allocations from the free list */
extern u_long peer_demobilizations; /* number of structs freed to free list */
extern int total_peer_structs; /* number of peer structs in circulation */
-extern int peer_associations; /* number of active associations */
-
+extern int peer_associations; /* mobilized associations */
+extern int peer_preempt; /* preemptable associations */
/* ntp_proto.c */
/*
* System variables are declared here. See Section 3.2 of the
@@ -356,6 +388,7 @@ extern double sys_rootdispersion; /* dispersion of system clock */
extern u_int32 sys_refid; /* reference source for local clock */
extern l_fp sys_reftime; /* time we were last updated */
extern struct peer *sys_peer; /* our current peer */
+extern struct peer *sys_pps; /* our current PPS peer */
extern struct peer *sys_prefer; /* our cherished peer */
extern u_long sys_automax; /* maximum session key lifetime */
@@ -374,6 +407,7 @@ extern int sys_floor; /* cluster stratum floor */
extern int sys_ceiling; /* cluster stratum ceiling */
extern u_char sys_ttl[]; /* ttl mapping vector */
extern int sys_ttlmax; /* max ttl mapping vector index */
+extern int leap_next; /* leap consensus */
/*
* Statistics counters
@@ -391,7 +425,7 @@ extern u_long sys_received; /* packets received */
/* ntp_refclock.c */
#ifdef REFCLOCK
-#if defined(PPS) || defined(HAVE_PPSAPI)
+#ifdef PPS
extern int fdpps; /* pps file descriptor */
#endif /* PPS */
#endif
@@ -417,12 +451,15 @@ extern u_long timer_xmtcalls;
/* ntp_util.c */
extern int stats_control; /* write stats to fileset? */
+extern int stats_write_period; /* # of seconds between writes. */
+extern double stats_write_tolerance;
/* ntpd.c */
extern volatile int debug; /* debugging flag */
extern int nofork; /* no-fork flag */
extern int initializing; /* initializing flag */
-#ifdef HAVE_CLOCKCTL
+#ifdef HAVE_DROPROOT
+extern int droproot; /* flag: try to drop root privileges after startup */
extern char *user; /* user to switch to */
extern char *group; /* group to switch to */
extern char *chrootdir; /* directory to chroot to */
diff --git a/contrib/ntp/include/parse.h b/contrib/ntp/include/parse.h
index 56a92e95d15a..8b4edcf8e625 100644
--- a/contrib/ntp/include/parse.h
+++ b/contrib/ntp/include/parse.h
@@ -1,21 +1,41 @@
/*
- * /src/NTP/ntp-4/include/parse.h,v 4.5 1998/08/09 22:23:32 kardel RELEASE_19990228_A
+ * /src/NTP/REPOSITORY/ntp4-dev/include/parse.h,v 4.12 2007/01/14 08:36:03 kardel RELEASE_20070114_A
*
- * parse.h,v 4.5 1998/08/09 22:23:32 kardel RELEASE_19990228_A
+ * parse.h,v 4.12 2007/01/14 08:36:03 kardel RELEASE_20070114_A
*
- * Copyright (C) 1989-1998 by Frank Kardel
- * Friedrich-Alexander Universität Erlangen-Nürnberg, Germany
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Copyright (c) 1995-2005 by Frank Kardel <kardel <AT> ntp.org>
+ * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universität Erlangen-Nürnberg, Germany
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
*
*/
#ifndef __PARSE_H__
#define __PARSE_H__
#if !(defined(lint) || defined(__GNUC__))
- static char parsehrcsid[]="parse.h,v 4.5 1998/08/09 22:23:32 kardel RELEASE_19990228_A";
+ static char parsehrcsid[]="parse.h,v 4.12 2007/01/14 08:36:03 kardel RELEASE_20070114_A";
#endif
#include "ntp_types.h"
@@ -152,8 +172,11 @@ extern unsigned int splclock P((void));
/*
* operation flags - lower nibble contains fudge flags
*/
-#define PARSE_STATISTICS 0x08 /* enable statistics */
-#define PARSE_LEAP_DELETE 0x04 /* delete leap */
+#define PARSE_TRUSTTIME CLK_FLAG1 /* use flag1 to indicate the time2 references mean the trust time */
+#define PARSE_CLEAR CLK_FLAG2 /* use flag2 to control pps on assert */
+#define PARSE_PPSKERNEL CLK_FLAG3 /* use flag3 to bind PPS to kernel */
+#define PARSE_LEAP_DELETE CLK_FLAG4 /* use flag4 to force leap deletion - only necessary when earth slows down */
+
#define PARSE_FIXED_FMT 0x10 /* fixed format */
#define PARSE_PPSCLOCK 0x20 /* try to get PPS time stamp via ppsclock ioctl */
@@ -162,7 +185,7 @@ extern unsigned int splclock P((void));
*/
#define PARSE_TCMAX 400 /* maximum addition data size */
-typedef union timestamp
+typedef union
{
struct timeval tv; /* timeval - kernel view */
l_fp fp; /* fixed point - ntp view */
@@ -367,6 +390,13 @@ extern int parse_timedout P((parse_t *, timestamp_t *, struct timeval *));
* History:
*
* parse.h,v
+ * Revision 4.12 2007/01/14 08:36:03 kardel
+ * make timestamp union anonymous to avoid conflicts with
+ * some OSes that choose to create a nameing conflic here.
+ *
+ * Revision 4.11 2005/06/25 10:58:45 kardel
+ * add missing log keywords
+ *
* Revision 4.5 1998/08/09 22:23:32 kardel
* 4.0.73e2 adjustments
*
diff --git a/contrib/ntp/include/parse_conf.h b/contrib/ntp/include/parse_conf.h
index 0a30eb635203..319dd543c43c 100644
--- a/contrib/ntp/include/parse_conf.h
+++ b/contrib/ntp/include/parse_conf.h
@@ -1,21 +1,41 @@
/*
- * /src/NTP/ntp-4/include/parse_conf.h,v 4.2 1998/06/14 21:09:28 kardel RELEASE_19990228_A
+ * /src/NTP/ntp4-dev/include/parse_conf.h,v 4.7 2005/06/25 10:58:45 kardel RELEASE_20050625_A
*
- * parse_conf.h,v 4.2 1998/06/14 21:09:28 kardel RELEASE_19990228_A
+ * parse_conf.h,v 4.7 2005/06/25 10:58:45 kardel RELEASE_20050625_A
*
- * Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998 by Frank Kardel
- * Friedrich-Alexander Universität Erlangen-Nürnberg, Germany
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Copyright (c) 1995-2005 by Frank Kardel <kardel <AT> ntp.org>
+ * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universität Erlangen-Nürnberg, Germany
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
*
*/
#ifndef __PARSE_CONF_H__
#define __PARSE_CONF_H__
#if !(defined(lint) || defined(__GNUC__))
- static char prshrcsid[] = "parse_conf.h,v 4.2 1998/06/14 21:09:28 kardel RELEASE_19990228_A";
+ static char prshrcsid[] = "parse_conf.h,v 4.7 2005/06/25 10:58:45 kardel RELEASE_20050625_A";
#endif
/*
@@ -52,3 +72,12 @@ struct format
u_long flags;
};
#endif
+
+/*
+ * History:
+ *
+ * parse_conf.h,v
+ * Revision 4.7 2005/06/25 10:58:45 kardel
+ * add missing log keywords
+ *
+ */
diff --git a/contrib/ntp/include/recvbuff.h b/contrib/ntp/include/recvbuff.h
index 4fde7f19250a..771b90b94a88 100644
--- a/contrib/ntp/include/recvbuff.h
+++ b/contrib/ntp/include/recvbuff.h
@@ -9,6 +9,9 @@
#include "ntp_fp.h"
#include "ntp_types.h"
+#include <isc/list.h>
+#include <isc/result.h>
+
/*
* recvbuf memory management
*/
@@ -45,8 +48,11 @@ extern HANDLE get_recv_buff_event P((void));
*/
#define RX_BUFF_SIZE 1000 /* hail Mary */
+
+typedef struct recvbuf recvbuf_t;
+
struct recvbuf {
- struct recvbuf *next; /* next buffer in chain */
+ ISC_LINK(recvbuf_t) link;
union {
struct sockaddr_storage X_recv_srcadr;
caddr_t X_recv_srcclock;
@@ -56,14 +62,14 @@ struct recvbuf {
#define recv_srcclock X_from_where.X_recv_srcclock
#define recv_peer X_from_where.X_recv_peer
#if defined HAVE_IO_COMPLETION_PORT
- IoCompletionInfo iocompletioninfo;
WSABUF wsabuff;
- DWORD AddressLength;
#else
struct sockaddr_storage srcadr; /* where packet came from */
#endif
+ int src_addr_len; /* source address length */
struct interface *dstadr; /* interface datagram arrived thru */
SOCKET fd; /* fd on which it was received */
+ int msg_flags; /* Flags received about the packet */
l_fp recv_time; /* time of arrival */
void (*receiver) P((struct recvbuf *)); /* routine to receive buffer */
int recv_length; /* number of octets received */
@@ -71,6 +77,7 @@ struct recvbuf {
struct pkt X_recv_pkt;
u_char X_recv_buffer[RX_BUFF_SIZE];
} recv_space;
+ int used;
#define recv_pkt recv_space.X_recv_pkt
#define recv_buffer recv_space.X_recv_buffer
};
@@ -81,16 +88,14 @@ extern void init_recvbuff P((int));
*/
extern void freerecvbuf P((struct recvbuf *));
-
-extern struct recvbuf * getrecvbufs P((void));
-
/* Get a free buffer (typically used so an async
* read can directly place data into the buffer
*
* The buffer is removed from the free list. Make sure
* you put it back with freerecvbuf() or
*/
-extern struct recvbuf *get_free_recv_buffer P((void));
+extern struct recvbuf *get_free_recv_buffer P((void)); /* signal safe - no malloc */
+extern struct recvbuf *get_free_recv_buffer_alloc P((void)); /* signal unsafe - may malloc */
/* Add a buffer to the full list
*/
@@ -109,5 +114,10 @@ extern u_long lowater_additions P((void));
*/
extern struct recvbuf *get_full_recv_buffer P((void));
+/*
+ * Checks to see if there are buffers to process
+ */
+extern isc_boolean_t has_full_recv_buffer P((void));
+
#endif /* defined __recvbuff_h */
diff --git a/contrib/ntp/include/timepps-SCO.h b/contrib/ntp/include/timepps-SCO.h
new file mode 100644
index 000000000000..130a153c69f0
--- /dev/null
+++ b/contrib/ntp/include/timepps-SCO.h
@@ -0,0 +1,503 @@
+/***********************************************************************
+ * *
+ * Copyright (c) David L. Mills 1999-2000 *
+ * *
+ * Permission to use, copy, modify, and distribute this software and *
+ * its documentation for any purpose and without fee is hereby *
+ * granted, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission *
+ * notice appear in supporting documentation, and that the name *
+ * University of Delaware not be used in advertising or publicity *
+ * pertaining to distribution of the software without specific, *
+ * written prior permission. The University of Delaware makes no *
+ * representations about the suitability this software for any *
+ * purpose. It is provided "as is" without express or implied *
+ * warranty. *
+ * *
+ ***********************************************************************
+ * *
+ * This header file complies with "Pulse-Per-Second API for UNIX-like *
+ * Operating Systems, Version 1.0", rfc2783. Credit is due Jeff Mogul *
+ * and Marc Brett, from whom much of this code was shamelessly stolen. *
+ * *
+ * this modified timepps.h can be used to provide a PPSAPI interface *
+ * to a machine running SCO Unix. *
+ * *
+ ***********************************************************************
+ * *
+ * A full PPSAPI interface to the SCO Unix kernel would be better, but *
+ * this at least removes the necessity for special coding from the NTP *
+ * NTP drivers. *
+ * *
+ ***********************************************************************
+ * *
+ * Some of this include file *
+ * Copyright (c) 1999 by Ulrich Windl, *
+ * based on code by Reg Clemens <reg@dwf.com> *
+ * based on code by Poul-Henning Kamp <phk@FreeBSD.org> *
+ * *
+ ***********************************************************************
+ * *
+ * "THE BEER-WARE LICENSE" (Revision 42): *
+ * <phk@FreeBSD.org> wrote this file. As long as you retain this *
+ * notice you can do whatever you want with this stuff. If we meet some*
+ * day, and you think this stuff is worth it, you can buy me a beer *
+ * in return. Poul-Henning Kamp *
+ * *
+ **********************************************************************/
+
+/*SCO UNIX version, TIOCDCDTIMESTAMP assumed to exist. */
+
+#ifndef _SYS_TIMEPPS_H_
+#define _SYS_TIMEPPS_H_
+
+#include <termios.h> /* to get TIOCDCDTIMESTAMP */
+
+/* Implementation note: the logical states ``assert'' and ``clear''
+ * are implemented in terms of the UART register, i.e. ``assert''
+ * means the bit is set.
+ */
+
+/*
+ * The following definitions are architecture independent
+ */
+
+#define PPS_API_VERS_1 1 /* API version number */
+#define PPS_JAN_1970 2208988800UL /* 1970 - 1900 in seconds */
+#define PPS_NANOSECOND 1000000000L /* one nanosecond in decimal */
+#define PPS_FRAC 4294967296. /* 2^32 as a double */
+
+#define PPS_NORMALIZE(x) /* normalize timespec */ \
+ do { \
+ if ((x).tv_nsec >= PPS_NANOSECOND) { \
+ (x).tv_nsec -= PPS_NANOSECOND; \
+ (x).tv_sec++; \
+ } else if ((x).tv_nsec < 0) { \
+ (x).tv_nsec += PPS_NANOSECOND; \
+ (x).tv_sec--; \
+ } \
+ } while (0)
+
+#define PPS_TSPECTONTP(x) /* convert timespec to l_fp */ \
+ do { \
+ double d_temp; \
+ \
+ (x).integral += (unsigned int)PPS_JAN_1970; \
+ d_temp = (x).fractional * PPS_FRAC / PPS_NANOSECOND; \
+ if (d_temp >= PPS_FRAC) \
+ (x).integral++; \
+ (x).fractional = (unsigned int)d_temp; \
+ } while (0)
+
+/*
+ * Device/implementation parameters (mode)
+ */
+
+#define PPS_CAPTUREASSERT 0x01 /* capture assert events */
+#define PPS_CAPTURECLEAR 0x02 /* capture clear events */
+#define PPS_CAPTUREBOTH 0x03 /* capture assert and clear events */
+
+#define PPS_OFFSETASSERT 0x10 /* apply compensation for assert ev. */
+#define PPS_OFFSETCLEAR 0x20 /* apply compensation for clear ev. */
+#define PPS_OFFSETBOTH 0x30 /* apply compensation for both */
+
+#define PPS_CANWAIT 0x100 /* Can we wait for an event? */
+#define PPS_CANPOLL 0x200 /* "This bit is reserved for */
+
+/*
+ * Kernel actions (mode)
+ */
+
+#define PPS_ECHOASSERT 0x40 /* feed back assert event to output */
+#define PPS_ECHOCLEAR 0x80 /* feed back clear event to output */
+
+/*
+ * Timestamp formats (tsformat)
+ */
+
+#define PPS_TSFMT_TSPEC 0x1000 /* select timespec format */
+#define PPS_TSFMT_NTPFP 0x2000 /* select NTP format */
+
+/*
+ * Kernel discipline actions (not used in Solaris)
+ */
+
+#define PPS_KC_HARDPPS 0 /* enable kernel consumer */
+#define PPS_KC_HARDPPS_PLL 1 /* phase-lock mode */
+#define PPS_KC_HARDPPS_FLL 2 /* frequency-lock mode */
+
+/*
+ * Type definitions
+ */
+
+typedef unsigned long pps_seq_t; /* sequence number */
+
+typedef struct ntp_fp {
+ unsigned int integral;
+ unsigned int fractional;
+} ntp_fp_t; /* NTP-compatible time stamp */
+
+typedef union pps_timeu { /* timestamp format */
+ struct timespec tspec;
+ ntp_fp_t ntpfp;
+ unsigned long longpad[3];
+} pps_timeu_t; /* generic data type to represent time stamps */
+
+/*
+ * Timestamp information structure
+ */
+
+typedef struct pps_info {
+ pps_seq_t assert_sequence; /* seq. num. of assert event */
+ pps_seq_t clear_sequence; /* seq. num. of clear event */
+ pps_timeu_t assert_tu; /* time of assert event */
+ pps_timeu_t clear_tu; /* time of clear event */
+ int current_mode; /* current mode bits */
+} pps_info_t;
+
+#define assert_timestamp assert_tu.tspec
+#define clear_timestamp clear_tu.tspec
+
+#define assert_timestamp_ntpfp assert_tu.ntpfp
+#define clear_timestamp_ntpfp clear_tu.ntpfp
+
+/*
+ * Parameter structure
+ */
+
+typedef struct pps_params {
+ int api_version; /* API version # */
+ int mode; /* mode bits */
+ pps_timeu_t assert_off_tu; /* offset compensation for assert */
+ pps_timeu_t clear_off_tu; /* offset compensation for clear */
+} pps_params_t;
+
+#define assert_offset assert_off_tu.tspec
+#define clear_offset clear_off_tu.tspec
+
+#define assert_offset_ntpfp assert_off_tu.ntpfp
+#define clear_offset_ntpfp clear_off_tu.ntpfp
+
+/*
+ * The following definitions are architecture-dependent
+ */
+
+#define PPS_CAP (PPS_CAPTUREASSERT | PPS_OFFSETASSERT | PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)
+#define PPS_RO (PPS_CANWAIT | PPS_CANPOLL | PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)
+
+typedef struct {
+ int filedes; /* file descriptor */
+ pps_params_t params; /* PPS parameters set by user */
+ struct timeval tv_save;
+ pps_seq_t serial;
+} pps_unit_t;
+
+typedef pps_unit_t* pps_handle_t; /* pps handlebars */
+
+/*
+ *------ Here begins the implementation-specific part! ------
+ */
+
+#include <errno.h>
+
+/*
+ * create PPS handle from file descriptor
+ */
+
+static inline int
+time_pps_create(
+ int filedes, /* file descriptor */
+ pps_handle_t *handle /* returned handle */
+ )
+{
+ int one = 1;
+
+ /*
+ * Check for valid arguments and attach PPS signal.
+ */
+
+ if (!handle) {
+ errno = EFAULT;
+ return (-1); /* null pointer */
+ }
+
+ /*
+ * Allocate and initialize default unit structure.
+ */
+
+ *handle = malloc(sizeof(pps_unit_t));
+ if (!(*handle)) {
+ errno = EBADF;
+ return (-1); /* what, no memory? */
+ }
+
+ memset(*handle, 0, sizeof(pps_unit_t));
+ (*handle)->filedes = filedes;
+ (*handle)->params.api_version = PPS_API_VERS_1;
+ (*handle)->params.mode = PPS_CAPTUREASSERT | PPS_TSFMT_TSPEC;
+ return (0);
+}
+
+/*
+ * release PPS handle
+ */
+
+static inline int
+time_pps_destroy(
+ pps_handle_t handle
+ )
+{
+ /*
+ * Check for valid arguments and detach PPS signal.
+ */
+
+ if (!handle) {
+ errno = EBADF;
+ return (-1); /* bad handle */
+ }
+ free(handle);
+ return (0);
+}
+
+/*
+ * set parameters for handle
+ */
+
+static inline int
+time_pps_setparams(
+ pps_handle_t handle,
+ const pps_params_t *params
+ )
+{
+ int mode, mode_in;
+ /*
+ * Check for valid arguments and set parameters.
+ */
+
+ if (!handle) {
+ errno = EBADF;
+ return (-1); /* bad handle */
+ }
+
+ if (!params) {
+ errno = EFAULT;
+ return (-1); /* bad argument */
+ }
+
+ /*
+ * There was no reasonable consensu in the API working group.
+ * I require `api_version' to be set!
+ */
+
+ if (params->api_version != PPS_API_VERS_1) {
+ errno = EINVAL;
+ return(-1);
+ }
+
+ /*
+ * only settable modes are PPS_CAPTUREASSERT and PPS_OFFSETASSERT
+ */
+
+ mode_in = params->mode;
+
+ /* turn off read-only bits */
+
+ mode_in &= ~PPS_RO;
+
+ /* test remaining bits, should only have captureassert and/or offsetassert */
+
+ if (mode_in & ~(PPS_CAPTUREASSERT | PPS_OFFSETASSERT)) {
+ errno = EOPNOTSUPP;
+ return(-1);
+ }
+
+ /*
+ * ok, ready to go.
+ */
+
+ mode = handle->params.mode;
+ memcpy(&handle->params, params, sizeof(pps_params_t));
+ handle->params.api_version = PPS_API_VERS_1;
+ handle->params.mode = mode | mode_in;
+ return (0);
+}
+
+/*
+ * get parameters for handle
+ */
+
+static inline int
+time_pps_getparams(
+ pps_handle_t handle,
+ pps_params_t *params
+ )
+{
+ /*
+ * Check for valid arguments and get parameters.
+ */
+
+ if (!handle) {
+ errno = EBADF;
+ return (-1); /* bad handle */
+ }
+
+ if (!params) {
+ errno = EFAULT;
+ return (-1); /* bad argument */
+ }
+
+ memcpy(params, &handle->params, sizeof(pps_params_t));
+ return (0);
+}
+
+/* (
+ * get capabilities for handle
+ */
+
+static inline int
+time_pps_getcap(
+ pps_handle_t handle,
+ int *mode
+ )
+{
+ /*
+ * Check for valid arguments and get capabilities.
+ */
+
+ if (!handle) {
+ errno = EBADF;
+ return (-1); /* bad handle */
+ }
+
+ if (!mode) {
+ errno = EFAULT;
+ return (-1); /* bad argument */
+ }
+ *mode = PPS_CAP;
+ return (0);
+}
+
+/*
+ * Fetch timestamps
+ */
+
+static inline int
+time_pps_fetch(
+ pps_handle_t handle,
+ const int tsformat,
+ pps_info_t *ppsinfo,
+ const struct timespec *timeout
+ )
+{
+ struct timeval tv;
+ pps_info_t infobuf;
+
+ /*
+ * Check for valid arguments and fetch timestamps
+ */
+
+ if (!handle) {
+ errno = EBADF;
+ return (-1); /* bad handle */
+ }
+
+ if (!ppsinfo) {
+ errno = EFAULT;
+ return (-1); /* bad argument */
+ }
+
+ /*
+ * nb. PPS_CANWAIT is NOT set by the implementation, we can totally
+ * ignore the timeout variable.
+ */
+
+ memset(&infobuf, 0, sizeof(infobuf));
+
+ /*
+ * if not captureassert, nothing to return.
+ */
+
+ if (!handle->params.mode & PPS_CAPTUREASSERT) {
+ memcpy(ppsinfo, &infobuf, sizeof(pps_info_t));
+ return (0);
+ }
+
+ if (ioctl(instance->filedes, TIOCDCDTIMESTAMP, &tv) < 0) {
+ perror("time_pps_fetch:");
+ errno = EOPNOTSUPP;
+ return(-1);
+ }
+
+ /*
+ * fake serial here
+ */
+
+ if (tv.tv_sec != handle->tv_save.tv_sec || tv.tv_usec != handle->tv_save.tv_usec) {
+ handle->tv_save = tv;
+ handle->serial++;
+ }
+
+ /*
+ * Apply offsets as specified. Note that only assert timestamps
+ * are captured by this interface.
+ */
+
+ infobuf.assert_sequence = handle->serial;
+ infobuf.assert_timestamp.tv_sec = tv.tv_sec;
+ infobuf.assert_timestamp.tv_nsec = tv.tv_usec * 1000;
+
+ if (handle->params.mode & PPS_OFFSETASSERT) {
+ infobuf.assert_timestamp.tv_sec += handle->params.assert_offset.tv_sec;
+ infobuf.assert_timestamp.tv_nsec += handle->params.assert_offset.tv_nsec;
+ PPS_NORMALIZE(infobuf.assert_timestamp);
+ }
+
+ /*
+ * Translate to specified format
+ */
+
+ switch (tsformat) {
+ case PPS_TSFMT_TSPEC:
+ break; /* timespec format requires no translation */
+
+ case PPS_TSFMT_NTPFP: /* NTP format requires conversion to fraction form */
+ PPS_TSPECTONTP(infobuf.assert_timestamp_ntpfp);
+ break;
+
+ default:
+ errno = EINVAL;
+ return (-1);
+ }
+
+ infobuf.current_mode = handle->params.mode;
+ memcpy(ppsinfo, &infobuf, sizeof(pps_info_t));
+ return (0);
+}
+
+/*
+ * specify kernel consumer
+ */
+
+static inline int
+time_pps_kcbind(
+ pps_handle_t handle,
+ const int kernel_consumer,
+ const int edge, const int tsformat
+ )
+{
+ /*
+ * Check for valid arguments and bind kernel consumer
+ */
+ if (!handle) {
+ errno = EBADF;
+ return (-1); /* bad handle */
+ }
+ if (geteuid() != 0) {
+ errno = EPERM;
+ return (-1); /* must be superuser */
+ }
+ errno = EOPNOTSUPP;
+ return(-1);
+}
+
+#endif /* _SYS_TIMEPPS_H_ */
diff --git a/contrib/ntp/include/timepps-Solaris.h b/contrib/ntp/include/timepps-Solaris.h
new file mode 100644
index 000000000000..da8fd9403c71
--- /dev/null
+++ b/contrib/ntp/include/timepps-Solaris.h
@@ -0,0 +1,501 @@
+/***********************************************************************
+ * *
+ * Copyright (c) David L. Mills 1999-2000 *
+ * *
+ * Permission to use, copy, modify, and distribute this software and *
+ * its documentation for any purpose and without fee is hereby *
+ * granted, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission *
+ * notice appear in supporting documentation, and that the name *
+ * University of Delaware not be used in advertising or publicity *
+ * pertaining to distribution of the software without specific, *
+ * written prior permission. The University of Delaware makes no *
+ * representations about the suitability this software for any *
+ * purpose. It is provided "as is" without express or implied *
+ * warranty. *
+ * *
+ ***********************************************************************
+ * *
+ * This header file complies with "Pulse-Per-Second API for UNIX-like *
+ * Operating Systems, Version 1.0", rfc2783. Credit is due Jeff Mogul *
+ * and Marc Brett, from whom much of this code was shamelessly stolen. *
+ * *
+ * this modified timepps.h can be used to provide a PPSAPI interface *
+ * to a machine running Solaris (2.6 and above). *
+ * *
+ ***********************************************************************
+ * *
+ * A full PPSAPI interface to the Solaris kernel would be better, but *
+ * this at least removes the necessity for special coding from the NTP *
+ * NTP drivers. *
+ * *
+ ***********************************************************************
+ * *
+ * Some of this include file *
+ * Copyright (c) 1999 by Ulrich Windl, *
+ * based on code by Reg Clemens <reg@dwf.com> *
+ * based on code by Poul-Henning Kamp <phk@FreeBSD.org> *
+ * *
+ ***********************************************************************
+ * *
+ * "THE BEER-WARE LICENSE" (Revision 42): *
+ * <phk@FreeBSD.org> wrote this file. As long as you retain this *
+ * notice you can do whatever you want with this stuff. If we meet some*
+ * day, and you think this stuff is worth it, you can buy me a beer *
+ * in return. Poul-Henning Kamp *
+ * *
+ **********************************************************************/
+
+/* Solaris version, TIOCGPPSEV and TIOCSPPS assumed to exist. */
+
+#ifndef _SYS_TIMEPPS_H_
+#define _SYS_TIMEPPS_H_
+
+#include <termios.h> /* to get TOCGPPSEV and TIOCSPPS */
+
+/* Implementation note: the logical states ``assert'' and ``clear''
+ * are implemented in terms of the UART register, i.e. ``assert''
+ * means the bit is set.
+ */
+
+/*
+ * The following definitions are architecture independent
+ */
+
+#define PPS_API_VERS_1 1 /* API version number */
+#define PPS_JAN_1970 2208988800UL /* 1970 - 1900 in seconds */
+#define PPS_NANOSECOND 1000000000L /* one nanosecond in decimal */
+#define PPS_FRAC 4294967296. /* 2^32 as a double */
+
+#define PPS_NORMALIZE(x) /* normalize timespec */ \
+ do { \
+ if ((x).tv_nsec >= PPS_NANOSECOND) { \
+ (x).tv_nsec -= PPS_NANOSECOND; \
+ (x).tv_sec++; \
+ } else if ((x).tv_nsec < 0) { \
+ (x).tv_nsec += PPS_NANOSECOND; \
+ (x).tv_sec--; \
+ } \
+ } while (0)
+
+#define PPS_TSPECTONTP(x) /* convert timespec to l_fp */ \
+ do { \
+ double d_temp; \
+ \
+ (x).integral += (unsigned int)PPS_JAN_1970; \
+ d_temp = (x).fractional * PPS_FRAC / PPS_NANOSECOND; \
+ if (d_temp >= PPS_FRAC) \
+ (x).integral++; \
+ (x).fractional = (unsigned int)d_temp; \
+ } while (0)
+
+/*
+ * Device/implementation parameters (mode)
+ */
+
+#define PPS_CAPTUREASSERT 0x01 /* capture assert events */
+#define PPS_CAPTURECLEAR 0x02 /* capture clear events */
+#define PPS_CAPTUREBOTH 0x03 /* capture assert and clear events */
+
+#define PPS_OFFSETASSERT 0x10 /* apply compensation for assert ev. */
+#define PPS_OFFSETCLEAR 0x20 /* apply compensation for clear ev. */
+#define PPS_OFFSETBOTH 0x30 /* apply compensation for both */
+
+#define PPS_CANWAIT 0x100 /* Can we wait for an event? */
+#define PPS_CANPOLL 0x200 /* "This bit is reserved for */
+
+/*
+ * Kernel actions (mode)
+ */
+
+#define PPS_ECHOASSERT 0x40 /* feed back assert event to output */
+#define PPS_ECHOCLEAR 0x80 /* feed back clear event to output */
+
+/*
+ * Timestamp formats (tsformat)
+ */
+
+#define PPS_TSFMT_TSPEC 0x1000 /* select timespec format */
+#define PPS_TSFMT_NTPFP 0x2000 /* select NTP format */
+
+/*
+ * Kernel discipline actions (not used in Solaris)
+ */
+
+#define PPS_KC_HARDPPS 0 /* enable kernel consumer */
+#define PPS_KC_HARDPPS_PLL 1 /* phase-lock mode */
+#define PPS_KC_HARDPPS_FLL 2 /* frequency-lock mode */
+
+/*
+ * Type definitions
+ */
+
+typedef unsigned long pps_seq_t; /* sequence number */
+
+typedef struct ntp_fp {
+ unsigned int integral;
+ unsigned int fractional;
+} ntp_fp_t; /* NTP-compatible time stamp */
+
+typedef union pps_timeu { /* timestamp format */
+ struct timespec tspec;
+ ntp_fp_t ntpfp;
+ unsigned long longpad[3];
+} pps_timeu_t; /* generic data type to represent time stamps */
+
+/*
+ * Timestamp information structure
+ */
+
+typedef struct pps_info {
+ pps_seq_t assert_sequence; /* seq. num. of assert event */
+ pps_seq_t clear_sequence; /* seq. num. of clear event */
+ pps_timeu_t assert_tu; /* time of assert event */
+ pps_timeu_t clear_tu; /* time of clear event */
+ int current_mode; /* current mode bits */
+} pps_info_t;
+
+#define assert_timestamp assert_tu.tspec
+#define clear_timestamp clear_tu.tspec
+
+#define assert_timestamp_ntpfp assert_tu.ntpfp
+#define clear_timestamp_ntpfp clear_tu.ntpfp
+
+/*
+ * Parameter structure
+ */
+
+typedef struct pps_params {
+ int api_version; /* API version # */
+ int mode; /* mode bits */
+ pps_timeu_t assert_off_tu; /* offset compensation for assert */
+ pps_timeu_t clear_off_tu; /* offset compensation for clear */
+} pps_params_t;
+
+#define assert_offset assert_off_tu.tspec
+#define clear_offset clear_off_tu.tspec
+
+#define assert_offset_ntpfp assert_off_tu.ntpfp
+#define clear_offset_ntpfp clear_off_tu.ntpfp
+
+/*
+ * The following definitions are architecture-dependent
+ */
+
+#define PPS_CAP (PPS_CAPTUREASSERT | PPS_OFFSETASSERT | PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)
+#define PPS_RO (PPS_CANWAIT | PPS_CANPOLL | PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)
+
+typedef struct {
+ int filedes; /* file descriptor */
+ pps_params_t params; /* PPS parameters set by user */
+} pps_unit_t;
+
+typedef pps_unit_t* pps_handle_t; /* pps handlebars */
+
+/*
+ *------ Here begins the implementation-specific part! ------
+ */
+
+#include <errno.h>
+
+/*
+ * create PPS handle from file descriptor
+ */
+
+static inline int
+time_pps_create(
+ int filedes, /* file descriptor */
+ pps_handle_t *handle /* returned handle */
+ )
+{
+ int one = 1;
+
+ /*
+ * Check for valid arguments and attach PPS signal.
+ */
+
+ if (!handle) {
+ errno = EFAULT;
+ return (-1); /* null pointer */
+ }
+
+ if (ioctl(filedes, TIOCSPPS, &one) < 0) {
+ perror("refclock_ioctl: TIOCSPPS failed:");
+ return (-1);
+ }
+
+ /*
+ * Allocate and initialize default unit structure.
+ */
+
+ *handle = malloc(sizeof(pps_unit_t));
+ if (!(*handle)) {
+ errno = EBADF;
+ return (-1); /* what, no memory? */
+ }
+
+ memset(*handle, 0, sizeof(pps_unit_t));
+ (*handle)->filedes = filedes;
+ (*handle)->params.api_version = PPS_API_VERS_1;
+ (*handle)->params.mode = PPS_CAPTUREASSERT | PPS_TSFMT_TSPEC;
+ return (0);
+}
+
+/*
+ * release PPS handle
+ */
+
+static inline int
+time_pps_destroy(
+ pps_handle_t handle
+ )
+{
+ /*
+ * Check for valid arguments and detach PPS signal.
+ */
+
+ if (!handle) {
+ errno = EBADF;
+ return (-1); /* bad handle */
+ }
+ free(handle);
+ return (0);
+}
+
+/*
+ * set parameters for handle
+ */
+
+static inline int
+time_pps_setparams(
+ pps_handle_t handle,
+ const pps_params_t *params
+ )
+{
+ int mode, mode_in;
+ /*
+ * Check for valid arguments and set parameters.
+ */
+
+ if (!handle) {
+ errno = EBADF;
+ return (-1); /* bad handle */
+ }
+
+ if (!params) {
+ errno = EFAULT;
+ return (-1); /* bad argument */
+ }
+
+ /*
+ * There was no reasonable consensu in the API working group.
+ * I require `api_version' to be set!
+ */
+
+ if (params->api_version != PPS_API_VERS_1) {
+ errno = EINVAL;
+ return(-1);
+ }
+
+ /*
+ * only settable modes are PPS_CAPTUREASSERT and PPS_OFFSETASSERT
+ */
+
+ mode_in = params->mode;
+
+ /* turn off read-only bits */
+
+ mode_in &= ~PPS_RO;
+
+ /* test remaining bits, should only have captureassert and/or offsetassert */
+
+ if (mode_in & ~(PPS_CAPTUREASSERT | PPS_OFFSETASSERT)) {
+ errno = EOPNOTSUPP;
+ return(-1);
+ }
+
+ /*
+ * ok, ready to go.
+ */
+
+ mode = handle->params.mode;
+ memcpy(&handle->params, params, sizeof(pps_params_t));
+ handle->params.api_version = PPS_API_VERS_1;
+ handle->params.mode = mode | mode_in;
+ return (0);
+}
+
+/*
+ * get parameters for handle
+ */
+
+static inline int
+time_pps_getparams(
+ pps_handle_t handle,
+ pps_params_t *params
+ )
+{
+ /*
+ * Check for valid arguments and get parameters.
+ */
+
+ if (!handle) {
+ errno = EBADF;
+ return (-1); /* bad handle */
+ }
+
+ if (!params) {
+ errno = EFAULT;
+ return (-1); /* bad argument */
+ }
+
+ memcpy(params, &handle->params, sizeof(pps_params_t));
+ return (0);
+}
+
+/* (
+ * get capabilities for handle
+ */
+
+static inline int
+time_pps_getcap(
+ pps_handle_t handle,
+ int *mode
+ )
+{
+ /*
+ * Check for valid arguments and get capabilities.
+ */
+
+ if (!handle) {
+ errno = EBADF;
+ return (-1); /* bad handle */
+ }
+
+ if (!mode) {
+ errno = EFAULT;
+ return (-1); /* bad argument */
+ }
+ *mode = PPS_CAP;
+ return (0);
+}
+
+/*
+ * Fetch timestamps
+ */
+
+static inline int
+time_pps_fetch(
+ pps_handle_t handle,
+ const int tsformat,
+ pps_info_t *ppsinfo,
+ const struct timespec *timeout
+ )
+{
+ struct ppsclockev {
+ struct timeval tv;
+ u_int serial;
+ } ev;
+
+ pps_info_t infobuf;
+
+ /*
+ * Check for valid arguments and fetch timestamps
+ */
+
+ if (!handle) {
+ errno = EBADF;
+ return (-1); /* bad handle */
+ }
+
+ if (!ppsinfo) {
+ errno = EFAULT;
+ return (-1); /* bad argument */
+ }
+
+ /*
+ * nb. PPS_CANWAIT is NOT set by the implementation, we can totally
+ * ignore the timeout variable.
+ */
+
+ memset(&infobuf, 0, sizeof(infobuf));
+
+ /*
+ * if not captureassert, nothing to return.
+ */
+
+ if (!handle->params.mode & PPS_CAPTUREASSERT) {
+ memcpy(ppsinfo, &infobuf, sizeof(pps_info_t));
+ return (0);
+ }
+
+ if (ioctl(handle->filedes, TIOCGPPSEV, (caddr_t) &ev) < 0) {
+ perror("time_pps_fetch:");
+ errno = EOPNOTSUPP;
+ return(-1);
+ }
+
+ /*
+ * Apply offsets as specified. Note that only assert timestamps
+ * are captured by this interface.
+ */
+
+ infobuf.assert_sequence = ev.serial;
+ infobuf.assert_timestamp.tv_sec = ev.tv.tv_sec;
+ infobuf.assert_timestamp.tv_nsec = ev.tv.tv_usec * 1000;
+
+ if (handle->params.mode & PPS_OFFSETASSERT) {
+ infobuf.assert_timestamp.tv_sec += handle->params.assert_offset.tv_sec;
+ infobuf.assert_timestamp.tv_nsec += handle->params.assert_offset.tv_nsec;
+ PPS_NORMALIZE(infobuf.assert_timestamp);
+ }
+
+ /*
+ * Translate to specified format
+ */
+
+ switch (tsformat) {
+ case PPS_TSFMT_TSPEC:
+ break; /* timespec format requires no translation */
+
+ case PPS_TSFMT_NTPFP: /* NTP format requires conversion to fraction form */
+ PPS_TSPECTONTP(infobuf.assert_timestamp_ntpfp);
+ break;
+
+ default:
+ errno = EINVAL;
+ return (-1);
+ }
+
+ infobuf.current_mode = handle->params.mode;
+ memcpy(ppsinfo, &infobuf, sizeof(pps_info_t));
+ return (0);
+}
+
+/*
+ * specify kernel consumer
+ */
+
+static inline int
+time_pps_kcbind(
+ pps_handle_t handle,
+ const int kernel_consumer,
+ const int edge, const int tsformat
+ )
+{
+ /*
+ * Check for valid arguments and bind kernel consumer
+ */
+ if (!handle) {
+ errno = EBADF;
+ return (-1); /* bad handle */
+ }
+ if (geteuid() != 0) {
+ errno = EPERM;
+ return (-1); /* must be superuser */
+ }
+ errno = EOPNOTSUPP;
+ return(-1);
+}
+
+#endif /* _SYS_TIMEPPS_H_ */
diff --git a/contrib/ntp/include/timepps-SunOS.h b/contrib/ntp/include/timepps-SunOS.h
new file mode 100644
index 000000000000..6cd166e69c54
--- /dev/null
+++ b/contrib/ntp/include/timepps-SunOS.h
@@ -0,0 +1,504 @@
+/***********************************************************************
+ * *
+ * Copyright (c) David L. Mills 1999-2000 *
+ * *
+ * Permission to use, copy, modify, and distribute this software and *
+ * its documentation for any purpose and without fee is hereby *
+ * granted, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission *
+ * notice appear in supporting documentation, and that the name *
+ * University of Delaware not be used in advertising or publicity *
+ * pertaining to distribution of the software without specific, *
+ * written prior permission. The University of Delaware makes no *
+ * representations about the suitability this software for any *
+ * purpose. It is provided "as is" without express or implied *
+ * warranty. *
+ * *
+ ***********************************************************************
+ * *
+ * This header file complies with "Pulse-Per-Second API for UNIX-like *
+ * Operating Systems, Version 1.0", rfc2783. Credit is due Jeff Mogul *
+ * and Marc Brett, from whom much of this code was shamelessly stolen. *
+ * *
+ * this modified timepps.h can be used to provide a PPSAPI interface *
+ * to a machine running SunOS. *
+ * *
+ ***********************************************************************
+ * *
+ * A full PPSAPI interface to the SunOS kernel would be better, but *
+ * this at least removes the necessity for special coding from the NTP *
+ * NTP drivers. *
+ * *
+ ***********************************************************************
+ * *
+ * Some of this include file *
+ * Copyright (c) 1999 by Ulrich Windl, *
+ * based on code by Reg Clemens <reg@dwf.com> *
+ * based on code by Poul-Henning Kamp <phk@FreeBSD.org> *
+ * *
+ ***********************************************************************
+ * *
+ * "THE BEER-WARE LICENSE" (Revision 42): *
+ * <phk@FreeBSD.org> wrote this file. As long as you retain this *
+ * notice you can do whatever you want with this stuff. If we meet some*
+ * day, and you think this stuff is worth it, you can buy me a beer *
+ * in return. Poul-Henning Kamp *
+ * *
+ **********************************************************************/
+
+/* SunOS version, CIOGETEV assumed to exist for SunOS */
+
+#ifndef _SYS_TIMEPPS_H_
+#define _SYS_TIMEPPS_H_
+
+#include <termios.h> /* to get CIOGETEV */
+
+/* Implementation note: the logical states ``assert'' and ``clear''
+ * are implemented in terms of the UART register, i.e. ``assert''
+ * means the bit is set.
+ */
+
+/*
+ * The following definitions are architecture independent
+ */
+
+#define PPS_API_VERS_1 1 /* API version number */
+#define PPS_JAN_1970 2208988800UL /* 1970 - 1900 in seconds */
+#define PPS_NANOSECOND 1000000000L /* one nanosecond in decimal */
+#define PPS_FRAC 4294967296. /* 2^32 as a double */
+
+#define PPS_NORMALIZE(x) /* normalize timespec */ \
+ do { \
+ if ((x).tv_nsec >= PPS_NANOSECOND) { \
+ (x).tv_nsec -= PPS_NANOSECOND; \
+ (x).tv_sec++; \
+ } else if ((x).tv_nsec < 0) { \
+ (x).tv_nsec += PPS_NANOSECOND; \
+ (x).tv_sec--; \
+ } \
+ } while (0)
+
+#define PPS_TSPECTONTP(x) /* convert timespec to l_fp */ \
+ do { \
+ double d_temp; \
+ \
+ (x).integral += (unsigned int)PPS_JAN_1970; \
+ d_temp = (x).fractional * PPS_FRAC / PPS_NANOSECOND; \
+ if (d_temp >= PPS_FRAC) \
+ (x).integral++; \
+ (x).fractional = (unsigned int)d_temp; \
+ } while (0)
+
+/*
+ * Device/implementation parameters (mode)
+ */
+
+#define PPS_CAPTUREASSERT 0x01 /* capture assert events */
+#define PPS_CAPTURECLEAR 0x02 /* capture clear events */
+#define PPS_CAPTUREBOTH 0x03 /* capture assert and clear events */
+
+#define PPS_OFFSETASSERT 0x10 /* apply compensation for assert ev. */
+#define PPS_OFFSETCLEAR 0x20 /* apply compensation for clear ev. */
+#define PPS_OFFSETBOTH 0x30 /* apply compensation for both */
+
+#define PPS_CANWAIT 0x100 /* Can we wait for an event? */
+#define PPS_CANPOLL 0x200 /* "This bit is reserved for */
+
+/*
+ * Kernel actions (mode)
+ */
+
+#define PPS_ECHOASSERT 0x40 /* feed back assert event to output */
+#define PPS_ECHOCLEAR 0x80 /* feed back clear event to output */
+
+/*
+ * Timestamp formats (tsformat)
+ */
+
+#define PPS_TSFMT_TSPEC 0x1000 /* select timespec format */
+#define PPS_TSFMT_NTPFP 0x2000 /* select NTP format */
+
+/*
+ * Kernel discipline actions (not used in SunOS)
+ */
+
+#define PPS_KC_HARDPPS 0 /* enable kernel consumer */
+#define PPS_KC_HARDPPS_PLL 1 /* phase-lock mode */
+#define PPS_KC_HARDPPS_FLL 2 /* frequency-lock mode */
+
+/*
+ * Type definitions
+ */
+
+typedef unsigned long pps_seq_t; /* sequence number */
+
+typedef struct ntp_fp {
+ unsigned int integral;
+ unsigned int fractional;
+} ntp_fp_t; /* NTP-compatible time stamp */
+
+typedef union pps_timeu { /* timestamp format */
+ struct timespec tspec;
+ ntp_fp_t ntpfp;
+ unsigned long longpad[3];
+} pps_timeu_t; /* generic data type to represent time stamps */
+
+/*
+ * Timestamp information structure
+ */
+
+typedef struct pps_info {
+ pps_seq_t assert_sequence; /* seq. num. of assert event */
+ pps_seq_t clear_sequence; /* seq. num. of clear event */
+ pps_timeu_t assert_tu; /* time of assert event */
+ pps_timeu_t clear_tu; /* time of clear event */
+ int current_mode; /* current mode bits */
+} pps_info_t;
+
+#define assert_timestamp assert_tu.tspec
+#define clear_timestamp clear_tu.tspec
+
+#define assert_timestamp_ntpfp assert_tu.ntpfp
+#define clear_timestamp_ntpfp clear_tu.ntpfp
+
+/*
+ * Parameter structure
+ */
+
+typedef struct pps_params {
+ int api_version; /* API version # */
+ int mode; /* mode bits */
+ pps_timeu_t assert_off_tu; /* offset compensation for assert */
+ pps_timeu_t clear_off_tu; /* offset compensation for clear */
+} pps_params_t;
+
+#define assert_offset assert_off_tu.tspec
+#define clear_offset clear_off_tu.tspec
+
+#define assert_offset_ntpfp assert_off_tu.ntpfp
+#define clear_offset_ntpfp clear_off_tu.ntpfp
+
+/*
+ * The following definitions are architecture-dependent
+ */
+
+#define PPS_CAP (PPS_CAPTUREASSERT | PPS_OFFSETASSERT | PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)
+#define PPS_RO (PPS_CANWAIT | PPS_CANPOLL | PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)
+
+typedef struct {
+ int filedes; /* file descriptor */
+ pps_params_t params; /* PPS parameters set by user */
+} pps_unit_t;
+
+typedef pps_unit_t* pps_handle_t; /* pps handlebars */
+
+/*
+ *------ Here begins the implementation-specific part! ------
+ */
+
+#include <errno.h>
+
+/*
+ * create PPS handle from file descriptor
+ */
+
+static inline int
+time_pps_create(
+ int filedes, /* file descriptor */
+ pps_handle_t *handle /* returned handle */
+ )
+{
+ /*
+ * Check for valid arguments and attach PPS signal.
+ */
+
+ if (!handle) {
+ errno = EFAULT;
+ return (-1); /* null pointer */
+ }
+
+ if (ioctl(filedes, I_PUSH, "ppsclock") < 0) {
+ perror("time_pps_create: I_PUSH ppsclock failed");
+ return (-1);
+ }
+
+ /*
+ * Allocate and initialize default unit structure.
+ */
+
+ *handle = malloc(sizeof(pps_unit_t));
+ if (!(*handle)) {
+ errno = EBADF;
+ return (-1); /* what, no memory? */
+ }
+
+ memset(*handle, 0, sizeof(pps_unit_t));
+ (*handle)->filedes = filedes;
+ (*handle)->params.api_version = PPS_API_VERS_1;
+ (*handle)->params.mode = PPS_CAPTUREASSERT | PPS_TSFMT_TSPEC;
+ return (0);
+}
+
+/*
+ * release PPS handle
+ */
+
+static inline int
+time_pps_destroy(
+ pps_handle_t handle
+ )
+{
+ /*
+ * Check for valid arguments and detach PPS signal.
+ */
+
+ if (!handle) {
+ errno = EBADF;
+ return (-1); /* bad handle */
+ }
+ free(handle);
+ return (0);
+}
+
+/*
+ * set parameters for handle
+ */
+
+static inline int
+time_pps_setparams(
+ pps_handle_t handle,
+ const pps_params_t *params
+ )
+{
+ int mode, mode_in;
+ /*
+ * Check for valid arguments and set parameters.
+ */
+
+ if (!handle) {
+ errno = EBADF;
+ return (-1); /* bad handle */
+ }
+
+ if (!params) {
+ errno = EFAULT;
+ return (-1); /* bad argument */
+ }
+
+ /*
+ * There was no reasonable consensu in the API working group.
+ * I require `api_version' to be set!
+ */
+
+ if (params->api_version != PPS_API_VERS_1) {
+ errno = EINVAL;
+ return(-1);
+ }
+
+ /*
+ * only settable modes are PPS_CAPTUREASSERT and PPS_OFFSETASSERT
+ */
+
+ mode_in = params->mode;
+
+ /* turn off read-only bits */
+
+ mode_in &= ~PPS_RO;
+
+ /* test remaining bits, should only have captureassert and/or offsetassert */
+
+ if (mode_in & ~(PPS_CAPTUREASSERT | PPS_OFFSETASSERT)) {
+ errno = EOPNOTSUPP;
+ return(-1);
+ }
+
+ /*
+ * ok, ready to go.
+ */
+
+ mode = handle->params.mode;
+ memcpy(&handle->params, params, sizeof(pps_params_t));
+ handle->params.api_version = PPS_API_VERS_1;
+ handle->params.mode = mode | mode_in;
+ return (0);
+}
+
+/*
+ * get parameters for handle
+ */
+
+static inline int
+time_pps_getparams(
+ pps_handle_t handle,
+ pps_params_t *params
+ )
+{
+ /*
+ * Check for valid arguments and get parameters.
+ */
+
+ if (!handle) {
+ errno = EBADF;
+ return (-1); /* bad handle */
+ }
+
+ if (!params) {
+ errno = EFAULT;
+ return (-1); /* bad argument */
+ }
+
+ memcpy(params, &handle->params, sizeof(pps_params_t));
+ return (0);
+}
+
+/* (
+ * get capabilities for handle
+ */
+
+static inline int
+time_pps_getcap(
+ pps_handle_t handle,
+ int *mode
+ )
+{
+ /*
+ * Check for valid arguments and get capabilities.
+ */
+
+ if (!handle) {
+ errno = EBADF;
+ return (-1); /* bad handle */
+ }
+
+ if (!mode) {
+ errno = EFAULT;
+ return (-1); /* bad argument */
+ }
+ *mode = PPS_CAP;
+ return (0);
+}
+
+/*
+ * Fetch timestamps
+ */
+
+static inline int
+time_pps_fetch(
+ pps_handle_t handle,
+ const int tsformat,
+ pps_info_t *ppsinfo,
+ const struct timespec *timeout
+ )
+{
+ struct ppsclockev {
+ struct timeval tv;
+ u_int serial;
+ } ev;
+ pps_info_t infobuf;
+
+ /*
+ * Check for valid arguments and fetch timestamps
+ */
+
+ if (!handle) {
+ errno = EBADF;
+ return (-1); /* bad handle */
+ }
+
+ if (!ppsinfo) {
+ errno = EFAULT;
+ return (-1); /* bad argument */
+ }
+
+ /*
+ * nb. PPS_CANWAIT is NOT set by the implementation, we can totally
+ * ignore the timeout variable.
+ */
+
+ memset(&infobuf, 0, sizeof(infobuf));
+
+ /*
+ * if not captureassert, nothing to return.
+ */
+
+ if (!handle->params.mode & PPS_CAPTUREASSERT) {
+ memcpy(ppsinfo, &infobuf, sizeof(pps_info_t));
+ return (0);
+ }
+
+#if defined(__STDC__)
+#define CIOGETEV _IOR('C', 0, struct ppsclockev) /* get last pps event */
+#else
+#define CIOGETEV _IOR(C, 0, struct ppsclockev) /* get last pps event */
+#endif
+
+ if (ioctl(handle->filedes, CIOGETEV, (caddr_t) &ev) < 0) {
+ perror("time_pps_fetch:");
+ errno = EOPNOTSUPP;
+ return(-1);
+ }
+
+ /*
+ * Apply offsets as specified. Note that only assert timestamps
+ * are captured by this interface.
+ */
+
+ infobuf.assert_sequence = ev.serial;
+ infobuf.assert_timestamp.tv_sec = ev.tv.tv_sec;
+ infobuf.assert_timestamp.tv_nsec = ev.tv.tv_usec * 1000;
+
+ if (handle->params.mode & PPS_OFFSETASSERT) {
+ infobuf.assert_timestamp.tv_sec += handle->params.assert_offset.tv_sec;
+ infobuf.assert_timestamp.tv_nsec += handle->params.assert_offset.tv_nsec;
+ PPS_NORMALIZE(infobuf.assert_timestamp);
+ }
+
+ /*
+ * Translate to specified format
+ */
+
+ switch (tsformat) {
+ case PPS_TSFMT_TSPEC:
+ break; /* timespec format requires no translation */
+
+ case PPS_TSFMT_NTPFP: /* NTP format requires conversion to fraction form */
+ PPS_TSPECTONTP(infobuf.assert_timestamp_ntpfp);
+ break;
+
+ default:
+ errno = EINVAL;
+ return (-1);
+ }
+
+ infobuf.current_mode = handle->params.mode;
+ memcpy(ppsinfo, &infobuf, sizeof(pps_info_t));
+ return (0);
+}
+
+/*
+ * specify kernel consumer
+ */
+
+static inline int
+time_pps_kcbind(
+ pps_handle_t handle,
+ const int kernel_consumer,
+ const int edge, const int tsformat
+ )
+{
+ /*
+ * Check for valid arguments and bind kernel consumer
+ */
+ if (!handle) {
+ errno = EBADF;
+ return (-1); /* bad handle */
+ }
+ if (geteuid() != 0) {
+ errno = EPERM;
+ return (-1); /* must be superuser */
+ }
+ errno = EOPNOTSUPP;
+ return(-1);
+}
+
+#endif /* _SYS_TIMEPPS_H_ */
diff --git a/contrib/ntp/include/trimble.h b/contrib/ntp/include/trimble.h
index 58a1a3aa8cf9..0387639612c8 100644
--- a/contrib/ntp/include/trimble.h
+++ b/contrib/ntp/include/trimble.h
@@ -1,9 +1,36 @@
/*
- * /src/NTP/ntp-4/include/trimble.h,v 4.4 1999/02/28 11:41:11 kardel RELEASE_19990228_A
+ * /src/NTP/ntp4-dev/include/trimble.h,v 4.6 2005/04/16 17:32:10 kardel RELEASE_20050508_A
+ *
+ * trimble.h,v 4.6 2005/04/16 17:32:10 kardel RELEASE_20050508_A
*
* $Created: Sun Aug 2 16:16:49 1998 $
*
- * Copyright (C) 1998 by Frank Kardel
+ * Copyright (c) 1998-2005 by Frank Kardel <kardel <AT> ntp.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
*/
#ifndef TRIMBLE_H
#define TRIMBLE_H
@@ -109,7 +136,15 @@ extern cmd_info_t *trimble_convert P((unsigned int cmd, cmd_info_t *tbl));
#endif
/*
+ * History:
+ *
* trimble.h,v
+ * Revision 4.6 2005/04/16 17:32:10 kardel
+ * update copyright
+ *
+ * Revision 4.5 2004/11/14 15:29:41 kardel
+ * support PPSAPI, upgrade Copyright to Berkeley style
+ *
* Revision 4.4 1999/02/28 11:41:11 kardel
* (CMD_RUTCPARAM): control variable name unification
*
diff --git a/contrib/ntp/include/version.def b/contrib/ntp/include/version.def
new file mode 100644
index 000000000000..b17d656155fc
--- /dev/null
+++ b/contrib/ntp/include/version.def
@@ -0,0 +1 @@
+version = '4.2.4p5';