1ef64b99roberto/*
27a6072eroberto * /src/NTP/REPOSITORY/ntp4-dev/include/parse.h,v 4.12 2007/01/14 08:36:03 kardel RELEASE_20070114_A
3ef64b99roberto *
47a6072eroberto * parse.h,v 4.12 2007/01/14 08:36:03 kardel RELEASE_20070114_A
5ef64b99roberto *
65ef283fcy * Copyright (c) 1995-2015 by Frank Kardel <kardel <AT> ntp.org>
7f63afe2cy * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany
87a6072eroberto *
97a6072eroberto * Redistribution and use in source and binary forms, with or without
107a6072eroberto * modification, are permitted provided that the following conditions
117a6072eroberto * are met:
127a6072eroberto * 1. Redistributions of source code must retain the above copyright
137a6072eroberto *    notice, this list of conditions and the following disclaimer.
147a6072eroberto * 2. Redistributions in binary form must reproduce the above copyright
157a6072eroberto *    notice, this list of conditions and the following disclaimer in the
167a6072eroberto *    documentation and/or other materials provided with the distribution.
177a6072eroberto * 3. Neither the name of the author nor the names of its contributors
187a6072eroberto *    may be used to endorse or promote products derived from this software
197a6072eroberto *    without specific prior written permission.
207a6072eroberto *
217a6072eroberto * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
227a6072eroberto * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
237a6072eroberto * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
247a6072eroberto * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
257a6072eroberto * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
267a6072eroberto * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
277a6072eroberto * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
287a6072eroberto * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
297a6072eroberto * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
307a6072eroberto * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
317a6072eroberto * SUCH DAMAGE.
32ef64b99roberto *
33ef64b99roberto */
34ef64b99roberto
35ef64b99roberto#ifndef __PARSE_H__
36ef64b99roberto#define __PARSE_H__
37ef64b99roberto#if	!(defined(lint) || defined(__GNUC__))
387a6072eroberto  static char parsehrcsid[]="parse.h,v 4.12 2007/01/14 08:36:03 kardel RELEASE_20070114_A";
39ef64b99roberto#endif
40ef64b99roberto
41ef64b99roberto#include "ntp_types.h"
42ef64b99roberto
43ef64b99roberto#include "parse_conf.h"
44ef64b99roberto
45ef64b99roberto/*
46ef64b99roberto * we use the following datastructures in two modes
47ef64b99roberto * either in the NTP itself where we use NTP time stamps at some places
48ef64b99roberto * or in the kernel, where only struct timeval will be used.
49ef64b99roberto */
50ef64b99roberto#undef PARSEKERNEL
51ef64b99roberto#if defined(KERNEL) || defined(_KERNEL)
52ef64b99roberto#ifndef PARSESTREAM
53ef64b99roberto#define PARSESTREAM
54ef64b99roberto#endif
55ef64b99roberto#endif
56ef64b99roberto#if defined(PARSESTREAM) && defined(HAVE_SYS_STREAM_H)
57ef64b99roberto#define PARSEKERNEL
58ef64b99roberto#endif
59ef64b99roberto#ifdef PARSEKERNEL
60ef64b99roberto#ifndef _KERNEL
61d54cfbdrobertoextern caddr_t kmem_alloc (unsigned int);
62d54cfbdrobertoextern caddr_t kmem_free (caddr_t, unsigned int);
63d54cfbdrobertoextern unsigned int splx (unsigned int);
64d54cfbdrobertoextern unsigned int splhigh (void);
65d54cfbdrobertoextern unsigned int splclock (void);
66ef64b99roberto#define MALLOC(_X_) (char *)kmem_alloc(_X_)
67ef64b99roberto#define FREE(_X_, _Y_) kmem_free((caddr_t)_X_, _Y_)
68ef64b99roberto#else
69ef64b99roberto#include <sys/kmem.h>
70ef64b99roberto#define MALLOC(_X_) (char *)kmem_alloc(_X_, KM_SLEEP)
71ef64b99roberto#define FREE(_X_, _Y_) kmem_free((caddr_t)_X_, _Y_)
72ef64b99roberto#endif
73ef64b99roberto#else
74ef64b99roberto#define MALLOC(_X_) malloc(_X_)
75ef64b99roberto#define FREE(_X_, _Y_) free(_X_)
76ef64b99roberto#endif
77ef64b99roberto
78ef64b99roberto#if defined(PARSESTREAM) && defined(HAVE_SYS_STREAM_H)
79ef64b99roberto#include <sys/stream.h>
80ef64b99roberto#include <sys/stropts.h>
81ef64b99roberto#else	/* STREAM */
82ef64b99roberto#include <stdio.h>
83ef64b99roberto#include "ntp_syslog.h"
84ef64b99roberto#ifdef	DEBUG
85ef64b99roberto#define DD_PARSE 5
86ef64b99roberto#define DD_RAWDCF 4
87ef64b99roberto#define parseprintf(LEVEL, ARGS) if (debug > LEVEL) printf ARGS
88ef64b99roberto#else	/* DEBUG */
89ef64b99roberto#define parseprintf(LEVEL, ARGS)
90ef64b99roberto#endif	/* DEBUG */
91ef64b99roberto#endif	/* PARSESTREAM */
92ef64b99roberto
93ef64b99roberto#if defined(timercmp) && defined(__GNUC__)
94ef64b99roberto#undef timercmp
95ef64b99roberto#endif
96ef64b99roberto
97ef64b99roberto#if !defined(timercmp)
98ef64b99roberto#define	timercmp(tvp, uvp, cmp)	\
99ef64b99roberto	((tvp)->tv_sec cmp (uvp)->tv_sec || \
100ef64b99roberto	 ((tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec))
101ef64b99roberto#endif
102ef64b99roberto
103ef64b99roberto#ifndef TIMES10
104ef64b99roberto#define TIMES10(_X_)	(((_X_) << 3) + ((_X_) << 1))
105ef64b99roberto#endif
106ef64b99roberto
107ef64b99roberto/*
108f63afe2cy * some constants useful for GPS time conversion
109f63afe2cy */
110a835b8fdelphij#define GPSORIGIN       2524953600UL         /* NTP origin - GPS origin in seconds */
111a835b8fdelphij#define GPSWEEKS        1024                 /* number of weeks until the GPS epch rolls over */
112f63afe2cy
113f63afe2cy/*
114ef64b99roberto * state flags
115ef64b99roberto */
116ef64b99roberto#define PARSEB_POWERUP            0x00000001 /* no synchronisation */
117ef64b99roberto#define PARSEB_NOSYNC             0x00000002 /* timecode currently not confirmed */
118ef64b99roberto
119ef64b99roberto/*
120ef64b99roberto * time zone information
121ef64b99roberto */
122ef64b99roberto#define PARSEB_ANNOUNCE           0x00000010 /* switch time zone warning (DST switch) */
123ef64b99roberto#define PARSEB_DST                0x00000020 /* DST in effect */
124ef64b99roberto#define PARSEB_UTC		  0x00000040 /* UTC time */
125ef64b99roberto
126ef64b99roberto/*
127ef64b99roberto * leap information
128ef64b99roberto */
129ef64b99roberto#define PARSEB_LEAPDEL		  0x00000100 /* LEAP deletion warning */
130ef64b99roberto#define PARSEB_LEAPADD		  0x00000200 /* LEAP addition warning */
131ef64b99roberto#define PARSEB_LEAPS		  0x00000300 /* LEAP warnings */
132ef64b99roberto#define PARSEB_LEAPSECOND	  0x00000400 /* actual leap second */
133ef64b99roberto/*
134ef64b99roberto * optional status information
135ef64b99roberto */
136f63afe2cy#define PARSEB_CALLBIT		  0x00001000 /* "call bit" used to signalize irregularities in the control facilities */
137ef64b99roberto#define PARSEB_POSITION		  0x00002000 /* position available */
138ef64b99roberto#define PARSEB_MESSAGE            0x00004000 /* addtitional message data */
139ef64b99roberto/*
140ef64b99roberto * feature information
141ef64b99roberto */
142ef64b99roberto#define PARSEB_S_LEAP		  0x00010000 /* supports LEAP */
1435ef283fcy#define PARSEB_S_CALLBIT	  0x00020000 /* supports callbit information */
144ef64b99roberto#define PARSEB_S_PPS     	  0x00040000 /* supports PPS time stamping */
145ef64b99roberto#define PARSEB_S_POSITION	  0x00080000 /* supports position information (GPS) */
146ef64b99roberto
147ef64b99roberto/*
148ef64b99roberto * time stamp availability
149ef64b99roberto */
150ef64b99roberto#define PARSEB_TIMECODE		  0x10000000 /* valid time code sample */
151ef64b99roberto#define PARSEB_PPS		  0x20000000 /* valid PPS sample */
152ef64b99roberto
153ef64b99roberto#define PARSE_TCINFO		(PARSEB_ANNOUNCE|PARSEB_POWERUP|PARSEB_NOSYNC|PARSEB_DST|\
154f63afe2cy				 PARSEB_UTC|PARSEB_LEAPS|PARSEB_CALLBIT|PARSEB_S_LEAP|\
155ef64b99roberto				 PARSEB_S_LOCATION|PARSEB_TIMECODE|PARSEB_MESSAGE)
156ef64b99roberto
157ef64b99roberto#define PARSE_POWERUP(x)        ((x) & PARSEB_POWERUP)
158ef64b99roberto#define PARSE_NOSYNC(x)         (((x) & (PARSEB_POWERUP|PARSEB_NOSYNC)) == PARSEB_NOSYNC)
159ef64b99roberto#define PARSE_SYNC(x)           (((x) & (PARSEB_POWERUP|PARSEB_NOSYNC)) == 0)
160ef64b99roberto#define PARSE_ANNOUNCE(x)       ((x) & PARSEB_ANNOUNCE)
161ef64b99roberto#define PARSE_DST(x)            ((x) & PARSEB_DST)
162ef64b99roberto#define PARSE_UTC(x)		((x) & PARSEB_UTC)
163ef64b99roberto#define PARSE_LEAPADD(x)	(PARSE_SYNC(x) && (((x) & PARSEB_LEAPS) == PARSEB_LEAPADD))
164ef64b99roberto#define PARSE_LEAPDEL(x)	(PARSE_SYNC(x) && (((x) & PARSEB_LEAPS) == PARSEB_LEAPDEL))
165f63afe2cy#define PARSE_CALLBIT(x)	((x) & PARSEB_CALLBIT)
166ef64b99roberto#define PARSE_LEAPSECOND(x)	(PARSE_SYNC(x) && ((x) & PARSEB_LEAP_SECOND))
167ef64b99roberto
168ef64b99roberto#define PARSE_S_LEAP(x)		((x) & PARSEB_S_LEAP)
1695ef283fcy#define PARSE_S_CALLBIT(x)	((x) & PARSEB_S_CALLBIT)
170ef64b99roberto#define PARSE_S_PPS(x)		((x) & PARSEB_S_PPS)
171ef64b99roberto#define PARSE_S_POSITION(x)	((x) & PARSEB_S_POSITION)
172ef64b99roberto
173ef64b99roberto#define PARSE_TIMECODE(x)	((x) & PARSEB_TIMECODE)
174ef64b99roberto#define PARSE_PPS(x)		((x) & PARSEB_PPS)
175ef64b99roberto#define PARSE_POSITION(x)	((x) & PARSEB_POSITION)
176ef64b99roberto#define PARSE_MESSAGE(x)	((x) & PARSEB_MESSAGE)
177ef64b99roberto
178ef64b99roberto/*
179ef64b99roberto * operation flags - lower nibble contains fudge flags
180ef64b99roberto */
1817a6072eroberto#define PARSE_TRUSTTIME     CLK_FLAG1  /* use flag1 to indicate the time2 references mean the trust time */
1827a6072eroberto#define PARSE_CLEAR         CLK_FLAG2  /* use flag2 to control pps on assert */
1837a6072eroberto#define PARSE_PPSKERNEL     CLK_FLAG3  /* use flag3 to bind PPS to kernel */
1847a6072eroberto#define PARSE_LEAP_DELETE   CLK_FLAG4  /* use flag4 to force leap deletion - only necessary when earth slows down */
1857a6072eroberto
186ef64b99roberto#define PARSE_FIXED_FMT     0x10  /* fixed format */
187ef64b99roberto#define PARSE_PPSCLOCK      0x20  /* try to get PPS time stamp via ppsclock ioctl */
188ef64b99roberto
189ef64b99roberto/*
190ef64b99roberto * size of buffers
191ef64b99roberto */
192ef64b99roberto#define PARSE_TCMAX	    400	  /* maximum addition data size */
193ef64b99roberto
1947a6072erobertotypedef union
195ef64b99roberto{
196ef64b99roberto  struct timeval tv;		/* timeval - kernel view */
197ef64b99roberto  l_fp           fp;		/* fixed point - ntp view */
198ef64b99roberto} timestamp_t;
199ef64b99roberto
200ef64b99roberto/*
201ef64b99roberto * standard time stamp structure
202ef64b99roberto */
203ef64b99robertostruct parsetime
204ef64b99roberto{
205ef64b99roberto  u_long  parse_status;	/* data status - CVT_OK, CVT_NONE, CVT_FAIL ... */
206ef64b99roberto  timestamp_t	 parse_time;	/* PARSE timestamp */
207ef64b99roberto  timestamp_t	 parse_stime;	/* telegram sample timestamp */
208ef64b99roberto  timestamp_t	 parse_ptime;	/* PPS time stamp */
209ef64b99roberto  long           parse_usecerror;	/* sampled usec error */
210ef64b99roberto  u_long	 parse_state;	/* current receiver state */
211ef64b99roberto  unsigned short parse_format;	/* format code */
212ef64b99roberto  unsigned short parse_msglen;	/* length of message */
213ef64b99roberto  unsigned char  parse_msg[PARSE_TCMAX]; /* original messages */
214ef64b99roberto};
215ef64b99roberto
216ef64b99robertotypedef struct parsetime parsetime_t;
217ef64b99roberto
218ef64b99roberto/*---------- STREAMS interface ----------*/
219ef64b99roberto
220ef64b99roberto#ifdef HAVE_SYS_STREAM_H
221ef64b99roberto/*
222ef64b99roberto * ioctls
223ef64b99roberto */
224ef64b99roberto#define PARSEIOC_ENABLE		(('D'<<8) + 'E')
225ef64b99roberto#define PARSEIOC_DISABLE	(('D'<<8) + 'D')
226ef64b99roberto#define PARSEIOC_SETFMT         (('D'<<8) + 'f')
227ef64b99roberto#define PARSEIOC_GETFMT	        (('D'<<8) + 'F')
228ef64b99roberto#define PARSEIOC_SETCS	        (('D'<<8) + 'C')
229ef64b99roberto#define PARSEIOC_TIMECODE	(('D'<<8) + 'T')
230ef64b99roberto
231ef64b99roberto#endif
232ef64b99roberto
233ef64b99roberto/*------ IO handling flags (sorry) ------*/
234ef64b99roberto
235ef64b99roberto#define PARSE_IO_CSIZE	0x00000003
236ef64b99roberto#define PARSE_IO_CS5	0x00000000
237ef64b99roberto#define PARSE_IO_CS6	0x00000001
238f63afe2cy#define PARSE_IO_CS7	0x00000002
239f63afe2cy#define PARSE_IO_CS8	0x00000003
240ef64b99roberto
241ef64b99roberto/*
242ef64b99roberto * ioctl structure
243ef64b99roberto */
244f63afe2cyunion parsectl
245ef64b99roberto{
246ef64b99roberto  struct parsegettc
247ef64b99roberto    {
248ef64b99roberto      u_long         parse_state;	/* last state */
249ef64b99roberto      u_long         parse_badformat; /* number of bad packets since last query */
250ef64b99roberto      unsigned short parse_format;/* last decoded format */
251ef64b99roberto      unsigned short parse_count;	/* count of valid time code bytes */
252ef64b99roberto      char           parse_buffer[PARSE_TCMAX+1]; /* timecode buffer */
253ef64b99roberto    } parsegettc;
254ef64b99roberto
255ef64b99roberto  struct parseformat
256ef64b99roberto    {
257ef64b99roberto      unsigned short parse_format;/* number of examined format */
258ef64b99roberto      unsigned short parse_count;	/* count of valid string bytes */
259ef64b99roberto      char           parse_buffer[PARSE_TCMAX+1]; /* format code string */
260ef64b99roberto    } parseformat;
261ef64b99roberto
262ef64b99roberto  struct parsesetcs
263ef64b99roberto    {
264ef64b99roberto      u_long         parse_cs;	/* character size (needed for stripping) */
265ef64b99roberto    } parsesetcs;
266ef64b99roberto};
267f63afe2cy
268ef64b99robertotypedef union parsectl parsectl_t;
269ef64b99roberto
270ef64b99roberto/*------ for conversion routines --------*/
271ef64b99roberto
272ef64b99robertostruct parse			/* parse module local data */
273ef64b99roberto{
274ef64b99roberto  int            parse_flags;	/* operation and current status flags */
275f63afe2cy
276ef64b99roberto  int		 parse_ioflags;	   /* io handling flags (5-8 Bit control currently) */
277ef64b99roberto
278ef64b99roberto  /*
279ef64b99roberto   * private data - fixed format only
280ef64b99roberto   */
281ef64b99roberto  unsigned short parse_plen;	/* length of private data */
282ef64b99roberto  void          *parse_pdata;	/* private data pointer */
283ef64b99roberto
284ef64b99roberto  /*
285ef64b99roberto   * time code input buffer (from RS232 or PPS)
286ef64b99roberto   */
287ef64b99roberto  unsigned short parse_index;	/* current buffer index */
288ef64b99roberto  char          *parse_data;    /* data buffer */
289ef64b99roberto  unsigned short parse_dsize;	/* size of data buffer */
290ef64b99roberto  unsigned short parse_lformat;	/* last format used */
291ef64b99roberto  u_long         parse_lstate;	/* last state code */
292ef64b99roberto  char          *parse_ldata;	/* last data buffer */
293ef64b99roberto  unsigned short parse_ldsize;	/* last data buffer length */
294ef64b99roberto  u_long         parse_badformat;	/* number of unparsable pakets */
295f63afe2cy
296ef64b99roberto  timestamp_t    parse_lastchar; /* last time a character was received */
297ef64b99roberto  parsetime_t    parse_dtime;	/* external data prototype */
298ef64b99roberto};
299ef64b99roberto
300ef64b99robertotypedef struct parse parse_t;
301ef64b99roberto
302ef64b99robertostruct clocktime		/* clock time broken up from time code */
303ef64b99roberto{
304ef64b99roberto  long day;
305ef64b99roberto  long month;
306ef64b99roberto  long year;
307ef64b99roberto  long hour;
308ef64b99roberto  long minute;
309ef64b99roberto  long second;
310ef64b99roberto  long usecond;
311ef64b99roberto  long utcoffset;	/* in seconds */
312ef64b99roberto  time_t utctime;	/* the actual time - alternative to date/time */
313ef64b99roberto  u_long flags;		/* current clock status */
314ef64b99roberto};
315ef64b99roberto
316ef64b99robertotypedef struct clocktime clocktime_t;
317ef64b99roberto
318ef64b99roberto/*
319ef64b99roberto * parser related return/error codes
320ef64b99roberto */
321ef64b99roberto#define CVT_MASK	 (unsigned)0x0000000F /* conversion exit code */
322ef64b99roberto#define   CVT_NONE	 (unsigned)0x00000001 /* format not applicable */
323ef64b99roberto#define   CVT_FAIL	 (unsigned)0x00000002 /* conversion failed - error code returned */
324ef64b99roberto#define   CVT_OK	 (unsigned)0x00000004 /* conversion succeeded */
325ef64b99roberto#define   CVT_SKIP	 (unsigned)0x00000008 /* conversion succeeded */
326ef64b99roberto#define CVT_ADDITIONAL   (unsigned)0x00000010 /* additional data is available */
327ef64b99roberto#define CVT_BADFMT	 (unsigned)0x00000100 /* general format error - (unparsable) */
328ef64b99roberto#define CVT_BADDATE      (unsigned)0x00000200 /* date field incorrect */
329ef64b99roberto#define CVT_BADTIME	 (unsigned)0x00000400 /* time field incorrect */
330ef64b99roberto
331ef64b99roberto/*
332ef64b99roberto * return codes used by special input parsers
333ef64b99roberto */
334ef64b99roberto#define PARSE_INP_SKIP  0x00	/* discard data - may have been consumed */
335ef64b99roberto#define PARSE_INP_TIME  0x01	/* time code assembled */
336ef64b99roberto#define PARSE_INP_PARSE 0x02	/* parse data using normal algorithm */
337ef64b99roberto#define PARSE_INP_DATA  0x04	/* additional data to pass up */
338ef64b99roberto#define PARSE_INP_SYNTH 0x08	/* just pass up synthesized time */
339ef64b99roberto
340ef64b99roberto/*
341ef64b99roberto * PPS edge info
342ef64b99roberto */
343ef64b99roberto#define SYNC_ZERO	0x00
344ef64b99roberto#define SYNC_ONE	0x01
345ef64b99roberto
346f63afe2cytypedef u_long parse_inp_fnc_t(parse_t *, char, timestamp_t *);
347f63afe2cytypedef u_long parse_cvt_fnc_t(unsigned char *, int, struct format *, clocktime_t *, void *);
348f63afe2cytypedef u_long parse_pps_fnc_t(parse_t *, int, timestamp_t *);
349f63afe2cy
350ef64b99robertostruct clockformat
351ef64b99roberto{
352ef64b99roberto  /* special input protocol - implies fixed format */
353f63afe2cy  parse_inp_fnc_t *input;
354ef64b99roberto  /* conversion routine */
355f63afe2cy  parse_cvt_fnc_t *convert;
356ef64b99roberto  /* routine for handling RS232 sync events (time stamps) */
357ef64b99roberto  /* PPS input routine */
358f63afe2cy  parse_pps_fnc_t *syncpps;
359ef64b99roberto  /* time code synthesizer */
360ef64b99roberto
361ef64b99roberto  void           *data;		/* local parameters */
362ef64b99roberto  const char     *name;		/* clock format name */
363ef64b99roberto  unsigned short  length;	/* maximum length of data packet */
364ef64b99roberto  unsigned short  plen;		/* length of private data - implies fixed format */
365ef64b99roberto};
366ef64b99roberto
367ef64b99robertotypedef struct clockformat clockformat_t;
368ef64b99roberto
369ef64b99roberto/*
370ef64b99roberto * parse interface
371ef64b99roberto */
372d54cfbdrobertoextern int  parse_ioinit (parse_t *);
373d54cfbdrobertoextern void parse_ioend (parse_t *);
374f63afe2cyextern int  parse_ioread (parse_t *, char, timestamp_t *);
375d54cfbdrobertoextern int  parse_iopps (parse_t *, int, timestamp_t *);
376d54cfbdrobertoextern void parse_iodone (parse_t *);
377d54cfbdrobertoextern int  parse_timecode (parsectl_t *, parse_t *);
378d54cfbdrobertoextern int  parse_getfmt (parsectl_t *, parse_t *);
379d54cfbdrobertoextern int  parse_setfmt (parsectl_t *, parse_t *);
380d54cfbdrobertoextern int  parse_setcs (parsectl_t *, parse_t *);
381d54cfbdroberto
382f63afe2cyextern unsigned int parse_restart (parse_t *, char);
383f63afe2cyextern unsigned int parse_addchar (parse_t *, char);
384d54cfbdrobertoextern unsigned int parse_end (parse_t *);
385d54cfbdroberto
386d54cfbdrobertoextern int Strok (const unsigned char *, const unsigned char *);
387d54cfbdrobertoextern int Stoi (const unsigned char *, long *, int);
388d54cfbdroberto
389d54cfbdrobertoextern time_t parse_to_unixtime (clocktime_t *, u_long *);
390d54cfbdrobertoextern u_long updatetimeinfo (parse_t *, u_long);
391d54cfbdrobertoextern void syn_simple (parse_t *, timestamp_t *, struct format *, u_long);
392f63afe2cyextern parse_pps_fnc_t pps_simple;
393f63afe2cyextern parse_pps_fnc_t pps_one;
394f63afe2cyextern parse_pps_fnc_t pps_zero;
395d54cfbdrobertoextern int parse_timedout (parse_t *, timestamp_t *, struct timeval *);
396ef64b99roberto
397ef64b99roberto#endif
398ef64b99roberto
399ef64b99roberto/*
400ef64b99roberto * History:
401ef64b99roberto *
402ef64b99roberto * parse.h,v
4037a6072eroberto * Revision 4.12  2007/01/14 08:36:03  kardel
4047a6072eroberto * make timestamp union anonymous to avoid conflicts with
4057a6072eroberto * some OSes that choose to create a nameing conflic here.
4067a6072eroberto *
4077a6072eroberto * Revision 4.11  2005/06/25 10:58:45  kardel
4087a6072eroberto * add missing log keywords
4097a6072eroberto *
410ef64b99roberto * Revision 4.5  1998/08/09 22:23:32  kardel
411ef64b99roberto * 4.0.73e2 adjustments
412ef64b99roberto *
413ef64b99roberto * Revision 4.4  1998/06/14 21:09:27  kardel
414ef64b99roberto * Sun acc cleanup
415ef64b99roberto *
416ef64b99roberto * Revision 4.3  1998/06/13 11:49:25  kardel
417ef64b99roberto * STREAM macro gone in favor of HAVE_SYS_STREAM_H
418ef64b99roberto *
419ef64b99roberto * Revision 4.2  1998/06/12 15:14:25  kardel
420ef64b99roberto * fixed prototypes
421ef64b99roberto *
422ef64b99roberto * Revision 4.1  1998/05/24 10:07:59  kardel
423ef64b99roberto * removed old data structure cruft (new input model)
424ef64b99roberto * new PARSE_INP* macros for input handling
425ef64b99roberto * removed old SYNC_* macros from old input model
426ef64b99roberto * (struct clockformat): removed old parse functions in favor of the
427ef64b99roberto * new input model
428ef64b99roberto * updated prototypes
429ef64b99roberto *
430ef64b99roberto * form V3 3.31 - log info deleted 1998/04/11 kardel
431ef64b99roberto */
432