#ifndef _INCLUDES_H
#define _INCLUDES_H
/* 
   Unix SMB/Netbios implementation.
   Version 1.9.
   Machine customisation and include handling
   Copyright (C) Andrew Tridgell 1994-1998
   
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ 

/******************************************************************************
 *
 * RCS ID
 * $Id: includes,v 1.4 2002/11/17 16:43:00 david Exp $
 *
 * HISTORY
 * $Log: includes,v $
 * Revision 1.4  2002/11/17 16:43:00  david
 * Updates to compiler with new 32-bit compiler
 *
 * Revision 1.3  2000/01/29 17:18:19  david
 * Updates to support passwords
 *
 * Revision 1.2  1999/11/23 21:59:06  david
 * Updates for long filename support.
 *
 * Revision 1.1  1999/05/16 13:22:12  david
 * Initial revision
 *
 *
 *****************************************************************************/

#define HAVE_STDARG_H   1
#define HAVE_FILE_MACRO 1
#define HAVE_STRFTIME   1
#define HAVE_SELECT     1
#define ACORN_RISCOS    1

# define NAMLEN(dirent) strlen((dirent)->d_name)

#include <time.h>

#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <ctype.h>

#include "socklib.h"
#include "unixlib.h"
#include "inetlib.h"

#include "sys/fcntl.h"

#include "pwd.h"
                    
#define malloc(A) my_malloc(__FILE__,__LINE__,(A))
#define calloc(A,B) my_calloc(__FILE__,__LINE__,(A),(B))
#define realloc(A,B) my_realloc(__FILE__,__LINE__,(A),(B))
#define free(A) my_free(__FILE__,__LINE__,(A))

#include "mytypes.h"

#include "local.h"

#include "byteorder.h"

#include "smb.h"      

#include "smbserver.h"

#include "kanji.h"    

#include "charset.h"

#include "nterr.h"



#define SIZEOF_INO_T 0
#define SIZEOF_OFF_T 0

#if 0
#if defined(HAVE_LONGLONG)
#define SMB_BIG_UINT unsigned long long
#define SMB_BIG_INT long long
#define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
#else
#if defined (SMB_BIG_UINT)
#undef SMB_BIG_UINT
#endif
#define SMB_BIG_UINT unsigned long
#endif

#if defined (SMB_BIG_INT)
#undef SMB_BIG_INT 
#endif
#define SMB_BIG_INT long
#define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
#endif

/*
 * Setup the correctly sized inode type.
 */

#ifndef SMB_INO_T
#  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_INO64_T)
#    define SMB_INO_T ino64_t
#  else
#    define SMB_INO_T ino_t
#  endif
#endif

#ifndef LARGE_SMB_INO_T
#  if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_INO64_T)) || (defined(SIZEOF_INO_T) && (SIZEOF_INO_T == 8))
#    define LARGE_SMB_INO_T 1
#  endif
#endif

#ifdef LARGE_SMB_INO_T
#define SINO_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
#else 
#define SINO_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
#endif

#ifndef SMB_OFF_T
#  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)
#    define SMB_OFF_T off64_t
#  else
#    define SMB_OFF_T off_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))
#else 
#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
#endif

#define SMB_OFF_T_BITS (sizeof(SMB_OFF_T)*8)

#ifndef SMB_STRUCT_STAT
#  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STAT64) && defined(HAVE_OFF64_T)
#    define SMB_STRUCT_STAT struct stat64
#  else
#    define SMB_STRUCT_STAT struct stat
#  endif
#endif

#ifndef SMB_STRUCT_DIRENT
#  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIRENT64)
#    define SMB_STRUCT_DIRENT struct dirent64
#  else
#    define SMB_STRUCT_DIRENT struct dirent
#  endif
#endif


#ifndef O_ACCMODE
#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
#endif

#include "ubi_dlinklist.h"
#include "ubi_sLinkList.h"
#include "dlinklist.h"

#ifndef UBI_BINTREE_H
#include "ubi_Cache.h"
#endif /* UBI_BINTREE_H */

#include "nameserv.h"

#include "debugparse.h"

#include "proto.h"

#include "version.h"

#ifndef DEFAULT_PRINTING
#ifdef 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 MAXCODEPAGELINES
#define MAXCODEPAGELINES 256
#endif


/* Types of machine we can announce as. */
#define ANNOUNCE_AS_NT 1
#define ANNOUNCE_AS_WIN95 2
#define ANNOUNCE_AS_WFW 3


#ifndef QSORT_CAST
#define QSORT_CAST (int (*)(const void *, const void *))
#endif

#define HAVE_GETTIMEOFDAY_TZ 1

#define readdir my_readdir
#define fstat   my_fstat


#define sys_open riscos_open
#define sys_close riscos_close
#define sys_write riscos_write
#define sys_read riscos_read
#define sys_lseek riscos_lseek

#include "proto2.h"

#endif /* _INCLUDES_H */
