this is the bug change to using connection_struct* instead of cnum.
[samba.git] / source / include / includes.h
1 #ifndef _INCLUDES_H
2 #define _INCLUDES_H
3 /* 
4    Unix SMB/Netbios implementation.
5    Version 1.9.
6    Machine customisation and include handling
7    Copyright (C) Andrew Tridgell 1994-1998
8    
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13    
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18    
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24 #include "config.h"
25 #include "local.h"
26
27 #ifdef AIX
28 #define DEFAULT_PRINTING PRINT_AIX
29 #endif
30
31 #ifdef HPUX
32 #define DEFAULT_PRINTING PRINT_HPUX
33 #endif
34
35 #ifdef QNX
36 #define DEFAULT_PRINTING PRINT_QNX
37 #endif
38
39 #ifdef SUNOS4
40 #define REPLACE_GETPASS
41 /* on SUNOS4 termios.h conflicts with sys/ioctl.h */
42 #undef HAVE_TERMIOS_H
43 #endif
44
45 #ifdef SUNOS5
46 #define REPLACE_GETPASS
47 #endif
48
49
50 #include <sys/types.h>
51
52 #ifdef HAVE_UNISTD_H
53 #include <unistd.h>
54 #endif
55 #include <stdio.h>
56 #include <stddef.h>
57
58 #ifdef HAVE_SYS_PARAM_H
59 #include <sys/param.h>
60 #endif
61
62 #ifdef HAVE_STDLIB_H
63 #include <stdlib.h>
64 #endif
65
66 #ifdef HAVE_SYS_SOCKET_H
67 #include <sys/socket.h>
68 #endif
69
70 #ifdef HAVE_STRING_H
71 #include <string.h>
72 #endif
73
74 #ifdef HAVE_MALLOC_H
75 #include <malloc.h>
76 #endif
77
78 #ifdef TIME_WITH_SYS_TIME
79 #include <sys/time.h>
80 #include <time.h>
81 #else
82 #ifdef HAVE_SYS_TIME_H
83 #include <sys/time.h>
84 #else
85 #include <time.h>
86 #endif
87 #endif
88
89 #ifdef HAVE_FCNTL_H
90 #include <fcntl.h>
91 #else
92 #ifdef HAVE_SYS_FCNTL_H
93 #include <sys/fcntl.h>
94 #endif
95 #endif
96
97 #include <sys/stat.h>
98
99 #ifdef HAVE_LIMITS_H
100 #include <limits.h>
101 #endif
102
103 #ifdef HAVE_SYS_IOCTL_H
104 #include <sys/ioctl.h>
105 #endif
106
107 #ifdef HAVE_SYS_FILIO_H
108 #include <sys/filio.h>
109 #endif
110
111 #include <signal.h>
112
113 #ifdef HAVE_SYS_WAIT_H
114 #include <sys/wait.h>
115 #endif
116 #ifdef HAVE_CTYPE_H
117 #include <ctype.h>
118 #endif
119 #ifdef HAVE_GRP_H
120 #include <grp.h>
121 #endif
122 #ifdef HAVE_SYS_ID_H
123 #include <sys/id.h>
124 #endif
125
126 #include <errno.h>
127
128 #ifdef HAVE_UTIME_H
129 #include <utime.h>
130 #endif
131
132 #ifdef HAVE_SYS_SELECT_H
133 #include <sys/select.h>
134 #endif
135
136 #ifdef HAVE_SYS_MODE_H
137 /* apparently AIX needs this for S_ISLNK */
138 #ifndef S_ISLNK
139 #include <sys/mode.h>
140 #endif
141 #endif
142
143 #ifdef HAVE_GLOB
144 #include <glob.h>
145 #endif
146
147 #include <pwd.h>
148 #include <grp.h>
149
150 #ifdef HAVE_STDARG_H
151 #include <stdarg.h>
152 #else
153 #include <varargs.h>
154 #endif
155
156 #include <netinet/in.h>
157 #include <arpa/inet.h>
158 #include <netdb.h>
159 #include <syslog.h>
160 #include <sys/file.h>
161
162 #ifdef HAVE_NETINET_TCP_H
163 #include <netinet/tcp.h>
164 #endif
165
166 #ifdef HAVE_TERMIOS_H
167 #include <termios.h>
168 #endif
169
170 #if HAVE_DIRENT_H
171 # include <dirent.h>
172 # define NAMLEN(dirent) strlen((dirent)->d_name)
173 #else
174 # define dirent direct
175 # define NAMLEN(dirent) (dirent)->d_namlen
176 # if HAVE_SYS_NDIR_H
177 #  include <sys/ndir.h>
178 # endif
179 # if HAVE_SYS_DIR_H
180 #  include <sys/dir.h>
181 # endif
182 # if HAVE_NDIR_H
183 #  include <ndir.h>
184 # endif
185 #endif
186
187 #ifdef HAVE_SHARED_MMAP
188 #include <sys/mman.h>
189 #endif
190
191 #ifdef HAVE_SYSV_IPC
192 #include <sys/ipc.h>
193 #include <sys/shm.h>
194 #include <sys/sem.h>
195 #endif
196
197 #ifdef HAVE_NET_IF_H
198 #include <net/if.h>
199 #endif
200
201
202 #ifdef HAVE_SYS_MOUNT_H
203 #include <sys/mount.h>
204 #endif
205
206 #ifdef HAVE_SYS_VFS_H
207 #include <sys/vfs.h>
208 #endif
209
210 #ifdef HAVE_SYS_FS_S5PARAM_H 
211 #include <sys/fs/s5param.h>
212 #endif
213
214 #if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY)
215 #include <sys/filsys.h> 
216 #endif
217
218 #ifdef HAVE_SYS_STATFS_H
219 # include <sys/statfs.h>
220 #endif
221
222 #ifdef HAVE_DUSTAT_H              
223 #include <sys/dustat.h>
224 #endif
225
226 #ifdef HAVE_SYS_STATVFS_H          
227 #include <sys/statvfs.h>
228 #endif
229
230 #ifdef HAVE_SHADOW_H
231 #include <shadow.h>
232 #endif
233
234 #ifdef HAVE_SYS_SECURITY_H
235 #include <sys/security.h>
236 #include <prot.h>
237 #define PASSWORD_LENGTH 16
238 #endif  /* HAVE_SYS_SECURITY_H */
239
240 #ifdef HAVE_COMPAT_H
241 #include <compat.h>
242 #endif
243
244 #ifndef uchar
245 #define uchar unsigned char
246 #endif
247
248 #ifdef HAVE_UNSIGNED_CHAR
249 #define schar signed char
250 #else
251 #define schar char
252 #endif
253
254 #ifndef int32
255 #if (SIZEOF_INT == 4)
256 #define int32 int
257 #elif (SIZEOF_LONG == 4)
258 #define int32 long
259 #elif (SIZEOF_SHORT == 4)
260 #define int32 short
261 #endif
262 #endif
263
264 #ifndef uint32
265 #define uint32 unsigned int32
266 #endif
267
268 #ifndef MIN
269 #define MIN(a,b) ((a)<(b)?(a):(b))
270 #endif
271
272 #ifndef MAX
273 #define MAX(a,b) ((a)>(b)?(a):(b))
274 #endif
275
276 #ifndef HAVE_STRERROR
277 extern char *sys_errlist[];
278 #define strerror(i) sys_errlist[i]
279 #endif
280
281 #ifndef HAVE_STRCHR
282 # define strchr                 index
283 # define strrchr                rindex
284 #endif
285
286 #ifndef HAVE_ERRNO_DECL
287 extern int errno;
288 #endif
289
290 #ifdef HAVE_BROKEN_GETGROUPS
291 #define GID_T int
292 #else
293 #define GID_T gid_t
294 #endif
295
296
297 /* Lists, trees, caching, datbase... */
298 #include "ubi_sLinkList.h"
299 #include "ubi_dLinkList.h"
300 #ifndef UBI_BINTREE_H
301 #include "ubi_Cache.h"
302 #endif /* UBI_BINTREE_H */
303
304 #include "version.h"
305 #include "smb.h"
306 #include "nameserv.h"
307
308 #include "byteorder.h"
309
310 #include "kanji.h"
311 #include "charset.h"
312
313 #ifndef MAXCODEPAGELINES
314 #define MAXCODEPAGELINES 256
315 #endif
316
317 /***** automatically generated prototypes *****/
318 #include "proto.h"
319
320 #ifdef strcpy
321 #undef strcpy
322 #endif /* strcpy */
323 #define strcpy(dest,src) __ERROR__XX__NEVER_USE_STRCPY___;
324
325 #ifdef strcat
326 #undef strcat
327 #endif /* strcat */
328 #define strcat(dest,src) __ERROR__XX__NEVER_USE_STRCAT___;
329
330 #ifdef sprintf
331 #undef sprintf
332 #endif /* sprintf */
333 #define sprintf __ERROR__XX__NEVER_USE_SPRINTF__;
334
335 #define pstrcpy(d,s) safe_strcpy((d),(s),sizeof(pstring)-1)
336 #define pstrcat(d,s) safe_strcat((d),(s),sizeof(pstring)-1)
337 #define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1)
338 #define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1)
339
340 #ifdef __COMPAR_FN_T
341 #define QSORT_CAST (__compar_fn_t)
342 #endif
343
344 #ifndef QSORT_CAST
345 #define QSORT_CAST (int (*)(const void *, const void *))
346 #endif
347
348 /* this guess needs to be improved (tridge) */
349 #if defined(STAT_STATVFS) && !defined(SYSV)
350 #define SYSV 1
351 #endif
352
353 #ifndef DEFAULT_PRINTING
354 #ifdef SYSV
355 #define DEFAULT_PRINTING PRINT_SYSV
356 #else
357 #define DEFAULT_PRINTING PRINT_BSD
358 #endif
359 #endif
360
361 #ifndef SIGCLD
362 #define SIGCLD SIGCHLD
363 #endif
364
365 #if (defined(HAVE_SYSV_IPC) || defined(HAVE_SHARED_MMAP))
366 #define FAST_SHARE_MODES 1
367 #endif
368
369 #ifndef MAP_FILE
370 #define MAP_FILE 0
371 #endif
372
373 #ifdef HAVE_SYSV_IPC
374 #ifndef HAVE_UNION_SEMUN
375 union semun {
376         int val;
377         struct semid_ds *buf;
378         unsigned short *array;
379 };
380 #endif
381 #endif
382
383 #if (!defined(WITH_NISPLUS) && !defined(WITH_LDAP))
384 #define USE_SMBPASS_DB 1
385 #endif
386
387 #if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS)
388 #define OSF1_ENH_SEC 1
389 #endif
390
391 #if defined(HAVE_PAM_AUTHENTICATE) && defined(HAVE_SECURITY_PAM_APPL_H)
392 #define HAVE_PAM 1
393 #endif
394
395 #if defined(HAVE_YP_GET_DEFAULT_DOMAIN)
396 #define HAVE_NETGROUP 1
397 #endif
398
399 #ifndef ALLOW_CHANGE_PASSWORD
400 #if (defined(HAVE_TERMIOS_H) && defined(HAVE_DUP2) && defined(HAVE_SETSID))
401 #define ALLOW_CHANGE_PASSWORD 1
402 #endif
403 #endif
404
405 /* what is the longest significant password available on your system? 
406  Knowing this speeds up password searches a lot */
407 #ifndef PASSWORD_LENGTH
408 #define PASSWORD_LENGTH 8
409 #endif
410
411 #ifdef REPLACE_INET_NTOA
412 #define inet_ntoa rep_inet_ntoa
413 #endif
414
415 #ifndef HAVE_PIPE
416 #define SYNC_DNS 1
417 #endif
418
419 #ifndef MAXPATHLEN
420 #define MAXPATHLEN 256
421 #endif
422
423 #ifndef SEEK_SET
424 #define SEEK_SET 0
425 #endif
426
427 #ifndef INADDR_LOOPBACK
428 #define INADDR_LOOPBACK 0x7f000001
429 #endif
430
431 #ifndef INADDR_NONE
432 #define INADDR_NONE 0xffffffff
433 #endif
434
435 #ifndef HAVE_CRYPT
436 #define crypt ufc_crypt
437 #endif
438
439 #if defined(HAVE_CRYPT16) && defined(HAVE_GETAUTHUID)
440 #define ULTRIX_AUTH 1
441 #endif
442
443 #ifndef HAVE_STRDUP
444 char *strdup(const char *s);
445 #endif
446
447 #ifndef HAVE_MEMMOVE
448 void *memmove(void *dest,const void *src,int size);
449 #endif
450
451 #ifndef HAVE_INITGROUPS
452 int initgroups(char *name,gid_t id);
453 #endif
454
455 #ifndef HAVE_RENAME
456 int rename(const char *zfrom, const char *zto);
457 #endif
458
459 #ifndef HAVE_MKTIME
460 time_t mktime(struct tm *t);
461 #endif
462
463 #ifndef HAVE_FTRUNCATE
464 int ftruncate(int f,long l);
465 #endif
466
467 #if (defined(HAVE_SETRESUID) && !defined(HAVE_SETRESUID_DECL))
468 /* stupid glibc */
469 int setresuid(uid_t ruid, uid_t euid, uid_t suid);
470 int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
471 #endif
472
473 #endif /* _INCLUDES_H */