/* Bbuuzzb error codes, configuration error codes and
   send message numbers.
   Rick Smereka, Copyright (C) 1997-2004.

   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, get a copy via the Internet at
   http://gnu.org/copyleft/gpl.html or write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
   MA 02111-1307 USA

   You can contact the author via email at rsmereka@future-lab.com

   Original DOS version Rick Smereka, Feb/97

   Port to QNX V4.23a Mar/98, Rick Smereka

   Added 'DBENG_RENAME_ERROR'. Nov/98, Rick Smereka

   Ported to 32bit Windows under CodeWarrior V4. Added IPC
   defines for a WinSock TCP connection oriented
   iterative server. Dec/98, Rick Smereka

   Ported to HP-UX under GNU C 2.8.1
   Jan/99, Rick Smereka

   Added send codes for all configuration commands. Changed
   'error_log' to 'log'. Mar/99, Rick Smereka

   Added send codes for configuration flag commands.
   Apr/99, Rick Smereka

   Ported to Red Hat Linux 5.2, Jul/99, Rick Smereka
   
   Removed default node and port defines. Added all current common
   socket send and reply codes. Mar/2000, Rick Smereka
   
   Added reply codes 'DBENG_SOCLOC_NO_INIT', 'DBENG_NO_SERVER'
   and 'DBENG_FAILOVER'. Added include of 'comcode.h'.
   Apr/2000, Rick Smereka

   Added error code 'DBENG_BAD_IP', send code
   'DBENG_SEND_GET_OPEN_TABLE_LIST' and list define
   'DBENG_LIST_DELIM'. Jun/2001, Rick Smereka

   Modified to accomidate both sockets and QNX message passing
   Sep/2001, Rick Smereka

   Added error codes 'DBENG_NO_CATALOG_ENTRY' and
   'DBENG_CATALOG_ENTRY_EXISTS'. Nov/2001, Rick Smereka

   Changed error codes 'DBENG_NO_SUCH_VALUE' to
   'DBENG_NO_SUCH_SUBFIELD', 'DBENG_NO_SUCH_SUBVALUE' to
   'DBENG_NO_SUCH_SUBSUBFIELD' and 'DBENG_FIELD_PUT_ERROR'
   to 'DBENG_PUT_ERROR'. Dec/2001, Rick Smereka

   Added new send codes 'DBENG_SEND_GET_NSUBFIELDS',
   'DBENG_SEND_GET_SUBFIELD_SIZE', 'DBENG_SEND_GET_SUBFIELD',
   'DBENG_SEND_PUT_SUBFIELD', 'DBENG_SEND_GET_NSUBSUBFIELDS',
   'DBENG_SEND_GET_SUBSUBFIELD_SIZE', 'DBENG_SEND_GET_SUBSUBFIELD',
   'DBENG_SEND_PUT_SUBSUBFIELD', 'DBENG_SEND_REPLICATE',
   'DBENG_SEND_GET_REPLICATE_FLAG', 'DBENG_SEND_SET_REPLICATE_FLAG'
   and new error codes 'DBENG_RECORD_POSITION_CHANGED',
   'DBENG_REPLICATION_NOT_ACTIVE' and 'DBENG_NO_REPLICATION_ENTRY'.
   Jan/2002, Rick Smereka
  
   Deleted defines 'DBENG_WRITE_MODE_NEW' and 'DBENG_WRITE_MODE_REWRITE'.
   Added new send code 'DBENG_SEND_REPLICATE_UPDATE'.
   Feb/2002, Rick Smereka

   Added defines 'DBENG_TABLE_IN_USE', 'DBENG_SEND_DELETE_TABLE'  
   and 'DBENG_SEND_EXIST'. May/2002, Rick Smereka

   Added defines 'DBENG_SEND_CLEAR_TABLE' and 'DBENG_SEND_COPY_TABLE. 
   Jun/2002, Rick Smereka

   Added define 'DBENG_SEND_GET_CATALOG_LIST'. Aug/2002, Rick Smereka

   Added defines 'DBENG_SEND_SORT', 'DBENG_SEND_GET_SORT_MEM',
   'DBENG_SEND_SET_SORT_MEM', 'DBENG_SEND_GET_SORT_OPEN_BIN' and
   'DBENG_SEND_SET_SORT_OPEN_BIN'. Ported to Debian Linux.
   Nov/2002, Rick Smereka
 
   Added defines 'DBENG_SEND_DELETE_FIELD', 'DBENG_SEND_DELETE_SUBFIELD'
   and 'DBENG_SEND_DELETE_SUBSUBFIELD'. Mar/2003, Rick Smereka

   Added defines 'DBENG_SEND_TRANS_NUM', 'DBENG_SEND_CONNECT_NUM'
   and 'DBENG_NO_INIT'. Jun/2003, Rick Smereka

   Added define 'DBENG_NO_CATALOG'. Nov/2003, Rick Smereka 

   Added defines 'DBENG_SEND_GET_AUTOPACK',
   'DBENG_SEND_SET_AUTOPACK' and 'DBENG_SEND_SET_LOG'. Mar/2004, 
   Rick Smereka */
   
/* define common send/reply codes */

#include "comcode.h"

/* local engine I/O error codes for single user or reply codes
   for multi user */

#define DBENG_OK SOCKET_RC_OK
#define DBENG_EXISTS 1
#define DBENG_NOT_EXIST 2
#define DBENG_RECORD_CHANGED 3
#define DBENG_NO_RECORD 4
#define DBENG_EOF 5
#define DBENG_NO_SUCH_FIELD 6
#define DBENG_INVALID_FILE_NAME 7
#define DBENG_UNABLE_TO_OPEN 8
#define DBENG_WRITE_FAIL 9
#define DBENG_NO_EXISTING_RECORD 10
#define DBENG_CANNOT_CREATE_TABLE 11 
#define DBENG_MAX_OPEN_TABLE 12
#define DBENG_NO_SUCH_FILE 13
#define DBENG_RECORD_TOO_LARGE 14
#define DBENG_MEMORY_FAIL 15
#define DBENG_INVALID_FUNCTION 16
#define DBENG_ACCESS_DENIED 17
#define DBENG_FUNCTION_NOT_IMPLEMENTED 18
#define DBENG_PUT_ERROR 19
#define DBENG_NO_SUCH_SUBFIELD 20
#define DBENG_NO_SUCH_SUBSUBFIELD 21
#define DBENG_FILENAME_TOO_LONG 22
#define DBENG_NO_SUCH_TID 23
#define DBENG_TABLE_LOCKED 24
#define DBENG_RENAME_ERROR 25
#define DBENG_INTERNAL_ERROR 26
#define DBENG_FILE_DATA_ERROR 27
#define DBENG_SOCLOC_NO_INIT 28
#define DBENG_NO_SERVER 29
#define DBENG_FAILOVER 30
#define DBENG_BAD_IP 31
#define DBENG_NO_CATALOG_ENTRY 32
#define DBENG_CATALOG_ENTRY_EXISTS 33
#define DBENG_RECORD_POSITION_CHANGED 34
#define DBENG_REPLICATION_NOT_ACTIVE 35
#define DBENG_NO_REPLICATION_ENTRY 36
#define DBENG_TABLE_IN_USE 37
#define DBENG_NO_INIT 38
#define DBENG_NO_CATALOG 39
#define DBENG_VC_ERROR SOCKET_RC_VC_ERROR

/* configuration codes */

#define DBENG_CONFIG_INVALID_PARAMETER 40
#define DBENG_CONFIG_PARAMETER_MISSING 41
#define DBENG_CONFIG_UNABLE_TO_OPEN 42
#define DBENG_CONFIG_TMP_PATH_SIZE 43
#define DBENG_CONFIG_LOG_SIZE 44
#define DBENG_CONFIG_SESSION_TABLE_SIZE 45
#define DBENG_CONFIG_INVALID_TMP_PATH 46
#define DBENG_CONFIG_INVALID_LOG 47
#define DBENG_CONFIG_INVALID_SESSION_TABLE 48
#define DBENG_CONFIG_INVALID_CATALOG 49

/* send message types */

#define DBENG_SEND_OPEN 60
#define DBENG_SEND_CLOSE 61
#define DBENG_SEND_NEXT 62
#define DBENG_SEND_TOP 63
#define DBENG_SEND_GET_REC 64
#define DBENG_SEND_GET_FIELD 65
#define DBENG_SEND_GOTO 66
#define DBENG_SEND_COUNT 67
#define DBENG_SEND_PUT_FIELD 68
#define DBENG_SEND_WRITE 69
#define DBENG_SEND_DELETE 70
#define DBENG_SEND_GET_DELETE_FLAG 71
#define DBENG_SEND_SET_DELETE_FLAG 72
#define DBENG_SEND_GET_NFIELDS 73
#define DBENG_SEND_GET_REC_SIZE 74
#define DBENG_SEND_GET_FIELD_SIZE 75
#define DBENG_SEND_GET_REC_NUM 76
#define DBENG_SEND_GET_POS 77
#define DBENG_SEND_SET_POS 78
#define DBENG_SEND_GET_CHANGE_REC_FLAG 79
#define DBENG_SEND_SET_CHANGE_REC_FLAG 80
#define DBENG_SEND_PACK 81
#define DBENG_SEND_NEW 82
#define DBENG_SEND_FIND 83
#define DBENG_SEND_FIND_FIELD 84
#define DBENG_SEND_FIND_PART 85
#define DBENG_SEND_FIND_FIELD_PART 86
#define DBENG_SEND_GET_REC_COUNT 87
#define DBENG_SEND_GET_ENF_CHANGE_REC_FLAG 88
#define DBENG_SEND_SET_ENF_CHANGE_REC_FLAG 89
#define DBENG_SEND_GET_IS_TABLE_LOCKED 90
#define DBENG_SEND_SET_IS_TABLE_LOCKED 91
#define DBENG_SEND_NEW_TABLE 92
#define DBENG_SEND_GET_TMP_PATH 93
#define DBENG_SEND_GET_LOG 94
#define DBENG_SEND_GET_SESSION 95
#define DBENG_SEND_GET_CATALOG 96
#define DBENG_SEND_GET_LOG_FLAG 97
#define DBENG_SEND_GET_SESSION_FLAG 98
#define DBENG_SEND_GET_CATALOG_FLAG 99
#define DBENG_SEND_GET_DBENG_VERSION 100
#define DBENG_SEND_SET_TMP_PATH 101
#define DBENG_SEND_SET_SESSION 102
#define DBENG_SEND_SET_CATALOG 103
#define DBENG_SEND_SET_LOG_FLAG 104
#define DBENG_SEND_SET_SESSION_FLAG 105
#define DBENG_SEND_SET_CATALOG_FLAG 106
#define DBENG_SEND_GET_OPEN_TABLE_LIST 107
#define DBENG_SEND_GET_NSUBFIELDS 108
#define DBENG_SEND_GET_SUBFIELD_SIZE 109
#define DBENG_SEND_GET_SUBFIELD 110
#define DBENG_SEND_PUT_SUBFIELD 111
#define DBENG_SEND_GET_NSUBSUBFIELDS 112
#define DBENG_SEND_GET_SUBSUBFIELD_SIZE 113
#define DBENG_SEND_GET_SUBSUBFIELD 114
#define DBENG_SEND_PUT_SUBSUBFIELD 115
#define DBENG_SEND_REPLICATE 116
#define DBENG_SEND_GET_REPLICATE_FLAG 117
#define DBENG_SEND_SET_REPLICATE_FLAG 118
#define DBENG_SEND_REPLICATE_UPDATE 119
#define DBENG_SEND_DELETE_TABLE 120
#define DBENG_SEND_EXIST 121
#define DBENG_SEND_CLEAR_TABLE 122
#define DBENG_SEND_COPY_TABLE 123
#define DBENG_SEND_GET_CATALOG_LIST 124
#define DBENG_SEND_SORT 125
#define DBENG_SEND_GET_SORT_MEM 126
#define DBENG_SEND_SET_SORT_MEM 127
#define DBENG_SEND_GET_SORT_OPEN_BIN 128
#define DBENG_SEND_SET_SORT_OPEN_BIN 129
#define DBENG_SEND_DELETE_FIELD 130
#define DBENG_SEND_DELETE_SUBFIELD 131
#define DBENG_SEND_DELETE_SUBSUBFIELD 132
#define DBENG_SEND_GET_AUTOPACK 133
#define DBENG_SEND_SET_AUTOPACK 134
#define DBENG_SEND_SET_LOG 135
#define DBENG_SEND_TERM SOCKET_SEND_TERM
#define DBENG_SEND_STATUS SOCKET_SEND_STATUS
#define DBENG_SEND_LOG_OFF SOCKET_SEND_LOG_OFF
#define DBENG_SEND_LOG_ON SOCKET_SEND_LOG_ON
#define DBENG_SEND_LOG_STATUS SOCKET_SEND_LOG_STATUS
#define DBENG_SEND_SERVICE_NAME SOCKET_SEND_SERVICE_NAME
#define DBENG_SEND_VERSION SOCKET_SEND_VERSION
#define DBENG_SEND_TRANS_NUM SOCKET_SEND_TRANS_NUM
#define DBENG_SEND_CONNECT_NUM SOCKET_SEND_CONNECT_NUM

/* maximum size of a record or field */

#ifdef OS_DOS
#define DBENG_MAXRECFIELD 32000 /* s/b the same as in 'dbeng.h' */
#define DBENG_MAXCOMLINE 32000
#else
#define DBENG_MAXRECFIELD 64000
#define DBENG_MAXCOMLINE 64000
#endif

#define DBENG_LIST_DELIM '^'     /* list delimiter */
#define DBENG_PATH_LIMIT 256     /* max size of any path/file */

/* send message structure */

struct dbeng_send_message
   {
   short unsigned type;         /* send type (as above) */
   char dbc[DBENG_MAXCOMLINE];  /* command line */
   };
  
/* TCP/IP IPC specific defines */

#ifdef IPC_TCP

/* service name for 'socloc' */

#define DBENG_SERVICE_NAME "Bbuuzzb"

/* QNX message passing specific defines */

#else

/* 'nameloc' name */

#define DBENG_SERVICE_NAME "/Bbuuzzb"
#endif
