#ifndef _DWC_TYPE_H
#define _DWC_TYPE_H

/*--------------------------------------------------------------------------
 *  Copyright (c) 2001-2004 Igor Daniloff. 
 *	All rights reserved.
 *
 * By using this file, you agree to the terms and conditions set
 * forth in the LICENSE file which can be found at this directory.
 *------------------------------------------------------------------------*/
 
/* $Id: dwc_type.h,v 1.44 2007/12/17 14:15:03 akorkov Exp $ */

#if defined(__WIN32_DW)
#include <stdio.h>
#endif /* WIN32 */
#if defined(__UNIX_DW)
#include <unistd.h>
#endif /* UNIX */
#include <sys/types.h>

#ifdef  __cplusplus
extern "C" {
#endif

#if defined(EMX_DW) || defined(__WIN32_DW)
#undef DW_VERSION
#define DW_VERSION   "4.44"
#endif /* EMX or WIN */

typedef enum {
    DWC_IPC_TYPE_0 = 0,
    DWC_IPC_TCP_SOCKET,
    DWC_IPC_UNIX_SOCKET,
    DWC_IPC_TYPE_MAX
}                   dwc_ipc_type_t;
typedef enum {
    DWC_IPC_SIDE_0 = 0,
    DWC_IPC_SIDE_LOCAL,
    DWC_IPC_SIDE_REMOTE,
    DWC_IPC_SIDE_MAX
}                   dwc_side_t;
typedef int         dwc_error_code_t;
typedef size_t      dwc_length_t;
typedef int         dwc_timeout_t; /* asv: in millisec - timeout_t must be at least 4 byte */
#define NOWAIT_TIMEOUT          ((dwc_timeout_t)(0))  
#define MAX_TIMEOUT             ((dwc_timeout_t)(14400000)) /* asv: 4 hour in millisec */
#define EXPIRED_TIMEOUT         ((dwc_timeout_t)(-2))
#define INFINITE_TIMEOUT        ((dwc_timeout_t)(-1))
typedef void*       dwc_pointer_t;
typedef const void* dwc_const_pointer_t;
#define DWC_pointer(p)          ((dwc_pointer_t)(p))
#define DWC_value(p,t)          (*(t*)(p))
typedef char        dwc_char_t;
typedef char*       dwc_string_t;
typedef const char* dwc_const_string_t;    
typedef unsigned int dwc_socklen_t; /* asv: socklen_t the best way - use autoconf */
typedef unsigned int dwc_off_t;     /* asv: off_t */
typedef unsigned int dwc_count_t;
#ifndef FALSE
#define FALSE       0
#endif /* FALSE */
#ifndef TRUE
#define TRUE        1
#endif /* TRUE */
typedef int         dwc_bool_t;
typedef int         dwc_bitset_t;
typedef void        dwc_void_t;
typedef int         dwc_fd_t;
typedef char*       dwc_membuf_t;
typedef const char* dwc_const_membuf_t;
typedef dwc_string_t dwc_path_t;
typedef dwc_const_string_t dwc_const_path_t;
typedef int         dwc_syserr_t;
#if defined(__UNIX_DW)
typedef pid_t       dwc_pid_t;
typedef mode_t      dwc_mode_t;
#endif /* UNIX */
#if defined(__WIN32_DW)
typedef int         dwc_pid_t;
typedef int         dwc_mode_t;
typedef long        off_t;
#endif /* WIN32 */

/* for backward compatibility */
typedef dwc_ipc_type_t      DWC_ipc_type_t;
typedef dwc_side_t          DWC_side_t;
typedef dwc_error_code_t    DWC_error_code_t;
typedef dwc_length_t        DWC_length_t;
typedef dwc_timeout_t       DWC_timeout_t;
typedef dwc_pointer_t       DWC_pointer_t;
typedef dwc_const_pointer_t DWC_const_pointer_t;
typedef dwc_char_t          DWC_char_t;
typedef dwc_string_t        DWC_string_t;
typedef dwc_const_string_t  DWC_const_string_t;
typedef dwc_socklen_t       DWC_socklen_t; 
typedef dwc_bool_t          DWC_bool_t;

#ifdef  __cplusplus
}
#endif

#endif /* _DWC_TYPE_H */
