tldm-universe/Ardent/UV/gcidir/include/netstruct.h
2024-09-09 17:51:08 -04:00

471 lines
15 KiB
C
Executable File

#ifndef h_netstruct
#define h_netstruct
/****************************************************************************
*
* netstruct.h - standard Network daemon data definitions
*
* 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.......................................
* 05/02/99 24890 LPC Change filepos to UVOFFT datatype for 64-bit.
* 03/25/99 24411 JBG Add UVSRV_DEFBINDEXEC
* 10/14/98 23801 SAP Change copyrights.
* 06/02/97 20748 MJC Add UVSRV_GETINFO
* 04/23/97 19665 JWT/FTW/JSM Add partial Advanced PICK READU constraints.
* 02/27/97 19916 WSM Add pointer to SHdata in T_ENTRY for group select.
* 08/08/96 18994 ENF Add ConnectOpts as server functions
* 05/31/96 18162 ENF Added new func to get procedure out params
* 04/09/96 18110 EAP Added DBscan messages
* 12/22/95 17804 GMM Added NT type logging
* 08/23/95 17162 GMM Moved public stuff into rpc_public.h
* 06/01/95 16588 TMC,PVW Change locking interface
* 05/03/95 15974 TMC add per host timeout execute level stacking
* 03/22/95 15921 TMC add UVSRV stuff
* 03/08/95 15974 TMC add timeout and remote execute changes
* 10/17/94 14073 TMC add signature packet
* 10/10/94 14073 TMC Network licensing
* 08/17/94 14473 TMC Fix watchlock and add debugging
* 07/15/94 14447 TMC change uvnet NETsemop interface
* 05/13/94 13942 JSW Add recordlocked
* 04/25/94 13773 JSW Add fileinfo
* 02/09/94 12960 TMC Add SET.REMOTE.ID for setting remote user
* 02/07/94 12627 TMC Allow uvNet to be compatible with older releases
* 09/10/93 8829 TMC add mkpath packet
* 09/08/93 12217 SHK Port 7.3.2 to SCO
* 09/02/93 11392 TMC Implement bscan as a network function
* 08/18/93 11392 TMC add Fexecute packet
* 08/10/93 11392 TMC Fix CLEAROUTPACKET and CLEARINPACKET so they are
* no longer off by one.
* 07/29/93 11392 TMC Fix logic errors
* 07/28/93 11392 TMC RPC conversion
* 01/11/93 4946 TMC add copy AUTHORIZATION name to remote
* 09/29/92 4946 TMC Add sqlperms
* 09/09/92 4946 TMC Get uVnet to work with release 7
* 01/09/92 4946 TMC port UVnet to release 7
* 12/31/91 9002 TMC fix NCL make shorts 4 bytes and put chars at end
* 10/25/91 8846 TMC fix all Mtype and rid to be uint not long
* 10/23/91 4946 TMC bring file up to date
* 08/10/91 8207 TMC Many changes for uvnet checked in
* 03/15/91 8100 DPB fix for problems with multiple net scandirs
* 03/11/91 8094 TMC (fixes to 8095 and 8096 too)
* 02/07/91 7898 TMC (fixes to 7566 also) fixes to stat fstat and DBread
* 01/18/90 7868 TMC Respond in all cases to problems
* 01/10/91 7868 TMC Allow network debugging to be turned on and off
* 12/26/90 7868 TMC Port Rel 5.7 to Rel 7
* 10/18/90 4944 TMC New file
*
***************************************************************************/
#if NETwork
#ifdef MSWIN
#include "uvntlog.h"
#endif
/* File server message queue name */
#define NETQUEUE 0xacef0400
/*******************************************
* These are the Defines for the Debugging
* Log Message Routines.
*******************************************/
#ifdef MSWIN
#define LOG0(FLAG, MSG) if (FLAG)\
{\
UVLOGEVENT(UV_INFO_MSG, MSG);\
}
#else
#define LOG0(FLAG, MSG) if (FLAG)\
{\
printdebug();\
fprintf(stderr,MSG);\
}
#endif
#define NETLOG0(MSG) LOG0(DBshmseg->featr2, MSG)
#define LICLOG0(MSG) LOG0(DBshmseg->featr3, MSG)
#define UCILOG0(MSG) LOG0(DBshmseg->featr5, MSG)
#ifdef MSWIN
#define LOG1(FLAG,MSG,ARG1) if (FLAG)\
{\
UVLOGEVENT1(UV_INFO_MSG, MSG, ARG1);\
}
#else
#define LOG1(FLAG,MSG,ARG1) if (FLAG)\
{\
printdebug();\
fprintf(stderr,MSG,ARG1);\
}
#endif
#define NETLOG1(MSG,ARG1) LOG1(DBshmseg->featr2,MSG,ARG1)
#define LICLOG1(MSG,ARG1) LOG1(DBshmseg->featr3,MSG,ARG1)
#define UCILOG1(MSG,ARG1) LOG1(DBshmseg->featr5,MSG,ARG1)
#ifdef MSWIN
#define LOG2(FLAG,MSG,ARG1,ARG2) if (FLAG)\
{\
UVLogEvent(__FILE__, __LINE__, UV_INFO_MSG, 0, NULL, MSG, ARG1,ARG2);\
}
#else
#define LOG2(FLAG,MSG,ARG1,ARG2) if (FLAG)\
{\
printdebug();\
fprintf(stderr,MSG,ARG1,ARG2);\
}
#endif
#define NETLOG2(MSG,ARG1,ARG2) LOG2(DBshmseg->featr2,MSG,ARG1,ARG2)
#define LICLOG2(MSG,ARG1,ARG2) LOG2(DBshmseg->featr3,MSG,ARG1,ARG2)
#define UCILOG2(MSG,ARG1,ARG2) LOG2(DBshmseg->featr5,MSG,ARG1,ARG2)
#ifdef MSWIN
#define LOG3(FLAG,MSG,ARG1,ARG2,ARG3) if (FLAG)\
{\
UVLogEvent(__FILE__, __LINE__,UV_INFO_MSG,0,NULL,MSG,ARG1,ARG2,ARG3);\
}
#else
#define LOG3(FLAG,MSG,ARG1,ARG2,ARG3) if (FLAG)\
{\
printdebug();\
fprintf(stderr,MSG,ARG1,ARG2,ARG3);\
}
#endif
#define NETLOG3(MSG,ARG1,ARG2,ARG3) LOG3(DBshmseg->featr2,MSG,ARG1,ARG2,ARG3)
#define LICLOG3(MSG,ARG1,ARG2,ARG3) LOG3(DBshmseg->featr3,MSG,ARG1,ARG2,ARG3)
#define UCILOG3(MSG,ARG1,ARG2,ARG3) LOG3(DBshmseg->featr5,MSG,ARG1,ARG2,ARG3)
#ifdef MSWIN
#define LOG4(FLAG,MSG,ARG1,ARG2, ARG3, ARG4) if (FLAG)\
{\
UVLogEvent(__FILE__,__LINE__,UV_INFO_MSG,0,NULL,MSG,ARG1,ARG2,ARG3,ARG4);\
}
#else
#define LOG4(FLAG,MSG,ARG1,ARG2, ARG3, ARG4) if (FLAG)\
{\
printdebug();\
fprintf(stderr,MSG,ARG1,ARG2,ARG3,ARG4);\
}
#endif
#define NETLOG4(MSG,ARG1,ARG2,ARG3,ARG4) LOG4(DBshmseg->featr2,MSG,ARG1,ARG2,ARG3,ARG4)
#define LICLOG4(MSG,ARG1,ARG2,ARG3,ARG4) LOG4(DBshmseg->featr3,MSG,ARG1,ARG2,ARG3,ARG4)
#define UCILOG4(MSG,ARG1,ARG2,ARG3,ARG4) LOG4(DBshmseg->featr5,MSG,ARG1,ARG2,ARG3,ARG4)
#ifdef MSWIN
#define LOG5(FLAG,MSG,ARG1,ARG2,ARG3,ARG4,ARG5) if (FLAG)\
{\
UVLogEvent(__FILE__,__LINE__,UV_INFO_MSG,0,NULL,MSG,ARG1,ARG2,ARG3,ARG4,ARG5);\
}
#else
#define LOG5(FLAG,MSG,ARG1,ARG2,ARG3,ARG4,ARG5) if (FLAG)\
{\
printdebug();\
fprintf(stderr,MSG,ARG1,ARG2,ARG3,ARG4,ARG5);\
}
#endif
#define NETLOG5(MSG,ARG1,ARG2,ARG3,ARG4,ARG5) LOG5(DBshmseg->featr2,MSG,ARG1,ARG2,ARG3,ARG4,ARG5)
#define LICLOG5(MSG,ARG1,ARG2,ARG3,ARG4,ARG5) LOG5(DBshmseg->featr3,MSG,ARG1,ARG2,ARG3,ARG4,ARG5)
#define UCILOG5(MSG,ARG1,ARG2,ARG3,ARG4,ARG5) LOG5(DBshmseg->featr5,MSG,ARG1,ARG2,ARG3,ARG4,ARG5)
#if NETwork == OMNI
#include <onet.h>
#endif
#if NETwork == TCPIP
#include "TCPIP.h"
#endif
#if DIR_SV3
#include DIRENT_H
#endif
#include SY_DIR_H
/*****************************************
* Copy to and from a network structure
* something ON the net is defined as byte type 0
* we may or may not have to convert if we are byte-swapped
* relative to this, but we call the functions anyway
*****************************************
*/
/* the byte ordering in the network (This is realy SWAPbyt 0)
The ethernet (TCP/IP) really uses this byte ordering so it is
probably good that we use it as well
*/
#define NETformat 1
/* int (32 bits) from network to mine */
#define IFN(y) (Convert(&(y), NETformat, SWAPbyt+1), (y))
/* int (32 bits) from mine to network */
#define ITN(y) (Convert(&(y), SWAPbyt+1, NETformat), (y))
/* long (16 bits) from network to mine */
#define SFN(y) (Convshrt(&(y), NETformat, SWAPbyt+1), (y))
/* long (16 bits) from mine to network */
#define STN(y) (Convshrt(&(y), SWAPbyt+1, NETformat), (y))
#define UPWORD(x) (((x) + sizeof(int) - 1) & ~(sizeof(int) - 1))
/* These definitions are for code readability */
/* if NET_MAXCONNECT changes, change it also in LEVEL.h */
#define NET_MAXCONNECT 255
#define NETTRYS 20
#define NETLOCKTRYS 70
#define TIMEOUT_VAL 5
/*
* The following File Table definitions are for the second level of networking.
* Basically this is so that the local system file descriptiors will only
* contain a few basic things, such as the network flag, the file name (full
* pathname, including the remote system name.), the netid (id of system to go
* to first), and netfdesc, which will be an offset into the network tables on
* the remote machine.
*/
union MISCFILS {
DBFILE dbfil;
MFILE mfil;
SEQFILE seqfil;
SELFILE selfil;
};
/*
* There are five types of files to be stored in this table. They are:
* 0 = EMPTY FILE ENTRY
* 1 = DBfile
* 2 = Mfile
* 3 = SEQfile
* 4 = SELfile
* The value of T_ENTRY.type will be set to one of these five.
*/
#define EMPTY 0
#define EMPTYENT 0
#define DBFILEENT 1
#define MFILEENT 2
#define SEQFILEENT 3
#define SELFILEENT 4
struct T_ENTRY
{
int type; /* This is the type of file stored here */
union MISCFILS *ptr;
union MISCFILS net_fil;
struct SHdata *saveSHd;
};
struct L_ENTRY
{
int used; /* Whether this entry is used */
long nodeid; /* node where the file is */
int keynum; /* file key on the remote system */
char *buf; /* buffer where bufferred i/o is */
int isdirty; /* is the write buffer dirty? */
int bufpos; /* position in the buffer where we are */
int bufcnt; /* number of characters in bufffer */
UVOFFT filepos; /* position in the file where this buffer is */
int connum; /* connection number for this open file */
int mode; /* mode to open the file to */
int oflag; /* flag to open the file with */
int err; /* was the last operation in error */
char *fname; /* file name of open file */
};
#define READABLE 1
#define WRITABLE 2
#define DBFENT 3
#define RDWRABLE 4
/*
* This table is an interesting beast. Its actually going to be a linked list
* of 128 element tables. All of the addition, deletions and access into this
* table will be handled by routines. If the number of file currently open
* across the network exceed the limits of the current table, a new one is
* malloc'd and added. The key to the amazingly complex peice of machinery is
* going to be a simple integer. Each table will have a key, ranging from
* 0 to 99, and each table will have 128 elements, indexed from 0 to 99. To
* get the keynumber for any file entry, the formula is ((key*128)+index).
* For example, if a keynumber is 521, then we are talking about the 21'st
* element in the table with a key number of 5.
*
* Deletion Notes:
* 1). When ever we delete a table entry we will set the type of the
* deleted entry to be a 0. The next new file descriptor will go in
* first table that has a 0'd type field. If any table ever becomes
* empty, it is removed, and the memory is returned to the system.
* Addition Notes:
* 2). Any added tables are given the lowest possible key number.
*
* General Notes:
* This will effectivly limit the number of files in use over the network
* to being less than 10,000. Hopefully this will see us through.
*/
struct FTBLE
{
struct T_ENTRY f_table[NETFMAX];
struct FTBLE *flink,
*blink;
int full,
key;
};
struct LTBLE
{
struct L_ENTRY l_table[NETFMAX];
struct LTBLE *flink,
*blink;
int full,
key;
};
/* structure to hold machine connections on the local side */
struct UVNCONNECT
{
int used; /* is this entry used? */
char *hostname; /* hostname */
int rpcnum; /* rpc connection number */
int connum; /* connection number */
int remote_uvrev; /* revision of remote uvnetd */
char *username; /* user name to use on remote node */
char *groupname; /* group name to use on remote node */
char *passwd; /* passwd to use on remote node */
int prompt; /* prompt for password on connection? */
int timeout; /* timeout for this host */
};
/* Netd to Netd Message Types */
#define NETtest 0
#define NETsemp 1
#define NETres 2
#define NETsignature 3
#define NETaccess 4
#define NETaccessrs 5
#define NETclose 6
#define NETclosers 7
#define NETfstat 8
#define NETfstatrs 9
#define NETlseek 10
#define NETlseekrs 11
#define NETopen 12
#define NETopenrs 13
#define NETread 14
#define NETreadrs 15
#define NETstat 16
#define NETstatrs 17
#define NETwrite 18
#define NETwriters 19
/* Defines for Level 2 networking */
#define NETDBopen 20
#define NETDBopenrs 21
#define NETDBclose 22
#define NETDBclosers 23
#define NETDBclrfl 24
#define NETDBclrflrs 25
#define NETDBdel 26
#define NETDBdelrs 27
#define NETDBprobe 28
#define NETDBprobers 29
#define NETDBread 30
#define NETDBreadrs 31
#define NETDBrdata 32
#define NETDBwrite 33
#define NETDBwriters 34
#define NETbscan 35
#define NETDBupdlock 36
#define NETDBupdlockrs 37
#define NETDBselect 38
#define NETsselect 39
#define NETselectrs 40
#define NETDBrblok 41
#define NETDBrblokrs 42
#define NETDBwblok 43
#define NETDBwblokrs 44
#define NETDBrelease 45
#define NETDBreleasers 46
#define NETDBscandir 47
#define NETDBscandirrs 48
#define NETDBstatus 49
#define NETDBstatusrs 50
#define NETexecute 51
#define NETexecuters 52
#define NETgetinfo30 53
#define NETgetinfo30rs 54
#define NETDBscant25 55
#define NETDBscant25rs 56
#define NETDB1lock 57
#define NETDB1lockrs 58
#define NETgetstats 59
#define NETgetstatsrs 60
#define NETbscanrs 61
#define NETmkpath 62
#define NETmkpathrs 63
#define NETDBfinfo 64
#define NETDBfinfors 65
#define NETDBrecordlocked 66
#define NETDBrecordlockedrs 67
#define NETDBslock 68
#define NETDBslockrs 69
#define NETDBreadlock 70
#define NETDBreadlockrs 71
#define NETDBscan 72
#define NETDBscanrs 73
#define NETDBreadlockap 74
#define NETDBreadlockaprs 75
#define NETDBreleaseap 76
#define NETDBreleaseaprs 77
#define NETDBrecordlockedap 78
#define NETDBrecordlockedaprs 79
#define NETMAXMESSNO 79
/* netlicd defines */
#define NETLICgetlic 0
#define NETLICgetlicrs 1
#define NETLICrellic 2
#define NETLICrellicrs 3
#define NETLICgetinfo 4
#define NETLICgetinfors 5
#define NETLICsig 6
#define NETLICsigrs 7
#define NETLICMAXMESSNO 7
/* uvsrv defines */
#define UVSRV_ASSOCIATE 0
#define UVSRV_BIND 1
#define UVSRV_CANCEL 2
#define UVSRV_CLOSE 3
#define UVSRV_COMMIT 4
#define UVSRV_CONNECT 5
#define UVSRV_DEFINE 6
#define UVSRV_DISCONNECT 7
#define UVSRV_ERRORMESSAGE 8
#define UVSRV_EXEC 9
#define UVSRV_FETCH 10
#define UVSRV_LOGOFF 11
#define UVSRV_LOGON 12
#define UVSRV_OPEN 13
#define UVSRV_ROLLBACK 14
#define UVSRV_TXBEGIN 15
#define UVSRV_nDESCRIBE 16
#define UVSRV_OUTPARAMS 17
#define UVSRV_CONNECTOPTS 18
#define UVSRV_GETINFO 19
#define UVSRV_DEFBINDEXEC 20
#define UVSRVMAXMESSNO 20
#endif /* if NETwork */
#endif /* end of netstruct.h */