[ntp:bk-ntp-dev-send] BitKeeper patch
stenn at whimsy.udel.edu
stenn at whimsy.udel.edu
Mon Jun 30 04:48:16 PDT 2003
This BitKeeper patch contains the following changesets:
stenn at whimsy.udel.edu|ChangeSet|20030628081443|04061
stenn at whimsy.udel.edu|ChangeSet|20030630105105|19014
stenn at whimsy.udel.edu|ChangeSet|20030630111408|19002
stenn at whimsy.udel.edu|ChangeSet|20030630112647|04053
stenn at whimsy.udel.edu|ChangeSet|20030630114206|19002
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# ID: stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
# User: stenn
# Host: whimsy.udel.edu
# Root: /backroom/ntp-dev
#
#--- 1.219.3.45/configure.in Tue Jun 10 04:08:47 2003
#+++ 1.317/configure.in Mon Jun 30 05:52:15 2003
#@@ -5,12 +5,13 @@
# AC_DEFINE_UNQUOTED(STR_SYSTEM, "$host", [canonical system (cpu-vendor-os) string])
# AM_CONFIG_HEADER(config.h)
# AC_ARG_PROGRAM
#-AM_INIT_AUTOMAKE(ntp, 4.1.1c-rc3)
#+AM_INIT_AUTOMAKE(ntp, 4.1.80-rc1)
# AC_PREREQ(2.53)
#
# ac_cv_var_atom_ok=no
# ac_cv_var_oncore_ok=no
# ac_cv_var_ripe_ncc_ok=no
#+ac_cv_var_jupiter_ok=no
#
# dnl Grab any initial CFLAGS so we can pick better defaults.
# iCFLAGS="$CFLAGS"
#@@ -52,6 +53,27 @@
# ;;
# esac
#
#+AC_CACHE_CHECK(if we should use /dev/clockctl, ac_clockctl,
#+[AC_ARG_ENABLE(clockctl,
#+ AC_HELP_STRING([--enable-clockctl], [Use /dev/clockctl for non-root time control]),
#+ [ans=$enableval],
#+ [case "$target" in
#+ *-*-netbsd*)
#+ ans=yes
#+ ;;
#+ *) ans=no
#+ ;;
#+ esac
#+ ])
#+ac_clockctl=$ans])
#+# End of AC_CACHE_CHECK for clockctl
#+AC_CHECK_HEADERS(sys/clockctl.h)
#+case "$ac_clockctl$ac_cv_header_sys_clockctl_h" in
#+ yesyes)
#+ AC_DEFINE(HAVE_CLOCKCTL, ,[[Use /dev/clockctl?]])
#+ ;;
#+esac
#+
# case "$build" in
# $host)
# ;;
#@@ -205,6 +227,9 @@
# AC_CHECK_FUNC(openlog, ,
# AC_CHECK_LIB(gen, openlog, ,
# AC_CHECK_LIB(syslog, openlog, , , -lsocket)))
#+AC_CHECK_LIB(md5, MD5Init, ,
#+ AC_CHECK_LIB(md, MD5Init))
#+AC_CHECK_FUNCS(MD5Init)
# dnl HMS: What a hack...
# AC_CHECK_HEADERS(readline/history.h readline/readline.h)
# case "$ac_cv_header_readline_history_h$ac_cv_header_readline_readline_h" in
#@@ -237,8 +262,10 @@
# AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
#
# AC_HEADER_STDC
#-AC_CHECK_HEADERS(bstring.h errno.h fcntl.h ieeefp.h math.h memory.h netdb.h)
#-AC_CHECK_HEADERS(poll.h resolv.h sched.h sgtty.h stdlib.h string.h termio.h)
#+AC_CHECK_HEADERS(bstring.h errno.h fcntl.h ieeefp.h math.h)
#+AC_CHECK_HEADERS(md5.h)
#+AC_CHECK_HEADERS(memory.h netdb.h poll.h)
#+AC_CHECK_HEADERS(sched.h sgtty.h stdlib.h string.h termio.h)
# AC_CHECK_HEADERS(termios.h timepps.h timex.h unistd.h)
# case "$host" in
# *-*-aix*)
#@@ -250,8 +277,26 @@
# ;;
# *) AC_CHECK_HEADERS(utmp.h utmpx.h) ;;
# esac
#-AC_CHECK_HEADERS(arpa/nameser.h net/if.h netinet/in_system.h)
#-AC_CHECK_HEADERS(netinet/in_systm.h netinet/in.h netinet/ip.h)
#+AC_CHECK_HEADERS(arpa/nameser.h)
#+AC_CHECK_HEADERS(net/if.h, [], [],
#+[#if HAVE_SYS_SOCKET_H
#+#include <sys/socket.h>
#+#endif
#+])
#+AC_CHECK_HEADERS(net/if6.h)
#+AC_CHECK_HEADERS(netinet/in_system.h netinet/in_systm.h)
#+AC_CHECK_HEADERS(netinet/in.h)
#+AC_CHECK_HEADERS(netinet/ip.h, [], [],
#+[#if HAVE_SYS_TYPES_H
#+#include <sys/types.h>
#+#endif
#+#if HAVE_NETINET_IN_H
#+#include <netinet/in.h>
#+#endif
#+#if HAVE_NETINET_IN_SYSTM_H
#+#include <netinet/in_systm.h>
#+#endif
#+])
# AC_CHECK_HEADERS(netinfo/ni.h, [AC_DEFINE(HAVE_NETINFO, 1, [NetInfo support?])])
# AC_CHECK_HEADERS(sun/audioio.h sys/audioio.h)
# dnl AC_CHECK_HEADERS(sys/chudefs.h)
#@@ -301,6 +346,27 @@
# fi
# ])dnl
#
#+dnl AC_CHECK_HEADERS(net/if.h, [], [],
#+dnl [#if HAVE_SYS_TYPES_H
#+dnl # include <sys/types.h>
#+dnl #endif
#+dnl #if HAVE_SYS_SOCKET_H
#+dnl # include <sys/socket.h>
#+dnl #endif
#+dnl ])
#+
#+AC_CHECK_HEADERS(resolv.h, [], [],
#+[#if HAVE_SYS_TYPES_H
#+#include <sys/types.h>
#+#endif
#+#if HAVE_NETINET_IN_H
#+#include <netinet/in.h>
#+#endif
#+#if HAVE_ARPA_NAMESER_H
#+#include <arpa/nameser.h>
#+#endif
#+])
#+
# AC_CACHE_CHECK(for basic volatile support, ac_cv_c_volatile,
# [AC_TRY_COMPILE([],[
# volatile int x;],
#@@ -340,6 +406,26 @@
# AC_CHECK_TYPE(time_t, long)
# AC_STRUCT_TM
#
#+AC_CACHE_CHECK([for u_int8_t], ac_cv_type_u_int8_t,
#+[AC_TRY_COMPILE([#include <sys/types.h>],
#+ [u_int8_t len = 42; return 0;],
#+ ac_cv_type_u_int8_t=yes,
#+ ac_cv_type_u_int8_t=no)
#+])
#+if test $ac_cv_type_u_int8_t = yes; then
#+ AC_DEFINE(HAVE_TYPE_U_INT8_T,1,Does u_int8_t exist)
#+fi
#+
#+AC_CACHE_CHECK([for u_int64_t], ac_cv_type_u_int64_t,
#+[AC_TRY_COMPILE([#include <sys/types.h>],
#+ [u_int64_t len = 42; return 0;],
#+ ac_cv_type_u_int64_t=yes,
#+ ac_cv_type_u_int64_t=no)
#+])
#+if test $ac_cv_type_u_int64_t = yes; then
#+ AC_DEFINE(HAVE_TYPE_U_INT64_T,1,Does u_int64_t exist)
#+fi
#+
# AC_CACHE_CHECK(for a fallback value for HZ, ac_cv_var_default_hz,
# [ac_cv_var_default_hz=100
# case "$host" in
#@@ -446,6 +532,45 @@
# AC_DEFINE(HAVE_SA_LEN_IN_STRUCT_SOCKADDR, 1, [Should be obvious...])
# fi
#
#+AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
#+ ac_cv_have_ss_family_in_struct_ss, [
#+ AC_TRY_COMPILE(
#+ [
#+#include <sys/types.h>
#+#include <sys/socket.h>
#+ ],
#+ [ struct sockaddr_storage s; s.ss_family = 1; ],
#+ [ ac_cv_have_ss_family_in_struct_ss="yes" ],
#+ [ ac_cv_have_ss_family_in_struct_ss="no" ],
#+ )
#+])
#+if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
#+ AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have ss_family?])
#+fi
#+
#+AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
#+ ac_cv_have___ss_family_in_struct_ss, [
#+ AC_TRY_COMPILE(
#+ [
#+#include <sys/types.h>
#+#include <sys/socket.h>
#+ ],
#+ [ struct sockaddr_storage s; s.__ss_family = 1; ],
#+ [ ac_cv_have___ss_family_in_struct_ss="yes" ],
#+ [ ac_cv_have___ss_family_in_struct_ss="no" ]
#+ )
#+])
#+if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
#+ AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1, [Does struct sockaddr_storage have __ss_family?])
#+fi
#+
#+AH_VERBATIM([X_HAVE_SS_FAMILY_IN_SS],
#+[/* Handle ss_family */
#+#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
#+# define ss_family __ss_family
#+# define ss_len __ss_len
#+#endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */])
#+
# case "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
# *yes*)
# AC_CACHE_CHECK([for struct snd_size], ac_cv_struct_snd_size,
#@@ -603,7 +728,9 @@
# *) AC_CHECK_FUNCS(getuid)
# ;;
# esac
#-AC_CHECK_FUNCS(hstrerror K_open kvm_open memcpy memmove memset)
#+AC_CHECK_FUNCS(hstrerror)
#+AC_CHECK_FUNC(inet_ntop, [], [AC_DEFINE(ISC_PLATFORM_NEEDNTOP, 1, [ISC: provide inet_ntop()])])
#+AC_CHECK_FUNCS(K_open kvm_open memcpy memmove memset)
# case "$host" in
# *-*-sco3.2v5.0.*)
# # Just stubs. Idiots.
#@@ -689,6 +816,12 @@
# esac
# AC_CHECK_FUNCS(uname updwtmp updwtmpx vsprintf)
#
#+case "$host" in
#+ *-*-sunos4*)
#+ AC_DEFINE(SPRINTF_CHAR, 1, [*s*printf() functions are char*])
#+ ;;
#+esac
#+
# AC_CACHE_CHECK(number of arguments to gettimeofday(), ac_cv_func_Xettimeofday_nargs,
# [AC_TRY_COMPILE([#include <sys/time.h>],[
# gettimeofday((struct timeval*)0,(struct timezone*)0);
#@@ -922,10 +1055,6 @@
# ;;
# esac
#
#-AC_CACHE_CHECK(if we should use a streams device for ifconfig,
#- ac_cv_var_use_streams_device_for_ifconfig,
#- ac_cv_var_use_streams_device_for_ifconfig=no)
#-
# AC_CACHE_CHECK(if we need extra room for SO_RCVBUF, ac_cv_var_rcvbuf_slop,
# [ans=no
# case "$host" in
#@@ -1518,6 +1647,7 @@
# AC_DEFINE(HAVE_PPSAPI, 1, [Do we have the PPS API per the Draft RFC?])
# ac_cv_var_oncore_ok=yes
# ac_cv_var_ripe_ncc_ok=yes
#+ ac_cv_var_jupiter_ok=yes
# ;;
# esac
#
#@@ -1650,7 +1780,7 @@
# AC_MSG_RESULT($ntp_canparse)
#
# AC_MSG_CHECKING([if we have support for audio clocks])
#-case "$ac_cv_header_sun_audioio_h$ac_cv_header_sys_audioio_h" in
#+case "$ac_cv_header_sun_audioio_h$ac_cv_header_sys_audioio_h$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
# *yes*)
# ntp_canaudio=yes
# AC_DEFINE(HAVE_AUDIO, , [Do we have audio support?])
#@@ -1875,25 +2005,18 @@
# fi
# AC_MSG_RESULT($ntp_ok)
#
#-# Not Ultrix
# AC_MSG_CHECKING(Rockwell Jupiter GPS receiver)
# AC_ARG_ENABLE(JUPITER,
# AC_HELP_STRING([--enable-JUPITER], [s Rockwell Jupiter GPS receiver]),
#- [ntp_ok=$enableval],
#- [case "$ac_cv_var_ppsclock" in
#-# yes) ntp_ok=$ntp_eac
#-# ;;
#- *) ntp_ok=no
#- ;;
#- esac])
#+ [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
#+case "$ac_cv_var_jupiter_ok" in
#+ no) ntp_ok=no ;;
#+esac
# if test "$ntp_ok" = "yes"; then
# ntp_refclock=yes
# AC_DEFINE(CLOCK_JUPITER, 1, [Rockwell Jupiter GPS clock?])
# fi
# AC_MSG_RESULT($ntp_ok)
#-case "$ntp_ok$host" in
#- yes*-*-ultrix*) AC_MSG_WARN(*** But the expected answer is... no ***) ;;
#-esac
#
# AC_MSG_CHECKING(Leitch CSD 5300 Master Clock System Driver)
# AC_ARG_ENABLE(LEITCH,
#@@ -2128,7 +2251,7 @@
# [ntp_ok=$enableval], [ntp_ok=$ntp_eac])
# if test "$ntp_ok" = "yes"; then
# ntp_refclock=yes
#- AC_DEFINE(CLOCK_ULINK, 1, [Ultralink M320 WWVB receiver])
#+ AC_DEFINE(CLOCK_ULINK, 1, [Ultralink M320 WWVB receiver?])
# fi
# AC_MSG_RESULT($ntp_ok)
#
#@@ -2420,18 +2543,18 @@
# esac
# AC_MSG_RESULT($ans)
#
#-AC_SUBST(RSAOBJS)
#-AC_SUBST(RSASRCS)
#-AC_SUBST(RSADIR)
#-AC_SUBST(RSAREF)
#-AC_SUBST(LIBRSAREF)
#-AC_SUBST(MAKE_LIBRSAREF)
#+# AC_SUBST(RSAOBJS)
#+# AC_SUBST(RSASRCS)
#+# AC_SUBST(RSADIR)
#+# AC_SUBST(RSAREF)
#+# AC_SUBST(LIBRSAREF)
#+# AC_SUBST(MAKE_LIBRSAREF)
#
# AC_SUBST(OPENSSL)
# AC_SUBST(OPENSSL_INC)
# AC_SUBST(OPENSSL_LIB)
#
#-AC_SUBST(MAKE_NTP_GENKEYS)
#+AC_SUBST(MAKE_NTP_KEYGEN)
#
# AC_MSG_CHECKING(for openssl library directory)
# AC_ARG_WITH(openssl-libdir,
#@@ -2440,7 +2563,7 @@
# case "$ans" in
# no) ;;
# yes) # Look in:
#- ans="/usr/lib /usr/local/lib /usr/local/ssl/lib"
#+ ans="/usr/lib /usr/lib/openssl /usr/local/lib /usr/local/ssl/lib"
# ;;
# *) # Look where they said
# ;;
#@@ -2450,7 +2573,14 @@
# *) # Look for libcrypto.a and libssl.a:
# for i in $ans no
# do
#- test -f $i/libcrypto.a -a -f $i/libssl.a && break
#+ case "$host" in
#+ *-*-darwin*)
#+ test -f $i/libcrypto.dylib -a -f $i/libssl.dylib && break
#+ ;;
#+ *)
#+ test -f $i/libcrypto.a -a -f $i/libssl.a && break
#+ ;;
#+ esac
# done
# case "$i" in
# no)
#@@ -2498,75 +2628,32 @@
# AC_MSG_RESULT($ans)
#
# AC_ARG_WITH(crypto,
#- AC_HELP_STRING([--with-crypto], [+ ={autokey,rsaref}]),
#-dnl AC_HELP_STRING([--with-crypto], [+ ={autokey,openssl,rsaref}]),
#+ AC_HELP_STRING([--with-crypto], [+ =openssl]),
# [ans=$withval], [ans=yes])
# case "$ans" in
# no) ;;
#- yes|rsaref|openssl)
#- case "$ans" in
#- yes|rsaref) # Just "rsaref" when OpenSSL is ready
#+ yes|openssl)
#+ if test -z "$OPENSSL_LIB" -o -z "$OPENSSL_INC"
#+ then
# ans=no
#- ;;
#- *)
#- if test -z "$OPENSSL_LIB" -o -z "$OPENSSL_INC"
#- then
#- ans=no
#- else
#- # We have OpenSSL inc/lib - use them.
#- ans=openssl
#- CPPFLAGS="$CPPFLAGS -I$OPENSSL_INC"
#- LDFLAGS="$LDFLAGS -L$OPENSSL_LIB"
#- LIBS="$LIBS -lcrypto"
#- AC_DEFINE(DES, 1, [Use DES?])
#- AC_DEFINE(OPENSSL, , [Use OpenSSL?])
#- AC_DEFINE(PUBKEY, , [Public key?])
#- fi
#- ;;
#- esac
#-
#- case "$ans" in
#- no)
#- if test -f $srcdir/rsaref2/source/digit.c
#- then
#- ans=rsaref
#- RSAOBJS=digit.o
#- RSASRCS="digit.c digit.h"
#- RSADIR=rsaref2
#- fi
#- if test -f $srcdir/rsaeuro1/source/rsaeuro.h
#- then
#- ans=rsaref
#- RSAOBJS="md4c.o shsc.o"
#- RSASRCS="md4c.c shsc.c"
#- RSADIR=rsaeuro1
#- fi
#- if test "$ans" = "rsaref"; then
#- LIBRSAREF=../librsaref/librsaref.a
#- MAKE_LIBRSAREF=librsaref.a
#- AC_DEFINE(DES, 1, [Use DES?])
#- AC_DEFINE(PUBKEY)
#- AC_DEFINE(RSAREF, , [Use RSAREF?])
#- fi
#- ;;
#- esac
#- ;;
#-esac
#-AM_CONDITIONAL(isRSAREF, test x$RSADIR = xrsaref2)
#-AM_CONDITIONAL(isRSAEURO, test x$RSADIR = xrsaeuro1)
#-AC_SUBST(AUTOKEY)
#-case "$ans" in
#- no) ;;
#- *)
#- AC_DEFINE(AUTOKEY, , [Autokey?])
#- AUTOKEY=1
#+ else
#+ # We have OpenSSL inc/lib - use them.
#+ ans=openssl
#+ CPPFLAGS="$CPPFLAGS -I$OPENSSL_INC"
#+ LDFLAGS="$LDFLAGS -L$OPENSSL_LIB"
#+ LIBS="$LIBS -lcrypto"
#+ MAKE_NTP_KEYGEN=ntp-keygen
#+ AC_DEFINE(OPENSSL, , [Use OpenSSL?])
#+ AC_CHECK_FUNCS(EVP_md2 EVP_mdc2)
#+ fi
# ;;
# esac
# AC_MSG_CHECKING(for the level of crypto support)
# AC_MSG_RESULT($ans)
#
# AC_MSG_CHECKING(if we want to compile with ElectricFence)
#-AC_ARG_WITH(electricfence, [ --with-electricfence - compile with ElectricFence malloc debugger],
#+AC_ARG_WITH(electricfence,
#+ AC_HELP_STRING([--with-electricfence], [- compile with ElectricFence malloc debugger]),
# [ans=$withval], [ans=no])
# case "$ans" in
# no) ;;
#@@ -2581,6 +2668,20 @@
# esac
# AC_MSG_RESULT($ans)
#
#+AC_MSG_CHECKING(if we want to try SNTP)
#+AC_ARG_WITH(sntp,
#+ AC_HELP_STRING([--with-sntp], [- Build SNTP?]),
#+[ans=$withval], [ans=no])
#+case "$ans" in
#+ no) ;;
#+ *)
#+ MAKE_SNTP="sntp"
#+ AC_SUBST(MAKE_SNTP)
#+ ans=yes
#+ ;;
#+esac
#+AC_MSG_RESULT($ans)
#+
# AC_SUBST(TESTDCF)
# AC_SUBST(DCFD)
#
#@@ -3167,6 +3268,20 @@
# ;;
# esac
#
#+AC_SUBST(MAKE_LIBNTPSIM)
#+AC_SUBST(MAKE_NTPDSIM)
#+AC_CACHE_CHECK([if we want to build the NTPD simulator], ac_cv_var_ntpd_sim,
#+[AC_ARG_ENABLE(simulator,
#+ AC_HELP_STRING([--enable-simulator], [- build/install the NTPD simulator?]),
#+ [ans=$enableval], [ans=no])
#+ac_cv_var_ntpd_sim=$ans])
#+case "$ac_cv_var_ntpd_sim" in
#+ yes)
#+ MAKE_NTPDSIM=ntpdsim
#+ MAKE_LIBNTPSIM=libntpsim.a
#+ ;;
#+esac
#+
# AC_CACHE_CHECK(if we want UDP wildcard delivery, ac_cv_var_udp_wildcard_delivery,
# [AC_ARG_ENABLE(udp-wildcard, [ --enable-udp-wildcard s use UDP wildcard delivery],
# [ans=$enableval],
#@@ -3378,6 +3493,124 @@
# yes) AC_DEFINE(KERNEL_FLL_BUG, 1, [Does the kernel have an FLL bug?]) ;;
# esac
#
#+AC_CACHE_CHECK(if we should use the IRIG sawtooth filter, ac_cv_var_irig_sucks,
#+[AC_ARG_ENABLE(irig-sawtooth,
#+ AC_HELP_STRING([--enable-irig-sawtooth], [s if we should enable the IRIG sawtooth filter]),
#+ [ans=$enableval],
#+ [case "$host" in
#+ *-*-solaris2.[[89]])
#+ ans=yes
#+ ;;
#+ *) ans=no
#+ ;;
#+ esac
#+ ])
#+ac_cv_var_irig_sucks=$ans])
#+case "$ac_cv_var_irig_sucks" in
#+ yes) AC_DEFINE(IRIG_SUCKS, 1, [Should we use the IRIG sawtooth filter?]) ;;
#+esac
#+
#+AC_CACHE_CHECK(if we should enable NIST lockclock scheme, ac_cv_var_nist_lockclock,
#+[AC_ARG_ENABLE(nist,
#+ AC_HELP_STRING([--enable-nist], [- if we should enable the NIST lockclock scheme]),
#+ [ans=$enableval],[ans=no])
#+ac_cv_var_nist_lockclock=$ans])
#+case "$ac_cv_var_nist_lockclock" in
#+ yes) AC_DEFINE(LOCKCLOCK, 1, [Should we align with the NIST lockclock scheme?]) ;;
#+esac
#+
#+#
#+# ISC stuff
#+#
#+
#+if test $ac_cv_struct_sockaddr_has_sa_len = yes; then
#+ AC_DEFINE(ISC_PLATFORM_HAVESALEN, ,[ISC: struct sockaddr as sa_len?])
#+fi
#+
#+AC_MSG_CHECKING(for IPv6 structures)
#+AC_TRY_COMPILE([
#+#include <sys/types.h>
#+#include <sys/socket.h>
#+#include <netinet/in.h>],
#+[struct sockaddr_in6 sin6; return (0);],
#+ [AC_MSG_RESULT(yes)
#+ found_ipv6=yes],
#+ [AC_MSG_RESULT(no)
#+ found_ipv6=no])
#+
#+AC_MSG_CHECKING([for struct if_laddrconf])
#+AC_TRY_LINK([
#+#include <sys/types.h>
#+#include <net/if6.h>
#+],[ struct if_laddrconf a; ],
#+ [AC_MSG_RESULT(yes)
#+ AC_DEFINE(ISC_PLATFORM_HAVEIF_LADDRCONF, ,
#+ [ISC: have struct if_laddrconf?])],
#+ [AC_MSG_RESULT(no)])
#+
#+AC_MSG_CHECKING([for struct if_laddrreq])
#+AC_TRY_LINK([
#+#include <sys/types.h>
#+#include <net/if6.h>
#+],[ struct if_laddrreq a; ],
#+ [AC_MSG_RESULT(yes)
#+ AC_DEFINE(ISC_PLATFORM_HAVEIF_LADDRREQ, ,
#+ [ISC: have struct if_laddrreq?])],
#+ [AC_MSG_RESULT(no)])
#+
#+case "$found_ipv6" in
#+ yes)
#+ AC_DEFINE(ISC_PLATFORM_HAVEIPV6, ,[ISC: Have IPv6?])
#+ AC_DEFINE(WANT_IPV6, ,[ISC: Want IPv6?])
#+
#+ AC_MSG_CHECKING(for in6_pktinfo)
#+ AC_TRY_COMPILE([
#+#include <sys/types.h>
#+#include <sys/socket.h>
#+#include <netinet/in.h>
#+$isc_netinetin6_hack
#+$isc_netinet6in6_hack
#+],
#+ [struct in6_pktinfo xyzzy; return (0);],
#+ [AC_MSG_RESULT(yes)
#+ AC_DEFINE(ISC_PLATFORM_HAVEIN6PKTINFO, ,
#+ [ISC: Have struct in6_pktinfo?])],
#+ [AC_MSG_RESULT(no -- disabling runtime ipv6 support)])
#+
#+ AC_MSG_CHECKING(for in6addr_any)
#+ AC_TRY_LINK([
#+#include <sys/types.h>
#+#include <sys/socket.h>
#+#include <netinet/in.h>
#+$isc_netinetin6_hack
#+$isc_netinet6in6_hack
#+$isc_in_addr6_hack
#+],
#+ [struct in6_addr in6; in6 = in6addr_any; return (in6.s6_addr[0]);],
#+ [AC_MSG_RESULT(yes)],
#+ [AC_MSG_RESULT(no)
#+ AC_DEFINE(ISC_PLATFORM_NEEDIN6ADDRANY, ,
#+ [ISC: Need in6addr_any?])]
#+ )
#+ ;;
#+esac
#+
#+#
#+# Look for a sysctl call to get the list of network interfaces.
#+#
#+AC_MSG_CHECKING(for interface list sysctl)
#+AC_EGREP_CPP(found_rt_iflist, [
#+#include <sys/param.h>
#+#include <sys/sysctl.h>
#+#include <sys/socket.h>
#+#ifdef NET_RT_IFLIST
#+found_rt_iflist
#+#endif
#+],
#+ [AC_MSG_RESULT(yes)
#+ AC_DEFINE(HAVE_IFLIST_SYSCTL,1,[ISC: Use iflist_sysctl?])],
#+ [AC_MSG_RESULT(no)])
#+
# case "$build" in
# $host)
# ;;
#@@ -3391,21 +3624,31 @@
#
# AC_DEFINE_DIR(NTP_KEYSDIR, sysconfdir, [Default location of crypto key info])
#
#-# HMS: I think we avoid this problem now...
#-## This is necessary so that .o files in LIBOBJS are also built via
#-## the ANSI2KNR-filtering rules.
#-#LIB@&t at OBJS=`echo "$LIB@&t at OBJS" | sed 's,\.[[^.]]* ,$U&,g;s,\.[[^.]]*$,$U&,'`
#+AC_SUBST(ARLIB_DIR)
#+if test -d $srcdir/arlib
#+then
#+ AC_ARG_WITH(arlib,
#+ AC_HELP_STRING([--with-arlib], [- Compile the async resolver library?]),
#+ [ans=$withval], [ans=no])
#+
#+ case "$ans" in
#+ yes)
#+ ARLIB_DIR=arlib
#+ AC_CONFIG_SUBDIRS(arlib)
#+ ;;
#+ esac
#+fi
#
# AC_CONFIG_FILES(Makefile)
# AC_CONFIG_FILES(ElectricFence/Makefile)
# AC_CONFIG_FILES(adjtimed/Makefile)
# AC_CONFIG_FILES(clockstuff/Makefile)
# AC_CONFIG_FILES(include/Makefile)
#+AC_CONFIG_FILES(include/isc/Makefile)
# AC_CONFIG_FILES(kernel/Makefile)
# AC_CONFIG_FILES(kernel/sys/Makefile)
# AC_CONFIG_FILES(libntp/Makefile)
# AC_CONFIG_FILES(libparse/Makefile)
#-AC_CONFIG_FILES(librsaref/Makefile)
# AC_CONFIG_FILES(ntpd/Makefile)
# AC_CONFIG_FILES(ntpdate/Makefile)
# AC_CONFIG_FILES(ntpdc/Makefile)
#@@ -3419,9 +3662,17 @@
# AC_CONFIG_FILES(scripts/mkver, [chmod +x scripts/mkver])
# AC_CONFIG_FILES(scripts/ntp-wait, [chmod +x scripts/ntp-wait])
# AC_CONFIG_FILES(scripts/ntpsweep, [chmod +x scripts/ntpsweep])
#+AC_CONFIG_FILES(scripts/ntptrace, [chmod +x scripts/ntptrace])
# AC_CONFIG_FILES(scripts/ntpver, [chmod +x scripts/ntpver])
# AC_CONFIG_FILES(scripts/plot_summary, [chmod +x scripts/plot_summary])
# AC_CONFIG_FILES(scripts/summary, [chmod +x scripts/summary])
# AC_CONFIG_FILES(util/Makefile)
#+
#+case "$MAKE_SNTP" in
#+ '') ;;
#+ *)
#+ AC_CONFIG_SUBDIRS(sntp)
#+ ;;
#+esac
#
# AC_OUTPUT
#
#--- 1.13.1.6/ntpd/refclock_conf.c Thu Jul 18 11:42:39 2002
#+++ 1.22/ntpd/refclock_conf.c Mon Jun 30 05:52:16 2003
#@@ -192,7 +192,7 @@
# #define refclock_oncore refclock_none
# #endif
#
#-#if defined(CLOCK_JUPITER) && defined(PPS)
#+#if defined(CLOCK_JUPITER) && defined(HAVE_PPSAPI)
# extern struct refclock refclock_jupiter;
# #else
# #define refclock_jupiter refclock_none
#
#--- 1.8/ntpd/refclock_jupiter.c Mon Oct 8 21:18:19 2001
#+++ 1.11/ntpd/refclock_jupiter.c Mon Jun 30 07:13:53 2003
#@@ -1,5 +1,5 @@
# /*
#- * Copyright (c) 1997, 1998
#+ * Copyright (c) 1997, 1998, 2003
# * The Regents of the University of California. All rights reserved.
# *
# * Redistribution and use in source and binary forms, with or without
#@@ -35,21 +35,28 @@
# # include <config.h>
# #endif
#
#-#if defined(REFCLOCK) && defined(CLOCK_JUPITER) && defined(PPS)
#+#if defined(REFCLOCK) && defined(CLOCK_JUPITER) && defined(HAVE_PPSAPI)
#
# #include "ntpd.h"
# #include "ntp_io.h"
# #include "ntp_refclock.h"
# #include "ntp_unixtime.h"
# #include "ntp_stdlib.h"
#-#include "ntp_calendar.h"
#
# #include <stdio.h>
# #include <ctype.h>
#
# #include "jupiter.h"
#
#-#include <sys/ppsclock.h>
#+#ifdef HAVE_PPSAPI
#+# ifdef HAVE_TIMEPPS_H
#+# include <timepps.h>
#+# else
#+# ifdef HAVE_SYS_TIMEPPS_H
#+# include <sys/timepps.h>
#+# endif
#+# endif
#+#endif
#
# #ifdef XNTP_BIG_ENDIAN
# #define getshort(s) ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff))
#@@ -83,15 +90,6 @@
# #define SPEED232 B9600 /* baud */
#
# /*
#- * The number of raw samples which we acquire to derive a single estimate.
#- * NSAMPLES ideally should not exceed the default poll interval 64.
#- * NKEEP must be a power of 2 to simplify the averaging process.
#- */
#-#define NSAMPLES 64
#-#define NKEEP 8
#-#define REFCLOCKMAXDISPERSE .25 /* max sample dispersion */
#-
#-/*
# * Radio interface parameters
# */
# #define PRECISION (-18) /* precision assumed (about 4 us) */
#@@ -114,24 +112,27 @@
# /*
# * Jupiter unit control structure.
# */
#-struct jupiterunit {
#+struct instance {
#+ struct peer *peer; /* peer */
# u_int pollcnt; /* poll message counter */
# u_int polled; /* Hand in a time sample? */
#- u_int lastserial; /* last pps serial number */
#- struct ppsclockev ppsev; /* PPS control structure */
#+#ifdef HAVE_PPSAPI
#+ pps_params_t pps_params; /* pps parameters */
#+ pps_info_t pps_info; /* last pps data */
#+ pps_handle_t pps_handle; /* pps handle */
#+ u_int assert; /* pps edge to use */
#+ struct timespec ts; /* last timestamp */
#+#endif
#+ l_fp limit;
#+ u_int gpos_gweek; /* Current GPOS GPS week number */
#+ u_int gpos_sweek; /* Current GPOS GPS seconds into week */
# u_int gweek; /* current GPS week number */
# u_int32 lastsweek; /* last seconds into GPS week */
#- u_int32 timecode; /* current ntp timecode */
#+ time_t timecode; /* current ntp timecode */
# u_int32 stime; /* used to detect firmware bug */
# int wantid; /* don't reconfig on channel id msg */
# u_int moving; /* mobile platform? */
#- u_long sloppyclockflag; /* fudge flags */
#- u_int known; /* position known yet? */
#- int coderecv; /* total received samples */
#- int nkeep; /* number of samples to preserve */
#- int rshift; /* number of rshifts for division */
#- l_fp filter[NSAMPLES]; /* offset filter */
#- l_fp lastref; /* last reference timestamp */
#+ u_char sloppyclockflag; /* fudge flags */
# u_short sbuf[512]; /* local input buffer */
# int ssize; /* space used in sbuf */
# };
#@@ -139,30 +140,28 @@
# /*
# * Function prototypes
# */
#-static void jupiter_canmsg P((struct peer *, u_int));
#+static void jupiter_canmsg P((struct instance *, u_int));
# static u_short jupiter_cksum P((u_short *, u_int));
#-#ifdef QSORT_USES_VOID_P
#- int jupiter_cmpl_fp P((const void *, const void *));
#-#else
#- int jupiter_cmpl_fp P((const l_fp *, const l_fp *));
#-#endif /* not QSORT_USES_VOID_P */
#-static void jupiter_config P((struct peer *));
#-static void jupiter_debug P((struct peer *, char *, ...))
#- __attribute__ ((format (printf, 2, 3)));
#-static char * jupiter_offset P((struct peer *));
#-static char * jupiter_parse_t P((struct peer *, u_short *));
#-static void jupiter_platform P((struct peer *, u_int));
#+static int jupiter_config P((struct instance *));
#+static void jupiter_debug P((struct peer *, char *, char *, ...))
#+ __attribute__ ((format (printf, 3, 4)));
#+static char * jupiter_parse_t P((struct instance *, u_short *));
#+static char * jupiter_parse_gpos P((struct instance *, u_short *));
#+static void jupiter_platform P((struct instance *, u_int));
# static void jupiter_poll P((int, struct peer *));
#-static int jupiter_pps P((struct peer *));
#-static char * jupiter_process P((struct peer *));
#-static int jupiter_recv P((struct peer *));
#-static void jupiter_receive P((register struct recvbuf *rbufp));
#-static void jupiter_reqmsg P((struct peer *, u_int, u_int));
#-static void jupiter_reqonemsg P((struct peer *, u_int));
#-static char * jupiter_send P((struct peer *, struct jheader *));
#+static void jupiter_control P((int, struct refclockstat *, struct
#+ refclockstat *, struct peer *));
#+#ifdef HAVE_PPSAPI
#+static int jupiter_ppsapi P((struct instance *, int, int));
#+static int jupiter_pps P((struct instance *));
#+#endif /* HAVE_PPSAPI */
#+static int jupiter_recv P((struct instance *));
#+static void jupiter_receive P((struct recvbuf *rbufp));
#+static void jupiter_reqmsg P((struct instance *, u_int, u_int));
#+static void jupiter_reqonemsg P((struct instance *, u_int));
#+static char * jupiter_send P((struct instance *, struct jheader *));
# static void jupiter_shutdown P((int, struct peer *));
# static int jupiter_start P((int, struct peer *));
#-static int jupiter_ttyinit P((struct peer *, int));
#
# /*
# * Transfer vector
#@@ -171,7 +170,7 @@
# jupiter_start, /* start up driver */
# jupiter_shutdown, /* shut down driver */
# jupiter_poll, /* transmit poll message */
#- noentry, /* (clock control) */
#+ jupiter_control, /* (clock control) */
# noentry, /* (clock init) */
# noentry, /* (clock buginfo) */
# NOFLAGS /* not used */
#@@ -182,39 +181,34 @@
# */
# static int
# jupiter_start(
#- register int unit,
#- register struct peer *peer
#+ int unit,
#+ struct peer *peer
# )
# {
# struct refclockproc *pp;
#- register struct jupiterunit *up;
#- register int fd;
#+ struct instance *instance;
#+ int fd = -1;
# char gpsdev[20];
#
# /*
# * Open serial port
# */
# (void)sprintf(gpsdev, DEVICE, unit);
#- fd = open(gpsdev, O_RDWR
#-#ifdef O_NONBLOCK
#- | O_NONBLOCK
#-#endif
#- , 0);
#- if (fd < 0) {
#- jupiter_debug(peer, "jupiter_start: open %s: %s\n",
#+ fd = refclock_open(gpsdev, SPEED232, LDISC_RAW);
#+ if (fd == 0) {
#+ jupiter_debug(peer, "jupiter_start", "open %s: %s",
# gpsdev, strerror(errno));
# return (0);
# }
#- if (!jupiter_ttyinit(peer, fd))
#- return (0);
#
# /* Allocate unit structure */
#- if ((up = (struct jupiterunit *)
#- emalloc(sizeof(struct jupiterunit))) == NULL) {
#+ if ((instance = (struct instance *)
#+ emalloc(sizeof(struct instance))) == NULL) {
# (void) close(fd);
# return (0);
# }
#- memset((char *)up, 0, sizeof(struct jupiterunit));
#+ memset((char *)instance, 0, sizeof(struct instance));
#+ instance->peer = peer;
# pp = peer->procptr;
# pp->io.clock_recv = jupiter_receive;
# pp->io.srcclock = (caddr_t)peer;
#@@ -222,10 +216,10 @@
# pp->io.fd = fd;
# if (!io_addclock(&pp->io)) {
# (void) close(fd);
#- free(up);
#+ free(instance);
# return (0);
# }
#- pp->unitptr = (caddr_t)up;
#+ pp->unitptr = (caddr_t)instance;
#
# /*
# * Initialize miscellaneous variables
#@@ -234,145 +228,228 @@
# pp->clockdesc = DESCRIPTION;
# memcpy((char *)&pp->refid, REFID, 4);
#
#+#ifdef HAVE_PPSAPI
#+ /*
#+ * Start the PPSAPI interface if it is there. Default to use
#+ * the assert edge and do not enable the kernel hardpps.
#+ */
#+ if (time_pps_create(fd, &instance->pps_handle) < 0) {
#+ instance->pps_handle = 0;
#+ msyslog(LOG_ERR,
#+ "refclock_jupiter: time_pps_create failed: %m");
#+ }
#+ else if (!jupiter_ppsapi(instance, 0, 0))
#+ goto clean_up;
#+#endif /* HAVE_PPSAPI */
#
# /* Ensure the receiver is properly configured */
#- jupiter_config(peer);
#+ if (!jupiter_config(instance))
#+ goto clean_up;
#
#- /* Turn on pulse gathering by requesting the first sample */
#- if (ioctl(fd, CIOGETEV, (caddr_t)&up->ppsev) < 0) {
#- jupiter_debug(peer, "jupiter_ttyinit: CIOGETEV: %s\n",
#- strerror(errno));
#- (void) close(fd);
#- free(up);
#- return (0);
#- }
#- up->lastserial = up->ppsev.serial;
#- memset(&up->ppsev, 0, sizeof(up->ppsev));
# return (1);
#+
#+clean_up:
#+ jupiter_shutdown(unit, peer);
#+ pp->unitptr = 0;
#+ return (0);
# }
#
# /*
# * jupiter_shutdown - shut down the clock
# */
# static void
#-jupiter_shutdown(register int unit, register struct peer *peer)
#+jupiter_shutdown(int unit, struct peer *peer)
# {
#- register struct jupiterunit *up;
#+ struct instance *instance;
# struct refclockproc *pp;
#
# pp = peer->procptr;
#- up = (struct jupiterunit *)pp->unitptr;
#+ instance = (struct instance *)pp->unitptr;
#+ if(!instance)
#+ return;
#+
#+#ifdef HAVE_PPSAPI
#+ if (instance->pps_handle) {
#+ time_pps_destroy(instance->pps_handle);
#+ instance->pps_handle = 0;
#+ }
#+#endif /* HAVE_PPSAPI */
#+
# io_closeclock(&pp->io);
#- free(up);
#+ free(instance);
# }
#
# /*
# * jupiter_config - Configure the receiver
# */
#-static void
#-jupiter_config(register struct peer *peer)
#+static int
#+jupiter_config(struct instance *instance)
# {
#- register int i;
#- register struct jupiterunit *up;
#- register struct refclockproc *pp;
#-
#- pp = peer->procptr;
#- up = (struct jupiterunit *)pp->unitptr;
#+ jupiter_debug(instance->peer, "jupiter_config", "init receiver");
#
# /*
# * Initialize the unit variables
#- *
#- * STRANGE BEHAVIOUR WARNING: The fudge flags are not available
#- * at the time jupiter_start is called. These are set later,
#- * and so the code must be prepared to handle changing flags.
# */
#- up->sloppyclockflag = pp->sloppyclockflag;
#- if (pp->sloppyclockflag & CLK_FLAG2) {
#- up->moving = 1; /* Receiver on mobile platform */
#- msyslog(LOG_DEBUG, "jupiter_config: mobile platform");
#- } else {
#- up->moving = 0; /* Static Installation */
#- }
#-
#- /* XXX fludge flags don't make the trip from the config to here... */
#-#ifdef notdef
#- /* Configure for trailing edge triggers */
#-#ifdef CIOSETTET
#- i = ((pp->sloppyclockflag & CLK_FLAG3) != 0);
#- jupiter_debug(peer, "jupiter_configure: (sloppyclockflag 0x%lx)\n",
#- pp->sloppyclockflag);
#- if (ioctl(pp->io.fd, CIOSETTET, (char *)&i) < 0)
#- msyslog(LOG_DEBUG, "jupiter_configure: CIOSETTET %d: %m", i);
#-#else
#- if (pp->sloppyclockflag & CLK_FLAG3)
#- msyslog(LOG_DEBUG, "jupiter_configure: \
#-No kernel support for trailing edge trigger");
#-#endif
#-#endif
#-
#- up->pollcnt = 2;
#- up->polled = 0;
#- up->known = 0;
#- up->gweek = 0;
#- up->lastsweek = 2 * WEEKSECS;
#- up->timecode = 0;
#- up->stime = 0;
#- up->ssize = 0;
#- up->coderecv = 0;
#- up->nkeep = NKEEP;
#- if (up->nkeep > NSAMPLES)
#- up->nkeep = NSAMPLES;
#- if (up->nkeep >= 1)
#- up->rshift = 0;
#- if (up->nkeep >= 2)
#- up->rshift = 1;
#- if (up->nkeep >= 4)
#- up->rshift = 2;
#- if (up->nkeep >= 8)
#- up->rshift = 3;
#- if (up->nkeep >= 16)
#- up->rshift = 4;
#- if (up->nkeep >= 32)
#- up->rshift = 5;
#- if (up->nkeep >= 64)
#- up->rshift = 6;
#- up->nkeep = 1;
#- i = up->rshift;
#- while (i > 0) {
#- up->nkeep *= 2;
#- i--;
#- }
#+ instance->sloppyclockflag = instance->peer->procptr->sloppyclockflag;
#+ instance->moving = !!(instance->sloppyclockflag & CLK_FLAG2);
#+ if (instance->moving)
#+ jupiter_debug(instance->peer, "jupiter_config",
#+ "mobile platform");
#+
#+ instance->pollcnt = 2;
#+ instance->polled = 0;
#+ instance->gpos_gweek = 0;
#+ instance->gpos_sweek = 0;
#+ instance->gweek = 0;
#+ instance->lastsweek = 2 * WEEKSECS;
#+ instance->timecode = 0;
#+ instance->stime = 0;
#+ instance->ssize = 0;
#
# /* Stop outputting all messages */
#- jupiter_canmsg(peer, JUPITER_ALL);
#+ jupiter_canmsg(instance, JUPITER_ALL);
#
# /* Request the receiver id so we can syslog the firmware version */
#- jupiter_reqonemsg(peer, JUPITER_O_ID);
#+ jupiter_reqonemsg(instance, JUPITER_O_ID);
#
# /* Flag that this the id was requested (so we don't get called again) */
#- up->wantid = 1;
#+ instance->wantid = 1;
#
# /* Request perodic time mark pulse messages */
#- jupiter_reqmsg(peer, JUPITER_O_PULSE, 1);
#+ jupiter_reqmsg(instance, JUPITER_O_PULSE, 1);
#+
#+ /* Request perodic geodetic position status */
#+ jupiter_reqmsg(instance, JUPITER_O_GPOS, 1);
#
# /* Set application platform type */
#- if (up->moving)
#- jupiter_platform(peer, JUPITER_I_PLAT_MED);
#+ if (instance->moving)
#+ jupiter_platform(instance, JUPITER_I_PLAT_MED);
#+ else
#+ jupiter_platform(instance, JUPITER_I_PLAT_LOW);
#+
#+ return (1);
#+}
#+
#+#ifdef HAVE_PPSAPI
#+/*
#+ * Initialize PPSAPI
#+ */
#+int
#+jupiter_ppsapi(
#+ struct instance *instance, /* unit structure pointer */
#+ int enb_clear, /* clear enable */
#+ int enb_hardpps /* hardpps enable */
#+ )
#+{
#+ int capability;
#+
#+ if (time_pps_getcap(instance->pps_handle, &capability) < 0) {
#+ msyslog(LOG_ERR,
#+ "refclock_jupiter: time_pps_getcap failed: %m");
#+ return (0);
#+ }
#+ memset(&instance->pps_params, 0, sizeof(pps_params_t));
#+ if (enb_clear)
#+ instance->pps_params.mode = capability & PPS_CAPTURECLEAR;
# else
#- jupiter_platform(peer, JUPITER_I_PLAT_LOW);
#+ instance->pps_params.mode = capability & PPS_CAPTUREASSERT;
#+ if (!(instance->pps_params.mode & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR))) {
#+ msyslog(LOG_ERR,
#+ "refclock_jupiter: invalid capture edge %d",
#+ !enb_clear);
#+ return (0);
#+ }
#+ instance->pps_params.mode |= PPS_TSFMT_TSPEC;
#+ if (time_pps_setparams(instance->pps_handle, &instance->pps_params) < 0) {
#+ msyslog(LOG_ERR,
#+ "refclock_jupiter: time_pps_setparams failed: %m");
#+ return (0);
#+ }
#+ if (enb_hardpps) {
#+ if (time_pps_kcbind(instance->pps_handle, PPS_KC_HARDPPS,
#+ instance->pps_params.mode & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR),
#+ PPS_TSFMT_TSPEC) < 0) {
#+ msyslog(LOG_ERR,
#+ "refclock_jupiter: time_pps_kcbind failed: %m");
#+ return (0);
#+ }
#+ pps_enable = 1;
#+ }
#+/* instance->peer->precision = PPS_PRECISION; */
#+
#+#if DEBUG
#+ if (debug) {
#+ time_pps_getparams(instance->pps_handle, &instance->pps_params);
#+ jupiter_debug(instance->peer, "refclock_jupiter",
#+ "pps capability 0x%x version %d mode 0x%x kern %d",
#+ capability, instance->pps_params.api_version,
#+ instance->pps_params.mode, enb_hardpps);
#+ }
#+#endif
#+
#+ return (1);
# }
#
# /*
#+ * Get PPSAPI timestamps.
#+ *
#+ * Return 0 on failure and 1 on success.
#+ */
#+static int
#+jupiter_pps(struct instance *instance)
#+{
#+ pps_info_t pps_info;
#+ struct timespec timeout, ts;
#+ double dtemp;
#+ l_fp tstmp;
#+
#+ /*
#+ * Convert the timespec nanoseconds field to ntp l_fp units.
#+ */
#+ if (instance->pps_handle == 0)
#+ return 1;
#+ timeout.tv_sec = 0;
#+ timeout.tv_nsec = 0;
#+ memcpy(&pps_info, &instance->pps_info, sizeof(pps_info_t));
#+ if (time_pps_fetch(instance->pps_handle, PPS_TSFMT_TSPEC, &instance->pps_info,
#+ &timeout) < 0)
#+ return 1;
#+ if (instance->pps_params.mode & PPS_CAPTUREASSERT) {
#+ if (pps_info.assert_sequence ==
#+ instance->pps_info.assert_sequence)
#+ return 1;
#+ ts = instance->pps_info.assert_timestamp;
#+ } else if (instance->pps_params.mode & PPS_CAPTURECLEAR) {
#+ if (pps_info.clear_sequence ==
#+ instance->pps_info.clear_sequence)
#+ return 1;
#+ ts = instance->pps_info.clear_timestamp;
#+ } else {
#+ return 1;
#+ }
#+ if ((instance->ts.tv_sec == ts.tv_sec) && (instance->ts.tv_nsec == ts.tv_nsec))
#+ return 1;
#+ instance->ts = ts;
#+
#+ tstmp.l_ui = ts.tv_sec + JAN_1970;
#+ dtemp = ts.tv_nsec * FRAC / 1e9;
#+ tstmp.l_uf = (u_int32)dtemp;
#+ instance->peer->procptr->lastrec = tstmp;
#+ return 0;
#+}
#+#endif /* HAVE_PPSAPI */
#+
#+/*
# * jupiter_poll - jupiter watchdog routine
# */
# static void
#-jupiter_poll(register int unit, register struct peer *peer)
#+jupiter_poll(int unit, struct peer *peer)
# {
#- register struct jupiterunit *up;
#- register struct refclockproc *pp;
#+ struct instance *instance;
#+ struct refclockproc *pp;
#
# pp = peer->procptr;
#- up = (struct jupiterunit *)pp->unitptr;
#+ instance = (struct instance *)pp->unitptr;
#
# /*
# * You don't need to poll this clock. It puts out timecodes
#@@ -383,79 +460,106 @@
# /*
# * If we haven't had a response in a while, reset the receiver.
# */
#- if (up->pollcnt > 0) {
#- up->pollcnt--;
#+ if (instance->pollcnt > 0) {
#+ instance->pollcnt--;
# } else {
# refclock_report(peer, CEVNT_TIMEOUT);
#
# /* Request the receiver id to trigger a reconfig */
#- jupiter_reqonemsg(peer, JUPITER_O_ID);
#- up->wantid = 0;
#+ jupiter_reqonemsg(instance, JUPITER_O_ID);
#+ instance->wantid = 0;
# }
#
# /*
# * polled every 64 seconds. Ask jupiter_receive to hand in
# * a timestamp.
# */
#- up->polled = 1;
#+ instance->polled = 1;
# pp->polls++;
# }
#
# /*
#- * jupiter_receive - receive gps data
#- * Gag me!
#+ * jupiter_control - fudge control
# */
# static void
#-jupiter_receive(register struct recvbuf *rbufp)
#+jupiter_control(
#+ int unit, /* unit (not used) */
#+ struct refclockstat *in, /* input parameters (not used) */
#+ struct refclockstat *out, /* output parameters (not used) */
#+ struct peer *peer /* peer structure pointer */
#+ )
# {
#- register int bpcnt, cc, size, ppsret;
#- register u_int32 last_timecode, laststime;
#- register char *cp;
#- register u_char *bp;
#- register u_short *sp;
#- register u_long sloppyclockflag;
#- register struct jupiterunit *up;
#- register struct jid *ip;
#- register struct jheader *hp;
#- register struct refclockproc *pp;
#- register struct peer *peer;
#+ struct refclockproc *pp;
#+ struct instance *instance;
#+ u_char sloppyclockflag;
#
#- /* Initialize pointers and read the timecode and timestamp */
#- peer = (struct peer *)rbufp->recv_srcclock;
# pp = peer->procptr;
#- up = (struct jupiterunit *)pp->unitptr;
#+ instance = (struct instance *)pp->unitptr;
#
#- /*
#- * If operating mode has been changed, then reinitialize the receiver
#- * before doing anything else.
#- */
#-/* XXX Sloppy clock flags are broken!! */
#- sloppyclockflag = up->sloppyclockflag;
#- up->sloppyclockflag = pp->sloppyclockflag;
#- if ((pp->sloppyclockflag & CLK_FLAG2) !=
#+ DTOLFP(pp->fudgetime2, &instance->limit);
#+ /* Force positive value. */
#+ if (L_ISNEG(&instance->limit))
#+ L_NEG(&instance->limit);
#+
#+#ifdef HAVE_PPSAPI
#+ instance->assert = !pp->sloppyclockflag & CLK_FLAG3;
#+ jupiter_ppsapi(instance, !instance->assert, 0);
#+#endif /* HAVE_PPSAPI */
#+
#+ sloppyclockflag = instance->sloppyclockflag;
#+ instance->sloppyclockflag = pp->sloppyclockflag;
#+ if ((instance->sloppyclockflag & CLK_FLAG2) !=
# (sloppyclockflag & CLK_FLAG2)) {
# jupiter_debug(peer,
#- "jupiter_receive: mode switch: reset receiver\n");
#- jupiter_config(peer);
#+ "jupiter_control",
#+ "mode switch: reset receiver");
#+ jupiter_config(instance);
# return;
# }
#+}
#
#- up->pollcnt = 2;
#+/*
#+ * jupiter_receive - receive gps data
#+ * Gag me!
#+ */
#+static void
#+jupiter_receive(struct recvbuf *rbufp)
#+{
#+ int bpcnt, cc, size, ppsret;
#+ time_t last_timecode;
#+ u_int32 laststime;
#+ char *cp;
#+ u_char *bp;
#+ u_short *sp;
#+ struct jid *ip;
#+ struct jheader *hp;
#+ struct peer *peer;
#+ struct refclockproc *pp;
#+ struct instance *instance;
#+ l_fp tstamp;
#+
#+ /* Initialize pointers and read the timecode and timestamp */
#+ peer = (struct peer *)rbufp->recv_srcclock;
#+ pp = peer->procptr;
#+ instance = (struct instance *)pp->unitptr;
#
# bp = (u_char *)rbufp->recv_buffer;
# bpcnt = rbufp->recv_length;
#
# /* This shouldn't happen */
#- if (bpcnt > sizeof(up->sbuf) - up->ssize)
#- bpcnt = sizeof(up->sbuf) - up->ssize;
#+ if (bpcnt > sizeof(instance->sbuf) - instance->ssize)
#+ bpcnt = sizeof(instance->sbuf) - instance->ssize;
#
# /* Append to input buffer */
#- memcpy((u_char *)up->sbuf + up->ssize, bp, bpcnt);
#- up->ssize += bpcnt;
#+ memcpy((u_char *)instance->sbuf + instance->ssize, bp, bpcnt);
#+ instance->ssize += bpcnt;
#
#- /* While there's at least a header and we parse a intact message */
#- while (up->ssize > sizeof(*hp) && (cc = jupiter_recv(peer)) > 0) {
#- hp = (struct jheader *)up->sbuf;
#+ /* While there's at least a header and we parse an intact message */
#+ while (instance->ssize > sizeof(*hp) && (cc = jupiter_recv(instance)) > 0) {
#+ instance->pollcnt = 2;
#+
#+ tstamp = rbufp->recv_time;
#+ hp = (struct jheader *)instance->sbuf;
# sp = (u_short *)(hp + 1);
# size = cc - sizeof(*hp);
# switch (getshort(hp->id)) {
#@@ -463,7 +567,7 @@
# case JUPITER_O_PULSE:
# if (size != sizeof(struct jpulse)) {
# jupiter_debug(peer,
#- "jupiter_receive: pulse: len %d != %u\n",
#+ "jupiter_receive", "pulse: len %d != %u",
# size, (int)sizeof(struct jpulse));
# refclock_report(peer, CEVNT_BADREPLY);
# break;
#@@ -479,23 +583,32 @@
# * pulse message in the last 210 ms, we skip
# * this one.
# */
#- laststime = up->stime;
#- up->stime = DS2UI(((struct jpulse *)sp)->stime);
#- if (laststime != 0 && up->stime - laststime <= 21) {
#- jupiter_debug(peer, "jupiter_receive: \
#-avoided firmware bug (stime %.2f, laststime %.2f)\n",
#- (double)up->stime * 0.01, (double)laststime * 0.01);
#+ laststime = instance->stime;
#+ instance->stime = DS2UI(((struct jpulse *)sp)->stime);
#+ if (laststime != 0 && instance->stime - laststime <= 21) {
#+ jupiter_debug(peer, "jupiter_receive",
#+ "avoided firmware bug (stime %.2f, laststime %.2f)",
#+ (double)instance->stime * 0.01, (double)laststime * 0.01);
# break;
# }
#
# /* Retrieve pps timestamp */
#- ppsret = jupiter_pps(peer);
#+ ppsret = jupiter_pps(instance);
#+
#+ /*
#+ * Add one second if msg received early
#+ * (i.e. before limit, a.k.a. fudgetime2) in
#+ * the second.
#+ */
#+ L_SUB(&tstamp, &pp->lastrec);
#+ if (!L_ISGEQ(&tstamp, &instance->limit))
#+ ++pp->lastrec.l_ui;
#
# /* Parse timecode (even when there's no pps) */
#- last_timecode = up->timecode;
#- if ((cp = jupiter_parse_t(peer, sp)) != NULL) {
#+ last_timecode = instance->timecode;
#+ if ((cp = jupiter_parse_t(instance, sp)) != NULL) {
# jupiter_debug(peer,
#- "jupiter_receive: pulse: %s\n", cp);
#+ "jupiter_receive", "pulse: %s", cp);
# break;
# }
#
#@@ -508,9 +621,7 @@
# break;
#
# /* Add the new sample to a median filter */
#- if ((cp = jupiter_offset(peer)) != NULL) {
#- jupiter_debug(peer,
#- "jupiter_receive: offset: %s\n", cp);
#+ if (!refclock_process(pp)) {
# refclock_report(peer, CEVNT_BADTIME);
# break;
# }
#@@ -520,288 +631,108 @@
# * but we only want one when polled. If we
# * havn't been polled, bail out.
# */
#- if (!up->polled)
#+ if (!instance->polled)
# break;
#+ instance->polled = 0;
#
# /*
# * It's a live one! Remember this time.
# */
#- pp->lasttime = current_time;
#+
#+ pp->lastref = pp->lastrec;
#+ refclock_receive(peer);
#
# /*
#- * Determine the reference clock offset and
#- * dispersion. NKEEP of NSAMPLE offsets are
#- * passed through a median filter.
#- * Save the (filtered) offset and dispersion in
#- * pp->offset and pp->disp.
#- */
#- if ((cp = jupiter_process(peer)) != NULL) {
#- jupiter_debug(peer,
#- "jupiter_receive: process: %s\n", cp);
#- refclock_report(peer, CEVNT_BADTIME);
#- break;
#- }
#- /*
#- * Return offset and dispersion to control
#- * module. We use lastrec as both the reference
#- * time and receive time in order to avoid
#- * being cute, like setting the reference time
#- * later than the receive time, which may cause
#- * a paranoid protocol module to chuck out the
#- * data.
#+ * If we get here - what we got from the clock is
#+ * OK, so say so
# */
#- jupiter_debug(peer,
#- "jupiter_receive: process time: \
#-%4d-%03d %02d:%02d:%02d at %s, %s\n",
#- pp->year, pp->day,
#- pp->hour, pp->minute, pp->second,
#- prettydate(&pp->lastrec), lfptoa(&pp->offset, 6));
#-
#- refclock_receive(peer);
#+ refclock_report(peer, CEVNT_NOMINAL);
#
# /*
# * We have succeeded in answering the poll.
# * Turn off the flag and return
# */
#- up->polled = 0;
#+ instance->polled = 0;
#+ break;
#+
#+ case JUPITER_O_GPOS:
#+ if (size != sizeof(struct jgpos)) {
#+ jupiter_debug(peer,
#+ "jupiter_receive", "gpos: len %d != %u",
#+ size, (int)sizeof(struct jgpos));
#+ refclock_report(peer, CEVNT_BADREPLY);
#+ break;
#+ }
#+
#+ if ((cp = jupiter_parse_gpos(instance, sp)) != NULL) {
#+ jupiter_debug(peer,
#+ "jupiter_receive", "gpos: %s", cp);
#+ break;
#+ }
# break;
#
# case JUPITER_O_ID:
# if (size != sizeof(struct jid)) {
# jupiter_debug(peer,
#- "jupiter_receive: id: len %d != %u\n",
#+ "jupiter_receive", "id: len %d != %u",
# size, (int)sizeof(struct jid));
# refclock_report(peer, CEVNT_BADREPLY);
# break;
# }
# /*
# * If we got this message because the Jupiter
#- * just powered up, it needs to be reconfigured.
#+ * just powered instance, it needs to be reconfigured.
# */
# ip = (struct jid *)sp;
# jupiter_debug(peer,
#- "jupiter_receive: >> %s chan ver %s, %s (%s)\n",
#+ "jupiter_receive", "%s chan ver %s, %s (%s)",
# ip->chans, ip->vers, ip->date, ip->opts);
# msyslog(LOG_DEBUG,
# "jupiter_receive: %s chan ver %s, %s (%s)\n",
# ip->chans, ip->vers, ip->date, ip->opts);
#- if (up->wantid)
#- up->wantid = 0;
#+ if (instance->wantid)
#+ instance->wantid = 0;
# else {
# jupiter_debug(peer,
#- "jupiter_receive: reset receiver\n");
#- jupiter_config(peer);
#- /* Rese since jupiter_config() just zeroed it */
#- up->ssize = cc;
#+ "jupiter_receive", "reset receiver");
#+ jupiter_config(instance);
#+ /*
#+ * Restore since jupiter_config() just
#+ * zeroed it
#+ */
#+ instance->ssize = cc;
# }
# break;
#
# default:
# jupiter_debug(peer,
#- "jupiter_receive: >> unknown message id %d\n",
#+ "jupiter_receive", "unknown message id %d",
# getshort(hp->id));
# break;
# }
#- up->ssize -= cc;
#- if (up->ssize < 0) {
#+ instance->ssize -= cc;
#+ if (instance->ssize < 0) {
# fprintf(stderr, "jupiter_recv: negative ssize!\n");
# abort();
#- } else if (up->ssize > 0)
#- memcpy(up->sbuf, (u_char *)up->sbuf + cc, up->ssize);
#- }
#- record_clock_stats(&peer->srcadr, "<timecode is binary>");
#-}
#-
#-/*
#- * jupiter_offset - Calculate the offset, and add to the rolling filter.
#- */
#-static char *
#-jupiter_offset(register struct peer *peer)
#-{
#- register struct jupiterunit *up;
#- register struct refclockproc *pp;
#- register int i;
#- l_fp offset;
#-
#- pp = peer->procptr;
#- up = (struct jupiterunit *)pp->unitptr;
#-
#- /*
#- * Calculate the offset
#- */
#- if (!clocktime(pp->day, pp->hour, pp->minute, pp->second, GMT,
#- pp->lastrec.l_ui, &pp->yearstart, &offset.l_ui)) {
#- return ("jupiter_process: clocktime failed");
#- }
#- if (pp->usec) {
#- TVUTOTSF(pp->usec, offset.l_uf);
#- } else {
#- MSUTOTSF(pp->msec, offset.l_uf);
#- }
#- L_ADD(&offset, &pp->fudgetime1);
#- up->lastref = offset; /* save last reference time */
#- L_SUB(&offset, &pp->lastrec); /* form true offset */
#-
#- /*
#- * A rolling filter. Initialize first time around.
#- */
#- i = ((up->coderecv)) % NSAMPLES;
#-
#- up->filter[i] = offset;
#- if (up->coderecv == 0)
#- for (i = 1; (u_int) i < NSAMPLES; i++)
#- up->filter[i] = up->filter[0];
#- up->coderecv++;
#-
#- return (NULL);
#-}
#-
#-/*
#- * jupiter_process - process the sample from the clock,
#- * passing it through a median filter and optionally averaging
#- * the samples. Returns offset and dispersion in "up" structure.
#- */
#-static char *
#-jupiter_process(register struct peer *peer)
#-{
#- register struct jupiterunit *up;
#- register struct refclockproc *pp;
#- register int i, n;
#- register int j, k;
#- l_fp offset, median, lftmp;
#- u_fp disp;
#- l_fp off[NSAMPLES];
#-
#- pp = peer->procptr;
#- up = (struct jupiterunit *)pp->unitptr;
#-
#- /*
#- * Copy the raw offsets and sort into ascending order
#- */
#- for (i = 0; i < NSAMPLES; i++)
#- off[i] = up->filter[i];
#- qsort((char *)off, (size_t)NSAMPLES, sizeof(l_fp), jupiter_cmpl_fp);
#-
#- /*
#- * Reject the furthest from the median of NSAMPLES samples until
#- * NKEEP samples remain.
#- */
#- i = 0;
#- n = NSAMPLES;
#- while ((n - i) > up->nkeep) {
#- lftmp = off[n - 1];
#- median = off[(n + i) / 2];
#- L_SUB(&lftmp, &median);
#- L_SUB(&median, &off[i]);
#- if (L_ISHIS(&median, &lftmp)) {
#- /* reject low end */
#- i++;
#- } else {
#- /* reject high end */
#- n--;
#- }
#- }
#-
#- /*
#- * Copy key values to the billboard to measure performance.
#- */
#- pp->lastref = up->lastref;
#- pp->coderecv = up->coderecv;
#- pp->filter[0] = off[0]; /* smallest offset */
#- pp->filter[1] = off[NSAMPLES-1]; /* largest offset */
#- for (j = 2, k = i; k < n; j++, k++)
#- pp->filter[j] = off[k]; /* offsets actually examined */
#-
#- /*
#- * Compute the dispersion based on the difference between the
#- * extremes of the remaining offsets. Add to this the time since
#- * the last clock update, which represents the dispersion
#- * increase with time. We know that NTP_MAXSKEW is 16. If the
#- * sum is greater than the allowed sample dispersion, bail out.
#- * If the loop is unlocked, return the most recent offset;
#- * otherwise, return the median offset.
#- */
#- lftmp = off[n - 1];
#- L_SUB(&lftmp, &off[i]);
#- disp = LFPTOFP(&lftmp);
#- if (disp > REFCLOCKMAXDISPERSE)
#- return ("Maximum dispersion exceeded");
#-
#- /*
#- * Now compute the offset estimate. If fudge flag 1
#- * is set, average the remainder, otherwise pick the
#- * median.
#- */
#- if (pp->sloppyclockflag & CLK_FLAG1) {
#- L_CLR(&lftmp);
#- while (i < n) {
#- L_ADD(&lftmp, &off[i]);
#- i++;
#- }
#- i = up->rshift;
#- while (i > 0) {
#- L_RSHIFT(&lftmp);
#- i--;
#- }
#- offset = lftmp;
#- } else {
#- i = (n + i) / 2;
#- offset = off[i];
#+ } else if (instance->ssize > 0)
#+ memcpy(instance->sbuf, (u_char *)instance->sbuf + cc, instance->ssize);
# }
#-
#- /*
#- * The payload: filtered offset and dispersion.
#- */
#-
#- pp->offset = offset;
#- pp->disp = disp;
#-
#- return (NULL);
#-
#-}
#-
#-/* Compare two l_fp's, used with qsort() */
#-#ifdef QSORT_USES_VOID_P
#-int
#-jupiter_cmpl_fp(register const void *p1, register const void *p2)
#-#else
#-int
#-jupiter_cmpl_fp(register const l_fp *fp1, register const l_fp *fp2)
#-#endif
#-{
#-#ifdef QSORT_USES_VOID_P
#- register const l_fp *fp1 = (const l_fp *)p1;
#- register const l_fp *fp2 = (const l_fp *)p2;
#-#endif
#-
#- if (!L_ISGEQ(fp1, fp2))
#- return (-1);
#- if (L_ISEQU(fp1, fp2))
#- return (0);
#- return (1);
# }
#
# static char *
#-jupiter_parse_t(register struct peer *peer, register u_short *sp)
#+jupiter_parse_t(struct instance *instance, u_short *sp)
# {
#- register struct refclockproc *pp;
#- register struct jupiterunit *up;
#- register struct tm *tm;
#- register char *cp;
#- register struct jpulse *jp;
#- register struct calendar *jt;
#- register u_int32 sweek;
#- register u_int32 last_timecode;
#- register u_short flags;
#- time_t t;
#- struct calendar cal;
#+ struct tm *tm;
#+ char *cp;
#+ struct jpulse *jp;
#+ u_int32 sweek;
#+ time_t last_timecode;
#+ u_short flags;
#
#- pp = peer->procptr;
#- up = (struct jupiterunit *)pp->unitptr;
# jp = (struct jpulse *)sp;
#
# /* The timecode is presented as seconds into the current GPS week */
#- sweek = DS2UI(jp->sweek);
#+ sweek = DS2UI(jp->sweek) % WEEKSECS;
#
# /*
# * If we don't know the current GPS week, calculate it from the
#@@ -815,12 +746,31 @@
# * If we already know the current GPS week, increment it when
# * we wrap into a new week.
# */
#- if (up->gweek == 0)
#- up->gweek = (time(NULL) - GPS_EPOCH) / WEEKSECS;
#- else if (sweek == 0 && up->lastsweek == WEEKSECS - 1) {
#- ++up->gweek;
#- jupiter_debug(peer,
#- "jupiter_parse_t: NEW gps week %u\n", up->gweek);
#+ if (instance->gweek == 0) {
#+ if (!instance->gpos_gweek) {
#+ return ("jupiter_parse_t: Unknown gweek");
#+ }
#+
#+ instance->gweek = instance->gpos_gweek;
#+
#+ /*
#+ * Fix warps. GPOS has GPS time and PULSE has UTC.
#+ * Plus, GPOS need not be completely in synch with
#+ * the PPS signal.
#+ */
#+ if (instance->gpos_sweek >= sweek) {
#+ if ((instance->gpos_sweek - sweek) > WEEKSECS / 2)
#+ ++instance->gweek;
#+ }
#+ else {
#+ if ((sweek - instance->gpos_sweek) > WEEKSECS / 2)
#+ --instance->gweek;
#+ }
#+ }
#+ else if (sweek == 0 && instance->lastsweek == WEEKSECS - 1) {
#+ ++instance->gweek;
#+ jupiter_debug(instance->peer,
#+ "jupiter_parse_t", "NEW gps week %u", instance->gweek);
# }
#
# /*
#@@ -835,167 +785,145 @@
# *
# * Then we warped.
# */
#- if (up->lastsweek == sweek)
#- jupiter_debug(peer,
#- "jupiter_parse_t: gps sweek not incrementing (%d)\n",
#+ if (instance->lastsweek == sweek)
#+ jupiter_debug(instance->peer,
#+ "jupiter_parse_t", "gps sweek not incrementing (%d)",
# sweek);
#- else if (up->lastsweek != 2 * WEEKSECS &&
#- up->lastsweek + 1 != sweek &&
#- !(sweek == 0 && up->lastsweek == WEEKSECS - 1))
#- jupiter_debug(peer,
#- "jupiter_parse_t: gps sweek jumped (was %d, now %d)\n",
#- up->lastsweek, sweek);
#- up->lastsweek = sweek;
#+ else if (instance->lastsweek != 2 * WEEKSECS &&
#+ instance->lastsweek + 1 != sweek &&
#+ !(sweek == 0 && instance->lastsweek == WEEKSECS - 1))
#+ jupiter_debug(instance->peer,
#+ "jupiter_parse_t", "gps sweek jumped (was %d, now %d)",
#+ instance->lastsweek, sweek);
#+ instance->lastsweek = sweek;
#
# /* This timecode describes next pulse */
#- last_timecode = up->timecode;
#- up->timecode = (u_int32)JAN_1970 +
#- GPS_EPOCH + (up->gweek * WEEKSECS) + sweek;
#+ last_timecode = instance->timecode;
#+ instance->timecode =
#+ GPS_EPOCH + (instance->gweek * WEEKSECS) + sweek;
#
# if (last_timecode == 0)
# /* XXX debugging */
#- jupiter_debug(peer,
#- "jupiter_parse_t: UTC <none> (gweek/sweek %u/%u)\n",
#- up->gweek, sweek);
#+ jupiter_debug(instance->peer,
#+ "jupiter_parse_t", "UTC <none> (gweek/sweek %u/%u)",
#+ instance->gweek, sweek);
# else {
# /* XXX debugging */
#- t = last_timecode - (u_int32)JAN_1970;
#- tm = gmtime(&t);
#+ tm = gmtime(&last_timecode);
# cp = asctime(tm);
#
#- jupiter_debug(peer,
#- "jupiter_parse_t: UTC %.24s (gweek/sweek %u/%u)\n",
#- cp, up->gweek, sweek);
#+ jupiter_debug(instance->peer,
#+ "jupiter_parse_t", "UTC %.24s (gweek/sweek %u/%u)",
#+ cp, instance->gweek, sweek);
#
# /* Billboard last_timecode (which is now the current time) */
#- jt = &cal;
#- caljulian(last_timecode, jt);
#- pp = peer->procptr;
#- pp->year = jt->year;
#- pp->day = jt->yearday;
#- pp->hour = jt->hour;
#- pp->minute = jt->minute;
#- pp->second = jt->second;
#- pp->msec = 0;
#- pp->usec = 0;
#+ instance->peer->procptr->year = tm->tm_year + 1900;
#+ instance->peer->procptr->day = tm->tm_yday + 1;
#+ instance->peer->procptr->hour = tm->tm_hour;
#+ instance->peer->procptr->minute = tm->tm_min;
#+ instance->peer->procptr->second = tm->tm_sec;
# }
#
#- /* XXX debugging */
#- tm = gmtime(&up->ppsev.tv.tv_sec);
#- cp = asctime(tm);
# flags = getshort(jp->flags);
#- jupiter_debug(peer,
#- "jupiter_parse_t: PPS %.19s.%06lu %.4s (serial %u)%s\n",
#- cp, up->ppsev.tv.tv_usec, cp + 20, up->ppsev.serial,
#- (flags & JUPITER_O_PULSE_VALID) == 0 ?
#- " NOT VALID" : "");
#
# /* Toss if not designated "valid" by the gps */
# if ((flags & JUPITER_O_PULSE_VALID) == 0) {
#- refclock_report(peer, CEVNT_BADTIME);
#+ refclock_report(instance->peer, CEVNT_BADTIME);
# return ("time mark not valid");
# }
#
# /* We better be sync'ed to UTC... */
# if ((flags & JUPITER_O_PULSE_UTC) == 0) {
#- refclock_report(peer, CEVNT_BADTIME);
#+ refclock_report(instance->peer, CEVNT_BADTIME);
# return ("time mark not sync'ed to UTC");
# }
#
# return (NULL);
# }
#
#-/*
#- * Process a PPS signal, returning a timestamp.
#- */
#-static int
#-jupiter_pps(register struct peer *peer)
#+static char *
#+jupiter_parse_gpos(struct instance *instance, u_short *sp)
# {
#- register struct refclockproc *pp;
#- register struct jupiterunit *up;
#- register int firsttime;
#- struct timeval ntp_tv;
#+ struct jgpos *jg;
#+ time_t t;
#+ struct tm *tm;
#+ char *cp;
#
#- pp = peer->procptr;
#- up = (struct jupiterunit *)pp->unitptr;
#+ jg = (struct jgpos *)sp;
#
#- /*
#- * Grab the timestamp of the PPS signal.
#- */
#- firsttime = (up->ppsev.tv.tv_sec == 0);
#- if (ioctl(pp->io.fd, CIOGETEV, (caddr_t)&up->ppsev) < 0) {
#- /* XXX Actually, if this fails, we're pretty much screwed */
#- jupiter_debug(peer, "jupiter_pps: CIOGETEV: %s\n",
#- strerror(errno));
#- refclock_report(peer, CEVNT_FAULT);
#- return (1);
#+ if (jg->navval != 0) {
#+ /*
#+ * Solution not valid. Use caution and refuse
#+ * to determine GPS week from this message.
#+ */
#+ instance->gpos_gweek = 0;
#+ instance->gpos_sweek = 0;
#+ return ("Navigation solution not valid");
# }
#
#- /*
#- * Check pps serial number against last one
#- */
#- if (!firsttime && up->lastserial + 1 != up->ppsev.serial) {
#- if (up->ppsev.serial == up->lastserial)
#- jupiter_debug(peer, "jupiter_pps: no new pps event\n");
#- else
#- jupiter_debug(peer,
#- "jupiter_pps: missed %d pps events\n",
#- up->ppsev.serial - up->lastserial - 1);
#- up->lastserial = up->ppsev.serial;
#- refclock_report(peer, CEVNT_FAULT);
#- return (1);
#+ instance->gpos_gweek = jg->gweek;
#+ instance->gpos_sweek = DS2UI(jg->sweek);
#+ while(instance->gpos_sweek >= WEEKSECS) {
#+ instance->gpos_sweek -= WEEKSECS;
#+ ++instance->gpos_gweek;
# }
#- up->lastserial = up->ppsev.serial;
#+ instance->gweek = 0;
#
#- /*
#- * Return the timestamp in pp->lastrec
#- */
#- ntp_tv = up->ppsev.tv;
#- ntp_tv.tv_sec += (u_int32)JAN_1970;
#- TVTOTS(&ntp_tv, &pp->lastrec);
#+ t = GPS_EPOCH + (instance->gpos_gweek * WEEKSECS) + instance->gpos_sweek;
#+ tm = gmtime(&t);
#+ cp = asctime(tm);
#
#- return (0);
#+ jupiter_debug(instance->peer,
#+ "jupiter_parse_g", "GPS %.24s (gweek/sweek %u/%u)",
#+ cp, instance->gpos_gweek, instance->gpos_sweek);
#+ return (NULL);
# }
#
# /*
# * jupiter_debug - print debug messages
# */
#-#if defined(__STDC__)
#+#if defined(__STDC__) || defined(SYS_WINNT)
# static void
#-jupiter_debug(struct peer *peer, char *fmt, ...)
#+jupiter_debug(struct peer *peer, char *function, char *fmt, ...)
# #else
# static void
#-jupiter_debug(peer, fmt, va_alist)
#+jupiter_debug(peer, function, fmt, va_alist)
# struct peer *peer;
#+ char *function;
# char *fmt;
# #endif /* __STDC__ */
# {
#+ char buffer[200];
# va_list ap;
#
#- if (debug) {
#-
#-#if defined(__STDC__)
#- va_start(ap, fmt);
#+#if defined(__STDC__) || defined(SYS_WINNT)
#+ va_start(ap, fmt);
# #else
#- va_start(ap);
#+ va_start(ap);
# #endif /* __STDC__ */
#- /*
#- * Print debug message to stdout
#- * In the future, we may want to get get more creative...
#- */
#- vfprintf(stderr, fmt, ap);
#-
#- va_end(ap);
#+ /*
#+ * Print debug message to stdout
#+ * In the future, we may want to get get more creative...
#+ */
#+ vsnprintf(buffer, sizeof(buffer), fmt, ap);
#+ record_clock_stats(&(peer->srcadr), buffer);
#+ if (debug) {
#+ fprintf(stdout, "%s: ", function);
#+ fprintf(stdout, buffer);
#+ fprintf(stdout, "\n");
#+ fflush(stdout);
# }
#+
#+ va_end(ap);
# }
#
# /* Checksum and transmit a message to the Jupiter */
# static char *
#-jupiter_send(register struct peer *peer, register struct jheader *hp)
#+jupiter_send(struct instance *instance, struct jheader *hp)
# {
#- register u_int len, size;
#- register int cc;
#- register u_short *sp;
#+ u_int len, size;
#+ int cc;
#+ u_short *sp;
# static char errstr[132];
#
# size = sizeof(*hp);
#@@ -1008,7 +936,7 @@
# size += (len + 1) * sizeof(u_short);
# }
#
#- if ((cc = write(peer->procptr->io.fd, (char *)hp, size)) < 0) {
#+ if ((cc = write(instance->peer->procptr->io.fd, (char *)hp, size)) < 0) {
# (void)sprintf(errstr, "write: %s", strerror(errno));
# return (errstr);
# } else if (cc != size) {
#@@ -1032,20 +960,20 @@
#
# /* An interval of zero means to output on trigger */
# static void
#-jupiter_reqmsg(register struct peer *peer, register u_int id,
#- register u_int interval)
#+jupiter_reqmsg(struct instance *instance, u_int id,
#+ u_int interval)
# {
#- register struct jheader *hp;
#- register struct jrequest *rp;
#- register char *cp;
#+ struct jheader *hp;
#+ struct jrequest *rp;
#+ char *cp;
#
# hp = &reqmsg.jheader;
# hp->id = putshort(id);
# rp = &reqmsg.jrequest;
# rp->trigger = putshort(interval == 0);
# rp->interval = putshort(interval);
#- if ((cp = jupiter_send(peer, hp)) != NULL)
#- jupiter_debug(peer, "jupiter_reqmsg: %u: %s\n", id, cp);
#+ if ((cp = jupiter_send(instance, hp)) != NULL)
#+ jupiter_debug(instance->peer, "jupiter_reqmsg", "%u: %s", id, cp);
# }
#
# /* Cancel periodic message output */
#@@ -1056,15 +984,15 @@
# };
#
# static void
#-jupiter_canmsg(register struct peer *peer, register u_int id)
#+jupiter_canmsg(struct instance *instance, u_int id)
# {
#- register struct jheader *hp;
#- register char *cp;
#+ struct jheader *hp;
#+ char *cp;
#
# hp = &canmsg;
# hp->id = putshort(id);
#- if ((cp = jupiter_send(peer, hp)) != NULL)
#- jupiter_debug(peer, "jupiter_canmsg: %u: %s\n", id, cp);
#+ if ((cp = jupiter_send(instance, hp)) != NULL)
#+ jupiter_debug(instance->peer, "jupiter_canmsg", "%u: %s", id, cp);
# }
#
# /* Request a single message output */
#@@ -1075,15 +1003,15 @@
# };
#
# static void
#-jupiter_reqonemsg(register struct peer *peer, register u_int id)
#+jupiter_reqonemsg(struct instance *instance, u_int id)
# {
#- register struct jheader *hp;
#- register char *cp;
#+ struct jheader *hp;
#+ char *cp;
#
# hp = &reqonemsg;
# hp->id = putshort(id);
#- if ((cp = jupiter_send(peer, hp)) != NULL)
#- jupiter_debug(peer, "jupiter_reqonemsg: %u: %s\n", id, cp);
#+ if ((cp = jupiter_send(instance, hp)) != NULL)
#+ jupiter_debug(instance->peer, "jupiter_reqonemsg", "%u: %s", id, cp);
# }
#
# /* Set the platform dynamics */
#@@ -1098,24 +1026,24 @@
# };
#
# static void
#-jupiter_platform(register struct peer *peer, register u_int platform)
#+jupiter_platform(struct instance *instance, u_int platform)
# {
#- register struct jheader *hp;
#- register struct jplat *pp;
#- register char *cp;
#+ struct jheader *hp;
#+ struct jplat *pp;
#+ char *cp;
#
# hp = &platmsg.jheader;
# pp = &platmsg.jplat;
# pp->platform = putshort(platform);
#- if ((cp = jupiter_send(peer, hp)) != NULL)
#- jupiter_debug(peer, "jupiter_platform: %u: %s\n", platform, cp);
#+ if ((cp = jupiter_send(instance, hp)) != NULL)
#+ jupiter_debug(instance->peer, "jupiter_platform", "%u: %s", platform, cp);
# }
#
# /* Checksum "len" shorts */
# static u_short
#-jupiter_cksum(register u_short *sp, register u_int len)
#+jupiter_cksum(u_short *sp, u_int len)
# {
#- register u_short sum, x;
#+ u_short sum, x;
#
# sum = 0;
# while (len-- > 0) {
#@@ -1127,60 +1055,61 @@
#
# /* Return the size of the next message (or zero if we don't have it all yet) */
# static int
#-jupiter_recv(register struct peer *peer)
#+jupiter_recv(struct instance *instance)
# {
#- register int n, len, size, cc;
#- register struct refclockproc *pp;
#- register struct jupiterunit *up;
#- register struct jheader *hp;
#- register u_char *bp;
#- register u_short *sp;
#-
#- pp = peer->procptr;
#- up = (struct jupiterunit *)pp->unitptr;
#+ int n, len, size, cc;
#+ struct jheader *hp;
#+ u_char *bp;
#+ u_short *sp;
#
# /* Must have at least a header's worth */
# cc = sizeof(*hp);
#- size = up->ssize;
#+ size = instance->ssize;
# if (size < cc)
# return (0);
#
# /* Search for the sync short if missing */
#- sp = up->sbuf;
#+ sp = instance->sbuf;
# hp = (struct jheader *)sp;
# if (getshort(hp->sync) != JUPITER_SYNC) {
# /* Wasn't at the front, sync up */
#- jupiter_debug(peer, "syncing");
#+ jupiter_debug(instance->peer, "jupiter_recv", "syncing");
# bp = (u_char *)sp;
# n = size;
# while (n >= 2) {
# if (bp[0] != (JUPITER_SYNC & 0xff)) {
#- jupiter_debug(peer, "{0x%x}", bp[0]);
#+ /*
#+ jupiter_debug(instance->peer, "{0x%x}", bp[0]);
#+ */
# ++bp;
# --n;
# continue;
# }
# if (bp[1] == ((JUPITER_SYNC >> 8) & 0xff))
# break;
#- jupiter_debug(peer, "{0x%x 0x%x}", bp[0], bp[1]);
#+ /*
#+ jupiter_debug(instance->peer, "{0x%x 0x%x}", bp[0], bp[1]);
#+ */
# bp += 2;
# n -= 2;
# }
#- jupiter_debug(peer, "\n");
#+ /*
#+ jupiter_debug(instance->peer, "\n");
#+ */
# /* Shuffle data to front of input buffer */
# if (n > 0)
# memcpy(sp, bp, n);
# size = n;
#- up->ssize = size;
#+ instance->ssize = size;
# if (size < cc || hp->sync != JUPITER_SYNC)
# return (0);
# }
#
# if (jupiter_cksum(sp, (cc / sizeof(u_short) - 1)) !=
# getshort(hp->hsum)) {
#- jupiter_debug(peer, "jupiter_recv: bad header checksum!\n");
#+ jupiter_debug(instance->peer, "jupiter_recv", "bad header checksum!");
# /* This is drastic but checksum errors should be rare */
#- up->ssize = 0;
#+ instance->ssize = 0;
# return (0);
# }
#
#@@ -1195,10 +1124,10 @@
# /* Check payload checksum */
# sp = (u_short *)(hp + 1);
# if (jupiter_cksum(sp, len) != getshort(sp[len])) {
#- jupiter_debug(peer,
#- "jupiter_recv: bad payload checksum!\n");
#+ jupiter_debug(instance->peer,
#+ "jupiter_recv", "bad payload checksum!");
# /* This is drastic but checksum errors should be rare */
#- up->ssize = 0;
#+ instance->ssize = 0;
# return (0);
# }
# cc += n;
#@@ -1206,57 +1135,6 @@
# return (cc);
# }
#
#-static int
#-jupiter_ttyinit(register struct peer *peer, register int fd)
#-{
#- struct termios termios;
#-
#- memset((char *)&termios, 0, sizeof(termios));
#- if (cfsetispeed(&termios, B9600) < 0 ||
#- cfsetospeed(&termios, B9600) < 0) {
#- jupiter_debug(peer,
#- "jupiter_ttyinit: cfsetispeed/cfgetospeed: %s\n",
#- strerror(errno));
#- return (0);
#- }
#-#ifdef HAVE_CFMAKERAW
#- cfmakeraw(&termios);
#-#else
#- termios.c_iflag &= ~(IMAXBEL | IXOFF | INPCK | BRKINT | PARMRK |
#- ISTRIP | INLCR | IGNCR | ICRNL | IXON | IGNPAR);
#- termios.c_iflag |= IGNBRK;
#- termios.c_oflag &= ~OPOST;
#- termios.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL | ICANON | ISIG |
#- IEXTEN | NOFLSH | TOSTOP | PENDIN);
#- termios.c_cflag &= ~(CSIZE | PARENB);
#- termios.c_cflag |= CS8 | CREAD;
#- termios.c_cc[VMIN] = 1;
#-#endif
#- termios.c_cflag |= CLOCAL;
#- if (tcsetattr(fd, TCSANOW, &termios) < 0) {
#- jupiter_debug(peer, "jupiter_ttyinit: tcsetattr: %s\n",
#- strerror(errno));
#- return (0);
#- }
#-
#-#ifdef TIOCSPPS
#- if (ioctl(fd, TIOCSPPS, (char *)&fdpps) < 0) {
#- jupiter_debug(peer, "jupiter_ttyinit: TIOCSPPS: %s\n",
#- strerror(errno));
#- return (0);
#- }
#-#endif
#-#ifdef I_PUSH
#- if (ioctl(fd, I_PUSH, "ppsclock") < 0) {
#- jupiter_debug(peer, "jupiter_ttyinit: push ppsclock: %s\n",
#- strerror(errno));
#- return (0);
#- }
#-#endif
#-
#- return (1);
#-}
#-
#-#else /* not (REFCLOCK && CLOCK_JUPITER && PPS) */
#+#else /* not (REFCLOCK && CLOCK_JUPITER && HAVE_PPSAPI) */
# int refclock_jupiter_bs;
#-#endif /* not (REFCLOCK && CLOCK_JUPITER && PPS) */
#+#endif /* not (REFCLOCK && CLOCK_JUPITER && HAVE_PPSAPI) */
#
#--- 1.9.2.1/ports/winnt/include/config.h Mon Jul 15 00:14:47 2002
#+++ 1.23/ports/winnt/include/config.h Mon Jun 30 05:52:16 2003
#@@ -4,6 +4,13 @@
# #define __config
#
# #if defined(_MSC_VER)
#+/*
#+ * An attempt to cut down the number of warnings generated during compilation.
#+ * All of these should be benign to disable.
#+ */
#+
#+#pragma warning(disable: 4100) /* unreferenced formal parameter */
#+#pragma warning(disable: 4101) /* unreferenced local variable */
# #pragma warning(disable : 4127)
# #endif
#
#@@ -16,16 +23,36 @@
# #if !defined _WIN32_WINNT || _WIN32_WINNT < 0x0400
# # error Please define _WIN32_WINNT in the project settings/makefile
# #endif
#+/*
#+ * ANSI C compliance enabled
#+ */
#+#define __STDC__ 1
#+/* Define if you have the ANSI C header files. */
#+#define STDC_HEADERS 1
#+
#+/* Skip asynch rpc inclusion */
#+#ifndef __RPCASYNC_H__
#+#define __RPCASYNC_H__
#+#endif
#+
#+/* Prevent inclusion of winsock.h in windows.h */
#+#ifndef _WINSOCKAPI_
#+#define _WINSOCKAPI_
#+#endif
#+
# # undef OPEN_BCAST_SOCKET /* for ntp_io.c */
# # undef UDP_WILDCARD_DELIVERY /* for ntp_io.c */ /* 98/06/01 */
#-# undef DES /* from libntp.mak */
# # define HAVE_RANDOM
# #define MAXHOSTNAMELEN 64
# #define AUTOKEY
#
#+/* Enable OpenSSL */
#+#define OPENSSL 1
#+
# #define finite _finite
# # define random rand
# # define srandom srand
#+int NT_set_process_priority(void); /* Define this function */
#
# # define MCAST /* Enable Multicast Support */
# # define REFCLOCK /* from ntpd.mak */
#@@ -41,6 +68,7 @@
# # define CLOCK_DUMBCLOCK
# # define CLOCK_TRIMBLEDC
# # define CLOCK_TRIMTSIP 1
#+# define CLOCK_JUPITER
#
# # define NTP_LITTLE_ENDIAN /* from libntp.mak */
# # define NTP_POSIX_SOURCE
#@@ -55,26 +83,32 @@
# # define QSORT_USES_VOID_P
# # define HAVE_SETVBUF
# # define HAVE_VSPRINTF
#+# define HAVE_SNPRINTF
# # define HAVE_PROTOTYPES /* from ntpq.mak */
# # define HAVE_MEMMOVE
# # define HAVE_TERMIOS_H
# # define HAVE_ERRNO_H
# # define HAVE_STDARG_H
# # define HAVE_NO_NICE
#+# define TIME_WITH_SYS_TIME
# # define HAVE_IO_COMPLETION_PORT
#-//# define volatile
#-# define STDC_HEADERS
#+# define HAVE_SOCKADDR_IN6
#+# define ISC_PLATFORM_NEEDNTOP
#
# # define NEED_S_CHAR_TYPEDEF
#
# # define USE_PROTOTYPES /* for ntp_types.h */
#
#+#define ULONG_CONST(a) a ## UL
#+
# # define NOKMEM
# # define RETSIGTYPE void
# # ifndef STR_SYSTEM
# # define STR_SYSTEM "WINDOWS/NT"
# # endif
# #define SIOCGIFFLAGS SIO_GET_INTERFACE_LIST /* used in ntp_io.c */
#-struct _RPC_ASYNC_STATE; /* forward declare to stop compiler warning */
#+
#+/* Include Windows headers */
#+#include <windows.h>
#
# #endif /* __config */
#
#--- 1.11/ports/winnt/ntpd/ntpd.dsp Sun Sep 16 00:07:14 2001
#+++ 1.17/ports/winnt/ntpd/ntpd.dsp Mon Jun 30 05:52:16 2003
#@@ -42,7 +42,7 @@
# # PROP Ignore_Export_Lib 0
# # PROP Target_Dir ""
# # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
#-# ADD CPP /nologo /MT /W4 /GX /O2 /I "..\..\..\include" /I "..\include" /D "NDEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /YX"windows.h" /FD /c
#+# ADD CPP /nologo /MT /W4 /GX /O2 /I "\\" /I "..\..\..\openssl\inc32" /I "." /I "..\include" /I "..\..\..\include" /I "\openssl-0.9.7b\inc32" /D "NDEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D "__STDC__" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /YX"windows.h" /FD /c
# # ADD BASE RSC /l 0x409 /d "NDEBUG"
# # ADD RSC /l 0x409 /d "NDEBUG"
# BSC32=bscmake.exe
#@@ -50,7 +50,7 @@
# # ADD BSC32 /nologo
# LINK32=link.exe
# # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
#-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386
#+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib \openssl-0.9.7b\out32dll\libeay32.lib /nologo /subsystem:console /machine:I386 /out:"../bin/Release/ntpd.exe"
#
# !ELSEIF "$(CFG)" == "ntpd - Win32 Debug"
#
#@@ -66,7 +66,7 @@
# # PROP Ignore_Export_Lib 0
# # PROP Target_Dir ""
# # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
#-# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "..\..\..\include" /I "..\include" /FI"windows.h" /D "_DEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /FR /YX"windows.h" /FD /GZ /c
#+# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "." /I "..\include" /I "..\..\..\include" /I "\openssl-0.9.7b\inc32" /FI"windows.h" /D "_DEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D "__STDC__" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /FR /YX"windows.h" /FD /GZ /c
# # ADD BASE RSC /l 0x409 /d "_DEBUG"
# # ADD RSC /l 0x409 /d "_DEBUG"
# BSC32=bscmake.exe
#@@ -74,7 +74,7 @@
# # ADD BSC32 /nologo
# LINK32=link.exe
# # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
#-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
#+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib \openssl-0.9.7b\out32dll\libeay32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../bin/Debug/ntpd.exe" /pdbtype:sept
#
# !ENDIF
#
#@@ -432,7 +432,6 @@
# # Begin Source File
#
# SOURCE=..\..\..\ntpd\refclock_jupiter.c
#-# PROP Exclude_From_Build 1
# # End Source File
# # Begin Source File
#
#
# Diff checksum=5a1de376
# Patch vers: 1.3
# Patch type: REGULAR
== ChangeSet ==
stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
stenn at whimsy.udel.edu|ChangeSet|20030627094400|03836
D 1.683.14.33 03/06/28 04:14:43-04:00 stenn at whimsy.udel.edu +5 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c [Bug 136] PPS fixes for refclock_jupiter, from peda at sectra.se (Peter Ekberg)
K 4061
P ChangeSet
------------------------------------------------
0a0
> stenn at whimsy.udel.edu|configure.in|19990526004811|01635|3aed0663 stenn at whimsy.udel.edu|configure.in|20030628081420|29338
> stenn at whimsy.udel.edu|ntpd/refclock_conf.c|19990526004817|01635|3aed0663 stenn at whimsy.udel.edu|ntpd/refclock_conf.c|20030628081420|34792
> stenn at whimsy.udel.edu|ntpd/refclock_jupiter.c|19990526004818|01635|3aed0663 stenn at whimsy.udel.edu|ntpd/refclock_jupiter.c|20030628081420|59384
> stenn at whimsy.udel.edu|ports/winnt/include/config.h|19990728020335|01289|29080509 stenn at whimsy.udel.edu|ports/winnt/include/config.h|20030628081420|32245
> stenn at whimsy.udel.edu|ports/winnt/ntpd/ntpd.dsp|19990728020426|01289|29080509 stenn at whimsy.udel.edu|ports/winnt/ntpd/ntpd.dsp|20030628081420|29101
stenn at whimsy.udel.edu|ChangeSet|20030630083742|19377
D 1.1094 03/06/30 06:51:05-04:00 stenn at whimsy.udel.edu +5 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Merge
i stenn at whimsy.udel.edu|ChangeSet|20030628081443|04061
K 19014
M stenn at whimsy.udel.edu|ChangeSet|20030628081443|04061
P ChangeSet
------------------------------------------------
0a0
> stenn at whimsy.udel.edu|configure.in|19990526004811|01635|3aed0663 stenn at whimsy.udel.edu|configure.in|20030630095215|18855
> stenn at whimsy.udel.edu|ntpd/refclock_conf.c|19990526004817|01635|3aed0663 stenn at whimsy.udel.edu|ntpd/refclock_conf.c|20030630095216|34792
> stenn at whimsy.udel.edu|ntpd/refclock_jupiter.c|19990526004818|01635|3aed0663 stenn at whimsy.udel.edu|ntpd/refclock_jupiter.c|20030630104716|56764
> stenn at whimsy.udel.edu|ports/winnt/include/config.h|19990728020335|01289|29080509 stenn at whimsy.udel.edu|ports/winnt/include/config.h|20030630095216|25489
> stenn at whimsy.udel.edu|ports/winnt/ntpd/ntpd.dsp|19990728020426|01289|29080509 stenn at whimsy.udel.edu|ports/winnt/ntpd/ntpd.dsp|20030630095216|49752
stenn at whimsy.udel.edu|ChangeSet|20030630105105|19014
D 1.1095 03/06/30 07:14:08-04:00 stenn at whimsy.udel.edu +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c More cleanup to the refclock_jupiter clock.
K 19002
P ChangeSet
------------------------------------------------
0a0
> stenn at whimsy.udel.edu|ntpd/refclock_jupiter.c|19990526004818|01635|3aed0663 stenn at whimsy.udel.edu|ntpd/refclock_jupiter.c|20030630111353|55506
stenn at whimsy.udel.edu|ChangeSet|20030628081443|04061
D 1.683.14.34 03/06/30 07:26:47-04:00 stenn at whimsy.udel.edu +0 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Merge whimsy.udel.edu:/backroom/ntp-stable
c into whimsy.udel.edu:/backroom/ntp-stable-136
i stenn at whimsy.udel.edu|ChangeSet|20030629101950|03828
K 4053
M stenn at whimsy.udel.edu|ChangeSet|20030629101950|03828
P ChangeSet
------------------------------------------------
stenn at whimsy.udel.edu|ChangeSet|20030630111408|19002
D 1.1096 03/06/30 07:42:06-04:00 stenn at whimsy.udel.edu +0 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Merge whimsy.udel.edu:/backroom/ntp-stable-136
c into whimsy.udel.edu:/backroom/ntp-dev-136
i stenn at whimsy.udel.edu|ChangeSet|20030630112647|04053
K 19002
M stenn at whimsy.udel.edu|ChangeSet|20030630112647|04053
P ChangeSet
------------------------------------------------
== configure.in ==
stenn at whimsy.udel.edu|configure.in|19990526004811|01635|3aed0663
stenn at whimsy.udel.edu|configure.in|20030610080847|34555
D 1.219.3.46 03/06/28 04:14:20-04:00 stenn at whimsy.udel.edu +6 -11
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c [Bug 136] PPS fixes for refclock_jupiter, from peda at sectra.se (Peter Ekberg)
K 29338
O -rw-rw-r--
P configure.in
------------------------------------------------
I13 1
ac_cv_var_jupiter_ok=no
I1520 1
ac_cv_var_jupiter_ok=yes
D1878 1
D1882 7
I1888 4
[ntp_ok=$enableval], [ntp_ok=$ntp_eac])
case "$ac_cv_var_jupiter_ok" in
no) ntp_ok=no ;;
esac
D1894 3
stenn at whimsy.udel.edu|configure.in|20030613064155|24072
D 1.317 03/06/30 05:52:15-04:00 stenn at whimsy.udel.edu +4 -15
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Auto merged
i stenn at whimsy.udel.edu|configure.in|20030628081420|29338
K 18855
M stenn at whimsy.udel.edu|configure.in|20030628081420|29338
O -rw-rw-r--
P configure.in
------------------------------------------------
D2008 1
D2012 7
I2018 4
[ntp_ok=$enableval], [ntp_ok=$ntp_eac])
case "$ac_cv_var_jupiter_ok" in
no) ntp_ok=no ;;
esac
D2024 3
D2028 4
== ntpd/refclock_conf.c ==
stenn at whimsy.udel.edu|ntpd/refclock_conf.c|19990526004817|01635|3aed0663
claas at webfix.linum.ein|ntpd/refclock_conf.c|20020718154239|34187
D 1.13.1.7 03/06/28 04:14:20-04:00 stenn at whimsy.udel.edu +1 -1
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c [Bug 136] PPS fixes for refclock_jupiter, from peda at sectra.se (Peter Ekberg)
K 34792
O -rw-rw-r--
P ntpd/refclock_conf.c
------------------------------------------------
D195 1
I195 1
#if defined(CLOCK_JUPITER) && defined(HAVE_PPSAPI)
stenn at whimsy.udel.edu|ntpd/refclock_conf.c|20020719163440|34187
D 1.22 03/06/30 05:52:16-04:00 stenn at whimsy.udel.edu +0 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Auto merged
i stenn at whimsy.udel.edu|ntpd/refclock_conf.c|20030628081420|34792
K 34792
M stenn at whimsy.udel.edu|ntpd/refclock_conf.c|20030628081420|34792
O -rw-rw-r--
P ntpd/refclock_conf.c
------------------------------------------------
== ntpd/refclock_jupiter.c ==
stenn at whimsy.udel.edu|ntpd/refclock_jupiter.c|19990526004818|01635|3aed0663
stenn at whimsy.udel.edu|ntpd/refclock_jupiter.c|20011009011819|07174
D 1.8.1.1 03/06/28 04:14:20-04:00 stenn at whimsy.udel.edu +529 -650
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c [Bug 136] PPS fixes for refclock_jupiter, from peda at sectra.se (Peter Ekberg)
K 59384
O -rw-rw-r--
P ntpd/refclock_jupiter.c
------------------------------------------------
D2 1
I2 1
* Copyright (c) 1997, 1998, 2003
D38 1
I38 1
#if defined(REFCLOCK) && defined(CLOCK_JUPITER) && defined(HAVE_PPSAPI)
D45 1
D52 1
I52 9
#ifdef HAVE_PPSAPI
# ifdef HAVE_TIMEPPS_H
# include <timepps.h>
# else
# ifdef HAVE_SYS_TIMEPPS_H
# include <sys/timepps.h>
# endif
# endif
#endif
D86 9
D117 1
I117 2
struct instance {
struct peer *peer; /* peer */
D120 2
I121 10
#ifdef HAVE_PPSAPI
pps_params_t pps_params; /* pps parameters */
pps_info_t pps_info; /* last pps data */
pps_handle_t pps_handle; /* pps handle */
u_int assert; /* pps edge to use */
struct timespec ts; /* last timestamp */
#endif
l_fp limit;
u_int gpos_gweek; /* Current GPOS GPS week number */
u_int gpos_sweek; /* Current GPOS GPS seconds into week */
D124 1
I124 1
time_t timecode; /* current ntp timecode */
D128 7
I134 1
u_char sloppyclockflag; /* fudge flags */
D142 1
I142 1
static void jupiter_canmsg P((struct instance *, u_int));
D144 11
I154 6
static int jupiter_config P((struct instance *));
static void jupiter_debug P((struct peer *, char *, char *, ...))
__attribute__ ((format (printf, 3, 4)));
static char * jupiter_parse_t P((struct instance *, u_short *));
static char * jupiter_parse_gpos P((struct instance *, u_short *));
static void jupiter_platform P((struct instance *, u_int));
D156 7
I162 11
static void jupiter_control P((int, struct refclockstat *, struct
refclockstat *, struct peer *));
#ifdef HAVE_PPSAPI
static int jupiter_ppsapi P((struct instance *, int, int));
static int jupiter_pps P((struct instance *));
#endif /* HAVE_PPSAPI */
static int jupiter_recv P((struct instance *));
static void jupiter_receive P((struct recvbuf *rbufp));
static void jupiter_reqmsg P((struct instance *, u_int, u_int));
static void jupiter_reqonemsg P((struct instance *, u_int));
static char * jupiter_send P((struct instance *, struct jheader *));
D165 1
D174 1
I174 1
jupiter_control, /* (clock control) */
D185 2
I186 2
int unit,
struct peer *peer
D190 2
I191 2
struct instance *instance;
int fd = -1;
D198 7
I204 3
fd = refclock_open(gpsdev, SPEED232, LDISC_RAW);
if (fd == 0) {
jupiter_debug(peer, "jupiter_start", "open %s: %s",
D208 2
D212 2
I213 2
if ((instance = (struct instance *)
emalloc(sizeof(struct instance))) == NULL) {
D217 1
I217 2
memset((char *)instance, 0, sizeof(struct instance));
instance->peer = peer;
D225 1
I225 1
free(instance);
D228 1
I228 1
pp->unitptr = (caddr_t)instance;
I236 13
#ifdef HAVE_PPSAPI
/*
* Start the PPSAPI interface if it is there. Default to use
* the assert edge and do not enable the kernel hardpps.
*/
if (time_pps_create(fd, &instance->pps_handle) < 0) {
instance->pps_handle = 0;
msyslog(LOG_ERR,
"refclock_jupiter: time_pps_create failed: %m");
}
else if (!jupiter_ppsapi(instance, 0, 0))
goto clean_up;
#endif /* HAVE_PPSAPI */
D239 1
I239 2
if (!jupiter_config(instance))
goto clean_up;
D241 10
I251 5
\
clean_up:
jupiter_shutdown(unit, peer);
pp->unitptr = 0;
return (0);
D258 1
I258 1
jupiter_shutdown(int unit, struct peer *peer)
D260 1
I260 1
struct instance *instance;
D264 1
I264 11
instance = (struct instance *)pp->unitptr;
if(!instance)
return;
\
#ifdef HAVE_PPSAPI
if (instance->pps_handle) {
time_pps_destroy(instance->pps_handle);
instance->pps_handle = 0;
}
#endif /* HAVE_PPSAPI */
\
D266 1
I266 1
free(instance);
D272 2
I273 2
static int
jupiter_config(struct instance *instance)
D275 6
I280 1
jupiter_debug(instance->peer, "jupiter_config", "init receiver");
D284 4
D289 56
I344 15
instance->sloppyclockflag = instance->peer->procptr->sloppyclockflag;
instance->moving = !!(instance->sloppyclockflag & CLK_FLAG2);
if (instance->moving)
jupiter_debug(instance->peer, "jupiter_config",
"mobile platform");
\
instance->pollcnt = 2;
instance->polled = 0;
instance->gpos_gweek = 0;
instance->gpos_sweek = 0;
instance->gweek = 0;
instance->lastsweek = 2 * WEEKSECS;
instance->timecode = 0;
instance->stime = 0;
instance->ssize = 0;
D347 1
I347 1
jupiter_canmsg(instance, JUPITER_ALL);
D350 1
I350 1
jupiter_reqonemsg(instance, JUPITER_O_ID);
D353 1
I353 1
instance->wantid = 1;
D356 1
I356 4
jupiter_reqmsg(instance, JUPITER_O_PULSE, 1);
\
/* Request perodic geodetic position status */
jupiter_reqmsg(instance, JUPITER_O_GPOS, 1);
D359 2
I360 29
if (instance->moving)
jupiter_platform(instance, JUPITER_I_PLAT_MED);
else
jupiter_platform(instance, JUPITER_I_PLAT_LOW);
\
return (1);
}
\
#ifdef HAVE_PPSAPI
/*
* Initialize PPSAPI
*/
int
jupiter_ppsapi(
struct instance *instance, /* unit structure pointer */
int enb_clear, /* clear enable */
int enb_hardpps /* hardpps enable */
)
{
int capability;
\
if (time_pps_getcap(instance->pps_handle, &capability) < 0) {
msyslog(LOG_ERR,
"refclock_jupiter: time_pps_getcap failed: %m");
return (0);
}
memset(&instance->pps_params, 0, sizeof(pps_params_t));
if (enb_clear)
instance->pps_params.mode = capability & PPS_CAPTURECLEAR;
D362 1
I362 36
instance->pps_params.mode = capability & PPS_CAPTUREASSERT;
if (!(instance->pps_params.mode & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR))) {
msyslog(LOG_ERR,
"refclock_jupiter: invalid capture edge %d",
!enb_clear);
return (0);
}
instance->pps_params.mode |= PPS_TSFMT_TSPEC;
if (time_pps_setparams(instance->pps_handle, &instance->pps_params) < 0) {
msyslog(LOG_ERR,
"refclock_jupiter: time_pps_setparams failed: %m");
return (0);
}
if (enb_hardpps) {
if (time_pps_kcbind(instance->pps_handle, PPS_KC_HARDPPS,
instance->pps_params.mode & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR),
PPS_TSFMT_TSPEC) < 0) {
msyslog(LOG_ERR,
"refclock_jupiter: time_pps_kcbind failed: %m");
return (0);
}
pps_enable = 1;
}
/* instance->peer->precision = PPS_PRECISION; */
\
#if DEBUG
if (debug) {
time_pps_getparams(instance->pps_handle, &instance->pps_params);
jupiter_debug(instance->peer, "refclock_jupiter",
"pps capability 0x%x version %d mode 0x%x kern %d",
capability, instance->pps_params.api_version,
instance->pps_params.mode, enb_hardpps);
}
#endif
\
return (1);
I365 49
* Get PPSAPI timestamps.
*
* Return 0 on failure and 1 on success.
*/
static int
jupiter_pps(struct instance *instance)
{
pps_info_t pps_info;
struct timespec timeout, ts;
double dtemp;
l_fp tstmp;
\
/*
* Convert the timespec nanoseconds field to ntp l_fp units.
*/
if (instance->pps_handle == 0)
return 1;
timeout.tv_sec = 0;
timeout.tv_nsec = 0;
memcpy(&pps_info, &instance->pps_info, sizeof(pps_info_t));
if (time_pps_fetch(instance->pps_handle, PPS_TSFMT_TSPEC, &instance->pps_info,
&timeout) < 0)
return 1;
if (instance->pps_params.mode & PPS_CAPTUREASSERT) {
if (pps_info.assert_sequence ==
instance->pps_info.assert_sequence)
return 1;
ts = instance->pps_info.assert_timestamp;
} else if (instance->pps_params.mode & PPS_CAPTURECLEAR) {
if (pps_info.clear_sequence ==
instance->pps_info.clear_sequence)
return 1;
ts = instance->pps_info.clear_timestamp;
} else {
return 1;
}
if ((instance->ts.tv_sec == ts.tv_sec) && (instance->ts.tv_nsec == ts.tv_nsec))
return 1;
instance->ts = ts;
\
tstmp.l_ui = ts.tv_sec + JAN_1970;
dtemp = ts.tv_nsec * FRAC / 1e9;
tstmp.l_uf = (u_int32)dtemp;
instance->peer->procptr->lastrec = tstmp;
return 0;
}
#endif /* HAVE_PPSAPI */
\
/*
D369 1
I369 1
jupiter_poll(int unit, struct peer *peer)
D371 2
I372 2
struct instance *instance;
struct refclockproc *pp;
D375 1
I375 1
instance = (struct instance *)pp->unitptr;
D386 2
I387 2
if (instance->pollcnt > 0) {
instance->pollcnt--;
D392 2
I393 2
jupiter_reqonemsg(instance, JUPITER_O_ID);
instance->wantid = 0;
D400 1
I400 1
instance->polled = 1;
D405 2
I406 1
* jupiter_control - fudge control
D409 1
I409 6
jupiter_control(
int unit, /* unit (not used) */
struct refclockstat *in, /* input parameters (not used) */
struct refclockstat *out, /* output parameters (not used) */
struct peer *peer /* peer structure pointer */
)
D411 11
I421 3
struct refclockproc *pp;
struct instance *instance;
u_char sloppyclockflag;
D423 2
D426 1
I426 1
instance = (struct instance *)pp->unitptr;
D428 8
I435 13
DTOLFP(pp->fudgetime2, &instance->limit);
/* Force positive value. */
if (L_ISNEG(&instance->limit))
L_NEG(&instance->limit);
\
#ifdef HAVE_PPSAPI
instance->assert = !pp->sloppyclockflag & CLK_FLAG3;
jupiter_ppsapi(instance, !instance->assert, 0);
#endif /* HAVE_PPSAPI */
\
sloppyclockflag = instance->sloppyclockflag;
instance->sloppyclockflag = pp->sloppyclockflag;
if ((instance->sloppyclockflag & CLK_FLAG2) !=
D438 2
I439 3
"jupiter_control",
"mode switch: reset receiver");
jupiter_config(instance);
I441 1
}
D443 1
I443 24
/*
* jupiter_receive - receive gps data
* Gag me!
*/
static void
jupiter_receive(struct recvbuf *rbufp)
{
int bpcnt, cc, size, ppsret;
time_t last_timecode;
u_int32 laststime;
char *cp;
u_char *bp;
u_short *sp;
struct jid *ip;
struct jheader *hp;
struct peer *peer;
struct refclockproc *pp;
struct instance *instance;
l_fp tstamp;
\
/* Initialize pointers and read the timecode and timestamp */
peer = (struct peer *)rbufp->recv_srcclock;
pp = peer->procptr;
instance = (struct instance *)pp->unitptr;
D449 2
I450 2
if (bpcnt > sizeof(instance->sbuf) - instance->ssize)
bpcnt = sizeof(instance->sbuf) - instance->ssize;
D453 2
I454 2
memcpy((u_char *)instance->sbuf + instance->ssize, bp, bpcnt);
instance->ssize += bpcnt;
D456 3
I458 6
/* While there's at least a header and we parse an intact message */
while (instance->ssize > sizeof(*hp) && (cc = jupiter_recv(instance)) > 0) {
instance->pollcnt = 2;
\
tstamp = rbufp->recv_time;
hp = (struct jheader *)instance->sbuf;
D466 1
I466 1
"jupiter_receive", "pulse: len %d != %u",
D482 6
I487 6
laststime = instance->stime;
instance->stime = DS2UI(((struct jpulse *)sp)->stime);
if (laststime != 0 && instance->stime - laststime <= 21) {
jupiter_debug(peer, "jupiter_receive",
"avoided firmware bug (stime %.2f, laststime %.2f)",
(double)instance->stime * 0.01, (double)laststime * 0.01);
D492 1
I492 10
ppsret = jupiter_pps(instance);
\
/*
* Add one second if msg received early
* (i.e. before limit, a.k.a. fudgetime2) in
* the second.
*/
L_SUB(&tstamp, &pp->lastrec);
if (!L_ISGEQ(&tstamp, &instance->limit))
++pp->lastrec.l_ui;
D495 2
I496 2
last_timecode = instance->timecode;
if ((cp = jupiter_parse_t(instance, sp)) != NULL) {
D498 1
I498 1
"jupiter_receive", "pulse: %s", cp);
D511 3
I513 1
if (!refclock_process(pp)) {
D523 1
I523 1
if (!instance->polled)
I524 1
instance->polled = 0;
D529 1
I529 2
\
refclock_receive(peer);
D532 20
I551 2
* If we get here - what we got from the clock is
* OK, so say so
D553 8
I560 1
refclock_report(peer, CEVNT_NOMINAL);
D566 1
I566 17
instance->polled = 0;
break;
\
case JUPITER_O_GPOS:
if (size != sizeof(struct jgpos)) {
jupiter_debug(peer,
"jupiter_receive", "gpos: len %d != %u",
size, (int)sizeof(struct jgpos));
refclock_report(peer, CEVNT_BADREPLY);
break;
}
\
if ((cp = jupiter_parse_gpos(instance, sp)) != NULL) {
jupiter_debug(peer,
"jupiter_receive", "gpos: %s", cp);
break;
}
D572 1
I572 1
"jupiter_receive", "id: len %d != %u",
D579 1
I579 1
* just powered instance, it needs to be reconfigured.
D583 1
I583 1
"jupiter_receive", "%s chan ver %s, %s (%s)",
D588 2
I589 2
if (instance->wantid)
instance->wantid = 0;
D592 4
I595 7
"jupiter_receive", "reset receiver");
jupiter_config(instance);
/*
* Restore since jupiter_config() just
* zeroed it
*/
instance->ssize = cc;
D601 1
I601 1
"jupiter_receive", "unknown message id %d",
D605 2
I606 2
instance->ssize -= cc;
if (instance->ssize < 0) {
D609 141
I749 2
} else if (instance->ssize > 0)
memcpy(instance->sbuf, (u_char *)instance->sbuf + cc, instance->ssize);
D751 31
D785 1
I785 1
jupiter_parse_t(struct instance *instance, u_short *sp)
D787 11
I797 6
struct tm *tm;
char *cp;
struct jpulse *jp;
u_int32 sweek;
time_t last_timecode;
u_short flags;
D799 2
D804 1
I804 1
sweek = DS2UI(jp->sweek) % WEEKSECS;
D818 6
I823 25
if (instance->gweek == 0) {
if (!instance->gpos_gweek) {
return ("jupiter_parse_t: Unknown gweek");
}
\
instance->gweek = instance->gpos_gweek;
\
/*
* Fix warps. GPOS has GPS time and PULSE has UTC.
* Plus, GPOS need not be completely in synch with
* the PPS signal.
*/
if (instance->gpos_sweek >= sweek) {
if ((instance->gpos_sweek - sweek) > WEEKSECS / 2)
++instance->gweek;
}
else {
if ((sweek - instance->gpos_sweek) > WEEKSECS / 2)
--instance->gweek;
}
}
else if (sweek == 0 && instance->lastsweek == WEEKSECS - 1) {
++instance->gweek;
jupiter_debug(instance->peer,
"jupiter_parse_t", "NEW gps week %u", instance->gweek);
D838 3
I840 3
if (instance->lastsweek == sweek)
jupiter_debug(instance->peer,
"jupiter_parse_t", "gps sweek not incrementing (%d)",
D842 7
I848 7
else if (instance->lastsweek != 2 * WEEKSECS &&
instance->lastsweek + 1 != sweek &&
!(sweek == 0 && instance->lastsweek == WEEKSECS - 1))
jupiter_debug(instance->peer,
"jupiter_parse_t", "gps sweek jumped (was %d, now %d)",
instance->lastsweek, sweek);
instance->lastsweek = sweek;
D851 3
I853 3
last_timecode = instance->timecode;
instance->timecode =
GPS_EPOCH + (instance->gweek * WEEKSECS) + sweek;
D857 3
I859 3
jupiter_debug(instance->peer,
"jupiter_parse_t", "UTC <none> (gweek/sweek %u/%u)",
instance->gweek, sweek);
D862 2
I863 1
tm = gmtime(&last_timecode);
D866 3
I868 3
jupiter_debug(instance->peer,
"jupiter_parse_t", "UTC %.24s (gweek/sweek %u/%u)",
cp, instance->gweek, sweek);
D871 10
I880 7
instance->peer->procptr->year = tm->tm_year + 1900;
instance->peer->procptr->day = tm->tm_yday + 1;
instance->peer->procptr->hour = tm->tm_hour;
instance->peer->procptr->minute = tm->tm_min;
instance->peer->procptr->second = tm->tm_sec;
instance->peer->procptr->msec = 0;
instance->peer->procptr->usec = 0;
D883 3
D887 5
D895 1
I895 1
refclock_report(instance->peer, CEVNT_BADTIME);
D901 1
I901 1
refclock_report(instance->peer, CEVNT_BADTIME);
D908 5
I912 2
static char *
jupiter_parse_gpos(struct instance *instance, u_short *sp)
D914 4
I917 4
struct jgpos *jg;
time_t t;
struct tm *tm;
char *cp;
D919 2
I920 1
jg = (struct jgpos *)sp;
D922 10
I931 8
if (jg->navval != 0) {
/*
* Solution not valid. Use caution and refuse
* to determine GPS week from this message.
*/
instance->gpos_gweek = 0;
instance->gpos_sweek = 0;
return ("Navigation solution not valid");
D934 13
I946 5
instance->gpos_gweek = jg->gweek;
instance->gpos_sweek = DS2UI(jg->sweek);
while(instance->gpos_sweek >= WEEKSECS) {
instance->gpos_sweek -= WEEKSECS;
++instance->gpos_gweek;
D948 1
I948 1
instance->gweek = 0;
D950 6
I955 3
t = GPS_EPOCH + (instance->gpos_gweek * WEEKSECS) + instance->gpos_sweek;
tm = gmtime(&t);
cp = asctime(tm);
D957 1
I957 4
jupiter_debug(instance->peer,
"jupiter_parse_g", "GPS %.24s (gweek/sweek %u/%u)",
cp, instance->gpos_gweek, instance->gpos_sweek);
return (NULL);
D963 1
I963 1
#if defined(__STDC__) || defined(SYS_WINNT)
D965 1
I965 1
jupiter_debug(struct peer *peer, char *function, char *fmt, ...)
D968 1
I968 1
jupiter_debug(peer, function, fmt, va_alist)
I969 1
char *function;
I972 1
char buffer[200];
D975 4
I978 2
#if defined(__STDC__) || defined(SYS_WINNT)
va_start(ap, fmt);
D980 1
I980 1
va_start(ap);
D982 7
I988 11
/*
* Print debug message to stdout
* In the future, we may want to get get more creative...
*/
vsnprintf(buffer, sizeof(buffer), fmt, ap);
record_clock_stats(&(peer->srcadr), buffer);
if (debug) {
fprintf(stdout, "%s: ", function);
fprintf(stdout, buffer);
fprintf(stdout, "\n");
fflush(stdout);
I989 2
\
va_end(ap);
D994 1
I994 1
jupiter_send(struct instance *instance, struct jheader *hp)
D996 3
I998 3
u_int len, size;
int cc;
u_short *sp;
D1011 1
I1011 1
if ((cc = write(instance->peer->procptr->io.fd, (char *)hp, size)) < 0) {
D1035 2
I1036 2
jupiter_reqmsg(struct instance *instance, u_int id,
u_int interval)
D1038 3
I1040 3
struct jheader *hp;
struct jrequest *rp;
char *cp;
D1047 2
I1048 2
if ((cp = jupiter_send(instance, hp)) != NULL)
jupiter_debug(instance->peer, "jupiter_reqmsg", "%u: %s", id, cp);
D1059 1
I1059 1
jupiter_canmsg(struct instance *instance, u_int id)
D1061 2
I1062 2
struct jheader *hp;
char *cp;
D1066 2
I1067 2
if ((cp = jupiter_send(instance, hp)) != NULL)
jupiter_debug(instance->peer, "jupiter_canmsg", "%u: %s", id, cp);
D1078 1
I1078 1
jupiter_reqonemsg(struct instance *instance, u_int id)
D1080 2
I1081 2
struct jheader *hp;
char *cp;
D1085 2
I1086 2
if ((cp = jupiter_send(instance, hp)) != NULL)
jupiter_debug(instance->peer, "jupiter_reqonemsg", "%u: %s", id, cp);
D1101 1
I1101 1
jupiter_platform(struct instance *instance, u_int platform)
D1103 3
I1105 3
struct jheader *hp;
struct jplat *pp;
char *cp;
D1110 2
I1111 2
if ((cp = jupiter_send(instance, hp)) != NULL)
jupiter_debug(instance->peer, "jupiter_platform", "%u: %s", platform, cp);
D1116 1
I1116 1
jupiter_cksum(u_short *sp, u_int len)
D1118 1
I1118 1
u_short sum, x;
D1130 1
I1130 1
jupiter_recv(struct instance *instance)
D1132 9
I1140 4
int n, len, size, cc;
struct jheader *hp;
u_char *bp;
u_short *sp;
D1144 1
I1144 1
size = instance->ssize;
D1149 1
I1149 1
sp = instance->sbuf;
D1153 1
I1153 1
jupiter_debug(instance->peer, "jupiter_recv", "syncing");
D1158 1
I1158 3
/*
jupiter_debug(instance->peer, "{0x%x}", bp[0]);
*/
D1165 1
I1165 3
/*
jupiter_debug(instance->peer, "{0x%x 0x%x}", bp[0], bp[1]);
*/
D1169 1
I1169 3
/*
jupiter_debug(instance->peer, "\n");
*/
D1174 1
I1174 1
instance->ssize = size;
D1181 1
I1181 1
jupiter_debug(instance->peer, "jupiter_recv", "bad header checksum!");
D1183 1
I1183 1
instance->ssize = 0;
D1198 2
I1199 2
jupiter_debug(instance->peer,
"jupiter_recv", "bad payload checksum!");
D1201 1
I1201 1
instance->ssize = 0;
D1209 52
I1260 1
#else /* not (REFCLOCK && CLOCK_JUPITER && HAVE_PPSAPI) */
D1262 1
I1262 1
#endif /* not (REFCLOCK && CLOCK_JUPITER && HAVE_PPSAPI) */
stenn at whimsy.udel.edu|ntpd/refclock_jupiter.c|20011222032418|38818
D 1.10 03/06/30 06:47:16-04:00 stenn at whimsy.udel.edu +1 -2
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Try Real Hard to apply the original stable -> dev
c patches to the new stable -> new dev code.
i stenn at whimsy.udel.edu|ntpd/refclock_jupiter.c|20030628081420|59384
K 56764
M stenn at whimsy.udel.edu|ntpd/refclock_jupiter.c|20030628081420|59384
O -rw-rw-r--
P ntpd/refclock_jupiter.c
------------------------------------------------
I641 1
instance->lastref = instance->lastrec;
D824 2
stenn at whimsy.udel.edu|ntpd/refclock_jupiter.c|20030630104716|56764
D 1.11 03/06/30 07:13:53-04:00 stenn at whimsy.udel.edu +1 -1
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c More cleanup to the refclock_jupiter clock.
K 55506
O -rw-rw-r--
P ntpd/refclock_jupiter.c
------------------------------------------------
D642 1
I642 1
pp->lastref = pp->lastrec;
== ports/winnt/include/config.h ==
stenn at whimsy.udel.edu|ports/winnt/include/config.h|19990728020335|01289|29080509
harlan at dog.pfcs.com|ports/winnt/include/config.h|20020715041447|30511
D 1.9.2.2 03/06/28 04:14:20-04:00 stenn at whimsy.udel.edu +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c [Bug 136] PPS fixes for refclock_jupiter, from peda at sectra.se (Peter Ekberg)
K 32245
O -rw-rw-r--
P ports/winnt/include/config.h
------------------------------------------------
I43 1
# define CLOCK_JUPITER
mayer at tecotoo.myibg.com|ports/winnt/include/config.h|20030628021856|23755
D 1.23 03/06/30 05:52:16-04:00 stenn at whimsy.udel.edu +0 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Auto merged
i stenn at whimsy.udel.edu|ports/winnt/include/config.h|20030628081420|32245
K 25489
M stenn at whimsy.udel.edu|ports/winnt/include/config.h|20030628081420|32245
O -rw-rw-r--
P ports/winnt/include/config.h
------------------------------------------------
== ports/winnt/ntpd/ntpd.dsp ==
stenn at whimsy.udel.edu|ports/winnt/ntpd/ntpd.dsp|19990728020426|01289|29080509
stenn at whimsy.udel.edu|ports/winnt/ntpd/ntpd.dsp|20010916040714|03397
D 1.11.1.1 03/06/28 04:14:20-04:00 stenn at whimsy.udel.edu +0 -1
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c [Bug 136] PPS fixes for refclock_jupiter, from peda at sectra.se (Peter Ekberg)
K 29101
O -rw-rw-r--
P ports/winnt/ntpd/ntpd.dsp
------------------------------------------------
D435 1
mayer at tecotoo.myibg.com|ports/winnt/ntpd/ntpd.dsp|20030628021905|52067
D 1.17 03/06/30 05:52:16-04:00 stenn at whimsy.udel.edu +0 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Auto merged
i stenn at whimsy.udel.edu|ports/winnt/ntpd/ntpd.dsp|20030628081420|29101
K 49752
M stenn at whimsy.udel.edu|ports/winnt/ntpd/ntpd.dsp|20030628081420|29101
O -rw-rw-r--
P ports/winnt/ntpd/ntpd.dsp
------------------------------------------------
# Patch checksum=9e54f138
More information about the bk-ntp-dev-send
mailing list