]> andersk Git - openssh.git/blame - defines.h
todo
[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
837c30b8 78/*
cb807f40 79# if (SIZEOF_LONG_INT == 8)
ea1970a3 80typedef long int int64_t;
cb807f40 81# else
82# if (SIZEOF_LONG_LONG_INT == 8)
ea1970a3 83typedef long long int int64_t;
76a8e733 84# define HAVE_INTXX_T 1
cb807f40 85# else
86# error "64 bit int type not found."
87# endif
88# endif
837c30b8 89*/
cb807f40 90#endif
91
92/* If sys/types.h does not supply u_intXX_t, supply them ourselves */
93#ifndef HAVE_U_INTXX_T
94# ifdef HAVE_UINTXX_T
976f7e19 95typedef uint8_t u_int8_t;
ea1970a3 96typedef uint16_t u_int16_t;
97typedef uint32_t u_int32_t;
837c30b8 98/*
ea1970a3 99typedef uint64_t u_int64_t;
837c30b8 100*/
76a8e733 101# define HAVE_U_INTXX_T 1
cb807f40 102# else
976f7e19 103# if (SIZEOF_CHAR == 1)
104typedef unsigned char u_int8_t;
105# else
106# error "8 bit int type not found."
107# endif
cb807f40 108# if (SIZEOF_SHORT_INT == 2)
ea1970a3 109typedef unsigned short int u_int16_t;
cb807f40 110# else
111# error "16 bit int type not found."
112# endif
113# if (SIZEOF_INT == 4)
ea1970a3 114typedef unsigned int u_int32_t;
cb807f40 115# else
116# error "32 bit int type not found."
117# endif
837c30b8 118/*
cb807f40 119# if (SIZEOF_LONG_INT == 8)
ea1970a3 120typedef unsigned long int u_int64_t;
cb807f40 121# else
122# if (SIZEOF_LONG_LONG_INT == 8)
ea1970a3 123typedef unsigned long long int u_int64_t;
76a8e733 124# define HAVE_U_INTXX_T 1
cb807f40 125# else
126# error "64 bit int type not found."
127# endif
128# endif
837c30b8 129*/
cb807f40 130# endif
131#endif
132
ea1970a3 133#ifndef HAVE_SOCKLEN_T
134typedef unsigned int socklen_t;
a6ddc88b 135# define HAVE_SOCKLEN_T
ea1970a3 136#endif /* HAVE_SOCKLEN_T */
137
e3a93db0 138#ifndef HAVE_SIZE_T
139typedef unsigned int size_t;
a6ddc88b 140# define HAVE_SIZE_T
e3a93db0 141#endif /* HAVE_SIZE_T */
142
48e671d5 143#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
144# define ss_family __ss_family
145#endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */
146
ea1970a3 147/* Paths */
148
cb807f40 149/* If _PATH_LASTLOG is not defined by system headers, set it to the */
150/* lastlog file detected by autoconf */
151#ifndef _PATH_LASTLOG
152# ifdef LASTLOG_LOCATION
153# define _PATH_LASTLOG LASTLOG_LOCATION
154# endif
155#endif
156
157#ifndef _PATH_UTMP
158# ifdef UTMP_FILE
159# define _PATH_UTMP UTMP_FILE
160# else
161# define _PATH_UTMP "/var/adm/utmp"
162# endif
163#endif
164
165#ifndef _PATH_WTMP
166# ifdef WTMP_FILE
167# define _PATH_WTMP WTMP_FILE
168# else
169# define _PATH_WTMP "/var/adm/wtmp"
170# endif
171#endif
172
173#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
174# ifndef _PATH_UTMPX
175# ifdef UTMPX_FILE
176# define _PATH_UTMPX UTMPX_FILE
177# else
178# define _PATH_UTMPX "/var/adm/utmpx"
179# endif
180# endif
181# ifndef _PATH_WTMPX
182# ifdef WTMPX_FILE
183# define _PATH_WTMPX WTMPX_FILE
184# else
185# define _PATH_WTMPX "/var/adm/wtmp"
186# endif
187# endif
188#endif
189
190#ifndef _PATH_BSHELL
191# define _PATH_BSHELL "/bin/sh"
192#endif
193
194#ifdef USER_PATH
195# ifdef _PATH_STDPATH
196# undef _PATH_STDPATH
197# endif
198# define _PATH_STDPATH USER_PATH
199#endif
200
201#ifndef _PATH_STDPATH
202# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
203#endif
204
205#ifndef _PATH_DEVNULL
206# define _PATH_DEVNULL "/dev/null"
207#endif
208
209#ifndef MAILDIR
210# define MAILDIR MAIL_DIRECTORY
211#endif
212
213#if !defined(_PATH_MAILDIR) && defined(MAILDIR)
214# define _PATH_MAILDIR MAILDIR
215#endif /* !defined(_PATH_MAILDIR) && defined(MAILDIR) */
216
ea1970a3 217#ifndef _PATH_RSH
218# ifdef RSH_PATH
219# define _PATH_RSH RSH_PATH
220# endif /* RSH_PATH */
221#endif /* _PATH_RSH */
222
223/* Macros */
224
cb807f40 225#ifndef MAX
226# define MAX(a,b) (((a)>(b))?(a):(b))
227# define MIN(a,b) (((a)<(b))?(a):(b))
228#endif
229
230#ifndef timersub
231#define timersub(a, b, result) \
232 do { \
233 (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
234 (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
235 if ((result)->tv_usec < 0) { \
236 --(result)->tv_sec; \
237 (result)->tv_usec += 1000000; \
238 } \
239 } while (0)
240#endif
241
cb807f40 242#ifndef __P
243# define __P(x) x
244#endif
245
a8ed9fd9 246#if !defined(IN6_IS_ADDR_V4MAPPED)
247# define IN6_IS_ADDR_V4MAPPED(a) \
84afc958 248 ((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \
249 (((u_int32_t *) (a))[2] == htonl (0xffff)))
a8ed9fd9 250#endif /* !defined(IN6_IS_ADDR_V4MAPPED) */
251
cb807f40 252#if !defined(__GNUC__) || (__GNUC__ < 2)
976f7e19 253# define __attribute__(x)
cb807f40 254#endif /* !defined(__GNUC__) || (__GNUC__ < 2) */
255
ea1970a3 256#if defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM)
257# define USE_PAM
258#endif /* defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM) */
259
260/* Function replacement / compatibility hacks */
261
262/* In older versions of libpam, pam_strerror takes a single argument */
263#ifdef HAVE_OLD_PAM
264# define PAM_STRERROR(a,b) pam_strerror((b))
265#else
266# define PAM_STRERROR(a,b) pam_strerror((a),(b))
267#endif
268
4c8ef3fb 269#if defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO)
270# undef HAVE_GETADDRINFO
271#endif /* defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO) */
272
76a8e733 273#endif /* _DEFINES_H */
This page took 0.091115 seconds and 5 git commands to generate.