mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 08:03:04 +01:00
XNET support on win32. Untested.
This commit is contained in:
parent
9a3658a58c
commit
fba5c08f2f
@ -50,6 +50,9 @@
|
||||
#include "../jrd/sch_proto.h"
|
||||
#include "../remote/window.h"
|
||||
#include "../common/config/config.h"
|
||||
#define NO_PORT
|
||||
#include "../remote/xnet_proto.h"
|
||||
#undef NO_PORT
|
||||
|
||||
#define statistics stat
|
||||
|
||||
@ -3777,7 +3780,6 @@ static SSHORT init( STATUS * user_status, ICC * picc)
|
||||
DWORD client_pid;
|
||||
ips_comm_area *comm;
|
||||
|
||||
|
||||
/* first, make sure that the critical region is initialized */
|
||||
|
||||
while (!initialized)
|
||||
@ -3793,6 +3795,8 @@ static SSHORT init( 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
|
||||
{
|
||||
|
@ -68,16 +68,12 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN_NT
|
||||
#include "../jrd/isc_proto.h"
|
||||
#endif
|
||||
|
||||
#if defined(WIN_NT)
|
||||
#define XNET
|
||||
#include "../jrd/isc_proto.h"
|
||||
#include "../remote/wnet_proto.h"
|
||||
#ifdef XNET
|
||||
#include "../remote/xnet_proto.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VMS
|
||||
#include "../remote/decne_proto.h"
|
||||
@ -4807,7 +4803,6 @@ static PORT analyze(TEXT* file_name,
|
||||
#endif
|
||||
|
||||
#if defined(WIN_NT)
|
||||
|
||||
*file_length = ISC_expand_share(file_name, expanded_name);
|
||||
strcpy((char *) file_name, (char *) expanded_name);
|
||||
#endif
|
||||
@ -4823,6 +4818,9 @@ static PORT analyze(TEXT* file_name,
|
||||
#endif
|
||||
|
||||
#if defined(WIN_NT)
|
||||
if (ISC_analyze_xnet(file_name, node_name))
|
||||
return XNET_analyze(file_name, file_length, status_vector,
|
||||
node_name, user_string, uv_flag);
|
||||
if (ISC_analyze_pclan(file_name, node_name))
|
||||
return WNET_analyze(file_name, file_length, status_vector,
|
||||
node_name, user_string, uv_flag);
|
||||
@ -4901,7 +4899,7 @@ static PORT analyze(TEXT* file_name,
|
||||
#endif /* IPSERV */
|
||||
#endif /* WIN_NT */
|
||||
|
||||
#ifdef XNET
|
||||
#if defined(XNET) && !defined(IPSERV)
|
||||
|
||||
/* all remote attempts have failed, so access locally through the
|
||||
interprocess server */
|
||||
@ -4987,6 +4985,9 @@ TEXT * user_string, USHORT uv_flag, SCHAR * dpb, SSHORT dpb_length)
|
||||
#endif
|
||||
|
||||
#if defined(WIN_NT)
|
||||
if (ISC_analyze_xnet(service_name, node_name))
|
||||
return XNET_analyze(service_name, service_length, status_vector,
|
||||
node_name, user_string, uv_flag);
|
||||
if (ISC_analyze_pclan(service_name, node_name))
|
||||
return WNET_analyze(service_name, service_length, status_vector,
|
||||
node_name, user_string, uv_flag);
|
||||
@ -4997,7 +4998,7 @@ TEXT * user_string, USHORT uv_flag, SCHAR * dpb, SSHORT dpb_length)
|
||||
node_name, user_string, uv_flag, dpb,
|
||||
dpb_length);
|
||||
|
||||
#ifdef XNET
|
||||
#if defined(XNET) && !defined(IPSERV)
|
||||
|
||||
/* all remote attempts have failed, so access locally through the
|
||||
interprocess server */
|
||||
@ -5616,7 +5617,6 @@ static void event_handler( PORT port)
|
||||
/* free up anything allocated */
|
||||
|
||||
REMOTE_free_packet(port, &packet);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -5691,7 +5691,9 @@ static STATUS fetch_blob(
|
||||
RSR statement,
|
||||
USHORT blr_length,
|
||||
UCHAR * blr,
|
||||
USHORT msg_type, USHORT msg_length, UCHAR * msg)
|
||||
USHORT msg_type,
|
||||
USHORT msg_length,
|
||||
UCHAR * msg)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
|
@ -315,13 +315,13 @@ enum rem_port_t
|
||||
port_mailbox, /* Apollo mailbox */
|
||||
port_pcic, /* IBM PC interconnect */
|
||||
port_inet, /* Internet (TCP/IP) */
|
||||
port_asyn_homebrew, /* homebrew asynchronous connection */
|
||||
port_asyn_homebrew, /* homebrew asynchronous connection */
|
||||
port_decnet, /* DECnet connection */
|
||||
port_ipc, /* NetIPC connection */
|
||||
port_pipe, /* Windows NT named pipe connection */
|
||||
port_mslan, /* Microsoft LanManager connection */
|
||||
port_spx, /* Novell SPX connection */
|
||||
port_ipserver, /* InterBase interprocess server */
|
||||
port_spx, /* Novell SPX connection */
|
||||
port_ipserver, /* InterBase interprocess server */
|
||||
port_xnet /* Windows NT named xnet connection */
|
||||
};
|
||||
|
||||
@ -407,9 +407,7 @@ typedef struct port
|
||||
#ifdef VMS
|
||||
USHORT port_iosb[4];
|
||||
#endif
|
||||
#ifdef XNET
|
||||
void* port_xcc; /* interprocess structure */
|
||||
#endif
|
||||
UCHAR port_buffer[1];
|
||||
|
||||
/* TMN: Beginning of C++ port */
|
||||
|
@ -3069,13 +3069,11 @@ BOOLEAN process_packet(PORT port,
|
||||
break;
|
||||
if ((server->srvr_flags & SRVR_multi_client) &&
|
||||
port != server->srvr_parent_port) {
|
||||
#ifdef XNET
|
||||
if (port->port_type == port_xnet) {
|
||||
port->disconnect(send, receive);
|
||||
THD_restore_specific();
|
||||
return FALSE;
|
||||
}
|
||||
#endif /* XNET */
|
||||
port->disconnect(send, receive);
|
||||
port = NULL;
|
||||
break;
|
||||
|
@ -96,9 +96,7 @@
|
||||
#include "../remote/window_proto.h"
|
||||
#include "../remote/wnet_proto.h"
|
||||
#include "../remote/window.rh"
|
||||
#ifdef XNET
|
||||
#include "../remote/xnet_proto.h"
|
||||
#endif /* XNET */
|
||||
#include "../jrd/gds_proto.h"
|
||||
#include "../jrd/license.h"
|
||||
#include "../jrd/sch_proto.h"
|
||||
@ -129,10 +127,8 @@ static SERVICE_TABLE_ENTRY service_table[] = {
|
||||
NULL, NULL
|
||||
};
|
||||
|
||||
#ifdef XNET
|
||||
/* put into ensure that we have a parent port for the XNET connections */
|
||||
static int xnet_server_set = FALSE;
|
||||
#endif /* XNET */
|
||||
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hThisInst,
|
||||
@ -200,6 +196,7 @@ int WINAPI WinMain(HINSTANCE hThisInst,
|
||||
server_flag |= SRVR_wnet;
|
||||
server_flag |= SRVR_inet;
|
||||
#ifdef SUPERSERVER
|
||||
server_flag |= SRVR_xnet;
|
||||
server_flag |= SRVR_ipc;
|
||||
#endif
|
||||
}
|
||||
@ -248,13 +245,6 @@ int WINAPI WinMain(HINSTANCE hThisInst,
|
||||
(wnet_connect_wait_thread), 0, THREAD_medium, 0,
|
||||
0);
|
||||
}
|
||||
#ifdef XNET
|
||||
if (server_flag & SRVR_xnet) {
|
||||
gds__thread_start(reinterpret_cast < FPTR_INT_VOID_PTR >
|
||||
(xnet_connect_wait_thread), 0, THREAD_medium, 0,
|
||||
0);
|
||||
}
|
||||
#endif
|
||||
/* No need to waste a thread if we are running as a window. Just start
|
||||
* the ipc communication
|
||||
*/
|
||||
@ -265,7 +255,6 @@ int WINAPI WinMain(HINSTANCE hThisInst,
|
||||
}
|
||||
|
||||
|
||||
#ifdef XNET
|
||||
ULONG SRVR_xnet_start_thread(ULONG client_pid)
|
||||
{
|
||||
/**************************************
|
||||
@ -283,7 +272,6 @@ ULONG SRVR_xnet_start_thread(ULONG client_pid)
|
||||
PORT port;
|
||||
ULONG response;
|
||||
|
||||
|
||||
/* get a port */
|
||||
port = XNET_start_thread(client_pid, &response);
|
||||
|
||||
@ -310,7 +298,6 @@ ULONG SRVR_xnet_start_thread(ULONG client_pid)
|
||||
/* return combined mapped area and number */
|
||||
return response;
|
||||
}
|
||||
#endif /* XNET */
|
||||
|
||||
|
||||
static void THREAD_ROUTINE process_connection_thread( PORT port)
|
||||
@ -468,12 +455,6 @@ 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);
|
||||
}
|
||||
#ifdef XNET
|
||||
if (server_flag & SRVR_xnet) {
|
||||
gds__thread_start(reinterpret_cast < FPTR_INT_VOID_PTR >
|
||||
(xnet_connect_wait_thread), 0, THREAD_medium, 0, 0);
|
||||
}
|
||||
#else
|
||||
if (server_flag & SRVR_ipc) {
|
||||
const int bFailed =
|
||||
gds__thread_start(reinterpret_cast < FPTR_INT_VOID_PTR >
|
||||
@ -496,7 +477,6 @@ static void THREAD_ROUTINE start_connections_thread( int flag)
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif /* XNET */
|
||||
}
|
||||
|
||||
|
||||
@ -586,16 +566,14 @@ static HANDLE parse_args( LPSTR lpszArgs, USHORT * pserver_flag)
|
||||
*pserver_flag &= ~SRVR_high_priority;
|
||||
break;
|
||||
|
||||
#ifdef XNET
|
||||
case 'X':
|
||||
*pserver_flag |= SRVR_xnet;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case 'W':
|
||||
*pserver_flag |= SRVR_wnet;
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
*pserver_flag |= SRVR_xnet;
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
ib_printf("Firebird remote server version %s\n",
|
||||
FB_VERSION);
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "../remote/remote_def.h"
|
||||
#include "../remote/window.rh"
|
||||
#include "../remote/property.rh"
|
||||
#include "../remote/xnet.h"
|
||||
#include "../ipserver/ips.h"
|
||||
|
||||
#include "../jrd/svc_proto.h"
|
||||
@ -117,8 +118,6 @@ int WINDOW_main( HINSTANCE hThisInst, int nWndMode, USHORT usServerFlagMask)
|
||||
}
|
||||
else {
|
||||
|
||||
#ifndef XNET
|
||||
|
||||
if (!IPS_init(hWnd, 0, (USHORT) Config::getIpcMapSize(), 0)) {
|
||||
// The initialization failed. Check to see if there is another
|
||||
// server running. If so, bring up it's property sheet and quit
|
||||
@ -147,8 +146,6 @@ int WINDOW_main( HINSTANCE hThisInst, int nWndMode, USHORT usServerFlagMask)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if (!XNET_init(hWnd, 0, 0, 0)) {
|
||||
char szMsgString[TMP_STRINGLEN];
|
||||
hWnd = FindWindow(szClassName, APP_NAME);
|
||||
@ -172,7 +169,6 @@ int WINDOW_main( HINSTANCE hThisInst, int nWndMode, USHORT usServerFlagMask)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* initialize main window */
|
||||
@ -491,12 +487,11 @@ LRESULT CALLBACK WindowFunc(HWND hWnd,
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
case IP_CONNECT_MESSAGE:
|
||||
#ifndef XNET
|
||||
case IPI_CONNECT_MESSAGE:
|
||||
return IPS_start_thread(lParam);
|
||||
#else
|
||||
|
||||
case XPI_CONNECT_MESSAGE:
|
||||
return SRVR_xnet_start_thread(lParam);
|
||||
#endif
|
||||
|
||||
case WM_DEVICECHANGE:
|
||||
pdbcv = (PDEV_BROADCAST_VOLUME) lParam;
|
||||
|
@ -49,6 +49,4 @@
|
||||
static char *szClassName = "FB_Server";
|
||||
static char *szWindowName = "Firebird Server";
|
||||
|
||||
#define IP_CONNECT_MESSAGE WM_USER + 1
|
||||
|
||||
#endif // WINDOW_H
|
||||
|
@ -24,8 +24,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef XNET
|
||||
|
||||
#include "firebird.h"
|
||||
#include "../jrd/ib_stdio.h"
|
||||
#include <string.h>
|
||||
@ -69,7 +67,6 @@
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
#ifdef WIN_NT
|
||||
#define ERRNO GetLastError()
|
||||
#endif
|
||||
@ -165,13 +162,10 @@ static HANDLE server_watcher_handle = 0;
|
||||
static HANDLE server_process_handle = 0;
|
||||
#endif
|
||||
static USHORT exit_flag = 0;
|
||||
static USHORT initialized = 0;
|
||||
static bool initialized = false;
|
||||
static MUTX_T xnet_mutex;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
PORT XNET_analyze(
|
||||
TEXT * file_name,
|
||||
USHORT * file_length,
|
||||
@ -201,7 +195,6 @@ PORT XNET_analyze(
|
||||
|
||||
p_cnct::p_cnct_repeat * protocol;
|
||||
|
||||
|
||||
*file_length = strlen(file_name);
|
||||
|
||||
/* We need to establish a connection to a remote server. Allocate the necessary
|
||||
@ -237,7 +230,6 @@ PORT XNET_analyze(
|
||||
|
||||
user_length = p - user_id;
|
||||
|
||||
|
||||
/* Establish connection to server */
|
||||
|
||||
cnct = &packet->p_cnct;
|
||||
@ -261,8 +253,6 @@ PORT XNET_analyze(
|
||||
cnct->p_cnct_user_id.cstr_length = user_length;
|
||||
cnct->p_cnct_user_id.cstr_address = (UCHAR *) user_id;
|
||||
|
||||
|
||||
|
||||
protocol = cnct->p_cnct_versions;
|
||||
|
||||
protocol->p_cnct_version = PROTOCOL_VERSION7;
|
||||
@ -513,10 +503,8 @@ PORT XNET_connect(TEXT * name,
|
||||
PORT port;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
if (!initialized) {
|
||||
initialized = 1;
|
||||
initialized = true;
|
||||
gds__register_cleanup((FPTR_VOID_PTR) exit_handler, NULL);
|
||||
THD_mutex_init(&xnet_mutex);
|
||||
}
|
||||
@ -562,7 +550,7 @@ for (xcc = client_threads; xcc; xcc = xcc->xcc_next)
|
||||
client_pid = GetCurrentProcessId();
|
||||
HWND hWndServer = FindWindow(szClassName, APP_NAME);
|
||||
number = (ULONG) SendMessage(hWndServer,
|
||||
IP_CONNECT_MESSAGE, 0,
|
||||
XPI_CONNECT_MESSAGE, 0,
|
||||
(LPARAM) client_pid);
|
||||
#else /* WIN_NT */
|
||||
client_pid = getpid();
|
||||
@ -575,9 +563,9 @@ for (xcc = client_threads; xcc; xcc = xcc->xcc_next)
|
||||
return 0;
|
||||
}
|
||||
pages_per_user = (USHORT) XPS_UNPACK_PAGES(number);
|
||||
users_per_map = (USHORT) XPS_UNPACK_MAX_USERS(number);
|
||||
users_per_map = (USHORT) XPS_UNPACK_MAX_SLOTS(number);
|
||||
mapped_area = (SSHORT) XPS_UNPACK_MAPNUM(number);
|
||||
mapped_position = (SSHORT) XPS_UNPACK_USERNUM(number);
|
||||
mapped_position = (SSHORT) XPS_UNPACK_SLOTNUM(number);
|
||||
|
||||
/* see if area is already mapped for this client */
|
||||
|
||||
@ -588,7 +576,7 @@ for (xcc = client_threads; xcc; xcc = xcc->xcc_next)
|
||||
if (!xpm) {
|
||||
/* add new mapping */
|
||||
|
||||
sprintf(name_buffer, XPI_MAPPED_FILE_NAME, mapped_area);
|
||||
sprintf(name_buffer, XPI_MAPPED_FILE_NAME, XPI_PREFIX, mapped_area);
|
||||
#ifdef WIN_NT
|
||||
file_handle = OpenFileMapping(FILE_MAP_WRITE, FALSE, name_buffer);
|
||||
if (!file_handle) {
|
||||
@ -646,7 +634,6 @@ for (xcc = client_threads; xcc; xcc = xcc->xcc_next)
|
||||
xcc->xcc_send_channel_locked = FALSE;
|
||||
xps = (XPS) xcc->xcc_mapped_addr;
|
||||
|
||||
|
||||
/* only speak if server has correct protocol */
|
||||
|
||||
if (xps->xps_server_protocol != 2L) {
|
||||
@ -673,7 +660,7 @@ for (xcc = client_threads; xcc; xcc = xcc->xcc_next)
|
||||
|
||||
/* get handles of semaphores */
|
||||
|
||||
sprintf(name_buffer, XPI_S_TO_C_SEM_NAME,
|
||||
sprintf(name_buffer, XPI_S_TO_C_SEM_NAME, XPI_PREFIX,
|
||||
mapped_area, mapped_position);
|
||||
#ifdef WIN_NT
|
||||
xcc->xcc_recv_sem =
|
||||
@ -681,7 +668,7 @@ for (xcc = client_threads; xcc; xcc = xcc->xcc_next)
|
||||
#else
|
||||
/* STUB : need to call event init for Unix */
|
||||
#endif
|
||||
sprintf(name_buffer, XPI_C_TO_S_SEM_NAME, mapped_area,
|
||||
sprintf(name_buffer, XPI_C_TO_S_SEM_NAME, XPI_PREFIX, mapped_area,
|
||||
mapped_position);
|
||||
#ifdef WIN_NT
|
||||
xcc->xcc_send_sem =
|
||||
@ -714,7 +701,6 @@ for (xcc = client_threads; xcc; xcc = xcc->xcc_next)
|
||||
xcc->xcc_receive_channel = &xps->xps_channels[1];
|
||||
xcc->xcc_send_channel = &xps->xps_channels[0];
|
||||
|
||||
|
||||
/* if we're not watching the server yet, do so now */
|
||||
|
||||
#ifdef WIN_NT
|
||||
@ -763,9 +749,8 @@ USHORT XNET_init(HWND hwnd,
|
||||
**************************************/
|
||||
XPM xpm;
|
||||
|
||||
|
||||
if (!initialized) {
|
||||
initialized = 1;
|
||||
initialized = true;
|
||||
gds__register_cleanup((FPTR_VOID_PTR) exit_handler, NULL);
|
||||
THD_mutex_init(&xnet_mutex);
|
||||
}
|
||||
@ -908,10 +893,10 @@ PORT XNET_start_thread(ULONG client_pid, ULONG * response)
|
||||
#ifdef WIN_NT
|
||||
/* create the semaphores and put the handles into the xcc */
|
||||
|
||||
sprintf(name_buffer, XPI_S_TO_C_SEM_NAME, mapped_area, mapped_position);
|
||||
sprintf(name_buffer, XPI_S_TO_C_SEM_NAME, XPI_PREFIX, mapped_area, mapped_position);
|
||||
xcc->xcc_send_sem = CreateSemaphore(ISC_get_security_desc(),
|
||||
0L, 2L, name_buffer);
|
||||
sprintf(name_buffer, XPI_C_TO_S_SEM_NAME, mapped_area, mapped_position);
|
||||
sprintf(name_buffer, XPI_C_TO_S_SEM_NAME, XPI_PREFIX, mapped_area, mapped_position);
|
||||
xcc->xcc_recv_sem = CreateSemaphore(ISC_get_security_desc(),
|
||||
0L, 2L, name_buffer);
|
||||
|
||||
@ -961,7 +946,6 @@ PORT XNET_start_thread(ULONG client_pid, ULONG * response)
|
||||
if (port)
|
||||
port->port_xcc = (void *) xcc;
|
||||
|
||||
|
||||
/* return combined mapped area and number */
|
||||
|
||||
THD_mutex_unlock(&xnet_mutex);
|
||||
@ -1020,7 +1004,7 @@ port->port_type = port_ipserver;
|
||||
ISC_get_host(buffer, sizeof(buffer));
|
||||
port->port_host = REMOTE_make_string(buffer);
|
||||
port->port_connection = REMOTE_make_string(buffer);
|
||||
sprintf(buffer, "IP Server (%s)", port->port_host->str_data);
|
||||
sprintf(buffer, "XNET Server (%s)", port->port_host->str_data);
|
||||
port->port_version = REMOTE_make_string(buffer);
|
||||
if (parent) {
|
||||
port->port_parent = parent;
|
||||
@ -1076,7 +1060,6 @@ static PORT aux_connect( PORT port, PACKET * packet, XDR_INT(*ast) (void))
|
||||
|
||||
USHORT espace;
|
||||
|
||||
|
||||
if (port->port_server_flags) {
|
||||
port->port_flags |= PORT_async;
|
||||
return port;
|
||||
@ -1106,11 +1089,11 @@ static PORT aux_connect( PORT port, PACKET * packet, XDR_INT(*ast) (void))
|
||||
#ifdef WIN_NT
|
||||
/* get handles of semaphores */
|
||||
|
||||
sprintf(name_buffer, XPI_S_TO_C_EVT_SEM_NAME,
|
||||
sprintf(name_buffer, XPI_S_TO_C_EVT_SEM_NAME,XPI_PREFIX,
|
||||
xcc->xcc_file, xcc->xcc_slot);
|
||||
xcc->xcc_recv_sem = OpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE,
|
||||
name_buffer);
|
||||
sprintf(name_buffer, XPI_C_TO_S_EVT_SEM_NAME,
|
||||
sprintf(name_buffer, XPI_C_TO_S_EVT_SEM_NAME, XPI_PREFIX,
|
||||
xcc->xcc_file, xcc->xcc_slot);
|
||||
xcc->xcc_send_sem = OpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE,
|
||||
name_buffer);
|
||||
@ -1204,11 +1187,11 @@ static PORT aux_request( PORT port, PACKET * packet)
|
||||
/* create the event semaphores and put the handles into the xcc */
|
||||
|
||||
#ifdef WIN_NT
|
||||
sprintf(name_buffer, XPI_S_TO_C_EVT_SEM_NAME,
|
||||
sprintf(name_buffer, XPI_S_TO_C_EVT_SEM_NAME, XPI_PREFIX,
|
||||
xcc->xcc_file, xcc->xcc_slot);
|
||||
xcc->xcc_send_sem = CreateSemaphore(ISC_get_security_desc(),
|
||||
0L, 2L, name_buffer);
|
||||
sprintf(name_buffer, XPI_C_TO_S_EVT_SEM_NAME,
|
||||
sprintf(name_buffer, XPI_C_TO_S_EVT_SEM_NAME, XPI_PREFIX,
|
||||
xcc->xcc_file, xcc->xcc_slot);
|
||||
xcc->xcc_recv_sem = CreateSemaphore(ISC_get_security_desc(),
|
||||
0L, 2L, name_buffer);
|
||||
@ -1462,7 +1445,6 @@ ULONG connection_setup(TEXT * name, PACKET * packet, STATUS * status_vector)
|
||||
#endif /* UNIX */
|
||||
|
||||
|
||||
|
||||
static void cleanup_comm( XCC xcc)
|
||||
{
|
||||
/**************************************
|
||||
@ -1520,7 +1502,6 @@ static void cleanup_comm( XCC xcc)
|
||||
|
||||
/* if this was the last area for this map, unmap it */
|
||||
|
||||
|
||||
xpm->xpm_count--;
|
||||
#ifdef SUPERCLIENT
|
||||
if (!xpm->xpm_count && client_maps) {
|
||||
@ -1570,7 +1551,6 @@ static void cleanup_port( PORT port)
|
||||
*
|
||||
**************************************/
|
||||
|
||||
|
||||
if (port->port_xcc)
|
||||
cleanup_comm((XCC) port->port_xcc);
|
||||
|
||||
@ -1661,7 +1641,6 @@ static void exit_handler( PORT main_port)
|
||||
**************************************/
|
||||
PORT port;
|
||||
|
||||
|
||||
for (port = main_port; port; port = port->port_next);
|
||||
}
|
||||
|
||||
@ -1688,10 +1667,9 @@ static XPM make_map( USHORT map_number)
|
||||
USHORT i;
|
||||
TEXT name_buffer[128];
|
||||
|
||||
|
||||
/* create the mapped file name and try to open it */
|
||||
|
||||
sprintf(name_buffer, XPI_MAPPED_FILE_NAME, map_number);
|
||||
sprintf(name_buffer, XPI_MAPPED_FILE_NAME, XPI_PREFIX, map_number);
|
||||
#ifdef WIN_NT
|
||||
map_handle = CreateFileMapping((HANDLE) 0xFFFFFFFF, NULL,
|
||||
PAGE_READWRITE, 0L,
|
||||
@ -1812,7 +1790,6 @@ static int packet_send( PORT port, SSHORT length)
|
||||
XCH xch;
|
||||
USHORT errres;
|
||||
|
||||
|
||||
xcc = reinterpret_cast<XCC>(port->port_xcc);
|
||||
xps = (XPS) (xcc->xcc_mapped_addr);
|
||||
xch = xcc->xcc_send_channel;
|
||||
@ -1857,7 +1834,6 @@ static PORT receive( PORT main_port, PACKET * packet)
|
||||
*
|
||||
**************************************/
|
||||
|
||||
|
||||
if (!xdr_protocol(&main_port->port_receive, packet))
|
||||
packet->p_operation = op_exit;
|
||||
return main_port;
|
||||
@ -1877,11 +1853,9 @@ static int send_full( PORT port, PACKET * packet)
|
||||
*
|
||||
**************************************/
|
||||
|
||||
|
||||
if (!xdr_protocol(&port->port_send, packet))
|
||||
return FALSE;
|
||||
return xdrxnet_endofrecord(&port->port_send, TRUE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1898,7 +1872,6 @@ static int send_partial( PORT port, PACKET * packet)
|
||||
*
|
||||
**************************************/
|
||||
|
||||
|
||||
return xdr_protocol(&port->port_send, packet);
|
||||
}
|
||||
|
||||
@ -1975,7 +1948,6 @@ static void server_watcher(void)
|
||||
#ifdef WIN_NT
|
||||
DWORD result;
|
||||
|
||||
|
||||
for (;;) {
|
||||
if (exit_flag)
|
||||
break;
|
||||
@ -2011,7 +1983,6 @@ static int xdrxnet_create(
|
||||
*
|
||||
**************************************/
|
||||
|
||||
|
||||
xdrs->x_public = (caddr_t) port;
|
||||
xdrs->x_private = (SCHAR *) buffer;
|
||||
xdrs->x_base = xdrs->x_private;
|
||||
@ -2035,7 +2006,6 @@ static bool_t xdrxnet_endofrecord( XDR * xdrs, bool_t flushnow)
|
||||
*
|
||||
**************************************/
|
||||
|
||||
|
||||
return xnet_write(xdrs, flushnow);
|
||||
}
|
||||
|
||||
@ -2095,7 +2065,6 @@ static int xnet_error(
|
||||
TEXT node_name[MAXPATHLEN];
|
||||
TEXT *p;
|
||||
|
||||
|
||||
strcpy(node_name, ((SCHAR *) port->port_connection->str_data) + 2);
|
||||
p = strchr(node_name, '\\');
|
||||
if (p != NULL)
|
||||
@ -2137,7 +2106,6 @@ static void xnet_gen_error( PORT port, STATUS status, ...)
|
||||
**************************************/
|
||||
STATUS *status_vector;
|
||||
|
||||
|
||||
port->port_flags |= PORT_broken;
|
||||
port->port_state = state_broken;
|
||||
status_vector = NULL;
|
||||
@ -2239,7 +2207,6 @@ static u_int xnet_getpostn( XDR * xdrs)
|
||||
*
|
||||
**************************************/
|
||||
|
||||
|
||||
return (u_int) (xdrs->x_private - xdrs->x_base);
|
||||
}
|
||||
|
||||
@ -2278,7 +2245,6 @@ static bool_t xnet_putbytes( XDR * xdrs, SCHAR * buff, u_int count)
|
||||
SLONG bytecount = count;
|
||||
SLONG to_copy;
|
||||
|
||||
|
||||
THREAD_EXIT;
|
||||
while (bytecount) {
|
||||
if (xdrs->x_handy >= bytecount)
|
||||
@ -2383,7 +2349,6 @@ static bool_t xnet_read( XDR * xdrs)
|
||||
PORT port;
|
||||
USHORT length;
|
||||
|
||||
|
||||
port = (PORT) xdrs->x_public;
|
||||
if (!packet_receive(port, &length))
|
||||
return FALSE;
|
||||
@ -2446,12 +2411,11 @@ static bool_t xnet_write( XDR * xdrs, bool_t end_flag)
|
||||
}
|
||||
|
||||
|
||||
#ifdef XNET
|
||||
void IPC_release_all(void)
|
||||
void XNET_release_all(void)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* I P C _ r e l e a s e _ a l l
|
||||
* X N E T _ r e l e a s e _ a l l
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
@ -2524,9 +2488,5 @@ void IPC_release_all(void)
|
||||
ALLR_free((UCHAR *) xpm);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif /* XNET */
|
||||
|
@ -56,10 +56,10 @@ typedef short DWORD;
|
||||
#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_USERS(n) (((ULONG)(n) >> 24) & 0xFF)
|
||||
#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_USERNUM(n) ((n) & 0xFF)
|
||||
#define XPS_UNPACK_SLOTNUM(n) ((n) & 0xFF)
|
||||
|
||||
/* mapped file structure */
|
||||
|
||||
@ -146,15 +146,19 @@ typedef struct xps
|
||||
|
||||
/* Windows names used to identify various named objects */
|
||||
|
||||
#define XPI_SERVER_NAME "InterBaseXPIServer"
|
||||
#define XPI_SERVER_CLASS "InterBaseXPIServerClass"
|
||||
#define XPI_MAPPED_FILE_NAME "InterBaseXPIMappedArea%d"
|
||||
#define XPI_C_TO_S_SEM_NAME "InterBaseXPICtoS%d_%d"
|
||||
#define XPI_S_TO_C_SEM_NAME "InterBaseXPIStoC%d_%d"
|
||||
#define XPI_C_TO_S_EVT_SEM_NAME "InterBaseXPICtoSEvent%d_%d"
|
||||
#define XPI_S_TO_C_EVT_SEM_NAME "InterBaseXPIStoCEvent%d_%d"
|
||||
#define XPI_EVENT_NAME "InterBaseXPIEvent%d"
|
||||
#define XPI_EVENT_CLASS "InterBaseXPIEventClass"
|
||||
#define XPI_EVENT_THREAD "InterBaseXPIEventThread%d_%d"
|
||||
#define XPI_PREFIX "FirebirdXPI"
|
||||
|
||||
#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 XPI_CONNECT_MESSAGE WM_USER + 3
|
||||
|
||||
#endif /* _REMOTE_XNET_H_ */
|
||||
|
@ -28,8 +28,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef XNET
|
||||
|
||||
#ifdef NO_PORT
|
||||
#define PORT void*
|
||||
#endif
|
||||
@ -37,10 +35,9 @@ extern "C" {
|
||||
extern PORT XNET_analyze( TEXT *, USHORT *, STATUS *, TEXT *, TEXT *, USHORT);
|
||||
extern PORT XNET_connect( TEXT *, struct packet *, STATUS *, USHORT);
|
||||
extern USHORT XNET_init( HWND, USHORT, USHORT, USHORT);
|
||||
extern void XNET_release_all(void);
|
||||
extern PORT XNET_start_thread( ULONG, ULONG *);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user