includes.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /*
  2. * $Id: includes.h,v 1.6 2007/06/21 18:07:22 cparker Exp $
  3. *
  4. * Copyright (C) 1997 Lars Fenneberg
  5. *
  6. * Copyright 1992 Livingston Enterprises, Inc.
  7. *
  8. * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan
  9. * and Merit Network, Inc. All Rights Reserved
  10. *
  11. * See the file COPYRIGHT for the respective terms and conditions.
  12. * If the file is missing contact me at lf@elemental.net
  13. * and I'll send you a copy.
  14. *
  15. */
  16. #ifndef RC_INCLUDES_H
  17. # define RC_INCLUDES_H
  18. #include "radius_config.h"
  19. #include "rtc.h"
  20. #include "rng.h"
  21. /* AIX requires this to be the first thing in the file. */
  22. #ifndef __GNUC__
  23. # if HAVE_ALLOCA_H
  24. # include <alloca.h>
  25. # else
  26. # ifdef _AIX
  27. # pragma alloca
  28. # else
  29. # ifndef alloca /* predefined by HP cc +Olibcalls */
  30. char *alloca ();
  31. # endif
  32. # endif
  33. # endif
  34. #endif
  35. //#include <sys/types.h>
  36. #include <ctype.h>
  37. #include <stdio.h>
  38. #include <errno.h>
  39. #ifdef HAVE_NETDB_H
  40. #include <netdb.h>
  41. #endif
  42. #ifdef HAVE_SYSLOG_H
  43. #include <syslog.h>
  44. #endif
  45. #ifdef STDC_HEADERS
  46. # include <stdlib.h>
  47. # include <string.h>
  48. # include <stdarg.h>
  49. #else
  50. # include <stdarg.h>
  51. # ifndef HAVE_STRCHR
  52. # define strchr index
  53. # define strrchr rindex
  54. # endif
  55. #endif
  56. /* I realize that this is ugly and unsafe.. :( */
  57. #ifndef HAVE_SNPRINTF
  58. # define snprintf(buf, len, format, ...) sprintf(buf, format, __VA_ARGS__)
  59. #endif
  60. #ifndef HAVE_VSNPRINTF
  61. # define vsnprintf(buf, len, format, ap) vsprintf(buf, format, ap)
  62. #endif
  63. #ifdef HAVE_UNISTD_H
  64. # include <unistd.h>
  65. #endif /* HAVE_UNISTD_H */
  66. #ifdef HAVE_FCNTL_H
  67. # include <fcntl.h>
  68. #endif
  69. #ifdef HAVE_SYS_FCNTL_H
  70. # include <sys/fcntl.h>
  71. #endif
  72. #ifdef HAVE_SYS_FILE_H
  73. # include <sys/file.h>
  74. #endif
  75. #ifdef HAVE_SYS_STAT_H
  76. # include <sys/stat.h>
  77. #endif
  78. #ifdef HAVE_SYS_UTSNAME_H
  79. # include <sys/utsname.h>
  80. #endif
  81. #ifdef HAVE_SYS_IOCTL_H
  82. # include <sys/ioctl.h>
  83. #endif
  84. #ifdef HAVE_CRYPT_H
  85. # include <crypt.h>
  86. #endif
  87. #ifdef HAVE_LIMITS_H
  88. # include <limits.h>
  89. #endif
  90. #ifdef HAVE_TERMIOS_H
  91. # include <termios.h>
  92. #endif
  93. #ifndef PATH_MAX
  94. #define PATH_MAX 1024
  95. #endif
  96. #ifndef UCHAR_MAX
  97. # ifdef __STDC__
  98. # define UCHAR_MAX 255U
  99. # else
  100. # define UCHAR_MAX 255
  101. # endif
  102. #endif
  103. #ifdef HAVE_PWD_H
  104. #include <pwd.h>
  105. #endif
  106. #ifdef HAVE_SYS_SOCKET_H
  107. #include <sys/socket.h>
  108. #endif
  109. #ifdef HAVE_NETINET_IN_H
  110. #include <netinet/in.h>
  111. #endif
  112. #ifdef HAVE_ARPA_INET_H
  113. #include <arpa/inet.h>
  114. #endif
  115. #if defined(HAVE_SIGNAL_H)
  116. # include <signal.h>
  117. #endif
  118. #if defined(HAVE_SYS_SIGNAL_H)
  119. # include <sys/signal.h>
  120. #endif
  121. #ifdef NEED_SIG_PROTOTYPES
  122. int sigemptyset(sigset_t *);
  123. int sigaddset(sigset_t *, int);
  124. int sigprocmask (int, sigset_t *, sigset_t *);
  125. #endif
  126. #if HAVE_GETOPT_H
  127. # include <getopt.h>
  128. #endif
  129. #if defined(HAVE_SHADOW_H) && defined(HAVE_SHADOW_PASSWORDS)
  130. # include <shadow.h>
  131. #endif
  132. #if TIME_WITH_SYS_TIME
  133. # include <sys/time.h>
  134. # include <time.h>
  135. #else
  136. # if HAVE_SYS_TIME_H
  137. # include <sys/time.h>
  138. # else
  139. # include <time.h>
  140. # endif
  141. #endif
  142. /*
  143. * prefer srandom/random over srand/rand as there generator has a
  144. * better distribution of the numbers on certain systems.
  145. * on Linux both generators are identical.
  146. */
  147. #ifndef HAVE_RANDOM
  148. # ifdef HAVE_RAND
  149. # define srandom srand
  150. # define random GetRandomNumber
  151. # endif
  152. #endif
  153. /* rlib/lock.c */
  154. int do_lock_exclusive(FILE *);
  155. int do_unlock(FILE *);
  156. #endif