/*
 * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
 */

#ifndef _RPC_TYPES_H
#define	_RPC_TYPES_H

/* "@(#)types.h	$Header: types.h,v 1.13.106.1 97/07/07 18:17:38 root Exp $" */

/*	types.h 1.23 88/10/25 SMI	*/

/*
 * Rpc additions to <sys/types.h>
 */
#ifndef _KERNEL
#include <sys/types.h>
#else
#include "../h/types.h"
#endif  /* _KERNEL */

#ifdef __cplusplus
extern "C" {
#endif

#ifndef _BOOL_T
#define _BOOL_T
typedef int bool_t;
#endif /* _BOOL_T */

typedef int enum_t;

/*
 * The following is part of a workaround for bug #1128007.
 * When it is fixed, this next typedef should be removed.
 */

#ifndef _LONGLONG_T
#define _LONGLONG_T
#if defined(__STDC__)
#ifndef __LP64__
#if defined (__STDC_EXT__)
	typedef long long longlong_t;
	typedef unsigned long long u_longlong_t;
#else /* NOT  __STDC_EXT__ */
	typedef union {
           long l[2];
           double d;
        } longlong_t;

        typedef union {
           unsigned long l[2];
           double d;
        } u_longlong_t;
#endif /* __STDC_EXT__ */
#else /* __LP64__ */
typedef int64_t longlong_t;
typedef uint64_t u_longlong_t;
#endif /* __LP64__ */

#else

/* used to reserve space and generate alignment */

#ifndef __LP64__
#ifdef __cplusplus
	typedef union {
	   long l[2];
	   double d;
	} longlong_t;

	typedef union {
	   unsigned long l[2];
	   double d;
	} u_longlong_t;
#else
	typedef long long           longlong_t;
        typedef unsigned long long  u_longlong_t;
#endif /* __cplusplus */
#else /* !__LP64__ */
typedef int64_t longlong_t;
typedef uint64_t u_longlong_t;
#endif /* !__LP64__ */
#endif /* __STDC__ */

typedef u_longlong_t ulonglong_t;
#endif /* _LONGLONG_T */

#define	__dontcare__	-1

#ifndef	FALSE
#define	FALSE	(0)
#endif

#ifndef	TRUE
#define	TRUE	(1)
#endif

#ifndef	NULL
#define	NULL	0
#endif

#ifndef	_KERNEL
#define	mem_alloc(bsize)	malloc(bsize)
#define	mem_free(ptr, bsize)	free(ptr)
#else
#include "../h/malloc.h"		/* XXX */

#define	mem_alloc(bsize)	kmem_alloc((size_t)bsize)
#define	mem_free(ptr, bsize)	kmem_free((caddr_t)(ptr), (size_t)(bsize))

#ifdef RPCDEBUG
#if defined(__STDC__) || defined(__cplusplus)
extern int	rpc_log(u_long, char *, int);
#else
extern int	rpc_log();
#endif
extern int	rpclog;

#define		RPCLOG(A, B, C) ((void)((rpclog) && rpc_log((A), (B), (C))))
#else
#define		RPCLOG(A, B, C)
#endif

#endif

#ifdef _NSL_RPC_ABI
/* For internal use only when building the libnsl RPC routines */
#define	select	_abi_select
#define	gettimeofday	_abi_gettimeofday
#define	syslog	_abi_syslog
#define	getgrent	_abi_getgrent
#define	endgrent	_abi_endgrent
#define	setgrent	_abi_setgrent
#endif

/* messaging stuff. */
#ifndef _KERNEL
#ifdef __STDC__
extern const char __nsl_dom[];
#else
extern char __nsl_dom[];
#endif
#endif

#ifdef __cplusplus
}
#endif

#ifndef _KERNEL
#include <sys/time.h>
#else
#include "../h/time.h"
#endif  /* _KERNEL */

#endif	/* _RPC_TYPES_H */
