includes.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. #ifdef PRINTF_STDLIB
  38. #include <stdio.h>
  39. #endif
  40. #ifdef PRINTF_CUSTOM
  41. #include "tinystdio.h"
  42. #endif
  43. #include <errno.h>
  44. #ifdef HAVE_NETDB_H
  45. #include <netdb.h>
  46. #endif
  47. #ifdef HAVE_SYSLOG_H
  48. #include <syslog.h>
  49. #endif
  50. #ifdef STDC_HEADERS
  51. # include <stdlib.h>
  52. # include <string.h>
  53. # include <stdarg.h>
  54. #else
  55. # include <stdarg.h>
  56. # ifndef HAVE_STRCHR
  57. # define strchr index
  58. # define strrchr rindex
  59. # endif
  60. #endif
  61. /* I realize that this is ugly and unsafe.. :( */
  62. #ifndef HAVE_SNPRINTF
  63. # define snprintf(buf, len, format, ...) sprintf(buf, format, __VA_ARGS__)
  64. #endif
  65. #ifndef HAVE_VSNPRINTF
  66. # define vsnprintf(buf, len, format, ap) vsprintf(buf, format, ap)
  67. #endif
  68. #ifdef HAVE_UNISTD_H
  69. # include <unistd.h>
  70. #endif /* HAVE_UNISTD_H */
  71. #ifdef HAVE_FCNTL_H
  72. # include <fcntl.h>
  73. #endif
  74. #ifdef HAVE_SYS_FCNTL_H
  75. # include <sys/fcntl.h>
  76. #endif
  77. #ifdef HAVE_SYS_FILE_H
  78. # include <sys/file.h>
  79. #endif
  80. #ifdef HAVE_SYS_STAT_H
  81. # include <sys/stat.h>
  82. #endif
  83. #ifdef HAVE_SYS_UTSNAME_H
  84. # include <sys/utsname.h>
  85. #endif
  86. #ifdef HAVE_SYS_IOCTL_H
  87. # include <sys/ioctl.h>
  88. #endif
  89. #ifdef HAVE_CRYPT_H
  90. # include <crypt.h>
  91. #endif
  92. #ifdef HAVE_LIMITS_H
  93. # include <limits.h>
  94. #endif
  95. #ifdef HAVE_TERMIOS_H
  96. # include <termios.h>
  97. #endif
  98. #ifndef PATH_MAX
  99. #define PATH_MAX 1024
  100. #endif
  101. #ifndef UCHAR_MAX
  102. # ifdef __STDC__
  103. # define UCHAR_MAX 255U
  104. # else
  105. # define UCHAR_MAX 255
  106. # endif
  107. #endif
  108. #ifdef HAVE_PWD_H
  109. #include <pwd.h>
  110. #endif
  111. #ifdef HAVE_SYS_SOCKET_H
  112. #include <sys/socket.h>
  113. #endif
  114. #ifdef HAVE_NETINET_IN_H
  115. #include <netinet/in.h>
  116. #endif
  117. #ifdef HAVE_ARPA_INET_H
  118. #include <arpa/inet.h>
  119. #endif
  120. #if defined(HAVE_SIGNAL_H)
  121. # include <signal.h>
  122. #endif
  123. #if defined(HAVE_SYS_SIGNAL_H)
  124. # include <sys/signal.h>
  125. #endif
  126. #ifdef NEED_SIG_PROTOTYPES
  127. int sigemptyset(sigset_t *);
  128. int sigaddset(sigset_t *, int);
  129. int sigprocmask (int, sigset_t *, sigset_t *);
  130. #endif
  131. #if HAVE_GETOPT_H
  132. # include <getopt.h>
  133. #endif
  134. #if defined(HAVE_SHADOW_H) && defined(HAVE_SHADOW_PASSWORDS)
  135. # include <shadow.h>
  136. #endif
  137. #if TIME_WITH_SYS_TIME
  138. # include <sys/time.h>
  139. # include <time.h>
  140. #else
  141. # if HAVE_SYS_TIME_H
  142. # include <sys/time.h>
  143. # else
  144. # include <time.h>
  145. # endif
  146. #endif
  147. /*
  148. * prefer srandom/random over srand/rand as there generator has a
  149. * better distribution of the numbers on certain systems.
  150. * on Linux both generators are identical.
  151. */
  152. #ifndef HAVE_RANDOM
  153. # ifdef HAVE_RAND
  154. # define srandom srand
  155. # define random GetRandomNumber
  156. # endif
  157. #endif
  158. /* rlib/lock.c */
  159. #if 0
  160. int do_lock_exclusive(FILE *);
  161. int do_unlock(FILE *);
  162. #endif
  163. #endif