r884: convert samba4 to use [u]int32_t instead of [u]int32
[abartlet/samba.git/.git] / source4 / include / includes.h
index f369367d821aef3c2718f312e37c1386bb684e21..e6593754ed133f710da1eb08a340ae1192c33c13 100644 (file)
@@ -23,6 +23,7 @@
 
 #ifndef NO_CONFIG_H /* for some tests */
 #include "config.h"
+#include "smb_build.h"
 #endif
 
 #include "local.h"
 #undef HAVE_TERMIOS_H
 #endif
 
-#ifdef LINUX
 #ifndef DEFAULT_PRINTING
 #define DEFAULT_PRINTING PRINT_BSD
 #endif
 #ifndef PRINTCAP_NAME
 #define PRINTCAP_NAME "/etc/printcap"
 #endif
-#endif
 
 #ifdef __GNUC__
 /** Use gcc attribute to check printf fns.  a1 is the 1-based index of
 #include <stropts.h>
 #endif
 
-#ifdef HAVE_POLL_H
-#include <poll.h>
-#endif
-
 #ifdef HAVE_SYS_CAPABILITY_H
 
 #if defined(BROKEN_REDHAT_7_SYSTEM_HEADERS) && !defined(_I386_STATFS_H)
 
 #endif
 
-#if defined(HAVE_RPC_RPC_H)
-/*
- * Check for AUTH_ERROR define conflict with rpc/rpc.h in prot.h.
- */
-#if defined(HAVE_SYS_SECURITY_H) && defined(HAVE_RPC_AUTH_ERROR_CONFLICT)
-#undef AUTH_ERROR
-#endif
-#include <rpc/rpc.h>
-#endif
-
-#if defined(HAVE_YP_GET_DEFAULT_DOMAIN) && defined(HAVE_SETNETGRENT) && defined(HAVE_ENDNETGRENT) && defined(HAVE_GETNETGRENT)
-#define HAVE_NETGROUP 1
-#endif
-
-#if defined (HAVE_NETGROUP)
-#if defined(HAVE_RPCSVC_YP_PROT_H)
-#include <rpcsvc/yp_prot.h>
-#endif
-#if defined(HAVE_RPCSVC_YPCLNT_H)
-#include <rpcsvc/ypclnt.h>
-#endif
-#endif /* HAVE_NETGROUP */
-
 #if defined(HAVE_SYS_IPC_H)
 #include <sys/ipc.h>
 #endif /* HAVE_SYS_IPC_H */
 /*
  * Define additional missing types
  */
-#if defined(HAVE_SIG_ATOMIC_T_TYPE) && defined(AIX)
-typedef sig_atomic_t SIG_ATOMIC_T;
-#elif defined(HAVE_SIG_ATOMIC_T_TYPE) && !defined(AIX)
-typedef sig_atomic_t VOLATILE SIG_ATOMIC_T;
-#else
-typedef int VOLATILE SIG_ATOMIC_T;
+#ifndef HAVE_SIG_ATOMIC_T_TYPE
+typedef int sig_atomic_t;
 #endif
 
 #ifndef HAVE_SOCKLEN_T_TYPE
@@ -475,7 +443,7 @@ typedef int socklen_t;
 #endif
 
 /*
-   Samba needs type definitions for int16, int32, uint16 and uint32.
+   Samba needs type definitions for int16, int32_t, uint16 and uint32_t.
 
    Normally these are signed and unsigned 16 and 32 bit integers, but
    they actually only need to be at least 16 and 32 bits
@@ -487,7 +455,7 @@ typedef int socklen_t;
 #define uint8 unsigned char
 #endif
 
-#if !defined(int16) && !defined(HAVE_INT16_FROM_RPC_RPC_H)
+#if !defined(int16)
 #if (SIZEOF_SHORT == 4)
 #define int16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
 #else /* SIZEOF_SHORT != 4 */
@@ -495,12 +463,8 @@ typedef int socklen_t;
 #endif /* SIZEOF_SHORT != 4 */
 #endif
 
-/*
- * Note we duplicate the size tests in the unsigned 
- * case as int16 may be a typedef from rpc/rpc.h
- */
 
-#if !defined(uint16) && !defined(HAVE_UINT16_FROM_RPC_RPC_H)
+#if !defined(uint16)
 #if (SIZEOF_SHORT == 4)
 #define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
 #else /* SIZEOF_SHORT != 4 */
@@ -508,35 +472,20 @@ typedef int socklen_t;
 #endif /* SIZEOF_SHORT != 4 */
 #endif
 
-#if !defined(int32) && !defined(HAVE_INT32_FROM_RPC_RPC_H)
-#if (SIZEOF_INT == 4)
-#define int32 int
-#elif (SIZEOF_LONG == 4)
-#define int32 long
-#elif (SIZEOF_SHORT == 4)
-#define int32 short
-#else
-/* uggh - no 32 bit type?? probably a CRAY. just hope this works ... */
-#define int32 int
-#endif
+#if !defined(int32)
+#define int32 int32_t
 #endif
 
-/*
- * Note we duplicate the size tests in the unsigned 
- * case as int32 may be a typedef from rpc/rpc.h
- */
+#if !defined(uint32)
+#define uint32 uint32_t
+#endif
 
-#if !defined(uint32) && !defined(HAVE_UINT32_FROM_RPC_RPC_H)
-#if (SIZEOF_INT == 4)
-#define uint32 unsigned int
-#elif (SIZEOF_LONG == 4)
-#define uint32 unsigned long
-#elif (SIZEOF_SHORT == 4)
-#define uint32 unsigned short
-#else
-/* uggh - no 32 bit type?? probably a CRAY. just hope this works ... */
-#define uint32 unsigned
+#if !defined(int64)
+#define int64 int64_t
 #endif
+
+#if !defined(uint64)
+#define uint64 uint64_t
 #endif
 
 /*
@@ -583,11 +532,6 @@ typedef int socklen_t;
 #  endif
 #endif
 
-/* this should really be a 64 bit type if possible */
-#define br_off SMB_BIG_UINT
-
-#define SMB_OFF_T_BITS (sizeof(SMB_OFF_T)*8)
-
 /*
  * Set the define that tells us if we can do 64 bit
  * NT SMB calls.
@@ -599,20 +543,6 @@ typedef int socklen_t;
 #  endif
 #endif
 
-#ifdef LARGE_SMB_OFF_T
-#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
-#define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,(v)&0xFFFFFFFF), SIVAL(p,ofs,(v)>>32))
-#define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF) )))
-#define IVAL2_TO_SMB_BIG_UINT(buf,off) ( (((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF)) | \
-               (( ((SMB_BIG_UINT)(IVAL((buf),(off+4)))) & ((SMB_BIG_UINT)0xFFFFFFFF) ) << 32 ) )
-#else 
-#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
-#define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,v),SIVAL(p,ofs,0))
-#define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((uint32)(IVAL((buf),(off)))) & 0xFFFFFFFF )))
-#define IVAL2_TO_SMB_BIG_UINT(buf,off) ( (((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF)) | \
-                               (( ((SMB_BIG_UINT)(IVAL((buf),(off+4)))) & ((SMB_BIG_UINT)0xFFFFFFFF) ) << 32 ) )
-#endif
-
 /*
  * Type for stat structure.
  */
@@ -631,9 +561,9 @@ typedef int socklen_t;
 
 #ifndef SMB_STRUCT_DIRENT
 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIRENT64)
-#    define SMB_STRUCT_DIRENT struct dirent64
+#    define smb_dirent dirent64
 #  else
-#    define SMB_STRUCT_DIRENT struct dirent
+#    define smb_dirent dirent
 #  endif
 #endif
 
@@ -673,20 +603,6 @@ typedef int socklen_t;
 #  endif
 #endif
 
-#if defined(HAVE_LONGLONG)
-#define SMB_BIG_UINT unsigned long long
-#define SMB_BIG_INT long long
-#define SBVAL(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
-#define BVAL(p, ofs) (IVAL(p,ofs) | (((SMB_BIG_UINT)IVAL(p,(ofs)+4)) << 32))
-#else
-#define SMB_BIG_UINT unsigned long
-#define SMB_BIG_INT long
-#define SBVAL(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
-#define BVAL(p, ofs) IVAL(p,ofs)
-#endif
-
-#define SMB_BIG_UINT_BITS (sizeof(SMB_BIG_UINT)*8)
-
 #ifndef MIN
 #define MIN(a,b) ((a)<(b)?(a):(b))
 #endif
@@ -719,14 +635,13 @@ extern int errno;
 
 /* Lists, trees, caching, database... */
 #include "xfile.h"
-#include "intl.h"
 #include "dlinklist.h"
-#include "../tdb/tdb.h"
-#include "../tdb/spinlock.h"
-#include "../tdb/tdbutil.h"
+#include "lib/ldb/include/ldb.h"
+#include "lib/tdb/include/tdb.h"
+#include "lib/tdb/include/spinlock.h"
+#include "lib/tdb/include/tdbutil.h"
 #include "talloc.h"
 #include "nt_status.h"
-#include "ads.h"
 #include "interfaces.h"
 #include "trans2.h"
 #include "ioctl.h"
@@ -734,93 +649,47 @@ extern int errno;
 #include "messages.h"
 #include "charset.h"
 #include "dynconfig.h"
-#include "adt_tree.h"
-
-#include "util_getent.h"
 
 #include "version.h"
 #include "smb.h"
+#include "ads.h"
 #include "nameserv.h"
 #include "secrets.h"
 
 #include "byteorder.h"
 
-#include "ntdomain.h"
-
-#include "msdfs.h"
-
-#include "mapping.h"
-
-#include "rap.h"
-
 #include "md5.h"
 #include "hmacmd5.h"
 
-#include "ntlmssp.h"
-
-#include "auth.h"
+#include "libcli/auth/ntlmssp.h"
+#include "libcli/auth/credentials.h"
+#include "libcli/auth/schannel.h"
 
-#include "passdb.h"
+#include "auth/auth.h"
 
-#include "sam.h"
-
-#include "session.h"
+#include "module.h"
 
 #include "asn_1.h"
 
 #include "popt.h"
 
-#include "mangle.h"
-
-#include "nsswitch/winbind_client.h"
-
-#include "genparser.h"
-
 #include "mutex.h"
 
-/*
- * Type for wide character dirent structure.
- * Only d_name is defined by POSIX.
- */
+#include "librpc/rpc/dcerpc.h"
 
-typedef struct smb_wdirent {
-       wpstring        d_name;
-} SMB_STRUCT_WDIRENT;
+#include "rpc_server/dcerpc_server.h"
+#include "context.h"
+#include "ntvfs/ntvfs.h"
+#include "cli_context.h"
+#include "registry.h"
 
-/*
- * Type for wide character passwd structure.
- */
-
-typedef struct smb_wpasswd {
-       wfstring       pw_name;
-       char           *pw_passwd;
-       uid_t          pw_uid;
-       gid_t          pw_gid;
-       wpstring       pw_gecos;
-       wpstring       pw_dir;
-       wpstring       pw_shell;
-} SMB_STRUCT_WPASSWD;
-
-/* used in net.c */
-struct functable {
-       const char *funcname;
-       int (*fn)(int argc, const char **argv);
-};
-
-
-/* Defines for wisXXX functions. */
-#define UNI_UPPER    0x1
-#define UNI_LOWER    0x2
-#define UNI_DIGIT    0x4
-#define UNI_XDIGIT   0x8
-#define UNI_SPACE    0x10
+#define malloc_p(type) (type *)malloc(sizeof(type))
+#define malloc_array_p(type, count) (type *)realloc_array(NULL, sizeof(type), count)
+#define realloc_p(p, type, count) (type *)realloc_array(p, sizeof(type), count)
 
-#include "nsswitch/nss.h"
-
-/* forward declaration from printing.h to get around 
-   header file dependencies */
-
-struct printjob;
+#ifndef HAVE_COMPARISON_FN_T
+typedef int (*comparison_fn_t)(const void *, const void *);
+#endif
 
 /***** automatically generated prototypes *****/
 #include "proto.h"
@@ -837,23 +706,6 @@ struct printjob;
 #define QSORT_CAST (int (*)(const void *, const void *))
 #endif
 
-#ifndef DEFAULT_PRINTING
-#ifdef HAVE_CUPS
-#define DEFAULT_PRINTING PRINT_CUPS
-#define PRINTCAP_NAME "cups"
-#elif defined(SYSV)
-#define DEFAULT_PRINTING PRINT_SYSV
-#define PRINTCAP_NAME "lpstat"
-#else
-#define DEFAULT_PRINTING PRINT_BSD
-#define PRINTCAP_NAME "/etc/printcap"
-#endif
-#endif
-
-#ifndef PRINTCAP_NAME
-#define PRINTCAP_NAME "/etc/printcap"
-#endif
-
 #ifndef SIGCLD
 #define SIGCLD SIGCHLD
 #endif
@@ -862,7 +714,7 @@ struct printjob;
 #define MAP_FILE 0
 #endif
 
-#if (!defined(WITH_NISPLUS) && !defined(WITH_LDAP) && !defined(WITH_TDB_SAM))
+#if (!defined(WITH_LDAP) && !defined(WITH_TDB_SAM))
 #define USE_SMBPASS_DB 1
 #endif
 
@@ -1208,30 +1060,5 @@ time_t timegm(struct tm *tm);
 #define VXFS_QUOTA
 #endif
 
-#if defined(HAVE_KRB5)
-
-#ifndef KRB5_SET_REAL_TIME
-krb5_error_code krb5_set_real_time(krb5_context context, int32_t seconds, int32_t microseconds);
-#endif
-
-#ifndef HAVE_KRB5_SET_DEFAULT_TGS_KTYPES
-krb5_error_code krb5_set_default_tgs_ktypes(krb5_context ctx, const krb5_enctype *enc);
-#endif
-
-#if defined(HAVE_KRB5_AUTH_CON_SETKEY) && !defined(HAVE_KRB5_AUTH_CON_SETUSERUSERKEY)
-krb5_error_code krb5_auth_con_setuseruserkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock *keyblock);
-#endif
-
-/* Samba wrapper function for krb5 functionality. */
-void setup_kaddr( krb5_address *pkaddr, struct sockaddr *paddr);
-int create_kerberos_key_from_string(krb5_context context, krb5_principal host_princ, krb5_data *password, krb5_keyblock *key, krb5_enctype enctype);
-void get_auth_data_from_tkt(DATA_BLOB *auth_data, krb5_ticket *tkt);
-krb5_const_principal get_principal_from_tkt(krb5_ticket *tkt);
-krb5_error_code krb5_locate_kdc(krb5_context ctx, const krb5_data *realm, struct sockaddr **addr_pp, int *naddrs, int get_masters);
-krb5_error_code get_kerberos_allowed_etypes(krb5_context context, krb5_enctype **enctypes);
-void free_kerberos_etypes(krb5_context context, krb5_enctype *enctypes);
-BOOL krb5_get_smb_session_key(krb5_context context, krb5_auth_context auth_context, uint8 session_key[16]);
-#endif /* HAVE_KRB5 */
-
 #endif /* _INCLUDES_H */