PageRenderTime 43ms CodeModel.GetById 25ms app.highlight 15ms RepoModel.GetById 1ms app.codeStats 0ms

/contrib/ntp/include/ntp_stdlib.h

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