summaryrefslogtreecommitdiff
path: root/contrib/ntp/include/ntp_refclock.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ntp/include/ntp_refclock.h')
-rw-r--r--contrib/ntp/include/ntp_refclock.h35
1 files changed, 25 insertions, 10 deletions
diff --git a/contrib/ntp/include/ntp_refclock.h b/contrib/ntp/include/ntp_refclock.h
index 4b807e5f369e..e74e77aa791a 100644
--- a/contrib/ntp/include/ntp_refclock.h
+++ b/contrib/ntp/include/ntp_refclock.h
@@ -14,11 +14,6 @@
#include "recvbuff.h"
-#define SAMPLE(x) pp->coderecv = (pp->coderecv + 1) % MAXSTAGE; \
- pp->filter[pp->coderecv] = (x); \
- if (pp->coderecv == pp->codeproc) \
- pp->codeproc = (pp->codeproc + 1) % MAXSTAGE;
-
/*
* Macros to determine the clock type and unit numbers from a
* 127.127.t.u address
@@ -54,6 +49,7 @@ extern struct clktype clktypes[];
#define CLK_HAVEFLAG2 0x20
#define CLK_HAVEFLAG3 0x40
#define CLK_HAVEFLAG4 0x80
+#define CLK_HAVEMINJIT 0x100
/*
* Constant for disabling event reporting in
@@ -68,7 +64,7 @@ extern struct clktype clktypes[];
struct refclockstat {
u_char type; /* clock type */
u_char flags; /* clock flags */
- u_char haveflags; /* bit array of valid flags */
+ u_short haveflags; /* bit array of valid flags */
u_short lencode; /* length of last timecode */
const char *p_lastcode; /* last timecode received */
u_int32 polls; /* transmit polls */
@@ -77,6 +73,7 @@ struct refclockstat {
u_int32 baddata; /* invalid data timecode received */
u_int32 timereset; /* driver resets */
const char *clockdesc; /* ASCII description */
+ double fudgeminjitter; /* configure fudge minjitter */
double fudgetime1; /* configure fudge time1 */
double fudgetime2; /* configure fudge time2 */
int32 fudgeval1; /* configure fudge value1 */
@@ -133,13 +130,12 @@ extern HANDLE WaitableIoEventHandle;
* Structure interface between the reference clock support
* ntp_refclock.c and the driver utility routines
*/
-#define MAXSTAGE 60 /* max median filter stages */
+#define MAXSTAGE 64 /* max median filter stages */
#define NSTAGE 5 /* default median filter stages */
#define BMAX 128 /* max timecode length */
#define GMT 0 /* I hope nobody sees this */
#define MAXDIAL 60 /* max length of modem dial strings */
-
struct refclockproc {
void * unitptr; /* pointer to unit structure */
struct refclock * conf; /* refclock_conf[type] */
@@ -148,6 +144,7 @@ struct refclockproc {
u_char currentstatus; /* clock status */
u_char lastevent; /* last exception event */
u_char type; /* clock type */
+ u_char inpoll; /* waiting for 'refclock_receive()' */
const char *clockdesc; /* clock description */
u_long nextaction; /* local activity timeout */
void (*action)(struct peer *); /* timeout callback */
@@ -162,8 +159,8 @@ struct refclockproc {
int second; /* second of minute */
long nsec; /* nanosecond of second */
u_long yearstart; /* beginning of year */
- int coderecv; /* put pointer */
- int codeproc; /* get pointer */
+ u_int coderecv; /* put pointer */
+ u_int codeproc; /* get pointer */
l_fp lastref; /* reference timestamp */
l_fp lastrec; /* receive timestamp */
double offset; /* mean offset */
@@ -176,6 +173,7 @@ struct refclockproc {
*/
double fudgetime1; /* fudge time1 */
double fudgetime2; /* fudge time2 */
+ double fudgeminjitter; /* manually set lower bound for jitter */
u_char stratum; /* server stratum */
u_int32 refid; /* reference identifier */
u_char sloppyclockflag; /* fudge flags */
@@ -229,12 +227,29 @@ 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 int refclock_samples_avail(struct refclockproc const *);
+extern int refclock_samples_expire(struct refclockproc *, int);
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 *);
+
+/* save string as la_code, size==(size_t)-1 ==> ASCIIZ string */
+extern void refclock_save_lcode(
+ struct refclockproc *, char const *, size_t);
+/* format data into la_code */
+extern void refclock_format_lcode(
+ struct refclockproc *, char const *, ...);
+extern void refclock_vformat_lcode(
+ struct refclockproc *, char const *, va_list);
+
+struct refclock_atom;
+extern int refclock_ppsaugment(
+ const struct refclock_atom*, l_fp *rcvtime ,
+ double rcvfudge, double ppsfudge);
+
#endif /* REFCLOCK */
#endif /* NTP_REFCLOCK_H */