Fix a serious bug in the NTPD loopfilter. Basically what happens is that
[dragonfly.git] / contrib / ntp / include / ntp_stdlib.h
1 /*
2  * ntp_stdlib.h - Prototypes for NTP lib.
3  */
4 #include <sys/types.h>
5
6 #include "ntp_types.h"
7 #include "ntp_string.h"
8 #include "l_stdlib.h"
9
10 /*
11  * Handle gcc __attribute__ if available.
12  */
13 #ifndef __attribute__
14 /* This feature is available in gcc versions 2.5 and later.  */
15 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || (defined(__STRICT_ANSI__))
16 #  define __attribute__(Spec) /* empty */
17 # endif
18 /* The __-protected variants of `format' and `printf' attributes
19    are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
20 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
21 #  define __format__ format
22 #  define __printf__ printf
23 # endif
24 #endif
25
26 #if defined(__STDC__) || defined(HAVE_STDARG_H)
27 # include <stdarg.h>
28 extern  void    msyslog         P((int, const char *, ...))
29                                 __attribute__((__format__(__printf__, 2, 3)));
30 #else
31 # include <varargs.h>
32 extern  void msyslog            P(());
33 #endif
34
35 extern  void    auth_delkeys    P((void));
36 extern  int     auth_havekey    P((keyid_t));
37 extern  int     authdecrypt     P((keyid_t, u_int32 *, int, int));
38 extern  int     authencrypt     P((keyid_t, u_int32 *, int));
39 extern  int     authhavekey     P((keyid_t));
40 extern  int     authistrusted   P((keyid_t));
41 extern  int     authreadkeys    P((const char *));
42 extern  void    authtrust       P((keyid_t, u_long));
43 extern  int     authusekey      P((keyid_t, int, const u_char *));
44
45 extern  u_long  calleapwhen     P((u_long));
46 extern  u_long  calyearstart    P((u_long));
47 extern  const char *clockname   P((int));
48 extern  int     clocktime       P((int, int, int, int, int, u_long, u_long *, u_int32 *));
49 #if defined SYS_WINNT && defined DEBUG
50 # define emalloc(_c) debug_emalloc(_c, __FILE__, __LINE__)
51 extern  void *  debug_emalloc           P((u_int, char *, int));
52 #else
53 extern  void *  emalloc         P((u_int));
54 #endif
55 extern  int     ntp_getopt      P((int, char **, const char *));
56 extern  void    init_auth       P((void));
57 extern  void    init_lib        P((void));
58 extern  void    init_random     P((void));
59 extern  struct savekey *auth_findkey P((keyid_t));
60 extern  int     auth_moremem    P((void));
61 extern  int     ymd2yd          P((int, int, int));
62
63 #ifdef  DES
64 extern  int     DESauthdecrypt  P((u_char *, u_int32 *, int, int));
65 extern  int     DESauthencrypt  P((u_char *, u_int32 *, int));
66 extern  void    DESauth_setkey  P((keyid_t, const u_int32 *));
67 extern  void    DESauth_subkeys P((const u_int32 *, u_char *, u_char *));
68 extern  void    DESauth_des     P((u_int32 *, u_char *));
69 extern  int     DESauth_parity  P((u_int32 *));
70 #endif  /* DES */
71
72 extern  int     MD5authdecrypt  P((u_char *, u_int32 *, int, int));
73 extern  int     MD5authencrypt  P((u_char *, u_int32 *, int));
74 extern  void    MD5auth_setkey  P((keyid_t, const u_char *, const int));
75
76 extern  int     atoint          P((const char *, long *));
77 extern  int     atouint         P((const char *, u_long *));
78 extern  int     hextoint        P((const char *, u_long *));
79 extern  char *  humandate       P((u_long));
80 extern  char *  humanlogtime    P((void));
81 extern  char *  inttoa          P((long));
82 extern  char *  mfptoa          P((u_long, u_long, int));
83 extern  char *  mfptoms         P((u_long, u_long, int));
84 extern  const char * modetoa    P((int));
85 extern  const char * eventstr   P((int));
86 extern  const char * ceventstr  P((int));
87 extern  char *  statustoa       P((int, int));
88 extern  const char * sysstatstr P((int));
89 extern  const char * peerstatstr P((int));
90 extern  const char * clockstatstr P((int));
91 extern  u_int32 netof           P((u_int32));
92 extern  char *  numtoa          P((u_int32));
93 extern  char *  numtohost       P((u_int32));
94 extern  int     octtoint        P((const char *, u_long *));
95 extern  u_long  ranp2           P((int));
96 extern  char *  refnumtoa       P((u_int32));
97 extern  int     tsftomsu        P((u_long, int));
98 extern  char *  uinttoa         P((u_long));
99
100 extern  int     decodenetnum    P((const char *, u_int32 *));
101
102 extern  const char *    FindConfig      P((const char *));
103
104 extern  void    signal_no_reset P((int, RETSIGTYPE (*func)(int)));
105
106 extern  void    getauthkeys     P((char *));
107 extern  void    auth_agekeys    P((void));
108 extern  void    rereadkeys      P((void));
109
110 /*
111  * Variable declarations for libntp.
112  */
113
114 /*
115  * Defined by any program.
116  */
117 extern volatile int debug;              /* debugging flag */
118
119 /* authkeys.c */
120 extern u_long   authkeynotfound;        /* keys not found */
121 extern u_long   authkeylookups;         /* calls to lookup keys */
122 extern u_long   authnumkeys;            /* number of active keys */
123 extern u_long   authkeyexpired;         /* key lifetime expirations */
124 extern u_long   authkeyuncached;        /* cache misses */
125 extern u_long   authencryptions;        /* calls to encrypt */
126 extern u_long   authdecryptions;        /* calls to decrypt */
127
128 extern int      authnumfreekeys;
129
130 /*
131  * The key cache. We cache the last key we looked at here.
132  */
133 extern keyid_t  cache_keyid;            /* key identifier */
134 extern u_char * cache_key;              /* key pointer */
135 extern u_int    cache_keylen;           /* key length */
136
137 /* clocktypes.c */
138 struct clktype;
139 extern struct clktype clktypes[];
140
141 /* getopt.c */
142 extern char *   ntp_optarg;             /* global argument pointer */
143 extern int      ntp_optind;             /* global argv index */
144
145 /* machines.c */
146 extern const char *set_tod_using;
147
148 /* mexit.c */
149 #if defined SYS_WINNT || defined SYS_CYGWIN32
150 extern HANDLE   hServDoneEvent;
151 #endif
152
153 /* systime.c */
154 extern int      systime_10ms_ticks;     /* adj sysclock in 10ms increments */
155
156 /* version.c */
157 extern const char *Version;             /* version declaration */