FreeBSD/contrib/ntp/ntpd/refclock_ripencc.c
/*
 * Parse Tracking Status packet
 *
 * 0 = success
 * -1 = errors
 */
Parse Tracking Status packet
0 = success
-1 = errors
Parse Tracking Status packet 0 = success - 1 = errors
int
parse0x5C(
	  TSIPPKT *rpt,
	  struct peer *peer
	  )
{
	unsigned char prn, channel, aqflag, ephstat;
	float snr, azinuth, elevation;
   	static char logbuf[1024];	
	unsigned char *buf;
	buf = rpt->buf;
	if (rpt->len != 24) 
		return(-1);
	prn = buf[0];
	channel = (unsigned char)(buf[1] >> 3);
	if (channel == 0x10) 
		channel = 2;
	else 
		channel++;
	aqflag = buf[2];
	ephstat = buf[3];
	snr = bGetSingle(&buf[4]);
	elevation = bGetSingle(&buf[12]) * R2D;
	azinuth = bGetSingle(&buf[16]) * R2D;
	sprintf(logbuf, "S1 %02d %d %d %02x %4.1f %5.1f %4.1f",
		prn, channel, aqflag, ephstat, snr, azinuth, elevation);
#ifdef DEBUG_NCC
	if (debug) 
   		puts(logbuf);
#endif 
	record_clock_stats(&peer->srcadr, logbuf);
	return (0);
}
int parse0x5C ( TSIPPKT * rpt , struct peer * peer ) { unsigned char prn , channel , aqflag , ephstat ; float snr , azinuth , elevation ; static char logbuf [ 1024 ] ; unsigned char * buf ; buf = rpt -> buf ; if ( rpt -> len != 24 ) return ( -1 ) ; prn = buf [ 0 ] ; channel = ( unsigned char ) ( buf [ 1 ] >> 3 ) ; if ( channel == 0x10 ) channel = 2 ; else channel ++ ; aqflag = buf [ 2 ] ; ephstat = buf [ 3 ] ; snr = bGetSingle ( & buf [ 4 ] ) ; elevation = bGetSingle ( & buf [ 12 ] ) * R2D ; azinuth = bGetSingle ( & buf [ 16 ] ) * R2D ; sprintf ( logbuf , " " , prn , channel , aqflag , ephstat , snr , azinuth , elevation ) ; #ifdef DEBUG_NCC if ( debug ) puts ( logbuf ) ; #endif record_clock_stats ( & peer -> srcadr , logbuf ) ; return ( 0 ) ; }
Parse Tracking Status packet
 0 = success
 -1 = errors
Parse Tracking Status packet 0 = success - 1 = errors
/* logging string buffer */ /* DEBUG_NCC */