includes.h 3.4 KB

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