diff options
author | Ollivier Robert <roberto@FreeBSD.org> | 2013-12-04 21:33:17 +0000 |
---|---|---|
committer | Ollivier Robert <roberto@FreeBSD.org> | 2013-12-04 21:33:17 +0000 |
commit | 2b45e011ca352ce509bc83ae148230aeee0c7e0d (patch) | |
tree | a618007bb41d13153794a598e3d904ace2976324 /ntpd/refclock_palisade.h | |
parent | 9b5bd0a264b0a21eefac2b929b574c73bd601507 (diff) |
Virgin import of ntpd 4.2.6p5.vendor/ntp/4.2.6p5
When the series of commits is complete, things like
https://cert.litnet.lt/en/docs/ntp-distributed-reflection-dos-attacks
should be fixed.
PR: bin/148836 (except that we import a newer version)
Asked by: Too many
MFC after: 2 weeks
Notes
Notes:
svn path=/vendor/ntp/dist/; revision=258945
svn path=/vendor/ntp/4.2.6p5/; revision=258946; tag=vendor/ntp/4.2.6p5
Diffstat (limited to 'ntpd/refclock_palisade.h')
-rw-r--r-- | ntpd/refclock_palisade.h | 61 |
1 files changed, 48 insertions, 13 deletions
diff --git a/ntpd/refclock_palisade.h b/ntpd/refclock_palisade.h index e63f3da36452..c2d4476a9833 100644 --- a/ntpd/refclock_palisade.h +++ b/ntpd/refclock_palisade.h @@ -71,6 +71,7 @@ # define _SVID3 # endif # include <termios.h> +# include <sys/stat.h> # ifdef TERMIOS_NEEDS__SVID3 # undef _SVID3 # endif @@ -108,10 +109,23 @@ #define LENCODE_8F0B 74 /* Length of TSIP 8F-0B Packet & header */ #define LENCODE_NTP 22 /* Length of Palisade NTP Packet */ +#define LENCODE_8FAC 68 /* Length of Thunderbolt 8F-AC Position Packet*/ +#define LENCODE_8FAB 17 /* Length of Thunderbolt Primary Timing Packet*/ + /* Allowed Sub-Packet ID's */ #define PACKET_8F0B 0x0B #define PACKET_NTP 0xAD +/* Thunderbolt Packets */ +#define PACKET_8FAC 0xAC /* Supplementary Thunderbolt Time Packet */ +#define PACKET_8FAB 0xAB /* Primary Thunderbolt Time Packet */ +#define PACKET_6D 0x6D /* Supplementary Thunderbolt Tracking Stats */ +#define PACKET_41 0x41 /* Thunderbolt I dont know what this packet is, it's not documented on my manual*/ + +/* Acutime Packets */ +#define PACKET_41A 0x41 /* GPS time */ +#define PACKET_46 0x46 /* Receiver Health */ + #define DLE 0x10 #define ETX 0x03 @@ -139,6 +153,16 @@ #define R2D (180.0/GPS_PI) /* + * Structure for build data packets for send (thunderbolt uses it only) + * taken from Markus Prosch + */ +struct packettx +{ + short size; + u_char *data; +}; + +/* * Palisade unit control structure. */ struct palisade_unit { @@ -147,7 +171,7 @@ struct palisade_unit { char leap_status; /* leap second flag */ char rpt_status; /* TSIP Parser State */ short rpt_cnt; /* TSIP packet length so far */ - char rpt_buf[BMAX]; /* packet assembly buffer */ + char rpt_buf[BMAX]; /* packet assembly buffer */ int type; /* Clock mode type */ }; @@ -155,16 +179,27 @@ struct palisade_unit { * Function prototypes */ -static int palisade_start P((int, struct peer *)); -static void palisade_shutdown P((int, struct peer *)); -static void palisade_receive P((struct peer *)); -static void palisade_poll P((int, struct peer *)); -static void palisade_io P((struct recvbuf *)); -int palisade_configure P((int, struct peer *)); -int TSIP_decode P((struct peer *)); -long HW_poll P((struct refclockproc *)); -float getfloat P((u_char *)); -double getdbl P((u_char *)); -short getint P((u_char *)); - +static int palisade_start (int, struct peer *); +static void palisade_shutdown (int, struct peer *); +static void palisade_receive (struct peer *); +static void palisade_poll (int, struct peer *); +static void palisade_io (struct recvbuf *); +int palisade_configure (int, struct peer *); +int TSIP_decode (struct peer *); +long HW_poll (struct refclockproc *); +float getfloat (u_char *); +double getdbl (u_char *); +short getint (u_char *); +long getlong (u_char *); + + +#ifdef PALISADE_SENDCMD_RESURRECTED +static void sendcmd (struct packettx *buffer, int c); +#endif +static void sendsupercmd (struct packettx *buffer, int c1, int c2); +static void sendbyte (struct packettx *buffer, int b); +static void sendint (struct packettx *buffer, int a); +static int sendetx (struct packettx *buffer, int fd); +static void init_thunderbolt (int fd); +static void init_acutime (int fd); #endif /* PALISADE_H */ |