// Sample code file: TYPES.H

// Warning: This code has been marked up for HTML

/*
//ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
//º (c) 1995 Novell, Inc.  All rights reserved.                              º
//º                                                                          º
//º THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND        º
//º TREATIES.                                                                º
//º                                                                          º
//º NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, COPIED,          º
//º DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, CONDENSED,         º
//º EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, TRANSFORMED OR ADAPTED    º
//º WITHOUT THE PRIOR WRITTEN CONSENT OF NOVELL, INC.                        º
//º                                                                          º
//º ANY USE OR EXPLOITATION OF THIS WORK WITHOUT AUTHORIZATION COULD SUBJECT º
//º THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.                         º
//ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
//º Source module name: TYPES.H                                              º
//ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
*/
/* Inclusion Control */
#if !defined( _RPC_TYPES_H )
   #define _RPC_TYPES_H

#include <rpc/ndpsrpc.h>

#if defined(NWDOS) || defined(N_PLAT_DOS)


#include <sys/types.h>     
#include <rpc/time.h>      /* struct timeval          */

#include <stddef.h>        /* defines NULL */
#ifndef FAR
#define FAR 
#endif
#ifndef PASCAL
#define PASCAL 
#endif

#ifndef FALSE
#  define   FALSE    (0)
#endif

#ifndef TRUE
#  define   TRUE     (1)
#endif

#ifndef NULL
#  define   NULL      0
#endif

#define __dontcare__  -1

/* Traditional Unix typedefs */
typedef unsigned long  ulong;
typedef unsigned int   uint;
typedef unsigned short ushort;
typedef unsigned long  u_long;
typedef unsigned int   u_int;
typedef unsigned short u_short;
typedef unsigned char  u_char;

typedef unsigned long  uid_t;
typedef unsigned long  gid_t;
typedef long           key_t;

typedef char far       * caddr_t;
typedef int            bool_t;
typedef int            enum_t;

#define mem_alloc(bsize)      malloc(bsize)
#define mem_free(ptr, bsize)  free(ptr)

#ifndef NBBY
#define NBBY   8      /* number of bits in a byte */

/*
 * Select uses bit masks of file descriptors in longs.
 * These macros manipulate such bit fields (the filesystem macros use chars).
 * FD_SETSIZE may be defined by the user, but the default here
 * should be >= NOFILE (param.h).
 */
#ifndef FD_SETSIZE
#define FD_SETSIZE   128
#endif
typedef long   fd_mask;

//DJB -- #define NFDBITS   (long)(sizeof(fd_mask) * NBBY)   /* bits per mask */
#define NFDBITS   (sizeof(fd_mask) * NBBY)   /* bits per mask */
#ifndef howmany
#define   howmany(x, y)   (((x)+((y)-1))/(y))
#endif

typedef   struct fd_set {
   fd_mask   fds_bits[howmany(FD_SETSIZE, NFDBITS)];
} fd_set;

#define FD_SET(n,p)   ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
#define FD_CLR(n,p)   ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
#define FD_ISSET(n,p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
#define FD_ZERO(p)    memset((void far *)(p), 0, sizeof(*(p)))

#endif /* NBBY */

#ifdef __cplusplus
extern "C" {
#endif

#define select(t,i,r,p,c)  _rpc_select(t,i,r,p,c)
int  _rpc_select(int, fd_set far *, fd_set far *, fd_set far *, struct timeval far *);

#ifdef  __cplusplus
}
#endif

#endif /* NWDOS */


#if defined(NWWIN) || defined(N_PLAT_MSW) 

#include <sys/types.h>
#include <rpc/fd_io.h>      /* normally part of sys/types.h in UNIX */

#if !defined(N_PLAT_MSW4)
   #include <rpc/time.h>      /* struct timeval */
   typedef unsigned long  uid_t;
   typedef unsigned long  gid_t;
#endif

typedef long           key_t;
/*typedef void FAR      *caddr_t; */
typedef char * caddr_t;
typedef unsigned short u_short;
typedef unsigned long  u_long;
typedef unsigned int   u_int;

#define   bool_t   int
#define   enum_t   int

#ifndef FALSE
#define   FALSE   (0)
#endif

#ifndef TRUE
#define   TRUE   (1)
#endif

#ifndef NULL
#define NULL 0
#endif

#endif /* NWWIN */


#ifdef IGNORE_THIS_CODE
// Block commented on 10 Nov 95 at 11:20:00 by James Paxman.
// #if defined(N_PLAT_MSW4) 
//    #include <ntypes.h>
//    #define FAR    N_FAR
//    #define PASCAL N_PASCAL
//    #define API N_API
// 
// #include <sys/types.h>
// #ifdef IGNORE_THIS_CODE
// // Block commented on 09 Nov 95 at 21:03:07 by James Paxman.
// // #include <rpc/time.h>      /* struct timeval     james added     */
// #endif /* IGNORE_THIS_CODE */
// #include <rpc/fd_io.h>      /* normally part of sys/types.h in UNIX */
// 
// #ifdef IGNORE_THIS_CODE
// // Block commented on 09 Nov 95 at 21:03:00 by James Paxman.
// // typedef unsigned long  uid_t;
// // typedef unsigned long  gid_t;
// #endif /* IGNORE_THIS_CODE */
// typedef long           key_t;
// typedef nptr    caddr_t;
// typedef unsigned short u_short;
// typedef unsigned long  u_long;
// typedef unsigned int   u_int;
// 
// #define   bool_t   int
// #define   enum_t   int
// 
// #ifndef FALSE
// #define   FALSE   (0)
// #endif
// 
// #ifndef TRUE
// #define   TRUE   (1)
// #endif
// 
// #ifndef NULL
// #define NULL 0
// #endif
// #endif /* NWWIN95 */
#endif /* IGNORE_THIS_CODE */




#if defined(NWNLM) || defined(N_PLAT_NLM)

#include <sys/types.h>

#if 0  /*^^^*/
typedef unsigned long  uid_t;
typedef unsigned long  gid_t;
#endif
typedef long           key_t;

#ifndef bool_t
#define   bool_t   int
#endif
#define   enum_t   int
#define __dontcare__   -1

#ifndef FALSE
#define   FALSE   0
#endif

#ifndef TRUE
#define   TRUE   1
#endif

#ifndef NULL
#define NULL 0
#endif

#endif /* NWNLM */ /* N_PLAT_NLM */


#endif /* _RPC_TYPES_H */