/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. #include "ntp_types.h"
  8. #include "ntp_string.h"
  9. #include "l_stdlib.h"
  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. #if defined(__STDC__) || defined(HAVE_STDARG_H)
  26. # include <stdarg.h>
  27. extern void msyslog P((int, const char *, ...))
  28. __attribute__((__format__(__printf__, 2, 3)));
  29. extern void netsyslog P((int, const char *, ...))
  30. __attribute__((__format__(__printf__, 2, 3)));
  31. #else
  32. # include <varargs.h>
  33. extern void msyslog P(());
  34. extern void netsyslog P(());
  35. #endif
  36. extern void auth_delkeys P((void));
  37. extern int auth_havekey P((keyid_t));
  38. extern int authdecrypt P((keyid_t, u_int32 *, int, int));
  39. extern int authencrypt P((keyid_t, u_int32 *, int));
  40. extern int authhavekey P((keyid_t));
  41. extern int authistrusted P((keyid_t));
  42. extern int authreadkeys P((const char *));
  43. extern void authtrust P((keyid_t, u_long));
  44. extern int authusekey P((keyid_t, int, const u_char *));
  45. extern u_long calyearstart P((u_long));
  46. extern const char *clockname P((int));
  47. extern int clocktime P((int, int, int, int, int, u_long, u_long *, u_int32 *));
  48. #if defined SYS_WINNT && defined DEBUG
  49. # define emalloc(_c) debug_emalloc(_c, __FILE__, __LINE__)
  50. extern void * debug_emalloc P((u_int, char *, int));
  51. #else
  52. extern void * emalloc P((u_int));
  53. #endif
  54. extern int ntp_getopt P((int, char **, const char *));
  55. extern void init_auth P((void));
  56. extern void init_lib P((void));
  57. extern struct savekey *auth_findkey P((keyid_t));
  58. extern int auth_moremem P((void));
  59. extern int ymd2yd P((int, int, int));
  60. extern int MD5authdecrypt P((u_char *, u_int32 *, int, int));
  61. extern int MD5authencrypt P((u_char *, u_int32 *, int));
  62. extern void MD5auth_setkey P((keyid_t, const u_char *, const int));
  63. extern u_int32 addr2refid P((struct sockaddr_storage *));
  64. extern int atoint P((const char *, long *));
  65. extern int atouint P((const char *, u_long *));
  66. extern int hextoint P((const char *, u_long *));
  67. extern char * humandate P((u_long));
  68. extern char * humanlogtime P((void));
  69. extern char * inttoa P((long));
  70. extern char * mfptoa P((u_long, u_long, short));
  71. extern char * mfptoms P((u_long, u_long, short));
  72. extern const char * modetoa P((int));
  73. extern const char * eventstr P((int));
  74. extern const char * ceventstr P((int));
  75. extern char * statustoa P((int, int));
  76. extern const char * sysstatstr P((int));
  77. extern const char * peerstatstr P((int));
  78. extern const char * clockstatstr P((int));
  79. extern struct sockaddr_storage* netof P((struct sockaddr_storage*));
  80. extern char * numtoa P((u_int32));
  81. extern char * numtohost P((u_int32));
  82. extern char * socktoa P((struct sockaddr_storage *));
  83. extern char * socktohost P((struct sockaddr_storage *));
  84. extern int octtoint P((const char *, u_long *));
  85. extern u_long ranp2 P((int));
  86. extern char * refnumtoa P((struct sockaddr_storage *));
  87. extern int tsftomsu P((u_long, int));
  88. extern char * uinttoa P((u_long));
  89. extern int decodenetnum P((const char *, struct sockaddr_storage *));
  90. extern const char * FindConfig P((const char *));
  91. extern void signal_no_reset P((int, RETSIGTYPE (*func)(int)));
  92. extern void getauthkeys P((const char *));
  93. extern void auth_agekeys P((void));
  94. extern void rereadkeys P((void));
  95. /*
  96. * Variable declarations for libntp.
  97. */
  98. /*
  99. * Defined by any program.
  100. */
  101. extern volatile int debug; /* debugging flag */
  102. /* authkeys.c */
  103. extern u_long authkeynotfound; /* keys not found */
  104. extern u_long authkeylookups; /* calls to lookup keys */
  105. extern u_long authnumkeys; /* number of active keys */
  106. extern u_long authkeyexpired; /* key lifetime expirations */
  107. extern u_long authkeyuncached; /* cache misses */
  108. extern u_long authencryptions; /* calls to encrypt */
  109. extern u_long authdecryptions; /* calls to decrypt */
  110. extern int authnumfreekeys;
  111. /*
  112. * The key cache. We cache the last key we looked at here.
  113. */
  114. extern keyid_t cache_keyid; /* key identifier */
  115. extern u_char * cache_key; /* key pointer */
  116. extern u_int cache_keylen; /* key length */
  117. /* getopt.c */
  118. extern char * ntp_optarg; /* global argument pointer */
  119. extern int ntp_optind; /* global argv index */
  120. /* machines.c */
  121. extern const char *set_tod_using;
  122. /* mexit.c */
  123. #if defined SYS_WINNT || defined SYS_CYGWIN32
  124. extern HANDLE hServDoneEvent;
  125. #endif
  126. /* systime.c */
  127. extern double sys_tick; /* adjtime() resolution */
  128. /* version.c */
  129. extern const char *Version; /* version declaration */