8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 14:03:07 +01:00

Added the current XNET implementation.

Let's hope it works not only for me <g>
This commit is contained in:
dimitr 2003-09-08 14:14:23 +00:00
parent b0499ab7cb
commit efe2cbce0d
15 changed files with 1947 additions and 1658 deletions

View File

@ -171,9 +171,6 @@ Package=<4>
Project_Dep_Name dsql_server_classic
End Project Dependency
Begin Project Dependency
Project_Dep_Name ipserver
End Project Dependency
Begin Project Dependency
Project_Dep_Name lock_classic
End Project Dependency
Begin Project Dependency
@ -311,9 +308,6 @@ Package=<4>
Begin Project Dependency
Project_Dep_Name engine
End Project Dependency
Begin Project Dependency
Project_Dep_Name ipserver
End Project Dependency
}}}
###############################################################################
@ -540,18 +534,6 @@ Package=<4>
###############################################################################
Project: "ipserver"=.\ipserver.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "isql"=.\isql.dsp - Package Owner=<4>
Package=<5>

View File

@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GDS32_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../../src/include" /I "../../../src/include/gen" /D "_DEBUG" /D "DEV_BUILD" /D "_WINDOWS" /D "_USRDLL" /D "CLIENT" /D "SUPERCLIENT" /D "SERVER_SHUTDOWN" /D "IPSERV" /D "GOVERNOR" /D "EXACT_NUMERICS" /D "WIN32" /D "_MBCS" /D "_X86_" /FR /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../../src/include" /I "../../../src/include/gen" /D "_DEBUG" /D "DEV_BUILD" /D "_WINDOWS" /D "_USRDLL" /D "CLIENT" /D "SUPERCLIENT" /D "SERVER_SHUTDOWN" /D "GOVERNOR" /D "EXACT_NUMERICS" /D "WIN32" /D "_MBCS" /D "_X86_" /FR /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x41d /d "_DEBUG"
@ -70,7 +70,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../../src/include" /I "../../../src/include/gen" /I "../../../src" /D "_DEBUG" /D "DEV_BUILD" /D "_WINDOWS" /D "_USRDLL" /D "GDS32_EXPORTS" /D "CLIENT" /D "SUPERCLIENT" /D "NOMSG" /D "SERVER_SHUTDOWN" /D "IPSERV" /D "GOVERNOR" /D "EXACT_NUMERICS" /D "I386" /D _X86_=1 /D "WIN32" /D "_MBCS" /D "_X86_" /FR /FD /GZ /c
# ADD CPP /nologo /MD /W3 /GX /Ot /Og /Oi /Op /Oy /Ob1 /I "../../../src/include" /I "../../../src/include/gen" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "CLIENT" /D "SUPERCLIENT" /D "SERVER_SHUTDOWN" /D "IPSERV" /D "GOVERNOR" /D "EXACT_NUMERICS" /D "I386" /D _X86_=1 /D "WIN32" /D "_MBCS" /D "_X86_" /FR /FD /EHc- /c
# ADD CPP /nologo /MD /W3 /GX /Ot /Og /Oi /Op /Oy /Ob1 /I "../../../src/include" /I "../../../src/include/gen" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "CLIENT" /D "SUPERCLIENT" /D "SERVER_SHUTDOWN" /D "GOVERNOR" /D "EXACT_NUMERICS" /D "I386" /D _X86_=1 /D "WIN32" /D "_MBCS" /D "_X86_" /FR /FD /EHc- /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x41d /d "_DEBUG"
@ -227,22 +227,6 @@ SOURCE=..\..\..\src\dsql\user_dsql.cpp
SOURCE=..\..\..\src\dsql\utld.cpp
# End Source File
# End Group
# Begin Group "IPSERVER files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\src\ipserver\alli.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\ipserver\ipcevent.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\ipserver\ipclient.cpp
# End Source File
# End Group
# Begin Group "REMOTE files"
# PROP Default_Filter ""

View File

@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "..\..\..\temp\debug\remote_ss"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../src/include" /I "../../../src/include/gen" /D "_DEBUG" /D "_LIB" /D "SUPERSERVER" /D "SERVER_SHUTDOWN" /D "IPSERVER" /D "WIN32" /D "_MBCS" /D "_X86_" /D "DEV_BUILD" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../src/include" /I "../../../src/include/gen" /D "_DEBUG" /D "_LIB" /D "SUPERSERVER" /D "SERVER_SHUTDOWN" /D "WIN32" /D "_MBCS" /D "_X86_" /D "DEV_BUILD" /FD /GZ /c
# ADD BASE RSC /l 0x41d /d "_DEBUG"
# ADD RSC /l 0x41d /d "_DEBUG"
BSC32=bscmake.exe
@ -65,7 +65,7 @@ LIB32=link.exe -lib
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /GX /Ot /Oi /Op /Oy /Ob2 /I "../../../src/include" /I "../../../src/include/gen" /D "_DEBUG" /D "_LIB" /D "SUPERCLIENT" /D "WIN32" /D "_MBCS" /D "NOMSG" /D "_X86_" /FD /GZ /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MD /W3 /GX /Ot /Og /Oi /Op /Oy /Ob1 /I "../../../src/include" /I "../../../src/include/gen" /D "NDEBUG" /D "_LIB" /D "SUPERSERVER" /D "SERVER_SHUTDOWN" /D "IPSERVER" /D "WIN32" /D "_MBCS" /D "_X86_" /FD /EHc- /c
# ADD CPP /nologo /MD /W3 /GX /Ot /Og /Oi /Op /Oy /Ob1 /I "../../../src/include" /I "../../../src/include/gen" /D "NDEBUG" /D "_LIB" /D "SUPERSERVER" /D "SERVER_SHUTDOWN" /D "WIN32" /D "_MBCS" /D "_X86_" /FD /EHc- /c
# ADD BASE RSC /l 0x41d /d "_DEBUG"
# ADD RSC /l 0x41d /d "_DEBUG"
BSC32=bscmake.exe

View File

@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "..\..\..\temp\debug\remote_cs"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../src/include" /I "../../../src/include/gen" /D "_DEBUG" /D "_LIB" /D "SERVER_SHUTDOWN" /D "IPSERVER" /D "WIN32" /D "_MBCS" /D "_X86_" /D "DEV_BUILD" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../../src/include" /I "../../../src/include/gen" /D "_DEBUG" /D "_LIB" /D "SERVER_SHUTDOWN" /D "WIN32" /D "_MBCS" /D "_X86_" /D "DEV_BUILD" /FD /GZ /c
# ADD BASE RSC /l 0x41d /d "_DEBUG"
# ADD RSC /l 0x41d /d "_DEBUG"
BSC32=bscmake.exe
@ -65,7 +65,7 @@ LIB32=link.exe -lib
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /GX /Ot /Oi /Op /Oy /Ob2 /I "../../../src/include" /I "../../../src/include/gen" /D "_DEBUG" /D "_LIB" /D "SUPERCLIENT" /D "WIN32" /D "_MBCS" /D "NOMSG" /D "_X86_" /FD /GZ /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MD /W3 /GX /Ot /Og /Oi /Op /Oy /Ob1 /I "../../../src/include" /I "../../../src/include/gen" /D "NDEBUG" /D "_LIB" /D "SERVER_SHUTDOWN" /D "IPSERVER" /D "WIN32" /D "_MBCS" /D "_X86_" /FD /EHc- /c
# ADD CPP /nologo /MD /W3 /GX /Ot /Og /Oi /Op /Oy /Ob1 /I "../../../src/include" /I "../../../src/include/gen" /D "NDEBUG" /D "_LIB" /D "SERVER_SHUTDOWN" /D "WIN32" /D "_MBCS" /D "_X86_" /FD /EHc- /c
# ADD BASE RSC /l 0x41d /d "_DEBUG"
# ADD RSC /l 0x41d /d "_DEBUG"
BSC32=bscmake.exe

View File

@ -51,9 +51,6 @@
#include "../jrd/sch_proto.h"
#include "../remote/os/win32/window.h"
#include "../common/config/config.h"
#define NO_PORT
#include "../remote/xnet_proto.h"
#undef NO_PORT
#define statistics stat
@ -3807,8 +3804,6 @@ static SSHORT init( ISC_STATUS * user_status, ICC * picc)
initialized = true;
gds__register_cleanup(reinterpret_cast<void(*)(void*)>(IPC_release_all),
NULL);
gds__register_cleanup(reinterpret_cast<void(*)(void*)>(XNET_release_all),
NULL);
}
else
{
@ -4580,7 +4575,6 @@ void IPC_process_event(
}
#ifndef XNET
void IPC_release_all(void)
{
/**************************************
@ -4726,7 +4720,6 @@ void IPC_release_all(void)
initialized = false;
}
}
#endif
} // extern "C"

View File

@ -42,7 +42,7 @@
*
*/
/*
$Id: why.cpp,v 1.24 2003-08-28 13:16:03 brodsom Exp $
$Id: why.cpp,v 1.25 2003-09-08 14:09:34 dimitr Exp $
*/
#include "firebird.h"
@ -548,14 +548,14 @@ static const ENTRY entrypoints[PROC_count * SUBSYSTEMS] =
#define ENTRYPOINT(gen,cur,bridge,rem,os2_rem,csi,rdb,pipe,bridge_pipe,win,winipi) {NULL, rdb},
#include "../jrd/entry.h"
#endif
/*
#ifdef IPSERV
#ifndef XNET
#define ENTRYPOINT(gen,cur,bridge,rem,os2_rem,csi,rdb,pipe,bridge_pipe,win,winipi) {NULL, winipi},
#include "../jrd/entry.h"
#endif
#endif
*/
};
#ifndef SUPERCLIENT

View File

@ -4873,7 +4873,24 @@ static PORT analyze(TEXT* file_name,
}
#endif
}
} // if (!port)
}
#if defined(XNET) && !defined(IPSERV)
/* all remote attempts have failed, so access locally through the
interprocess server */
if (!port)
{
return XNET_analyze(file_name,
file_length,
status_vector,
node_name,
user_string,
uv_flag);
}
#endif /* XNET */
#if defined(SUPERCLIENT) && !defined(EMBEDDED)
/* Coerce host connections to loopback to SUPERSERVER. */
@ -4904,23 +4921,6 @@ static PORT analyze(TEXT* file_name,
#endif /* IPSERV */
#endif /* WIN_NT */
#if defined(XNET) && !defined(IPSERV)
/* all remote attempts have failed, so access locally through the
interprocess server */
if (!port)
{
return XNET_analyze(file_name,
file_length,
status_vector,
node_name,
user_string,
uv_flag);
}
#endif /* XNET */
#ifdef UNIX
if (!port && !node_name[0])

View File

@ -312,7 +312,7 @@ static char *MakeVersionString(char *pchBuf, int nLen,
if (p < end)
*p++ = '\n';
}
if (usServerFlagMask & SRVR_ipc) {
if (usServerFlagMask & SRVR_xnet || usServerFlagMask & SRVR_ipc) {
p += LoadString(hInstance, IDS_IPC, p, end - p);
}
*p = '\0';

View File

@ -92,6 +92,5 @@ produced by Borland Resource Workshop
#define IDS_NP 12
#define IDS_IPC 13
#define IDS_SERVERPROD_NAME 76
#define IDS_LOCALPROD_NAME 77

View File

@ -109,13 +109,13 @@
#include "../jrd/file_params.h"
#include "../common/config/config.h"
static void THREAD_ROUTINE process_connection_thread(PORT);
static void THREAD_ROUTINE inet_connect_wait_thread(void *);
static void THREAD_ROUTINE ipc_connect_wait_thread(void *);
static void service_connection(PORT);
static void THREAD_ROUTINE start_connections_thread(int);
static void THREAD_ROUTINE wnet_connect_wait_thread(void *);
static void THREAD_ROUTINE xnet_connect_wait_thread(void *);
static HANDLE parse_args(LPSTR, USHORT *);
static void service_connection(PORT);
static HINSTANCE hInst;
@ -205,8 +205,8 @@ int WINAPI WinMain(HINSTANCE hThisInst,
if (ISC_is_WinNT()) /* True - NT, False - Win95 */
server_flag |= SRVR_wnet;
server_flag |= SRVR_inet;
#ifdef SUPERSERVER
server_flag |= SRVR_xnet;
#ifdef SUPERSERVER
server_flag |= SRVR_ipc;
#endif
}
@ -247,6 +247,8 @@ int WINAPI WinMain(HINSTANCE hThisInst,
port = INET_reconnect(connection_handle, 0, status_vector);
else if (server_flag & SRVR_wnet)
port = WNET_reconnect(connection_handle, 0, status_vector);
else if (server_flag & SRVR_xnet)
port = XNET_reconnect((ULONG) connection_handle, 0, status_vector);
THREAD_EXIT;
if (port) {
service_connection(port);
@ -272,6 +274,11 @@ int WINAPI WinMain(HINSTANCE hThisInst,
(wnet_connect_wait_thread), 0, THREAD_medium, 0,
0);
}
if (server_flag & SRVR_xnet) {
gds__thread_start(reinterpret_cast<FPTR_INT_VOID_PTR>
(xnet_connect_wait_thread), 0, THREAD_medium, 0,
0);
}
/* No need to waste a thread if we are running as a window. Just start
* the IPC communication
*/
@ -306,52 +313,7 @@ int WINAPI WinMain(HINSTANCE hThisInst,
}
ULONG SRVR_xnet_start_thread(ULONG client_pid)
{
/**************************************
*
* S R V R _ x n e t _ s t a r t _ t h r e a d
*
**************************************
*
* Functional description
* Start an interprocess thread. This allocates
* the next available chunk of the mapped file and
* tells the client where it is.
*
**************************************/
PORT port;
ULONG response;
/* get a port */
port = XNET_start_thread(client_pid, &response);
/* Ensure that the main port is set with this new port if we are the first
* XNET connection
*/
if (!xnet_server_set) {
USHORT flags = ((USHORT) SRVR_xnet | (USHORT) SRVR_multi_client |
(USHORT) SRVR_thread_per_port);
PORT xnet_header_port = (PORT) ALLR_alloc(sizeof(struct port));
if (xnet_header_port)
*xnet_header_port = *port;
else
return FALSE;
xnet_server_set = TRUE;
set_server(xnet_header_port, flags);
}
/* start the thread for this client */
gds__thread_start(reinterpret_cast<FPTR_INT_VOID_PTR>
(process_connection_thread), port,
THREAD_medium, 0, 0);
/* return combined mapped area and number */
return response;
}
static void THREAD_ROUTINE process_connection_thread( PORT port)
void THREAD_ROUTINE process_connection_thread( PORT port)
{
/**************************************
*
@ -472,6 +434,32 @@ static void THREAD_ROUTINE ipc_connect_wait_thread( void *dummy)
}
static void THREAD_ROUTINE xnet_connect_wait_thread(void *dummy)
{
/**************************************
*
* x n e t _ c o n n e c t _ w a i t _ t h r e a d
*
**************************************
*
* Functional description
* Starts xnet server side interprocess thread
*
**************************************/
void *thread;
if (!(server_flag & SRVR_non_service))
thread = CNTL_insert_thread();
THREAD_ENTER;
XNET_srv(server_flag);
THREAD_EXIT;
if (!(server_flag & SRVR_non_service))
CNTL_remove_thread(thread);
}
static void service_connection( PORT port)
{
/**************************************
@ -509,6 +497,10 @@ static void THREAD_ROUTINE start_connections_thread( int flag)
gds__thread_start(reinterpret_cast<FPTR_INT_VOID_PTR>
(wnet_connect_wait_thread), 0, THREAD_medium, 0, 0);
}
if (server_flag & SRVR_xnet) {
gds__thread_start(reinterpret_cast<FPTR_INT_VOID_PTR>
(xnet_connect_wait_thread), 0, THREAD_medium, 0, 0);
}
if (server_flag & SRVR_ipc) {
const int bFailed =
gds__thread_start(reinterpret_cast<FPTR_INT_VOID_PTR>

View File

@ -30,7 +30,6 @@
#include "../remote/remote_def.h"
#include "../remote/os/win32/window.rh"
#include "../remote/os/win32/property.rh"
#include "../remote/xnet.h"
#ifdef IPSERVER
#include "../ipserver/ips.h"
#endif
@ -51,7 +50,6 @@
#define NO_PORT
#include "../remote/protocol.h"
#include "../remote/serve_proto.h"
#include "../remote/xnet_proto.h"
#undef NO_PORT
#include "../common/config/config.h"
@ -139,29 +137,6 @@ int WINDOW_main( HINSTANCE hThisInst, int nWndMode, USHORT usServerFlagMask)
return 0;
}
#endif
if (!XNET_init(hWnd, 0, 0, 0)) {
char szMsgString[TMP_STRINGLEN];
hWnd = FindWindow(szClassName, APP_NAME);
if (hWnd) {
LoadString(hInstance, IDS_ALREADYSTARTED, szMsgString,
TMP_STRINGLEN);
if (usServerFlagMask & SRVR_non_service) {
MessageBox(NULL, szMsgString, APP_LABEL,
MB_OK | MB_ICONHAND);
}
gds__log(szMsgString);
}
else {
LoadString(hInstance, IDS_MAPERROR, szMsgString,
TMP_STRINGLEN);
if (usServerFlagMask & SRVR_non_service) {
MessageBox(NULL, szMsgString, APP_LABEL,
MB_OK | MB_ICONHAND);
}
gds__log(szMsgString);
}
return 0;
}
}
/* initialize main window */

View File

@ -24,20 +24,29 @@
#ifndef _REMOTE_SERVE_PROTO_H_
#define _REMOTE_SERVE_PROTO_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef WINDOWS_ROUTER
extern void SRVR_WinMain (struct port *, USHORT, HINSTANCE, HINSTANCE, int);
extern void SRVR_WinMain(struct port *, USHORT, HINSTANCE, HINSTANCE, int);
#else /* WINDOWS_ROUTER */
extern void SRVR_main (struct port *, USHORT);
extern void SRVR_main(struct port *, USHORT);
#endif /* WINDOWS_ROUTER */
#ifdef NO_PORT
#define PORT void*
#endif
extern void SRVR_multi_thread (struct port *, USHORT);
extern ULONG SRVR_xnet_start_thread(ULONG);
extern SLONG check_license (void);
extern BOOLEAN process_packet (PORT, PACKET *, PACKET *, PORT *);
extern void set_server (PORT, USHORT);
extern void SRVR_multi_thread(struct port *, USHORT);
extern BOOLEAN process_packet(PORT, PACKET *, PACKET *, PORT *);
extern void set_server(PORT, USHORT);
extern void THREAD_ROUTINE process_connection_thread(PORT);
#ifdef __cplusplus
}
#endif
#endif /* _REMOTE_SERVE_PROTO_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,8 @@
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
* 2003.05.01 Victor Seryodkin, Dmitry Yemanov: Completed XNET implementation
*/
#ifndef _REMOTE_XNET_H_
@ -26,7 +28,6 @@
#ifndef WIN_NT
#include <sys/types.h>
//typedef short DWORD;
#define PID_T pid_t
#define CADDR_T caddr_t
#define FILE_ID int
@ -36,129 +37,150 @@
#define FILE_ID HANDLE
#endif
#define XNET_CONNECT_TIMEOUT 10000 /* client connect timeout (ms) */
#define XNET_RECV_WAIT_TIMEOUT 10000 /* Receive wait timeout (ms) */
#define XNET_SEND_WAIT_TIMEOUT XNET_RECV_WAIT_TIMEOUT /* Send wait timeout (ms) */
/* mapped file parameters */
#define XPS_MAPPED_PER_CLI(p) ((ULONG)(p) * 1024L)
#define XPS_MAPPED_FOR_CLI(p,x) ((ULONG)(x) * XPS_MAPPED_PER_CLI(p))
#define XPS_MAPPED_SIZE(p,c) ((ULONG)(c) * XPS_MAPPED_PER_CLI(p))
#define XPS_USEFUL_SPACE(p) (XPS_MAPPED_PER_CLI(p) - sizeof( struct xps))
#define XPS_MAPPED_PER_CLI(p) ((ULONG)(p) * 1024L)
#define XPS_SLOT_OFFSET(pages,slot) (XPS_MAPPED_PER_CLI(pages) * (ULONG)(slot))
#define XPS_MAPPED_SIZE(users,pages) ((ULONG)(users) * XPS_MAPPED_PER_CLI(pages))
#define XPS_USEFUL_SPACE(p) (XPS_MAPPED_PER_CLI(p) - sizeof(struct xps))
#define XPS_DEF_NUM_CLI 10 /* default clients per mapped file */
#define XPS_DEF_NUM_MAPS 10 /* default maps available */
#define XPS_DEF_PAGES_PER_CLI 8 /* default 1k pages space per client */
#define XPS_MIN_NUM_CLI 1 /* min clients per mapped file */
#define XPS_MIN_NUM_MAPS 1 /* min maps available */
#define XPS_MIN_PAGES_PER_CLI 1 /* min 1k pages space per client */
#define XPS_MAX_NUM_CLI 64 /* max clients per mapped file */
#define XPS_MAX_NUM_MAPS 64 /* max maps available */
#define XPS_MAX_PAGES_PER_CLI 16 /* max 1k pages space per client */
#define XPS_PACK_PARAMS(x,p,m,u) (((ULONG)(x) << 24) + ((ULONG)(p) << 16) + ((m) << 8) + (u))
#define XPS_UNPACK_MAX_SLOTS(n) (((ULONG)(n) >> 24) & 0xFF)
#define XPS_UNPACK_PAGES(n) (((ULONG)(n) >> 16) & 0xFF)
#define XPS_UNPACK_MAPNUM(n) (((ULONG)(n) >> 8) & 0xFF)
#define XPS_UNPACK_SLOTNUM(n) ((n) & 0xFF)
#define XNET_INVALID_MAP_NUM 0xFFFFFFFF
#define XNET_EVENT_SPACE 100 /* half of space (bytes) for event handling per connection */
/* mapped file structure */
typedef struct xpm {
struct xpm *xpm_next; /* pointer to next one */
USHORT xpm_count; /* slots in use */
USHORT xpm_number; /* mapped area number */
ULONG xpm_count; /* slots in use */
ULONG xpm_number; /* mapped area number */
FILE_ID xpm_handle; /* handle of mapped memory */
USHORT xpm_flags; /* flag word */
CADDR_T xpm_address; /* address of mapped memory */
UCHAR *xpm_ids[XPS_MAX_NUM_CLI]; /* ids */
UCHAR xpm_ids[XPS_MAX_NUM_CLI]; /* ids */
time_t xpm_timestamp; /* timestamp to avoid map name confilcts */
} *XPM;
/* mapped structure flags */
#define XPMF_SERVER_SHUTDOWN 1 /* server has shut down */
#define XPM_FREE 0 /* xpm structure is free for use */
#define XPM_BUSY 1 /* xpm structure is in use */
/* thread connection control block */
typedef struct xcc {
struct xcc *xcc_next; /* pointer to next thread */
struct xpm *xcc_xpm; /* pointer back to xpm */
BOOLEAN xcc_send_channel_locked; /* status of send channel */
SSHORT xcc_file; /* this thread's mapped file number */
USHORT xcc_slot; /* this thread's slot number */
FILE_ID xcc_file_handle; /* mapped file's handle */
#ifdef WIN_NT
HANDLE xcc_server_proc; /* server's process handle */
HANDLE xcc_client_proc; /* client's process handle */
#endif
PID_T xcc_server_id; /* server's process id */
PID_T xcc_client_id; /* client's process id */
#ifdef WIN_NT
HANDLE xcc_recv_sem; /* start receive semaphore handle */
HANDLE xcc_send_sem; /* start send semaphore handle */
#endif
struct xch *xcc_receive_channel; /* receive channel structure */
struct xch *xcc_send_channel; /* send channel structure */
USHORT xcc_flags; /* status bits */
UCHAR *xcc_mapped_addr; /* where the thread's mapped to */
} *XCC;
/* xcc structure flags */
#define XCCF_SHUTDOWN 1 /* shutdown in progress */
#define XCCF_SERVER_SHUTDOWN 2 /* server has shut down */
/* comm channel structure - four per connection (client to server data,
/* xch comm channel structure - four per connection (client to server data,
server to client data, client to server events, server to client events) */
typedef struct xch
{
USHORT xch_sent; /* messages sent */
USHORT xch_received; /* messages received */
USHORT xch_length; /* message length */
USHORT xch_size; /* channel data size */
USHORT xch_flags; /* flags */
UCHAR *xch_buffer; /* message */
UCHAR *xch_client_ptr; /* client pointer to xch buffers */
ULONG xch_length; /* message length */
ULONG xch_size; /* channel data size */
USHORT xch_flags; /* flags */
UCHAR *xch_buffer; /* message */
UCHAR *xch_client_ptr; /* client pointer to xch buffers */
} *XCH;
#define XCHFLAG_more_data 1 /* more data coming */
#define XCHFLAG_data_overrun 2 /* receive buffer full */
/*
This structure is mapped to the start of the allocated
communications area between the client and server.
*/
/* thread connection control block (xcc) */
typedef struct xcc {
struct xcc *xcc_next; /* pointer to next thread */
XPM xcc_xpm; /* pointer back to xpm */
ULONG xcc_map_num; /* this thread's mapped file number */
ULONG xcc_slot; /* this thread's slot number */
FILE_ID xcc_map_handle; /* mapped file's handle */
#ifdef WIN_NT
HANDLE xcc_proc_h; /* for server client's process handle
for client server's process handle */
HANDLE xcc_event_send_channel_filled; /* xcc_send_channel ready for reading */
HANDLE xcc_event_send_channel_empted; /* xcc_send_channel ready for writting */
HANDLE xcc_event_recv_channel_filled; /* xcc_receive_channel ready for reading */
HANDLE xcc_event_recv_channel_empted; /* xcc_receive_channel ready for writing */
#endif
XCH xcc_recv_channel; /* receive channel structure */
XCH xcc_send_channel; /* send channel structure */
ULONG xcc_flags; /* status bits */
UCHAR *xcc_mapped_addr; /* where the thread's mapped to */
} *XCC;
/* xcc structure flags */
#define XCCF_SERVER_SHUTDOWN 2 /* server has shutdown detected */
/* This structure (xps) is mapped to the start of the allocated
communications area between the client and server. */
typedef struct xps
{
ULONG xps_server_protocol; /* server's protocol level */
ULONG xps_client_protocol; /* client's protocol level */
#ifdef WIN_NT
HANDLE xps_server_proc; /* server's process handle */
HANDLE xps_client_proc; /* client's process handle */
#endif
PID_T xps_server_id; /* server's process id */
PID_T xps_client_id; /* client's process id */
PID_T xps_server_proc_id; /* server's process id */
PID_T xps_client_proc_id; /* client's process id */
USHORT xps_flags; /* flags word */
struct xch xps_channels[4]; /* comm channels */
ULONG xps_data[1]; /* start of data area */
} *XPS;
/* xps_channel numbers */
#define XPS_CHANNEL_C2S_DATA 0 /* 0 - client to server data */
#define XPS_CHANNEL_S2C_DATA 1 /* 1 - server to client data */
#define XPS_CHANNEL_C2S_EVENTS 2 /* 2 - client to server events */
#define XPS_CHANNEL_S2C_EVENTS 3 /* 3 - server to client events */
#define XPI_CLIENT_PROTOCOL_VERSION 3L
#define XPI_SERVER_PROTOCOL_VERSION 3L
/* XNET_RESPONSE - server response on client connect request */
typedef struct{
ULONG proc_id;
ULONG slots_per_map;
ULONG pages_per_slot;
ULONG map_num;
ULONG slot_num;
time_t timestamp;
} XNET_RESPONSE, *PXNET_RESPONSE;
/* XNET_CONNECT_RESPONZE_SIZE - amount of bytes server writes on connect response */
#define XNET_CONNECT_RESPONZE_SIZE sizeof(XNET_RESPONSE)
/* Windows names used to identify various named objects */
#define XPI_PREFIX "FirebirdXPI"
#define XNET_PREFIX "FirebirdXNET"
#define XNET_MAPPED_FILE_NAME "%s_MAP_%d_%d"
#define XPI_SERVER_NAME "%sServer"
#define XPI_SERVER_CLASS "%sServerClass"
#define XPI_MAPPED_FILE_NAME "%sMappedArea%d"
#define XPI_C_TO_S_SEM_NAME "%sCtoS%d_%d"
#define XPI_S_TO_C_SEM_NAME "%sStoC%d_%d"
#define XPI_C_TO_S_EVT_SEM_NAME "%sCtoSEvent%d_%d"
#define XPI_S_TO_C_EVT_SEM_NAME "%sStoCEvent%d_%d"
#define XPI_EVENT_NAME "%sEvent%d"
#define XPI_EVENT_CLASS "%sEventClass"
#define XPI_EVENT_THREAD "%sEventThread%d_%d"
#define XNET_MA_CONNECT_MAP "%s_CONNECT_MAP"
#define XNET_MU_CONNECT_MUTEX "%s_CONNECT_MUTEX"
#define XNET_E_CONNECT_EVENT "%s_E_CONNECT_EVENT"
#define XNET_E_RESPONSE_EVENT "%s_E_RESPONSE_EVENT"
#define XNET_E_C2S_DATA_CHAN_FILLED "%s_E_C2S_DATA_FILLED_%d_%d_%d"
#define XNET_E_C2S_DATA_CHAN_EMPTED "%s_E_C2S_DATA_EMPTED_%d_%d_%d"
#define XNET_E_S2C_DATA_CHAN_FILLED "%s_E_S2C_DATA_FILLED_%d_%d_%d"
#define XNET_E_S2C_DATA_CHAN_EMPTED "%s_E_S2C_DATA_EMPTED_%d_%d_%d"
#define XPI_CONNECT_MESSAGE WM_USER + 3
#define XNET_E_C2S_EVNT_CHAN_FILLED "%s_E_C2S_EVNT_FILLED_%d_%d_%d"
#define XNET_E_C2S_EVNT_CHAN_EMPTED "%s_E_C2S_EVNT_EMPTED_%d_%d_%d"
#define XNET_E_S2C_EVNT_CHAN_FILLED "%s_E_S2C_EVNT_FILLED_%d_%d_%d"
#define XNET_E_S2C_EVNT_CHAN_EMPTED "%s_E_S2C_EVNT_EMPTED_%d_%d_%d"
#endif /* _REMOTE_XNET_H_ */

View File

@ -19,6 +19,8 @@
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
* 2003.05.01 Victor Seryodkin, Dmitry Yemanov: Completed XNET implementation
*/
#ifndef _REMOTE_XNET_PROTO_H_
@ -32,11 +34,13 @@ extern "C" {
#define PORT void*
#endif
extern PORT XNET_analyze( TEXT *, USHORT *, ISC_STATUS *, TEXT *, TEXT *, USHORT);
extern PORT XNET_connect( TEXT *, struct packet *, ISC_STATUS *, USHORT);
extern USHORT XNET_init( HWND, USHORT, USHORT, USHORT);
extern void XNET_release_all(void);
extern PORT XNET_start_thread( ULONG, ULONG *);
extern PORT XNET_analyze(TEXT *, USHORT *, ISC_STATUS *, TEXT *, TEXT *, USHORT);
extern PORT XNET_connect(TEXT *, struct packet *, ISC_STATUS *, USHORT);
#ifndef SUPERCLIENT
extern void XNET_srv(USHORT flag);
extern PORT XNET_reconnect(ULONG, TEXT *, ISC_STATUS *);
#endif
#ifdef __cplusplus
} /* extern "C" */