]> andersk Git - openssh.git/blame - defines.h
remove debugging junk
[openssh.git] / defines.h
CommitLineData
76a8e733 1#ifndef _DEFINES_H
2#define _DEFINES_H
3
ea1970a3 4/* Necessary headers */
5
a8ed9fd9 6#include <sys/types.h> /* For [u]intxx_t */
7
cb807f40 8#include <sys/socket.h> /* For SHUT_XXXX */
9
a8ed9fd9 10#include <netinet/in.h> /* For IPv6 macros */
11
5cdfe03f 12#ifdef HAVE_SYS_BITYPES_H
13# include <sys/bitypes.h> /* For u_intXX_t */
14#endif
15
cb807f40 16#ifdef HAVE_PATHS_H
17# include <paths.h> /* For _PATH_XXX */
18#endif
19
20#ifdef HAVE_UTMP_H
21# include <utmp.h> /* For _PATH_XXX */
22#endif
23
24#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
25# include <utmpx.h> /* For _PATH_XXX */
26#endif
27
28#ifdef HAVE_SYS_TIME_H
29# include <sys/time.h> /* For timersub */
30#endif
31
32#ifdef HAVE_MAILLOCK_H
d94aa2ae 33# include <maillock.h> /* For _PATH_MAILDIR */
cb807f40 34#endif
35
d94aa2ae 36#ifdef HAVE_SYS_CDEFS_H
37# include <sys/cdefs.h> /* For __P() */
38#endif
39
d468fc76 40#ifdef HAVE_SYS_SYSMACROS_H
41# include <sys/sysmacros.h> /* For MIN, MAX, etc */
42#endif
43
ea1970a3 44/* Constants */
45
cb807f40 46#ifndef SHUT_RDWR
47enum
48{
49 SHUT_RD = 0, /* No more receptions. */
50 SHUT_WR, /* No more transmissions. */
51 SHUT_RDWR /* No more receptions or transmissions. */
52};
53# define SHUT_RD SHUT_RD
54# define SHUT_WR SHUT_WR
55# define SHUT_RDWR SHUT_RDWR
56#endif
57
ea1970a3 58/* Types */
59
cb807f40 60/* If sys/types.h does not supply intXX_t, supply them ourselves */
61/* (or die trying) */
62#ifndef HAVE_INTXX_T
976f7e19 63# if (SIZEOF_CHAR == 1)
64typedef char int8_t;
65# else
66# error "8 bit int type not found."
67# endif
cb807f40 68# if (SIZEOF_SHORT_INT == 2)
ea1970a3 69typedef short int int16_t;
cb807f40 70# else
71# error "16 bit int type not found."
72# endif
73# if (SIZEOF_INT == 4)
ea1970a3 74typedef int int32_t;
cb807f40 75# else
76# error "32 bit int type not found."
77# endif
78# if (SIZEOF_LONG_INT == 8)
ea1970a3 79typedef long int int64_t;
cb807f40 80# else
81# if (SIZEOF_LONG_LONG_INT == 8)
ea1970a3 82typedef long long int int64_t;
76a8e733 83# define HAVE_INTXX_T 1
cb807f40 84# else
85# error "64 bit int type not found."
86# endif
87# endif
88#endif
89
90/* If sys/types.h does not supply u_intXX_t, supply them ourselves */
91#ifndef HAVE_U_INTXX_T
92# ifdef HAVE_UINTXX_T
976f7e19 93typedef uint8_t u_int8_t;
ea1970a3 94typedef uint16_t u_int16_t;
95typedef uint32_t u_int32_t;
96typedef uint64_t u_int64_t;
76a8e733 97# define HAVE_U_INTXX_T 1
cb807f40 98# else
976f7e19 99# if (SIZEOF_CHAR == 1)
100typedef unsigned char u_int8_t;
101# else
102# error "8 bit int type not found."
103# endif
cb807f40 104# if (SIZEOF_SHORT_INT == 2)
ea1970a3 105typedef unsigned short int u_int16_t;
cb807f40 106# else
107# error "16 bit int type not found."
108# endif
109# if (SIZEOF_INT == 4)
ea1970a3 110typedef unsigned int u_int32_t;
cb807f40 111# else
112# error "32 bit int type not found."
113# endif
114# if (SIZEOF_LONG_INT == 8)
ea1970a3 115typedef unsigned long int u_int64_t;
cb807f40 116# else
117# if (SIZEOF_LONG_LONG_INT == 8)
ea1970a3 118typedef unsigned long long int u_int64_t;
76a8e733 119# define HAVE_U_INTXX_T 1
cb807f40 120# else
121# error "64 bit int type not found."
122# endif
123# endif
124# endif
125#endif
126
ea1970a3 127#ifndef HAVE_SOCKLEN_T
128typedef unsigned int socklen_t;
a6ddc88b 129# define HAVE_SOCKLEN_T
ea1970a3 130#endif /* HAVE_SOCKLEN_T */
131
e3a93db0 132#ifndef HAVE_SIZE_T
133typedef unsigned int size_t;
a6ddc88b 134# define HAVE_SIZE_T
e3a93db0 135#endif /* HAVE_SIZE_T */
136
48e671d5 137#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
138# define ss_family __ss_family
139#endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */
140
ea1970a3 141/* Paths */
142
cb807f40 143/* If _PATH_LASTLOG is not defined by system headers, set it to the */
144/* lastlog file detected by autoconf */
145#ifndef _PATH_LASTLOG
146# ifdef LASTLOG_LOCATION
147# define _PATH_LASTLOG LASTLOG_LOCATION
148# endif
149#endif
150
151#ifndef _PATH_UTMP
152# ifdef UTMP_FILE
153# define _PATH_UTMP UTMP_FILE
154# else
155# define _PATH_UTMP "/var/adm/utmp"
156# endif
157#endif
158
159#ifndef _PATH_WTMP
160# ifdef WTMP_FILE
161# define _PATH_WTMP WTMP_FILE
162# else
163# define _PATH_WTMP "/var/adm/wtmp"
164# endif
165#endif
166
167#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
168# ifndef _PATH_UTMPX
169# ifdef UTMPX_FILE
170# define _PATH_UTMPX UTMPX_FILE
171# else
172# define _PATH_UTMPX "/var/adm/utmpx"
173# endif
174# endif
175# ifndef _PATH_WTMPX
176# ifdef WTMPX_FILE
177# define _PATH_WTMPX WTMPX_FILE
178# else
179# define _PATH_WTMPX "/var/adm/wtmp"
180# endif
181# endif
182#endif
183
184#ifndef _PATH_BSHELL
185# define _PATH_BSHELL "/bin/sh"
186#endif
187
188#ifdef USER_PATH
189# ifdef _PATH_STDPATH
190# undef _PATH_STDPATH
191# endif
192# define _PATH_STDPATH USER_PATH
193#endif
194
195#ifndef _PATH_STDPATH
196# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
197#endif
198
199#ifndef _PATH_DEVNULL
200# define _PATH_DEVNULL "/dev/null"
201#endif
202
203#ifndef MAILDIR
204# define MAILDIR MAIL_DIRECTORY
205#endif
206
207#if !defined(_PATH_MAILDIR) && defined(MAILDIR)
208# define _PATH_MAILDIR MAILDIR
209#endif /* !defined(_PATH_MAILDIR) && defined(MAILDIR) */
210
ea1970a3 211#ifndef _PATH_RSH
212# ifdef RSH_PATH
213# define _PATH_RSH RSH_PATH
214# endif /* RSH_PATH */
215#endif /* _PATH_RSH */
216
217/* Macros */
218
cb807f40 219#ifndef MAX
220# define MAX(a,b) (((a)>(b))?(a):(b))
221# define MIN(a,b) (((a)<(b))?(a):(b))
222#endif
223
224#ifndef timersub
225#define timersub(a, b, result) \
226 do { \
227 (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
228 (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
229 if ((result)->tv_usec < 0) { \
230 --(result)->tv_sec; \
231 (result)->tv_usec += 1000000; \
232 } \
233 } while (0)
234#endif
235
cb807f40 236#ifndef __P
237# define __P(x) x
238#endif
239
a8ed9fd9 240#if !defined(IN6_IS_ADDR_V4MAPPED)
241# define IN6_IS_ADDR_V4MAPPED(a) \
84afc958 242 ((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \
243 (((u_int32_t *) (a))[2] == htonl (0xffff)))
a8ed9fd9 244#endif /* !defined(IN6_IS_ADDR_V4MAPPED) */
245
cb807f40 246#if !defined(__GNUC__) || (__GNUC__ < 2)
976f7e19 247# define __attribute__(x)
cb807f40 248#endif /* !defined(__GNUC__) || (__GNUC__ < 2) */
249
ea1970a3 250#if defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM)
251# define USE_PAM
252#endif /* defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM) */
253
254/* Function replacement / compatibility hacks */
255
256/* In older versions of libpam, pam_strerror takes a single argument */
257#ifdef HAVE_OLD_PAM
258# define PAM_STRERROR(a,b) pam_strerror((b))
259#else
260# define PAM_STRERROR(a,b) pam_strerror((a),(b))
261#endif
262
4c8ef3fb 263#if defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO)
264# undef HAVE_GETADDRINFO
265#endif /* defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO) */
266
76a8e733 267#endif /* _DEFINES_H */
This page took 0.088922 seconds and 5 git commands to generate.