282 lines
8.2 KiB
C
Executable File
282 lines
8.2 KiB
C
Executable File
/******************************************************************************
|
|
*
|
|
* ic_private.h - Used by the ICI modules using private data.
|
|
*
|
|
* Module %M% Version %I% Date %H%
|
|
*
|
|
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
|
|
* This is unpublished proprietary source code of Ardent Software, Inc.
|
|
* The copyright notice above does not evidence any actual or intented
|
|
* publication of such source code.
|
|
*
|
|
*******************************************************************************
|
|
*
|
|
* Maintenence log - insert most recent change descriptions at top
|
|
*
|
|
* Date.... GTAR# WHO Description.........................................
|
|
* 10/14/98 23801 SAP Change copyrights.
|
|
* 01/05/95 15483 FRA undef malloc free to use system alloc for ici objects
|
|
* 16/03/94 12306 JC Changed max rec.id to be 255
|
|
* 13.12.93 12306 JC Creation of Module. Based on the PI/open version.
|
|
* 22.02.94 12306 JC Removed need for MAX_PATHNAME_LENGTH
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*****************************************************************************/
|
|
|
|
|
|
/* START-DESCRIPTION:
|
|
*
|
|
* This file contains definitions of the ICI internal data structures,
|
|
* tokens, variables, etc. This file should only be included by ICI source
|
|
* modules.
|
|
*
|
|
* END-DESCRIPTION
|
|
*
|
|
* START-DESIGN:
|
|
*
|
|
* END-DESIGN
|
|
*
|
|
* START-FUTURES:
|
|
*
|
|
* END-FUTURES
|
|
*
|
|
* START-CODE:
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#ifndef public
|
|
#define public
|
|
#endif
|
|
#ifndef private
|
|
#define private static
|
|
#endif
|
|
|
|
typedef int bool;
|
|
|
|
#define min(a,b) (((a) > (b)) ? (b) : (a))
|
|
#define max(a,b) (((a) < (b)) ? (b) : (a))
|
|
|
|
/* Constants */
|
|
|
|
#define TRUE 1
|
|
#define FALSE 0
|
|
|
|
#ifndef PATH_MAX
|
|
#define PATH_MAX 254
|
|
#endif
|
|
|
|
/* Version number */
|
|
|
|
#define IC_VERSION_NUMBER 6
|
|
|
|
/* Voc record tokens */
|
|
|
|
#define DEFAULT_VOCPATH "VOC"
|
|
#define DEFAULT_VOCLEN 3
|
|
|
|
#define DEFAULT_SYSTEM "uvsh"
|
|
#define MAX_SYSTEM_LEN 10
|
|
|
|
#define NUM_FILE_PORTIONS 2
|
|
|
|
#define DATA_PORTION_FIELD 2
|
|
#define DICT_PORTION_FIELD 3
|
|
|
|
#define CWD_SYMBOL '.' /* Name of current working directory */
|
|
#define PATHNAME_DELIMITER '/' /* Separator between pathname components*/
|
|
#define ROOT_SYMBOL '/' /* Fully-qualifed names start with this*/
|
|
|
|
/* Select list processing tokens */
|
|
|
|
#define MIN_TYPE 0
|
|
#define IC_SL_SINGLE 0
|
|
#define IC_SL_MULTIPLE 1
|
|
#define MAX_ICI_SELECT_LISTS MAX_USER_SELECT_NUMBER + 1
|
|
#define MAX_TYPE 1
|
|
#define MAX_USER_SELECT_NUMBER 10
|
|
|
|
/* Time out value */
|
|
|
|
#define DEFAULT_TIMEOUT 30 /* Default timeout value in seconds */
|
|
|
|
/* Limits */
|
|
|
|
#define IC_BUFFER_SIZE 8188
|
|
#define IC_MAX_RECID_LEN 255
|
|
#define IC_MINIBUF_SIZE 32
|
|
#define IC_MAX_LOGIN_LINE 256
|
|
#define IC_MAX_HOSTNAME_LEN 128
|
|
#define IC_MAX_TASKS 16
|
|
#define MAX_USERIDLEN 255
|
|
|
|
/* Tokens for convert_lock routine to tell it which lock type to expect */
|
|
|
|
#define MIN_OPERATION 0
|
|
#define OP_READ 0
|
|
#define OP_WRITE 1
|
|
#define OP_DELETE 2
|
|
#define MAX_OPERATION 2
|
|
|
|
#define NO_OF_FILE_DESCS 10
|
|
#define SUFFIX_LENGTH 3
|
|
|
|
#define END_OF_STRING 0
|
|
|
|
/*
|
|
* Size in bytes of the ici_buffer work area. This size is chosen to be big
|
|
* enough for the maximum size of a disk based select list.
|
|
*/
|
|
|
|
#define WORK_AREA 65536
|
|
|
|
#define MAX_LOCK_VALUE 5 /* the maximum ici lock value */
|
|
|
|
#define DEFERRED_UPDATE_FILE 2 /* the number of the deferred update subfile */
|
|
#define SUBFILE_INCREMENT 2 /* the increment required to get from one */
|
|
/* subfile pair to the next */
|
|
|
|
#define error_clear(errorvalue) ((errorvalue) = 0)
|
|
|
|
/* Types */
|
|
|
|
typedef struct
|
|
{
|
|
int initialised; /* ICI initialised */
|
|
int called_from_pi; /* ICI called from PI+ (via GCI) */
|
|
char *account_path; /* ICI account pathname */
|
|
long account_path_len; /* the length of the account name */
|
|
char *info_path; /* Path for ic_info to use */
|
|
long info_path_len; /* Length of info_path */
|
|
int pid; /* Process number of server */
|
|
int readpipe; /* File id for the read pipe */
|
|
int writepipe; /* File id for the write pipe */
|
|
int conv_mode; /* convertion mode to be used in convertions */
|
|
} IC_PRIVATE_DATA_TYPE;
|
|
|
|
/* Variables */
|
|
|
|
extern IC_PRIVATE_DATA_TYPE ic_private_data;
|
|
extern char ici_buffer[WORK_AREA];
|
|
/* ic_sendbuffer is used to construct messages to be sent, other than
|
|
data messages (which go direct from the user's buffer).
|
|
ic_sendlength is the length of the data held in it. */
|
|
|
|
extern char ic_sendbuffer[IC_BUFFER_SIZE];
|
|
extern int ic_sendlength;
|
|
extern char ic_stored_message[IC_BUFFER_SIZE];
|
|
extern int ic_stored_message_len;
|
|
extern int ic_timeout; /* Timeout value in seconds */
|
|
|
|
/* ic_response is used to hold responses from the host which need to
|
|
be examined rather than passed back to the user.
|
|
ic_responselength is its length (needs to be long because a "*long"
|
|
is needed as an argument to ip_receive_message). */
|
|
|
|
extern char ic_response[IC_BUFFER_SIZE+sizeof(int)];
|
|
extern long ic_responselength;
|
|
|
|
/* ic_namebuffer is used to copy the record ID to a C string,
|
|
so that we can use sprintf to construct messages. */
|
|
|
|
extern char ic_namebuffer[IC_MAX_RECID_LEN + 1];
|
|
|
|
/* Following defines the string used during client RESET operations: */
|
|
|
|
#define IC_RESET_STRING "RESET"
|
|
|
|
/* Inital protcal values */
|
|
|
|
#define IC_PLATFORM_IS_PIOPEN 'O'
|
|
#define IC_PLATFORM_IS_PRIMOS 'P'
|
|
#define IC_PLATFORM_IS_UNIVERSE 'V'
|
|
|
|
#define IC_ICI_PACKET_SIZE -1
|
|
|
|
#define IC_ICI_SERVER_VERSION 6
|
|
/* Command characters */
|
|
|
|
#define OPEN_ACTION 34
|
|
#define READ_ACTION 35
|
|
#define READL_ACTION 36
|
|
#define READU_ACTION 37
|
|
#define RELEASE_0_ACTION 38
|
|
#define RELEASE_1_ACTION 39
|
|
#define RELEASE_2_ACTION 40
|
|
#define WRITE_ACTION 41
|
|
#define WRITEU_ACTION 42
|
|
#define QUIT_ACTION 43
|
|
#define LOGOUT_ACTION 44
|
|
#define DELETE_ACTION 45
|
|
#define DELETEU_ACTION 46
|
|
#define CLOSE_ACTION 47
|
|
#define FILELOCK_ACTION 48
|
|
#define FILEUNLOCK_ACTION 49
|
|
#define CLEARFILE_ACTION 50
|
|
#define READNEXT_ACTION 51
|
|
#define READV_ACTION 52
|
|
#define READVL_ACTION 53
|
|
#define READVU_ACTION 54
|
|
#define RECORDLOCKL_ACTION 55
|
|
#define RECORDLOCKU_ACTION 56
|
|
#define RECORDLOCKED_ACTION 57
|
|
#define WRITEV_ACTION 58
|
|
#define WRITEVU_ACTION 59
|
|
#define CLEARSELECT_ACTION 60
|
|
#define SELECT_ACTION 61
|
|
#define READLIST_ACTION 62
|
|
#define INDICES_1_ACTION 74
|
|
#define INDICES_2_ACTION 64
|
|
#define SELECTINDEX_0_ACTION 65
|
|
#define SELECTINDEX_1_ACTION 66
|
|
#define EXECUTE_ACTION 67
|
|
#define ICONV_ACTION 68
|
|
#define OCONV_ACTION 69
|
|
#define FMT_ACTION 70
|
|
#define FILEINFO_ACTION 71
|
|
#define ERRORMSG_ACTION 72
|
|
#define DEBUG_ACTION 73
|
|
#define READRECORD_ACTION 75
|
|
#define READRECORDL_ACTION 76
|
|
#define READRECORDU_ACTION 77
|
|
#define RESET_ACTION 78
|
|
#define TRANSACTION_ACTION 79
|
|
#define FETCH_ACTION 80
|
|
#define FETCHU_ACTION 81
|
|
#define FETCHL_ACTION 82
|
|
#define DELSEL_ACTION 83
|
|
#define DELSELU_ACTION 84
|
|
#define NULLSEL_ACTION 85
|
|
#define NULLSELU_ACTION 86
|
|
#define READCONT_ACTION 87
|
|
#define WRITESTART_ACTION 88
|
|
#define WRITECONT_ACTION 89
|
|
#define SUBCALL_ACTION 90
|
|
#define INSERT_ACTION 91
|
|
#define INSERTU_ACTION 92
|
|
#define MULTI_FETCH_ACTION 93
|
|
#define MULTI_FETCH_ACTIONU 94
|
|
#define MULTI_FETCH_ACTIONL 95
|
|
#define SET_HOOK_ACTION 96
|
|
#define INIT_HOOK_ACTION 97
|
|
|
|
/* Following tokens in first byte of response message identify response type: */
|
|
|
|
#define IC_RESPONSE_THEN 'T'
|
|
#define IC_RESPONSE_ELSE 'E'
|
|
#define IC_RESPONSE_LOCKED 'L'
|
|
#define IC_RESPONSE_ONERROR 'O'
|
|
#define IC_RESPONSE_ERROR 'X'
|
|
|
|
/* undef alloc routines to use system alloc for ici objects */
|
|
|
|
#undef malloc
|
|
#undef realloc
|
|
#undef calloc
|
|
#undef free
|
|
|
|
/* END-CODE */
|