diff options
author | delphij <delphij@FreeBSD.org> | 2015-07-15 19:21:26 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2015-07-15 19:21:26 +0000 |
commit | 2a25cee78ab1d37e7d2bc40ae675646974d99f56 (patch) | |
tree | b0302ac4be59e104f4e1e54014561a1389397192 /contrib/ntp/include/ntp_refclock.h | |
parent | a0741a75537b2e0514472ac3b28afc55a7846c30 (diff) | |
download | FreeBSD-src-2a25cee78ab1d37e7d2bc40ae675646974d99f56.zip FreeBSD-src-2a25cee78ab1d37e7d2bc40ae675646974d99f56.tar.gz |
MFC r280849,280915-280916,281015-281016,282097,282408,282415,283542,
284864,285169-285170,285435:
ntp 4.2.8p3.
Relnotes: yes
Approved by: re (?)
Diffstat (limited to 'contrib/ntp/include/ntp_refclock.h')
-rw-r--r-- | contrib/ntp/include/ntp_refclock.h | 138 |
1 files changed, 52 insertions, 86 deletions
diff --git a/contrib/ntp/include/ntp_refclock.h b/contrib/ntp/include/ntp_refclock.h index d63f3af..f92d14c 100644 --- a/contrib/ntp/include/ntp_refclock.h +++ b/contrib/ntp/include/ntp_refclock.h @@ -5,44 +5,14 @@ #ifndef NTP_REFCLOCK_H #define NTP_REFCLOCK_H -#include "ntp_types.h" - -#if defined(HAVE_BSD_TTYS) -#include <sgtty.h> -#endif /* HAVE_BSD_TTYS */ - -#if defined(HAVE_SYSV_TTYS) -#include <termio.h> -#endif /* HAVE_SYSV_TTYS */ - -#if defined(HAVE_TERMIOS) -# ifdef TERMIOS_NEEDS__SVID3 -# define _SVID3 -# endif -# include <termios.h> -# ifdef TERMIOS_NEEDS__SVID3 -# undef _SVID3 -# endif -#endif - #if defined(HAVE_SYS_MODEM_H) #include <sys/modem.h> #endif -#if 0 /* If you need that, include ntp_io.h instead */ -#if defined(STREAM) -#include <stropts.h> -#if defined(CLK) /* This is never defined, except perhaps by a system header file */ -#include <sys/clkdefs.h> -#endif /* CLK */ -#endif /* STREAM */ -#endif - +#include "ntp_types.h" +#include "ntp_tty.h" #include "recvbuff.h" -#if !defined(SYSV_TTYS) && !defined(STREAM) & !defined(BSD_TTYS) -#define BSD_TTYS -#endif /* SYSV_TTYS STREAM BSD_TTYS */ #define SAMPLE(x) pp->coderecv = (pp->coderecv + 1) % MAXSTAGE; \ pp->filter[pp->coderecv] = (x); \ @@ -110,7 +80,7 @@ struct refclockstat { double fudgetime1; /* configure fudge time1 */ double fudgetime2; /* configure fudge time2 */ int32 fudgeval1; /* configure fudge value1 */ - int32 fudgeval2; /* configure fudge value2 */ + u_int32 fudgeval2; /* configure fudge value2 */ u_char currentstatus; /* clock status */ u_char lastevent; /* last exception event */ u_char leap; /* leap bits */ @@ -123,15 +93,20 @@ struct refclockstat { */ struct refclockio { struct refclockio *next; /* link to next structure */ - void (*clock_recv) P((struct recvbuf *)); /* completion routine */ - int (*io_input) P((struct recvbuf *)); /* input routine - + void (*clock_recv) (struct recvbuf *); /* completion routine */ + int (*io_input) (struct recvbuf *); /* input routine - to avoid excessive buffer use due to small bursts of refclock input data */ - caddr_t srcclock; /* pointer to clock structure */ - int datalen; /* lenth of data */ - SOCKET fd; /* file descriptor */ + struct peer *srcclock; /* refclock peer */ + int datalen; /* length of data */ + int fd; /* file descriptor */ u_long recvcount; /* count of receive completions */ + int active; /* nonzero when in use */ + +#ifdef HAVE_IO_COMPLETION_PORT + void * device_context; /* device-related data for i/o subsystem */ +#endif }; /* @@ -149,6 +124,10 @@ struct refclockbug { l_fp times[NCLKBUGTIMES]; /* real times */ }; +#ifdef HAVE_IO_COMPLETION_PORT +extern HANDLE WaitableIoEventHandle; +#endif + /* * Structure interface between the reference clock support * ntp_refclock.c and the driver utility routines @@ -159,33 +138,21 @@ struct refclockbug { #define GMT 0 /* I hope nobody sees this */ #define MAXDIAL 60 /* max length of modem dial strings */ -/* - * Line discipline flags. These require line discipline or streams - * modules to be installed/loaded in the kernel. If specified, but not - * installed, the code runs as if unspecified. - */ -#define LDISC_STD 0x00 /* standard */ -#define LDISC_CLK 0x01 /* tty_clk \n intercept */ -#define LDISC_CLKPPS 0x02 /* tty_clk \377 intercept */ -#define LDISC_ACTS 0x04 /* tty_clk #* intercept */ -#define LDISC_CHU 0x08 /* depredated */ -#define LDISC_PPS 0x10 /* ppsclock, ppsapi */ -#define LDISC_RAW 0x20 /* raw binary */ -#define LDISC_ECHO 0x40 /* enable echo */ -#define LDISC_REMOTE 0x80 /* remote mode */ -#define LDISC_7O1 0x100 /* 7-bit, odd parity for Z3801A */ struct refclockproc { - struct refclockio io; /* I/O handler structure */ - caddr_t unitptr; /* pointer to unit structure */ + void * unitptr; /* pointer to unit structure */ + struct refclock * conf; /* refclock_conf[type] */ + struct refclockio io; /* I/O handler structure */ u_char leap; /* leap/synchronization code */ u_char currentstatus; /* clock status */ u_char lastevent; /* last exception event */ u_char type; /* clock type */ const char *clockdesc; /* clock description */ + u_long nextaction; /* local activity timeout */ + void (*action)(struct peer *); /* timeout callback */ char a_lastcode[BMAX]; /* last timecode received */ - u_short lencode; /* length of last timecode */ + int lencode; /* length of last timecode */ int year; /* year of eternity */ int day; /* day of year */ @@ -231,43 +198,42 @@ struct refclockproc { #define NOFLAGS 0 /* flag for null flags */ struct refclock { - int (*clock_start) P((int, struct peer *)); - void (*clock_shutdown) P((int, struct peer *)); - void (*clock_poll) P((int, struct peer *)); - void (*clock_control) P((int, struct refclockstat *, - struct refclockstat *, struct peer *)); - void (*clock_init) P((void)); - void (*clock_buginfo) P((int, struct refclockbug *, struct peer *)); - void (*clock_timer) P((int, struct peer *)); + int (*clock_start) (int, struct peer *); + void (*clock_shutdown) (int, struct peer *); + void (*clock_poll) (int, struct peer *); + void (*clock_control) (int, const struct refclockstat *, + struct refclockstat *, struct peer *); + void (*clock_init) (void); + void (*clock_buginfo) (int, struct refclockbug *, struct peer *); + void (*clock_timer) (int, struct peer *); }; /* * Function prototypes */ -/* - * auxiliary PPS interface (implemented by refclock_atom()) - */ -extern int pps_sample P((l_fp *)); -extern int io_addclock_simple P((struct refclockio *)); -extern int io_addclock P((struct refclockio *)); -extern void io_closeclock P((struct refclockio *)); +extern int io_addclock (struct refclockio *); +extern void io_closeclock (struct refclockio *); #ifdef REFCLOCK -extern void refclock_buginfo P((struct sockaddr_storage *, - struct refclockbug *)); -extern void refclock_control P((struct sockaddr_storage *, - struct refclockstat *, - struct refclockstat *)); -extern int refclock_open P((char *, u_int, u_int)); -extern int refclock_setup P((int, u_int, u_int)); -extern void refclock_timer P((struct peer *)); -extern void refclock_transmit P((struct peer *)); -extern int refclock_ioctl P((int, u_int)); -extern int refclock_process P((struct refclockproc *)); -extern void refclock_process_offset P((struct refclockproc *, l_fp, l_fp, double)); -extern void refclock_report P((struct peer *, int)); -extern int refclock_gtlin P((struct recvbuf *, char *, int, l_fp *)); -extern int refclock_gtraw P((struct recvbuf *, char *, int, l_fp *)); +extern void refclock_buginfo(sockaddr_u *, + struct refclockbug *); +extern void refclock_control(sockaddr_u *, + const struct refclockstat *, + struct refclockstat *); +extern int refclock_open (char *, u_int, u_int); +extern int refclock_setup (int, u_int, u_int); +extern void refclock_timer (struct peer *); +extern void refclock_transmit(struct peer *); +extern int refclock_process(struct refclockproc *); +extern int refclock_process_f(struct refclockproc *, double); +extern void refclock_process_offset(struct refclockproc *, l_fp, + l_fp, double); +extern void refclock_report (struct peer *, int); +extern int refclock_gtlin (struct recvbuf *, char *, int, l_fp *); +extern int refclock_gtraw (struct recvbuf *, char *, int, l_fp *); +extern int indicate_refclock_packet(struct refclockio *, + struct recvbuf *); +extern void process_refclock_packet(struct recvbuf *); #endif /* REFCLOCK */ #endif /* NTP_REFCLOCK_H */ |