mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 10:43:24 +00:00
Removing obsolete xpcom/remote files.
Bug #102787 r=igor.kushnirskiy@sun.com
This commit is contained in:
parent
3e771f6d39
commit
8cd04ee331
@ -1,35 +0,0 @@
|
||||
#!gmake
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = ../..
|
||||
VPATH = .
|
||||
srcdir = .
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS= \
|
||||
common \
|
||||
server \
|
||||
client \
|
||||
tests \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
@ -1,35 +0,0 @@
|
||||
#!gmake
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS= \
|
||||
common \
|
||||
server \
|
||||
client \
|
||||
tests \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
@ -1,28 +0,0 @@
|
||||
This document is under construction.
|
||||
|
||||
|
||||
The main goal of module is to give services for calling xpcom objects across
|
||||
process boundaries.
|
||||
|
||||
Currently we are providing communication between two processes only
|
||||
1
|
||||
The reason of this is that this project was started to help blackwood
|
||||
projects to use oji on solaris.
|
||||
(Under solaris jvm is running in a separate process.)
|
||||
In this specific case we need to have only two process communication
|
||||
(We have one jvm per mozilla running)
|
||||
------------------------
|
||||
sources are organized as follows:
|
||||
|
||||
server/ - server related
|
||||
client/ - client related
|
||||
common/ - related to bough
|
||||
tests/ - tests for this
|
||||
|
||||
-----------------------------------
|
||||
This code was tested under solaris and linux
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
* Figure out when to free memory allocated for marshaling/demarshaling
|
||||
(I am going to use my on nsIAllocator for this.
|
||||
I guess it would be convenient to free all memory allocated by this
|
||||
allocator)
|
||||
|
||||
* Add marshaling for Interfaces.
|
||||
(It would be done using IMarshalToolkit
|
||||
We need to implement read/write interface for server and client side
|
||||
and update code for MarshalToolkitImpl::read/ride Array in order to use
|
||||
arrays of interfaces)
|
||||
|
||||
* Add handling of AddRef, Release and QueryInterface to RemoteObjectProxy
|
||||
|
||||
* Implement smarter Dispatcher and RPCChannel.
|
||||
In order to use it in multi threading environment.
|
||||
|
||||
|
@ -1,57 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = ../../..
|
||||
srcdir = .
|
||||
VPATH = .
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
LIBRARY_NAME = rpcclient
|
||||
EXPORT_LIBRARY = 1
|
||||
MODULE = rpcclient
|
||||
|
||||
|
||||
|
||||
CPPSRCS = \
|
||||
RPCChannelClientImpl.cpp \
|
||||
RPCClientService.cpp \
|
||||
RemoteObjectProxy.cpp \
|
||||
$(NULL)
|
||||
|
||||
|
||||
INCLUDES += -I../common -I../server
|
||||
|
||||
LIBS = \
|
||||
-lxpcom \
|
||||
-lxptinfo \
|
||||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
|
||||
|
@ -1,59 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#include "nsISupports.h"
|
||||
#include "RPCChannelClientImpl.h"
|
||||
#include "prmem.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(RPCChannelClientImpl, IRPCChannel)
|
||||
|
||||
|
||||
RPCChannelClientImpl::RPCChannelClientImpl(ITransport * _transport) {
|
||||
NS_INIT_REFCNT();
|
||||
transport = _transport;
|
||||
}
|
||||
|
||||
RPCChannelClientImpl::~RPCChannelClientImpl() {
|
||||
NS_IF_RELEASE(transport);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RPCChannelClientImpl::SendReceive(IRPCall * call) {
|
||||
//nb temporary implamentation
|
||||
if(!transport
|
||||
|| !call) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
void *rawData = NULL;
|
||||
PRUint32 size = 0;
|
||||
nsresult rv;
|
||||
if (NS_FAILED(rv = call->GetRawData(&rawData,&size))) {
|
||||
return rv;
|
||||
}
|
||||
transport->Write(rawData,size);
|
||||
PR_Free(rawData);
|
||||
rawData = NULL;
|
||||
while (!NS_SUCCEEDED(transport->Read(&rawData,&size))) { //nb ugly just for testing
|
||||
;
|
||||
}
|
||||
rv = call->Demarshal(rawData,size);
|
||||
PR_Free(rawData);
|
||||
return rv;
|
||||
}
|
||||
|
@ -1,37 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __RPCChannelClientImpl_h__
|
||||
#define __RPCChannelClientImpl_h__
|
||||
#include "IRPCChannel.h"
|
||||
#include "ITransport.h"
|
||||
#include "IRPCall.h"
|
||||
|
||||
class RPCChannelClientImpl : public IRPCChannel {
|
||||
public:
|
||||
RPCChannelClientImpl(ITransport *transport);
|
||||
virtual ~RPCChannelClientImpl(void);
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_IMETHOD SendReceive(IRPCall * call);
|
||||
private:
|
||||
ITransport *transport;
|
||||
};
|
||||
#endif __RPCChannelClientImpl_h__
|
@ -1,112 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#include "RPCClientService.h"
|
||||
#include "RemoteObjectProxy.h"
|
||||
#include "RPCChannelClientImpl.h"
|
||||
#include "RPCallImpl.h"
|
||||
#include "TransportImpl.h"
|
||||
#include "IMarshalToolkit.h"
|
||||
#include "MarshalToolkitImpl.h"
|
||||
|
||||
static IMarshalToolkit * marshalToolkit = new MarshalToolkitImpl();
|
||||
|
||||
RPCClientService * RPCClientService::instance = NULL;
|
||||
char * RPCClientService::serverName = NULL;
|
||||
|
||||
RPCClientService::RPCClientService(void) {
|
||||
transport = NULL;
|
||||
rpcChannel = NULL;
|
||||
}
|
||||
|
||||
RPCClientService::~RPCClientService(void) {
|
||||
instance = NULL;
|
||||
NS_IF_RELEASE(rpcChannel);
|
||||
}
|
||||
|
||||
RPCClientService * RPCClientService::GetInstance(void) {
|
||||
if (!instance) {
|
||||
instance = new RPCClientService();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
void RPCClientService::Initialize(char *_serverName) {
|
||||
serverName = _serverName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP RPCClientService::CreateRPCall(IRPCall **result) {
|
||||
if (!result) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*result = new RPCallImpl(marshalToolkit);
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RPCClientService::CreateObjectProxy(OID oid, const nsIID &iid, nsISupports **result) {
|
||||
if (!result) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*result = new RemoteObjectProxy(oid, iid);
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RPCClientService::GetTransport(ITransport **result) {
|
||||
if (!result) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (!transport) {
|
||||
transport = new TransportImpl(serverName);
|
||||
if (!transport) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
NS_ADDREF(transport);
|
||||
*result = transport;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP RPCClientService::GetRPCChannel(IRPCChannel **result) {
|
||||
nsresult rv = NS_OK;
|
||||
if (!result) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (!rpcChannel) {
|
||||
ITransport * _transport = NULL;
|
||||
if (NS_FAILED(rv = GetTransport(&_transport))) {
|
||||
return rv;
|
||||
}
|
||||
rpcChannel = new RPCChannelClientImpl(_transport);
|
||||
if (!rpcChannel) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_ADDREF(rpcChannel); //nb !! it is for future
|
||||
}
|
||||
NS_ADDREF(rpcChannel);
|
||||
*result = rpcChannel;
|
||||
return NS_OK;
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __RPCClientServoce_h__
|
||||
#define __RPCClientService_h__
|
||||
#include "nsISupports.h"
|
||||
#include "ITransport.h"
|
||||
#include "IRPCall.h"
|
||||
#include "IRPCChannel.h"
|
||||
|
||||
class RPCClientService {
|
||||
public:
|
||||
static RPCClientService * GetInstance(void);
|
||||
static void Initialize(char *serverName);
|
||||
~RPCClientService();
|
||||
NS_IMETHOD GetRPCChannel(IRPCChannel **channel);
|
||||
NS_IMETHOD CreateRPCall(IRPCall **rcall);
|
||||
NS_IMETHOD CreateObjectProxy(OID oid, const nsIID &iid, nsISupports **result);
|
||||
protected:
|
||||
RPCClientService(void);
|
||||
NS_IMETHOD GetTransport(ITransport **transport);
|
||||
static RPCClientService * instance;
|
||||
ITransport * transport;
|
||||
IRPCChannel * rpcChannel;
|
||||
static char * serverName;
|
||||
};
|
||||
#endif /* __RPCClientService_h__ */
|
@ -1,100 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#include "nsIInterfaceInfoManager.h"
|
||||
#include "RemoteObjectProxy.h"
|
||||
#include "IRPCall.h"
|
||||
#include "IRPCChannel.h"
|
||||
|
||||
#include "RPCClientService.h"
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS1(RemoteObjectProxy, RemoteObjectProxy)
|
||||
|
||||
RemoteObjectProxy::RemoteObjectProxy(OID _oid, REFNSIID _iid ) {
|
||||
NS_INIT_REFCNT();
|
||||
oid = _oid;
|
||||
iid = _iid;
|
||||
interfaceInfo = NULL;
|
||||
}
|
||||
|
||||
RemoteObjectProxy::~RemoteObjectProxy() {
|
||||
NS_IF_RELEASE(interfaceInfo);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteObjectProxy::GetInterfaceInfo(nsIInterfaceInfo** info) {
|
||||
printf("--RemoteObjectProxy::GetInterfaceInfo\n");
|
||||
if(!info) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (!interfaceInfo) {
|
||||
nsIInterfaceInfoManager* iimgr;
|
||||
if(iimgr = XPTI_GetInterfaceInfoManager()) {
|
||||
if (NS_FAILED(iimgr->GetInfoForIID(&iid, &interfaceInfo))) {
|
||||
printf("--RemoteObjectProxy::GetInterfaceInfo NS_ERROR_FAILURE 1 \n");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_RELEASE(iimgr);
|
||||
} else {
|
||||
printf("--RemoteObjectProxy::GetInterfaceInfo NS_ERROR_FAILURE 2 \n");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
NS_ADDREF(interfaceInfo);
|
||||
*info = interfaceInfo;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RemoteObjectProxy::CallMethod(PRUint16 methodIndex,
|
||||
const nsXPTMethodInfo* info,
|
||||
nsXPTCMiniVariant* params) {
|
||||
printf("--RemoteObjectProxy::CallMethod methodIndex %d\n", methodIndex);
|
||||
RPCClientService * rpcService = RPCClientService::GetInstance();
|
||||
IRPCall * call = NULL;
|
||||
IRPCChannel *rpcChannel = NULL;
|
||||
nsresult rv;
|
||||
if (NS_FAILED(rv = rpcService->GetRPCChannel(&rpcChannel))) {
|
||||
printf("--RemoteObjectProxy::CallMethod: failed to get channel\n");
|
||||
return rv;
|
||||
}
|
||||
if (NS_FAILED(rv = rpcService->CreateRPCall(&call))) {
|
||||
printf("--RemoteObjectProxy::CallMethod: failed to create call\n");
|
||||
NS_IF_RELEASE(rpcChannel);
|
||||
return rv;
|
||||
}
|
||||
if (NS_FAILED(rv = call->Marshal(iid,oid,methodIndex,info,params))) {
|
||||
printf("--RemoteObjectProxy::CallMethod: failed marshal\n");
|
||||
NS_IF_RELEASE(call);
|
||||
NS_IF_RELEASE(rpcChannel);
|
||||
return rv;
|
||||
}
|
||||
rv = rpcChannel->SendReceive(call);
|
||||
NS_IF_RELEASE(call);
|
||||
NS_IF_RELEASE(rpcChannel);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __RemoteObjectProxy_h__
|
||||
#define __RemoteObjectProxy_h__
|
||||
|
||||
#include "xptcall.h"
|
||||
#include "nsISupports.h"
|
||||
#include "IRPCChannel.h"
|
||||
#include "rproxydefs.h"
|
||||
|
||||
// {59678963-A52B-11d3-837C-0004AC56C49E}
|
||||
|
||||
#define REMOTEOBJECTPROXY_IID \
|
||||
{ 0x59678963, 0xa52b, 0x11d3, { 0x83, 0x7c, 0x0, 0x4, 0xac, 0x56, 0xc4, 0x9e } }
|
||||
|
||||
class RemoteObjectProxy : public nsXPTCStubBase {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(REMOTEOBJECTPROXY_IID)
|
||||
NS_DECL_ISUPPORTS
|
||||
RemoteObjectProxy(OID oid, const nsIID &iid );
|
||||
virtual ~RemoteObjectProxy();
|
||||
NS_IMETHOD GetInterfaceInfo(nsIInterfaceInfo** info);
|
||||
// call this method and return result
|
||||
NS_IMETHOD CallMethod(PRUint16 methodIndex,
|
||||
const nsXPTMethodInfo* info,
|
||||
nsXPTCMiniVariant* params);
|
||||
NS_IMETHOD GetOID(OID *_oid) { *_oid = oid; return NS_OK;}
|
||||
private:
|
||||
OID oid;
|
||||
nsIID iid;
|
||||
nsIInterfaceInfo * interfaceInfo;
|
||||
};
|
||||
#endif /* __RemoteObjectProxy_h__ */
|
||||
|
@ -1,61 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __IMarshalToolkit_h__
|
||||
#define __IMarshalToolkit_h__
|
||||
#include <iostream.h>
|
||||
#include "nsISupports.h"
|
||||
#include "xptcall.h"
|
||||
#include "nsIAllocator.h"
|
||||
|
||||
class IMarshalToolkit : public nsISupports {
|
||||
public:
|
||||
/* nsXPTType::T_I8, nsXPTType::T_U8, nsXPTType::T_I16, nsXPTType::T_U16
|
||||
* nsXPTType::T_I32, nsXPTType::T_U32, nsXPTType::T_I64, nsXPTType::T_U64,
|
||||
* nsXPTType::T_FLOAT, nsXPTType::T_DOUBLE, nsXPTType::T_BOOL, nsXPTType::T_CHAR, nsXPTType::T_WCHAR,
|
||||
*/
|
||||
NS_IMETHOD ReadSimple(istream *in, nsXPTCMiniVariant *value,nsXPTType * type, PRBool isOut, nsIAllocator * allocator = NULL) = 0;
|
||||
NS_IMETHOD WriteSimple(ostream *out, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut) = 0;
|
||||
|
||||
/* nsXPTType::T_IID
|
||||
*/
|
||||
NS_IMETHOD ReadIID(istream *in, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, nsIAllocator * allocator = NULL) = 0;
|
||||
NS_IMETHOD WriteIID(ostream *out, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut) = 0;
|
||||
|
||||
/* case nsXPTType::T_CHAR_STR:
|
||||
* case nsXPTType::T_WCHAR_STR:
|
||||
* case nsXPTType::T_PSTRING_SIZE_IS:
|
||||
* case nsXPTType::T_PWSTRING_SIZE_IS:
|
||||
*/
|
||||
NS_IMETHOD ReadString(istream *in, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, nsIAllocator * allocator = NULL) = 0;
|
||||
NS_IMETHOD WriteString(ostream *out, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, PRInt32 size = -1) = 0;
|
||||
|
||||
/* nsXPTType::T_INTERFACE, nsXPTType::T_INTERFACE_IS
|
||||
*/
|
||||
NS_IMETHOD ReadInterface(istream *in, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, nsIID * iid = NULL,
|
||||
nsIAllocator * allocator = NULL) = 0;
|
||||
NS_IMETHOD WriteInterface(ostream *out, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, nsIID * iid = NULL) = 0;
|
||||
|
||||
/* nsXPTType::T_ARRAY
|
||||
*/
|
||||
NS_IMETHOD ReadArray(istream *in, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, nsXPTType * datumType, nsIAllocator * allocator = NULL) = 0;
|
||||
NS_IMETHOD WriteArray(ostream *out, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, nsXPTType * datumType, PRUint32 size) = 0;
|
||||
};
|
||||
#endif /* __IMarshalToolkit_h__ */
|
@ -1,179 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/msg.h>
|
||||
#include <sys/shm.h>
|
||||
#include <string.h>
|
||||
#include "IPCbridge.h"
|
||||
|
||||
#define SERVER 1L
|
||||
#define CLIENT 2L
|
||||
|
||||
const char * IPCBridge::PREFIX = "/tmp/.msg";
|
||||
struct data_info {
|
||||
long dataId;
|
||||
size_t dataSize;
|
||||
int dataBlock;
|
||||
};
|
||||
|
||||
|
||||
// constructor for both
|
||||
IPCBridge::IPCBridge( const char* serverName)
|
||||
{
|
||||
if (serverName) {
|
||||
fname = (char *)malloc(strlen(serverName) + strlen(PREFIX) + 1);
|
||||
sprintf(fname,"%s%s",PREFIX,serverName);
|
||||
initClient();
|
||||
} else {
|
||||
initServer();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// destructor
|
||||
IPCBridge::~IPCBridge()
|
||||
{
|
||||
switch( this_side )
|
||||
{
|
||||
case SERVER:
|
||||
// remove msg queue
|
||||
msgctl(msg_handler, IPC_RMID, NULL);
|
||||
// remove file
|
||||
unlink(fname);
|
||||
case CLIENT:
|
||||
// free memory
|
||||
free(fname);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int IPCBridge::Read( void **data )
|
||||
{
|
||||
int status;
|
||||
void *shmem;
|
||||
struct data_info di;
|
||||
|
||||
/* read message about array */
|
||||
status = msgrcv(msg_handler, &di, sizeof(struct data_info), other_side, IPC_NOWAIT);
|
||||
if( status==-1 ) return 0;
|
||||
|
||||
/* attach shared memory block */
|
||||
shmem = shmat(di.dataBlock, NULL, 0);
|
||||
|
||||
/* copy array to local memory */
|
||||
*data = malloc(di.dataSize);
|
||||
memcpy(*data, shmem, di.dataSize);
|
||||
|
||||
/* destroy shared memory block */
|
||||
shmdt((char *)shmem);
|
||||
status = shmctl(di.dataBlock, IPC_RMID, NULL);
|
||||
|
||||
/* return data */
|
||||
return di.dataSize;
|
||||
}
|
||||
|
||||
unsigned int IPCBridge::Write( unsigned int size, void *data )
|
||||
{
|
||||
int status;
|
||||
int shm_handler;
|
||||
void *shmem;
|
||||
struct data_info di;
|
||||
|
||||
/* create and attach shared memory block */
|
||||
shm_handler = shmget(IPC_PRIVATE, size, IPC_CREAT | 0600);
|
||||
shmem = shmat(shm_handler, NULL, 0);
|
||||
|
||||
/* copy array from local memory */
|
||||
memcpy(shmem, data, size);
|
||||
shmdt((char *)shmem);
|
||||
|
||||
/* create and send message about array */
|
||||
di.dataId = this_side;
|
||||
di.dataSize = size;
|
||||
di.dataBlock = shm_handler;
|
||||
status = msgsnd(msg_handler, &di, sizeof(struct data_info), IPC_NOWAIT);
|
||||
if( status==-1 )
|
||||
{
|
||||
shmctl(shm_handler, IPC_RMID, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* return */
|
||||
return size;
|
||||
}
|
||||
|
||||
int IPCBridge::initServer( void )
|
||||
{
|
||||
int status;
|
||||
int fs;
|
||||
|
||||
/* create exchange file */
|
||||
/* name is /tmp/.mgg<pid_in_hex_mode> */
|
||||
fname = get_name(getpid());
|
||||
fs = open(fname, O_RDWR | O_CREAT | O_TRUNC, 0600);
|
||||
printf("--InitServer %s\n",fname);
|
||||
/* create message queue */
|
||||
msg_handler = msgget(IPC_PRIVATE, IPC_CREAT | 0600);
|
||||
if (msg_handler < 0) {
|
||||
printf("--IPCBridge::initServer failed. status\n");
|
||||
perror(NULL);
|
||||
}
|
||||
this_side = SERVER;
|
||||
other_side = CLIENT;
|
||||
|
||||
/* wrtie handler into exchange file */
|
||||
status = write(fs, &msg_handler, sizeof(int));
|
||||
|
||||
close(fs);
|
||||
return status;
|
||||
}
|
||||
|
||||
int IPCBridge::initClient( void )
|
||||
{
|
||||
int status;
|
||||
int fs;
|
||||
|
||||
/* create exchange filename */
|
||||
/* name is /tmp/.msg<parent_pid_in_hex_mode> */
|
||||
|
||||
|
||||
/* get message handler */
|
||||
fs = open(fname,O_RDONLY);
|
||||
status = read(fs,&msg_handler,sizeof(int));
|
||||
this_side = CLIENT;
|
||||
other_side = SERVER;
|
||||
|
||||
close(fs);
|
||||
return status;
|
||||
}
|
||||
|
||||
char *IPCBridge::get_name( pid_t pid )
|
||||
{
|
||||
char * p = (char *)malloc(100);
|
||||
sprintf(p,"%s%x",PREFIX,pid);
|
||||
printf("--get_name %s\n",p);
|
||||
return p;
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __IPCbridge_h__
|
||||
#define __IPCbridge_h__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/msg.h>
|
||||
#include <sys/shm.h>
|
||||
|
||||
class IPCBridge {
|
||||
|
||||
public:
|
||||
IPCBridge(const char* serverName = NULL);
|
||||
~IPCBridge();
|
||||
unsigned int Read( void** );
|
||||
unsigned int Write( unsigned int, void* );
|
||||
private:
|
||||
const static char * PREFIX;
|
||||
int msg_handler;
|
||||
long this_side;
|
||||
long other_side;
|
||||
char *fname;
|
||||
|
||||
char *get_name( pid_t );
|
||||
int initServer( void );
|
||||
int initClient( void );
|
||||
|
||||
};
|
||||
|
||||
#endif /* __IPCbridge_h__ */
|
@ -1,37 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __IRPCChannel_h__
|
||||
#define __IRPCChannel_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "IRPCall.h"
|
||||
|
||||
// {59678951-A52B-11d3-837C-0004AC56C49E}
|
||||
#define IRPCCHANNEL_IID \
|
||||
{ 0x59678951, 0xa52b, 0x11d3, { 0x83, 0x7c, 0x0, 0x4, 0xac, 0x56, 0xc4, 0x9e } }
|
||||
|
||||
class IRPCChannel : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(IRPCCHANNEL_IID)
|
||||
NS_IMETHOD SendReceive(IRPCall * call) = 0;
|
||||
};
|
||||
|
||||
#endif /* __IRPCChannel_h__ */
|
@ -1,45 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __IRPCall_h__
|
||||
#define __IRPCall_h__
|
||||
#include "nsISupports.h"
|
||||
#include "xptcall.h"
|
||||
#include "rproxydefs.h"
|
||||
|
||||
// {59678952-A52B-11d3-837C-0004AC56C49E}
|
||||
#define IRPCALL_IID\
|
||||
{ 0x59678952, 0xa52b, 0x11d3, { 0x83, 0x7c, 0x0, 0x4, 0xac, 0x56, 0xc4, 0x9e } }
|
||||
|
||||
class IRPCall : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(IRPCALL_IID)
|
||||
NS_IMETHOD Marshal(const nsIID &iid, OID oid, PRUint16 methodIndex,
|
||||
const nsXPTMethodInfo* info,
|
||||
nsXPTCMiniVariant* params) = 0;
|
||||
NS_IMETHOD Marshal() = 0;
|
||||
NS_IMETHOD Demarshal(void * data, PRUint32 size) = 0;
|
||||
NS_IMETHOD GetRawData(void ** data, PRUint32 *size) = 0;
|
||||
//you should not free(params)
|
||||
NS_IMETHOD GetXPTCData(OID *oid,PRUint32 *methodIndex,
|
||||
PRUint32 *paramCount, nsXPTCVariant** params, nsresult **result) = 0;
|
||||
|
||||
};
|
||||
#endif /* __IRPCall_h__ */
|
@ -1,37 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __ITransport_h__
|
||||
#define __ITransport_h__
|
||||
#include "nsISupports.h"
|
||||
|
||||
// {59678953-A52B-11d3-837C-0004AC56C49E}
|
||||
#define ITRANSPORT_IID \
|
||||
{ 0x59678953, 0xa52b, 0x11d3, { 0x83, 0x7c, 0x0, 0x4, 0xac, 0x56, 0xc4, 0x9e } }
|
||||
|
||||
class ITransport : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(ITRANSPORT_IID)
|
||||
NS_IMETHOD Read(void** data, PRUint32 * size) = 0;
|
||||
NS_IMETHOD Write(void* data, PRUint32 size) = 0;
|
||||
};
|
||||
|
||||
#endif /* __ITransport_h__ */
|
||||
|
@ -1,55 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = ../../..
|
||||
srcdir = .
|
||||
VPATH = .
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
LIBRARY_NAME = rpccommon
|
||||
EXPORT_LIBRARY = 1
|
||||
MODULE = rpccommon
|
||||
|
||||
|
||||
CPPSRCS = \
|
||||
IPCbridge.cpp \
|
||||
Queue.cpp \
|
||||
TransportImpl.cpp \
|
||||
MarshalToolkitImpl.cpp \
|
||||
RPCallImpl.cpp \
|
||||
$(NULL)
|
||||
|
||||
|
||||
LIBS = \
|
||||
-lxpcom \
|
||||
-lxptinfo \
|
||||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
|
||||
|
@ -1,307 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <iostream.h>
|
||||
#include "MarshalToolkitImpl.h"
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS0(MarshalToolkitImpl)
|
||||
|
||||
|
||||
MarshalToolkitImpl::MarshalToolkitImpl(void) {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
MarshalToolkitImpl::~MarshalToolkitImpl() {
|
||||
}
|
||||
|
||||
PRInt16 MarshalToolkitImpl::GetSimpleSize(nsXPTType *type) {
|
||||
PRInt16 size = -1;
|
||||
switch(type->TagPart()) {
|
||||
case nsXPTType::T_I8:
|
||||
case nsXPTType::T_U8:
|
||||
size = sizeof(PRInt8);
|
||||
break;
|
||||
case nsXPTType::T_I16:
|
||||
case nsXPTType::T_U16:
|
||||
size = sizeof(PRInt16);
|
||||
break;
|
||||
case nsXPTType::T_I32:
|
||||
case nsXPTType::T_U32:
|
||||
size = sizeof(PRInt32);
|
||||
break;
|
||||
case nsXPTType::T_I64:
|
||||
case nsXPTType::T_U64:
|
||||
size = sizeof(PRInt64);
|
||||
break;
|
||||
case nsXPTType::T_FLOAT:
|
||||
size = sizeof(float);
|
||||
break;
|
||||
case nsXPTType::T_DOUBLE:
|
||||
size = sizeof(double);
|
||||
break;
|
||||
case nsXPTType::T_BOOL:
|
||||
size = sizeof(PRBool);
|
||||
break;
|
||||
case nsXPTType::T_CHAR:
|
||||
size = sizeof(char);
|
||||
break;
|
||||
case nsXPTType::T_WCHAR:
|
||||
size = sizeof(PRUnichar);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP MarshalToolkitImpl::ReadSimple(istream *in, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, nsIAllocator * allocator) {
|
||||
PRInt16 size = GetSimpleSize(type);
|
||||
if (size <= 0 ) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
void * data = NULL;
|
||||
if (isOut) {
|
||||
if (allocator) {
|
||||
value->val.p = allocator->Alloc(size);
|
||||
}
|
||||
data = value->val.p;
|
||||
} else {
|
||||
data = value;
|
||||
}
|
||||
in->read((char*)data,size);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP MarshalToolkitImpl::WriteSimple(ostream *out, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut) {
|
||||
PRInt16 size = GetSimpleSize(type);
|
||||
if (size <= 0 ) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
void *data = (isOut)? value->val.p : value;
|
||||
out->write((const char*)data,size);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP MarshalToolkitImpl::ReadIID(istream *in, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, nsIAllocator * allocator) {
|
||||
void * data = malloc(sizeof(nsIID)); // nb I guess it is more convinient
|
||||
if (isOut) {
|
||||
if (allocator) {
|
||||
value->val.p = allocator->Alloc(sizeof(void*));
|
||||
}
|
||||
memcpy(value->val.p,(void *)&data,sizeof(void*));
|
||||
} else {
|
||||
value->val.p = data;
|
||||
}
|
||||
in->read((char*)data,sizeof(nsIID));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP MarshalToolkitImpl::WriteIID(ostream *out, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut) {
|
||||
void * data = NULL;
|
||||
if (isOut) {
|
||||
memcpy((void *)&data, value->val.p, sizeof(void*));
|
||||
} else {
|
||||
data = value->val.p;
|
||||
}
|
||||
out->write((const char*)data, sizeof(nsIID));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP MarshalToolkitImpl::ReadString(istream *in, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut,
|
||||
nsIAllocator * allocator) {
|
||||
PRUint32 length;
|
||||
void *data = NULL;
|
||||
PRBool isStringWithSize = PR_FALSE;
|
||||
in->read((char*)&length, sizeof(PRUint32)); //length 0 means NULL string
|
||||
PRUint32 actualLength = 0;
|
||||
if (length) {
|
||||
switch (type->TagPart()) {
|
||||
case nsXPTType::T_CHAR_STR:
|
||||
case nsXPTType::T_WCHAR_STR:
|
||||
actualLength = length;
|
||||
break;
|
||||
case nsXPTType::T_PSTRING_SIZE_IS:
|
||||
case nsXPTType::T_PWSTRING_SIZE_IS:
|
||||
isStringWithSize = PR_TRUE;
|
||||
actualLength = length - 1 ; //length could not be less than 2. It is impossible to have empty ("") string for this case
|
||||
break;
|
||||
default:
|
||||
return NS_ERROR_FAILURE;
|
||||
};
|
||||
data = malloc(actualLength);
|
||||
}
|
||||
|
||||
if (isOut) {
|
||||
if (allocator) {
|
||||
value->val.p = allocator->Alloc(sizeof(void*));
|
||||
}
|
||||
memcpy(value->val.p,(void *)&data,sizeof(void*));
|
||||
} else {
|
||||
value->val.p = data;
|
||||
}
|
||||
if (length-1 > 0) {
|
||||
in->read((char*)data,length-1);
|
||||
}
|
||||
if (!isStringWithSize
|
||||
&& length) {
|
||||
((char*)data)[length-1]=0;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP MarshalToolkitImpl::WriteString(ostream *out, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, PRInt32 size) {
|
||||
void * data = NULL;
|
||||
if (isOut) {
|
||||
memcpy((void *)&data, value->val.p, sizeof(void*));
|
||||
} else {
|
||||
data = value->val.p;
|
||||
}
|
||||
PRUint32 length = 0;
|
||||
if (!data) {
|
||||
out->write((const char*)&length,sizeof(PRUint32));
|
||||
return NS_OK;
|
||||
}
|
||||
switch (type->TagPart()) {
|
||||
case nsXPTType::T_CHAR_STR:
|
||||
case nsXPTType::T_WCHAR_STR:
|
||||
length = strlen((char*)data);
|
||||
break;
|
||||
case nsXPTType::T_PSTRING_SIZE_IS:
|
||||
case nsXPTType::T_PWSTRING_SIZE_IS:
|
||||
length = size;
|
||||
break;
|
||||
default:
|
||||
return NS_ERROR_FAILURE;
|
||||
};
|
||||
length++; //0 for NULL, 1 for "", etc.
|
||||
out->write((const char*)&length,sizeof(PRUint32));
|
||||
out->write((const char*)data, length-1);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP MarshalToolkitImpl::ReadInterface(istream *in, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, nsIID * iid,
|
||||
nsIAllocator * allocator) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP MarshalToolkitImpl::WriteInterface(ostream *out, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, nsIID * iid) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP MarshalToolkitImpl::ReadArray(istream *in, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, nsXPTType * datumType, nsIAllocator * allocator) {
|
||||
PRUint32 length;
|
||||
in->read((char*)&length,sizeof(PRUint32));
|
||||
PRInt16 elemSize = GetSimpleSize(datumType);
|
||||
if(elemSize<0) { //not simple
|
||||
elemSize = sizeof(void*); //it has to be a pointer
|
||||
}
|
||||
void * data = malloc(elemSize*length);
|
||||
if (isOut) {
|
||||
if (allocator) {
|
||||
value->val.p = allocator->Alloc(sizeof(void*));
|
||||
}
|
||||
memcpy(value->val.p,(void *)&data,sizeof(void*));
|
||||
} else {
|
||||
value->val.p = data;
|
||||
}
|
||||
char *current = (char*)data;
|
||||
nsIID iid;
|
||||
for (int i = 0; i < length;i++) {
|
||||
switch(datumType->TagPart()) {
|
||||
case nsXPTType::T_I8 :
|
||||
case nsXPTType::T_I16 :
|
||||
case nsXPTType::T_I32 :
|
||||
case nsXPTType::T_I64 :
|
||||
case nsXPTType::T_U8 :
|
||||
case nsXPTType::T_U16 :
|
||||
case nsXPTType::T_U32 :
|
||||
case nsXPTType::T_U64 :
|
||||
case nsXPTType::T_FLOAT :
|
||||
case nsXPTType::T_DOUBLE :
|
||||
case nsXPTType::T_BOOL :
|
||||
case nsXPTType::T_CHAR :
|
||||
case nsXPTType::T_WCHAR :
|
||||
ReadSimple(in,(nsXPTCMiniVariant*)current,datumType,PR_FALSE,allocator);
|
||||
break;
|
||||
case nsXPTType::T_IID :
|
||||
ReadIID(in,(nsXPTCMiniVariant*)current,datumType,PR_FALSE,allocator);
|
||||
break;
|
||||
case nsXPTType::T_CHAR_STR :
|
||||
case nsXPTType::T_WCHAR_STR :
|
||||
ReadString(in,(nsXPTCMiniVariant*)current,datumType,PR_FALSE,allocator);
|
||||
break;
|
||||
case nsXPTType::T_INTERFACE : //nb
|
||||
break;
|
||||
default:
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
current += elemSize;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP MarshalToolkitImpl::WriteArray(ostream *out, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, nsXPTType * datumType, PRUint32 length) {
|
||||
PRInt16 elemSize = GetSimpleSize(datumType);
|
||||
if(elemSize < 0) { //not simple
|
||||
elemSize = sizeof(void*); //it has to be a pointer
|
||||
}
|
||||
char *current = NULL;
|
||||
if (isOut) {
|
||||
memcpy(¤t,value->val.p,sizeof(void*));
|
||||
} else {
|
||||
current = (char*)value->val.p;
|
||||
}
|
||||
out->write((char*)&length,sizeof(PRUint32));
|
||||
for (int i = 0; i < length;i++) {
|
||||
switch(datumType->TagPart()) {
|
||||
case nsXPTType::T_I8 :
|
||||
case nsXPTType::T_I16 :
|
||||
case nsXPTType::T_I32 :
|
||||
case nsXPTType::T_I64 :
|
||||
case nsXPTType::T_U8 :
|
||||
case nsXPTType::T_U16 :
|
||||
case nsXPTType::T_U32 :
|
||||
case nsXPTType::T_U64 :
|
||||
case nsXPTType::T_FLOAT :
|
||||
case nsXPTType::T_DOUBLE :
|
||||
case nsXPTType::T_BOOL :
|
||||
case nsXPTType::T_CHAR :
|
||||
case nsXPTType::T_WCHAR :
|
||||
WriteSimple(out,(nsXPTCMiniVariant*)current,datumType,PR_FALSE);
|
||||
break;
|
||||
case nsXPTType::T_IID :
|
||||
WriteIID(out,(nsXPTCMiniVariant*)current,datumType,PR_FALSE);
|
||||
break;
|
||||
case nsXPTType::T_CHAR_STR :
|
||||
case nsXPTType::T_WCHAR_STR :
|
||||
WriteString(out,(nsXPTCMiniVariant*)current,datumType,PR_FALSE);
|
||||
break;
|
||||
case nsXPTType::T_INTERFACE : //nb
|
||||
break;
|
||||
default:
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
current += elemSize;
|
||||
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __MarshalToolkitImpl_h__
|
||||
#define __MarshalToolkitImpl_h__
|
||||
#include "nsISupports.h"
|
||||
#include "xptcall.h"
|
||||
#include "IMarshalToolkit.h"
|
||||
|
||||
class MarshalToolkitImpl : public IMarshalToolkit {
|
||||
NS_DECL_ISUPPORTS
|
||||
/* nsXPTType::T_I8, nsXPTType::T_U8, nsXPTType::T_I16, nsXPTType::T_U16
|
||||
* nsXPTType::T_I32, nsXPTType::T_U32, nsXPTType::T_I64, nsXPTType::T_U64,
|
||||
* nsXPTType::T_FLOAT, nsXPTType::T_DOUBLE, nsXPTType::T_BOOL, nsXPTType::T_CHAR, nsXPTType::T_WCHAR,
|
||||
*/
|
||||
NS_IMETHOD ReadSimple(istream *in, nsXPTCMiniVariant *value,nsXPTType * type, PRBool isOut, nsIAllocator * allocator = NULL);
|
||||
NS_IMETHOD WriteSimple(ostream *out, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut);
|
||||
|
||||
/* nsXPTType::T_IID
|
||||
*/
|
||||
NS_IMETHOD ReadIID(istream *in, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, nsIAllocator * allocator = NULL);
|
||||
NS_IMETHOD WriteIID(ostream *out, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut);
|
||||
|
||||
/* case nsXPTType::T_CHAR_STR:
|
||||
* case nsXPTType::T_WCHAR_STR:
|
||||
* case nsXPTType::T_PSTRING_SIZE_IS:
|
||||
* case nsXPTType::T_PWSTRING_SIZE_IS:
|
||||
*/
|
||||
NS_IMETHOD ReadString(istream *in, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, nsIAllocator * allocator = NULL);
|
||||
NS_IMETHOD WriteString(ostream *out, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, PRInt32 size = -1);
|
||||
|
||||
/* nsXPTType::T_INTERFACE, nsXPTType::T_INTERFACE_IS
|
||||
*/
|
||||
NS_IMETHOD ReadInterface(istream *in, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, nsIID * iid = NULL,
|
||||
nsIAllocator * allocator = NULL);
|
||||
NS_IMETHOD WriteInterface(ostream *out, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, nsIID * iid = NULL);
|
||||
|
||||
/* nsXPTType::T_ARRAY
|
||||
*/
|
||||
NS_IMETHOD ReadArray(istream *in, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, nsXPTType * datumType, nsIAllocator * allocator = NULL);
|
||||
NS_IMETHOD WriteArray(ostream *out, nsXPTCMiniVariant *value, nsXPTType * type, PRBool isOut, nsXPTType * datumType, PRUint32 size);
|
||||
|
||||
MarshalToolkitImpl(void);
|
||||
virtual ~MarshalToolkitImpl();
|
||||
private:
|
||||
PRInt16 GetSimpleSize(nsXPTType *type);
|
||||
};
|
||||
#endif /* __MarshalToolkitImpl_h__ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,89 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#include "Queue.h"
|
||||
|
||||
struct QueueEntry {
|
||||
void * ptr;
|
||||
QueueEntry *next;
|
||||
QueueEntry *prev;
|
||||
QueueEntry(void* _ptr) {
|
||||
next = prev = NULL;
|
||||
ptr = _ptr;
|
||||
}
|
||||
};
|
||||
|
||||
Queue::Queue() {
|
||||
m_head = NULL;
|
||||
m_tail = NULL;
|
||||
m_lock = PR_NewLock();
|
||||
}
|
||||
|
||||
Queue::~Queue() {
|
||||
while (Get())
|
||||
;
|
||||
PR_DestroyLock(m_lock);
|
||||
}
|
||||
|
||||
nsresult Queue::Put(void *ptr) {
|
||||
PR_Lock(m_lock);
|
||||
QueueEntry* p = new QueueEntry(ptr);
|
||||
if (!m_tail) {
|
||||
m_tail = new QueueEntry(ptr);
|
||||
}
|
||||
else {
|
||||
m_tail->next = new QueueEntry(ptr);
|
||||
m_tail->next->prev = m_tail;
|
||||
m_tail = m_tail->next;
|
||||
}
|
||||
if (!m_head)
|
||||
m_head = m_tail;
|
||||
|
||||
PR_Unlock(m_lock);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void * Queue::Get() {
|
||||
void *res;
|
||||
PR_Lock(m_lock);
|
||||
|
||||
if (!m_head) {
|
||||
m_tail = NULL;
|
||||
PR_Unlock(m_lock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
QueueEntry* excluded;
|
||||
excluded = m_head;
|
||||
|
||||
if (m_head->next)
|
||||
m_head = m_head->next, m_head->prev = NULL;
|
||||
else
|
||||
m_head = m_tail = NULL;
|
||||
|
||||
|
||||
res = excluded->ptr;
|
||||
delete excluded;
|
||||
PR_Unlock(m_lock);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,40 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __Queue_h__
|
||||
#define __Queue_h__
|
||||
#include "nspr.h"
|
||||
#include "nsError.h"
|
||||
class QueueEntry;
|
||||
|
||||
class Queue {
|
||||
public:
|
||||
Queue();
|
||||
~Queue();
|
||||
void * Get();
|
||||
nsresult Put(void *);
|
||||
private:
|
||||
QueueEntry * m_head;
|
||||
QueueEntry * m_tail;
|
||||
PRLock * m_lock;
|
||||
};
|
||||
#endif /* __Queue_h__ */
|
||||
|
||||
|
@ -1,329 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <strstream.h>
|
||||
#include "RPCallImpl.h"
|
||||
#include "prmem.h"
|
||||
#include "nsIInterfaceInfoManager.h"
|
||||
#include "nsIInterfaceInfo.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(RPCallImpl, IRPCall)
|
||||
|
||||
RPCallImpl::RPCallImpl(IMarshalToolkit * _marshalToolkit) {
|
||||
NS_INIT_REFCNT();
|
||||
params = NULL;
|
||||
info = NULL;
|
||||
oid = 0;
|
||||
bundle = NULL;
|
||||
size = 0;
|
||||
callSide = unDefined;
|
||||
interfaceInfo = NULL;
|
||||
result = NS_ERROR_FAILURE;
|
||||
marshalToolkit = _marshalToolkit;
|
||||
}
|
||||
|
||||
RPCallImpl::~RPCallImpl() {
|
||||
if (params) {
|
||||
free(params);
|
||||
}
|
||||
|
||||
if (bundle) {
|
||||
free(bundle);
|
||||
}
|
||||
NS_IF_RELEASE(interfaceInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP RPCallImpl::Marshal(const nsIID &_iid, OID _oid, PRUint16 _methodIndex,
|
||||
const nsXPTMethodInfo* _info,
|
||||
nsXPTCMiniVariant* _params) {
|
||||
if (callSide == unDefined) {
|
||||
callSide = onClient;
|
||||
}
|
||||
iid = _iid;
|
||||
oid = _oid;
|
||||
nsIInterfaceInfoManager *iimgr = NULL;
|
||||
iimgr = XPTI_GetInterfaceInfoManager();
|
||||
if (!iimgr) {
|
||||
return NS_ERROR_FAILURE; //nb how are we going to handle critical errors?
|
||||
}
|
||||
if (NS_FAILED(iimgr->GetInfoForIID(&iid, &interfaceInfo))) {
|
||||
NS_IF_RELEASE(iimgr);
|
||||
printf("--RemoteObjectProxy::GetInterfaceInfo NS_ERROR_FAILURE 1 \n");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_IF_RELEASE(iimgr);
|
||||
|
||||
methodIndex = _methodIndex;
|
||||
info = (nsXPTMethodInfo*) _info;
|
||||
paramCount = info->GetParamCount();
|
||||
if (paramCount > 0) {
|
||||
params = (nsXPTCVariant*)malloc(sizeof(nsXPTCVariant) * paramCount);
|
||||
if (params == nsnull) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
for (int i = 0; i < paramCount; i++) {
|
||||
(params)[i].Init(_params[i], info->GetParam(i).GetType());
|
||||
if (info->GetParam(i).IsOut()) {
|
||||
params[i].flags |= nsXPTCVariant::PTR_IS_DATA;
|
||||
params[i].ptr = params[i].val.p = _params[i].val.p;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Marshal();
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP RPCallImpl::Marshal(void) {
|
||||
ostrstream out;
|
||||
if (callSide == onClient) {
|
||||
out.write((const char *)&iid, sizeof(nsIID));
|
||||
out.write((const char *)&oid, sizeof(OID));
|
||||
out.write((const char *)&methodIndex, sizeof(PRUint16));
|
||||
}
|
||||
for (int i = 0; i < paramCount; i++) {
|
||||
nsXPTParamInfo param = info->GetParam(i);
|
||||
nsXPTType type = param.GetType();
|
||||
PRBool isOut = param.IsOut();
|
||||
if ((callSide == onClient && !param.IsIn())
|
||||
|| (callSide == onServer && !param.IsOut())) {
|
||||
continue;
|
||||
}
|
||||
nsXPTCVariant *value = & params[i];
|
||||
switch(type.TagPart()) {
|
||||
case nsXPTType::T_I8 :
|
||||
case nsXPTType::T_I16 :
|
||||
case nsXPTType::T_I32 :
|
||||
case nsXPTType::T_I64 :
|
||||
case nsXPTType::T_U8 :
|
||||
case nsXPTType::T_U16 :
|
||||
case nsXPTType::T_U32 :
|
||||
case nsXPTType::T_U64 :
|
||||
case nsXPTType::T_FLOAT :
|
||||
case nsXPTType::T_DOUBLE :
|
||||
case nsXPTType::T_BOOL :
|
||||
case nsXPTType::T_CHAR :
|
||||
case nsXPTType::T_WCHAR :
|
||||
marshalToolkit->WriteSimple(&out,value,&type,isOut);
|
||||
break;
|
||||
case nsXPTType::T_IID :
|
||||
marshalToolkit->WriteIID(&out,value,&type,isOut);
|
||||
break;
|
||||
case nsXPTType::T_CHAR_STR :
|
||||
case nsXPTType::T_WCHAR_STR :
|
||||
marshalToolkit->WriteString(&out,value,&type,isOut);
|
||||
break;
|
||||
case nsXPTType::T_INTERFACE :
|
||||
case nsXPTType::T_INTERFACE_IS :
|
||||
marshalToolkit->WriteInterface(&out,value,&type,isOut,NULL);
|
||||
break;
|
||||
case nsXPTType::T_PSTRING_SIZE_IS:
|
||||
case nsXPTType::T_PWSTRING_SIZE_IS:
|
||||
case nsXPTType::T_ARRAY:
|
||||
{
|
||||
PRUint32 arraySize;
|
||||
if(!GetArraySizeFromParam(interfaceInfo,info,param,methodIndex,i,params,GET_LENGTH, &arraySize)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (type.TagPart() == nsXPTType::T_ARRAY) {
|
||||
nsXPTType datumType;
|
||||
if(NS_FAILED(interfaceInfo->GetTypeForParam(methodIndex, ¶m, 1,&datumType))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
marshalToolkit->WriteArray(&out,value,&type,isOut,&datumType,arraySize);
|
||||
} else {
|
||||
marshalToolkit->WriteString(&out,value,&type,isOut, arraySize);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
if (callSide == onServer) {
|
||||
out.write((const char*)&result,sizeof(nsresult));
|
||||
}
|
||||
size = out.pcount();
|
||||
bundle = malloc(size);
|
||||
memcpy(bundle,out.str(),size);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RPCallImpl::Demarshal(void * data, PRUint32 _size) {
|
||||
if(callSide == unDefined) {
|
||||
callSide = onServer;
|
||||
}
|
||||
istrstream in((const char*)data,_size);
|
||||
nsIAllocator * allocator = NULL;
|
||||
if (callSide == onServer) {
|
||||
in.read((char*)&iid,sizeof(nsIID));
|
||||
in.read((char*)&oid,sizeof(OID));
|
||||
in.read((char*)&methodIndex,sizeof(PRUint16));
|
||||
nsIInterfaceInfoManager *iimgr = NULL;
|
||||
iimgr = XPTI_GetInterfaceInfoManager();
|
||||
if (!iimgr) {
|
||||
return NS_ERROR_FAILURE; //nb how are we going to handle critical errors?
|
||||
}
|
||||
if (NS_FAILED(iimgr->GetInfoForIID(&iid, &interfaceInfo))) {
|
||||
NS_IF_RELEASE(iimgr);
|
||||
printf("--RemoteObjectProxy::GetInterfaceInfo NS_ERROR_FAILURE 1 \n");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_IF_RELEASE(iimgr);
|
||||
interfaceInfo->GetMethodInfo(methodIndex,(const nsXPTMethodInfo**)&info);
|
||||
paramCount = info->GetParamCount();
|
||||
if (paramCount > 0) {
|
||||
params = (nsXPTCVariant*)malloc(sizeof(nsXPTCVariant) * paramCount);
|
||||
if (params == nsnull) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
allocator = nsAllocator::GetGlobalAllocator();
|
||||
}
|
||||
for (int i = 0; i < paramCount; i++) {
|
||||
nsXPTParamInfo param = info->GetParam(i);
|
||||
PRBool isOut = param.IsOut();
|
||||
nsXPTCMiniVariant tmpValue = params[i]; //we need to set value for client side
|
||||
nsXPTCMiniVariant * value;
|
||||
value = &tmpValue;
|
||||
nsXPTType type = param.GetType();
|
||||
if ( (callSide == onServer && !param.IsIn()
|
||||
|| (callSide == onClient && !param.IsOut()))){
|
||||
if (callSide == onServer) { //we need to allocate memory for out parametr
|
||||
value->val.p = allocator->Alloc(sizeof(nsXPTCMiniVariant)); // sizeof(nsXPTCMiniVariant) is good
|
||||
params[i].Init(*value,type);
|
||||
params[i].ptr = params[i].val.p = value->val.p;
|
||||
params[i].flags |= nsXPTCVariant::PTR_IS_DATA;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
switch(type.TagPart()) {
|
||||
case nsXPTType::T_I8 :
|
||||
case nsXPTType::T_I16 :
|
||||
case nsXPTType::T_I32 :
|
||||
case nsXPTType::T_I64 :
|
||||
case nsXPTType::T_U8 :
|
||||
case nsXPTType::T_U16 :
|
||||
case nsXPTType::T_U32 :
|
||||
case nsXPTType::T_U64 :
|
||||
case nsXPTType::T_FLOAT :
|
||||
case nsXPTType::T_DOUBLE :
|
||||
case nsXPTType::T_BOOL :
|
||||
case nsXPTType::T_CHAR :
|
||||
case nsXPTType::T_WCHAR :
|
||||
marshalToolkit->ReadSimple(&in,value,&type,isOut,allocator);
|
||||
break;
|
||||
case nsXPTType::T_IID :
|
||||
marshalToolkit->ReadIID(&in,value,&type,isOut,allocator);
|
||||
break;
|
||||
|
||||
case nsXPTType::T_PSTRING_SIZE_IS:
|
||||
case nsXPTType::T_PWSTRING_SIZE_IS:
|
||||
case nsXPTType::T_CHAR_STR :
|
||||
case nsXPTType::T_WCHAR_STR :
|
||||
marshalToolkit->ReadString(&in,value,&type,isOut,allocator);
|
||||
break;
|
||||
case nsXPTType::T_INTERFACE :
|
||||
case nsXPTType::T_INTERFACE_IS :
|
||||
marshalToolkit->ReadInterface(&in,value,&type,isOut,NULL,allocator);
|
||||
break;
|
||||
|
||||
case nsXPTType::T_ARRAY:
|
||||
{
|
||||
nsXPTType datumType;
|
||||
if(NS_FAILED(interfaceInfo->GetTypeForParam(methodIndex, ¶m, 1,&datumType))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
marshalToolkit->ReadArray(&in,value,&type,isOut,&datumType,allocator);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
params[i].Init(*value,type);
|
||||
if (isOut) {
|
||||
params[i].flags |= nsXPTCVariant::PTR_IS_DATA;
|
||||
params[i].ptr = params[i].val.p = value->val.p;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RPCallImpl::GetRawData(void ** data, PRUint32 * _size) {
|
||||
if (!bundle) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*data = malloc(size);
|
||||
*_size = size;
|
||||
memcpy(*data,bundle,size);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//you should not free(params)
|
||||
NS_IMETHODIMP RPCallImpl::GetXPTCData(OID * _oid,PRUint32 *_methodIndex,
|
||||
PRUint32 *_paramCount, nsXPTCVariant** _params, nsresult ** _result) {
|
||||
*_oid = oid;
|
||||
*_methodIndex = methodIndex;
|
||||
*_paramCount = paramCount;
|
||||
*_params = params;
|
||||
*_result = &result;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PRBool RPCallImpl::GetArraySizeFromParam( nsIInterfaceInfo *interfaceInfo,
|
||||
const nsXPTMethodInfo* method,
|
||||
const nsXPTParamInfo& param,
|
||||
uint16 methodIndex,
|
||||
uint8 paramIndex,
|
||||
nsXPTCVariant* nativeParams,
|
||||
SizeMode mode,
|
||||
PRUint32* result) {
|
||||
//code borrowed from mozilla/js/src/xpconnect/src/xpcwrappedjsclass.cpp
|
||||
uint8 argnum;
|
||||
nsresult rv;
|
||||
if(mode == GET_SIZE) {
|
||||
rv = interfaceInfo->GetSizeIsArgNumberForParam(methodIndex, ¶m, 0, &argnum);
|
||||
} else {
|
||||
rv = interfaceInfo->GetLengthIsArgNumberForParam(methodIndex, ¶m, 0, &argnum);
|
||||
}
|
||||
if(NS_FAILED(rv)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
const nsXPTParamInfo& arg_param = method->GetParam(argnum);
|
||||
const nsXPTType& arg_type = arg_param.GetType();
|
||||
|
||||
// XXX require PRUint32 here - need to require in compiler too!
|
||||
if(arg_type.IsPointer() || arg_type.TagPart() != nsXPTType::T_U32)
|
||||
return PR_FALSE;
|
||||
|
||||
if(arg_param.IsOut())
|
||||
*result = *(PRUint32*)nativeParams[argnum].val.p;
|
||||
else
|
||||
*result = nativeParams[argnum].val.u32;
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -1,68 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __RPCallImpl_h__
|
||||
#define __RPCallImpl_h__
|
||||
#include "IRPCall.h"
|
||||
#include "IMarshalToolkit.h"
|
||||
|
||||
class ostream;
|
||||
class istream;
|
||||
class nsIInterfaceInfo;
|
||||
|
||||
class RPCallImpl : public IRPCall {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_IMETHOD Marshal(const nsIID &iid, OID oid, PRUint16 methodIndex,
|
||||
const nsXPTMethodInfo* info,
|
||||
nsXPTCMiniVariant* params);
|
||||
NS_IMETHOD Marshal(void);
|
||||
NS_IMETHOD Demarshal(void * data, PRUint32 size);
|
||||
NS_IMETHOD GetRawData(void ** data, PRUint32 *size);
|
||||
//you should not free(params)
|
||||
NS_IMETHOD GetXPTCData(OID *oid,PRUint32 *methodIndex,
|
||||
PRUint32 *paramCount, nsXPTCVariant** params, nsresult **result);
|
||||
RPCallImpl(IMarshalToolkit * _marshalToolkit);
|
||||
virtual ~RPCallImpl();
|
||||
protected:
|
||||
enum { unDefined, onServer, onClient } callSide;
|
||||
enum SizeMode { GET_SIZE, GET_LENGTH } ;
|
||||
nsIID iid;
|
||||
OID oid;
|
||||
PRUint16 methodIndex;
|
||||
nsXPTMethodInfo* info;
|
||||
nsXPTCVariant *params;
|
||||
PRUint32 paramCount;
|
||||
nsIInterfaceInfo * interfaceInfo;
|
||||
void *bundle;
|
||||
PRUint32 size;
|
||||
nsresult result;
|
||||
IMarshalToolkit * marshalToolkit;
|
||||
static PRBool GetArraySizeFromParam( nsIInterfaceInfo *interfaceInfo,
|
||||
const nsXPTMethodInfo* method,
|
||||
const nsXPTParamInfo& param,
|
||||
uint16 methodIndex,
|
||||
uint8 paramIndex,
|
||||
nsXPTCVariant* nativeParams,
|
||||
SizeMode mode,
|
||||
PRUint32* result);
|
||||
};
|
||||
|
||||
#endif /* __RPCallImpl_h__ */
|
@ -1,59 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#include "TransportImpl.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(TransportImpl, ITransport)
|
||||
|
||||
NS_IMETHODIMP TransportImpl::Read(void** data, PRUint32 * size) {
|
||||
if(!bridge) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
*size = bridge->Read(data);
|
||||
if (*size > 0) {
|
||||
printf("--TransportImpl::Read size %d\n",*size);
|
||||
}
|
||||
return (*size > 0 ) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP TransportImpl::Write(void* data, PRUint32 size) {
|
||||
if(!bridge) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (!bridge->Write(size,data)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
printf("--TransportImpl::Write size %d\n",size);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
TransportImpl::TransportImpl(const char* serverName) {
|
||||
NS_INIT_REFCNT();
|
||||
bridge = new IPCBridge(serverName);
|
||||
}
|
||||
|
||||
TransportImpl::~TransportImpl() {
|
||||
if (bridge) {
|
||||
delete bridge;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,36 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __TransportImpl_h__
|
||||
#define __TransportImpl_h__
|
||||
#include "ITransport.h"
|
||||
#include "IPCbridge.h"
|
||||
|
||||
class TransportImpl : public ITransport {
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_IMETHOD Read(void** data, PRUint32 * size);
|
||||
NS_IMETHOD Write(void* data, PRUint32 size);
|
||||
TransportImpl(const char* serverName = NULL);
|
||||
virtual ~TransportImpl();
|
||||
protected:
|
||||
IPCBridge * bridge; //nb temporary
|
||||
};
|
||||
#endif /* __TransportImpl_h__ */
|
||||
|
@ -1,27 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __rproxydefs_h__
|
||||
#define __rproxydefs_h__
|
||||
#include "prtypes.h"
|
||||
|
||||
typedef PRInt32 OID;
|
||||
|
||||
#endif /* __rproxydefs_h__ */
|
@ -1,173 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#include "DispatcherImpl.h"
|
||||
#include "RPCServerService.h"
|
||||
#include "IRPCChannel.h"
|
||||
#include "xptcall.h"
|
||||
|
||||
class ObjectDescription {
|
||||
public:
|
||||
nsISupports* p;
|
||||
OID oid;
|
||||
public:
|
||||
ObjectDescription(nsISupports *_p, OID _oid) {
|
||||
p = _p; oid = _oid;
|
||||
}
|
||||
~ObjectDescription() {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS1(DispatcherImpl, IDispatcher)
|
||||
|
||||
|
||||
DispatcherImpl::DispatcherImpl()
|
||||
: m_objects(NULL), m_currentOID(0)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
DispatcherImpl::~DispatcherImpl() {
|
||||
PRUint32 size = m_objects->GetSize();
|
||||
for (PRUint32 i = 0; i < size; i++) {
|
||||
ObjectDescription* obj = (ObjectDescription*)(*m_objects)[i];
|
||||
delete obj;
|
||||
}
|
||||
delete m_objects;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DispatcherImpl::Dispatch(IRPCall *call) {
|
||||
RPCServerService * rpcService = RPCServerService::GetInstance();
|
||||
IRPCChannel *channel = NULL;
|
||||
OID oid;
|
||||
PRUint32 methodIndex;
|
||||
PRUint32 paramCount;
|
||||
nsXPTCVariant* params;
|
||||
nsresult *result;
|
||||
call->GetXPTCData(&oid,&methodIndex, ¶mCount, ¶ms, &result);
|
||||
nsISupports * p = NULL;
|
||||
OIDToPointer(&p,oid);
|
||||
*result = XPTC_InvokeByIndex(p, methodIndex,
|
||||
paramCount, params);
|
||||
call->Marshal();
|
||||
rpcService->GetRPCChannel(&channel);
|
||||
channel->SendReceive(call);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DispatcherImpl::OIDToPointer(nsISupports **_p,OID _oid) {
|
||||
|
||||
PRUint32 size = m_objects->GetSize();
|
||||
PRUint32 i;
|
||||
ObjectDescription* desc;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
desc = (ObjectDescription*)(*m_objects)[i];
|
||||
if (desc->oid == _oid) {
|
||||
*_p = desc->p;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DispatcherImpl:: PointerToOID(OID *_oid, nsISupports *_p) {
|
||||
PRUint32 size = m_objects->GetSize();
|
||||
PRUint32 i;
|
||||
ObjectDescription* desc;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
desc = (ObjectDescription*)(*m_objects)[i];
|
||||
if (desc->p == _p) {
|
||||
*_oid = desc->oid;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DispatcherImpl::RegisterWithOID(nsISupports *_p, OID _oid) {
|
||||
|
||||
if (_p == NULL)
|
||||
return NS_OK;
|
||||
if (m_objects == NULL) {
|
||||
m_objects = new nsVector();
|
||||
if (m_objects == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
ObjectDescription* desc = new ObjectDescription(_p, _oid);
|
||||
PRUint32 size = m_objects->GetSize();
|
||||
PRUint32 i, rv;
|
||||
rv = -1;
|
||||
for (i = 0; i < size; i++) {
|
||||
if ((*m_objects)[i] == NULL) {
|
||||
fprintf(stderr, "Adding %p to index %d\n", desc, i);
|
||||
(*m_objects)[i] = desc, rv = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= size) {
|
||||
fprintf(stderr, "Adding %p to the end\n", desc);
|
||||
rv = m_objects->Add(desc);
|
||||
}
|
||||
return rv == -1 ? NS_ERROR_FAILURE : NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP DispatcherImpl::UnregisterWithOID(nsISupports *_p, OID _oid) {
|
||||
|
||||
if (_p == NULL)
|
||||
return NS_OK;
|
||||
|
||||
PRUint32 size = m_objects->GetSize();
|
||||
PRUint32 i, rv;
|
||||
rv = -1;
|
||||
for (i = 0; i < size; i++) {
|
||||
ObjectDescription* desc = (ObjectDescription*)(*m_objects)[i];
|
||||
if (desc == NULL) continue;
|
||||
if (desc->oid == _oid) {
|
||||
// this is kind of security measure :)
|
||||
if (desc->p == _p) {
|
||||
delete desc;
|
||||
(*m_objects)[i] = NULL;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DispatcherImpl::GetOID(OID *_oid) {
|
||||
*_oid = --m_currentOID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,47 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __DispatcherImpl_h__
|
||||
#define __DispatcherImpl_h__
|
||||
#include "nsISupports.h"
|
||||
#include "IRPCall.h"
|
||||
#include "IDispatcher.h"
|
||||
#include "rproxydefs.h"
|
||||
#include "nsVector.h"
|
||||
|
||||
class DispatcherImpl : public IDispatcher {
|
||||
public :
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_IMETHOD Dispatch(IRPCall *call);
|
||||
NS_IMETHOD OIDToPointer(nsISupports **p,OID oid);
|
||||
NS_IMETHOD PointerToOID(OID *oid, nsISupports *p);
|
||||
NS_IMETHOD RegisterWithOID(nsISupports *p, OID oid);
|
||||
NS_IMETHOD UnregisterWithOID(nsISupports *p, OID oid);
|
||||
NS_IMETHOD GetOID(OID *oid);
|
||||
DispatcherImpl();
|
||||
virtual ~DispatcherImpl();
|
||||
private:
|
||||
nsVector* m_objects; // vector of registred objects
|
||||
OID m_currentOID;
|
||||
};
|
||||
#endif /* __DispatcherImpl_h__ */
|
||||
|
||||
|
||||
|
@ -1,42 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __IDispatcher_h__
|
||||
#define __IDispatcher_h__
|
||||
#include "nsISupports.h"
|
||||
#include "IRPCall.h"
|
||||
#include "rproxydefs.h"
|
||||
|
||||
|
||||
// {59678955-A52B-11d3-837C-0004AC56C49E}
|
||||
#define IDISPATCHER_IID \
|
||||
{ 0x59678955, 0xa52b, 0x11d3, { 0x83, 0x7c, 0x0, 0x4, 0xac, 0x56, 0xc4, 0x9e } }
|
||||
|
||||
class IDispatcher : public nsISupports {
|
||||
public :
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(IDISPATCHER_IID)
|
||||
NS_IMETHOD Dispatch(IRPCall *call) = 0;
|
||||
NS_IMETHOD OIDToPointer(nsISupports **p,OID oid) = 0;
|
||||
NS_IMETHOD PointerToOID(OID *oid, nsISupports *p) = 0;
|
||||
NS_IMETHOD RegisterWithOID(nsISupports *p, OID oid) = 0;
|
||||
NS_IMETHOD UnregisterWithOID(nsISupports *p, OID oid) = 0;
|
||||
NS_IMETHOD GetOID(OID *oid) = 0;
|
||||
};
|
||||
#endif /* __IDispatcher_h__ */
|
@ -1,56 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = ../../..
|
||||
srcdir = .
|
||||
VPATH = .
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
LIBRARY_NAME = rpcserver
|
||||
EXPORT_LIBRARY = 1
|
||||
MODULE = rpcserver
|
||||
|
||||
|
||||
|
||||
CPPSRCS = \
|
||||
DispatcherImpl.cpp \
|
||||
RPCChannelServerImpl.cpp\
|
||||
RPCServerService.cpp \
|
||||
$(NULL)
|
||||
|
||||
INCLUDES += -I../common/
|
||||
|
||||
LIBS = \
|
||||
-lxpcom \
|
||||
-lxptinfo \
|
||||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
|
||||
|
@ -1,119 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#include "nsISupports.h"
|
||||
#include "RPCChannelServerImpl.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsIRunnable.h"
|
||||
#include "RPCServerService.h"
|
||||
#include "Queue.h"
|
||||
#include "IDispatcher.h"
|
||||
|
||||
|
||||
class RPCChannelRunner : public nsIRunnable {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_IMETHOD Run() {
|
||||
while(1) { //nb
|
||||
rpcChannel->SendReceive(NULL);
|
||||
PR_Sleep(100);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
RPCChannelRunner(IRPCChannel *_rpcChannel) {
|
||||
NS_INIT_REFCNT();
|
||||
rpcChannel = _rpcChannel;
|
||||
NS_ADDREF(rpcChannel);
|
||||
}
|
||||
virtual ~RPCChannelRunner() {
|
||||
NS_IF_RELEASE(rpcChannel);
|
||||
}
|
||||
private:
|
||||
IRPCChannel * rpcChannel;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(RPCChannelRunner, nsIRunnable)
|
||||
NS_IMPL_ISUPPORTS1(RPCChannelServerImpl, IRPCChannel)
|
||||
|
||||
|
||||
|
||||
|
||||
RPCChannelServerImpl::RPCChannelServerImpl(ITransport * _transport) {
|
||||
NS_INIT_REFCNT();
|
||||
transport = _transport;
|
||||
queue = new Queue();
|
||||
rawData = NULL;
|
||||
dispatcher = NULL;
|
||||
service = NULL;
|
||||
|
||||
NS_NewThread(&thread,new RPCChannelRunner(this));
|
||||
}
|
||||
|
||||
RPCChannelServerImpl::~RPCChannelServerImpl() {
|
||||
NS_IF_RELEASE(dispatcher);
|
||||
NS_IF_RELEASE(thread);
|
||||
NS_IF_RELEASE(transport);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RPCChannelServerImpl::SendReceive(IRPCall * call) {
|
||||
if (call) {
|
||||
queue->Put(call);
|
||||
} else {
|
||||
if (!rawData) {
|
||||
IRPCall * call = (IRPCall*) queue->Get();
|
||||
if (call) {
|
||||
call->GetRawData(&rawData,&size);
|
||||
NS_RELEASE(call);
|
||||
}
|
||||
}
|
||||
if (rawData) {
|
||||
if (NS_SUCCEEDED(transport->Write(rawData,size))) {
|
||||
PR_Free(rawData);
|
||||
rawData = NULL;
|
||||
}
|
||||
}
|
||||
char *data;
|
||||
PRUint32 s;
|
||||
if (NS_SUCCEEDED(transport->Read((void**)&data,&s))) {
|
||||
IRPCall *call = NULL;
|
||||
if (!service) {
|
||||
service = RPCServerService::GetInstance();
|
||||
}
|
||||
service->CreateRPCall(&call);
|
||||
call->Demarshal(data,s); //nb error handling
|
||||
PR_Free(data);
|
||||
if (!dispatcher) {
|
||||
service->GetDispatcher(&dispatcher);
|
||||
}
|
||||
dispatcher->Dispatch(call);
|
||||
}
|
||||
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,48 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __RPCChannelServerImpl_h__
|
||||
#define __RPCChannelServerImpl_h__
|
||||
#include "IRPCChannel.h"
|
||||
#include "ITransport.h"
|
||||
#include "IRPCall.h"
|
||||
|
||||
class nsIThread;
|
||||
class Queue;
|
||||
class IDispatcher;
|
||||
class RPCServerService;
|
||||
|
||||
class RPCChannelServerImpl : public IRPCChannel {
|
||||
public:
|
||||
RPCChannelServerImpl(ITransport *transport);
|
||||
virtual ~RPCChannelServerImpl(void);
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_IMETHOD SendReceive(IRPCall * call);
|
||||
private:
|
||||
nsIThread * thread;
|
||||
ITransport *transport;
|
||||
IDispatcher *dispatcher;
|
||||
Queue * queue;
|
||||
RPCServerService *service;
|
||||
void * rawData;
|
||||
PRUint32 size;
|
||||
};
|
||||
#endif __RPCChannelServerImpl_h__
|
@ -1,108 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#include "RPCServerService.h"
|
||||
#include "RPCallImpl.h"
|
||||
#include "TransportImpl.h"
|
||||
#include "DispatcherImpl.h"
|
||||
#include "RPCChannelServerImpl.h"
|
||||
#include "MarshalToolkitImpl.h"
|
||||
|
||||
static IMarshalToolkit * marshalToolkit = new MarshalToolkitImpl();
|
||||
|
||||
RPCServerService * RPCServerService::instance = NULL;
|
||||
|
||||
RPCServerService * RPCServerService::GetInstance() {
|
||||
if (!instance) {
|
||||
instance = new RPCServerService();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RPCServerService::CreateRPCall(IRPCall **result) {
|
||||
if (!result) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*result = new RPCallImpl(marshalToolkit);
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RPCServerService::GetTransport(ITransport **result) {
|
||||
if (!result) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (!transport) {
|
||||
transport = new TransportImpl();
|
||||
if (!transport) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
NS_ADDREF(transport);
|
||||
*result = transport;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP RPCServerService::GetDispatcher(IDispatcher **result) {
|
||||
if (!result) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (!dispatcher) {
|
||||
dispatcher = new DispatcherImpl();
|
||||
if (!dispatcher) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
NS_ADDREF(dispatcher);
|
||||
*result = dispatcher;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP RPCServerService::GetRPCChannel(IRPCChannel **result) {
|
||||
nsresult rv = NS_OK;
|
||||
if (!result) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (!rpcChannel) {
|
||||
ITransport * _transport = NULL;
|
||||
if (NS_FAILED(rv = GetTransport(&_transport))) {
|
||||
return rv;
|
||||
}
|
||||
rpcChannel = new RPCChannelServerImpl(_transport);
|
||||
if (!rpcChannel) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
NS_ADDREF(rpcChannel);
|
||||
*result = rpcChannel;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
RPCServerService::RPCServerService() {
|
||||
transport = NULL;
|
||||
dispatcher = NULL;
|
||||
GetRPCChannel(&rpcChannel);
|
||||
}
|
||||
|
||||
RPCServerService::~RPCServerService() {
|
||||
NS_IF_RELEASE(rpcChannel);
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Sun Microsystems,
|
||||
* Inc. Portions created by Sun are
|
||||
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __RPCServerServoce_h__
|
||||
#define __RPCServerService_h__
|
||||
#include "nsISupports.h"
|
||||
#include "ITransport.h"
|
||||
#include "IRPCall.h"
|
||||
#include "IRPCChannel.h"
|
||||
#include "IDispatcher.h"
|
||||
|
||||
|
||||
class RPCServerService {
|
||||
public:
|
||||
static RPCServerService * GetInstance(void);
|
||||
~RPCServerService();
|
||||
NS_IMETHOD GetRPCChannel(IRPCChannel **channel);
|
||||
NS_IMETHOD GetDispatcher(IDispatcher **dispatcher);
|
||||
NS_IMETHOD CreateRPCall(IRPCall **rcall);
|
||||
protected:
|
||||
RPCServerService(void);
|
||||
NS_IMETHOD GetTransport(ITransport **transport);
|
||||
static RPCServerService * instance;
|
||||
ITransport * transport;
|
||||
IRPCChannel * rpcChannel;
|
||||
IDispatcher * dispatcher;
|
||||
};
|
||||
#endif /* __RPCServerService_h__ */
|
@ -1,64 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = ../../..
|
||||
srcdir = .
|
||||
VPATH = .
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
SIMPLE_PROGRAMS = clientIn serverIn \
|
||||
clientOut serverOut \
|
||||
clientInOut serverInOut \
|
||||
clientComb serverComb
|
||||
|
||||
XPIDL_MODULE = rpctest
|
||||
|
||||
XPIDLSRCS = nsIRPCTestIn.idl \
|
||||
nsIRPCTestOut.idl \
|
||||
nsIRPCTestInOut.idl \
|
||||
nsIRPCTestComb.idl
|
||||
|
||||
INCLUDES += -I../common -I../server -I../client
|
||||
|
||||
LIBRARY_NAME = common
|
||||
|
||||
CPPSRCS = common.cpp
|
||||
|
||||
LIBS = \
|
||||
-lcommon \
|
||||
-lxpcom \
|
||||
-lxptinfo \
|
||||
-lrpcserver \
|
||||
-lrpcclient \
|
||||
-lrpccommon \
|
||||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = ../../..
|
||||
srcdir = .
|
||||
VPATH = .
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
SIMPLE_PROGRAMS = clientIn serverIn
|
||||
|
||||
XPIDL_MODULE = rpctest
|
||||
|
||||
XPIDLSRCS = nsIRPCTestIn.idl
|
||||
|
||||
INCLUDES += -I../common -I../server -I../client
|
||||
|
||||
LIBS = \
|
||||
-lxpcom \
|
||||
-lxptinfo \
|
||||
-lrpcserver \
|
||||
-lrpcclient \
|
||||
-lrpccommon \
|
||||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = ../../..
|
||||
srcdir = .
|
||||
VPATH = .
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
SIMPLE_PROGRAMS = clientInOut serverInOut
|
||||
|
||||
XPIDL_MODULE = rpctest
|
||||
|
||||
XPIDLSRCS = nsIRPCTestInOut.idl
|
||||
|
||||
INCLUDES += -I../common -I../server -I../client
|
||||
|
||||
LIBS = \
|
||||
-lxpcom \
|
||||
-lxptinfo \
|
||||
-lrpcserver \
|
||||
-lrpcclient \
|
||||
-lrpccommon \
|
||||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = ../../..
|
||||
srcdir = .
|
||||
VPATH = .
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
SIMPLE_PROGRAMS = clientOut serverOut
|
||||
|
||||
XPIDL_MODULE = rpctest
|
||||
|
||||
XPIDLSRCS = nsIRPCTestOut.idl
|
||||
|
||||
INCLUDES += -I../common -I../server -I../client
|
||||
|
||||
LIBS = \
|
||||
-lxpcom \
|
||||
-lxptinfo \
|
||||
-lrpcserver \
|
||||
-lrpcclient \
|
||||
-lrpccommon \
|
||||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = ../..
|
||||
srcdir = .
|
||||
VPATH = .
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
SIMPLE_PROGRAMS = client server
|
||||
|
||||
XPIDL_MODULE = rpctest
|
||||
|
||||
XPIDLSRCS = nsIRPCTest.idl
|
||||
|
||||
INCLUDES += -I../common -I../server -I../client
|
||||
|
||||
LIBS = \
|
||||
-lxpcom \
|
||||
-lxptinfo \
|
||||
-lrpcserver \
|
||||
-lrpcclient \
|
||||
-lrpccommon \
|
||||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
|
||||
|
@ -1,29 +0,0 @@
|
||||
To build the tests,
|
||||
- Run make or gmake.
|
||||
|
||||
To run the tests,
|
||||
- Run each server and client modules on separate terminals.
|
||||
- Type the following,
|
||||
|
||||
sIn - server for IN parameter tests
|
||||
cIn - client for IN parameter tests
|
||||
sOut - server for OUT parameter tests
|
||||
cOut - client for OUT parameter tests
|
||||
sIO - server for INOUT parameter tests
|
||||
cIO - client for INOUT parameter tests
|
||||
sComb - server for Combinational tests
|
||||
cComb - client for Combinational tests
|
||||
|
||||
Each server and client module writes the values of each
|
||||
parameter that it sends and/or receive to a result file.
|
||||
Each has its own result file.
|
||||
|
||||
To check the result, the result files of the server and
|
||||
the client will be compared using the diff tool. Tests
|
||||
pass if data in both files exactly match; otherwise,
|
||||
they fail.
|
||||
chkIn - comparing the IN result files
|
||||
chkOut - comparing the OUT result files
|
||||
chkIO - comparing the INOUT result files
|
||||
chkComb - comparing the Combinational result files
|
||||
|
@ -1,3 +0,0 @@
|
||||
rm serverComb.res
|
||||
rm clientComb.res
|
||||
clientComb
|
@ -1,3 +0,0 @@
|
||||
rm serverInOut.res
|
||||
rm clientInOut.res
|
||||
clientInOut
|
@ -1,3 +0,0 @@
|
||||
rm serverIn.res
|
||||
rm clientIn.res
|
||||
clientIn
|
@ -1,3 +0,0 @@
|
||||
rm serverOut.res
|
||||
rm clientOut.res
|
||||
clientOut
|
@ -1,3 +0,0 @@
|
||||
echo diff clientComb.res serverComb.res
|
||||
diff clientComb.res serverComb.res
|
||||
|
@ -1,3 +0,0 @@
|
||||
echo diff clientInOut.res serverInOut.res
|
||||
diff clientInOut.res serverInOut.res
|
||||
|
@ -1,3 +0,0 @@
|
||||
echo diff clientIn.res serverIn.res
|
||||
diff clientIn.res serverIn.res
|
||||
|
@ -1,3 +0,0 @@
|
||||
echo diff clientOut.res serverOut.res
|
||||
diff clientOut.res serverOut.res
|
||||
|
@ -1,3 +0,0 @@
|
||||
#!/usr/bin/sh
|
||||
ME=`who am i |awk '{print $1}'`
|
||||
for d in `ipcs -q | grep $ME |awk '{print $2}'`;do ipcrm -q $d;done
|
@ -1,42 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include "RPCClientService.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsISample.h"
|
||||
#include "nsIRPCTest.h"
|
||||
|
||||
extern char* transportName;
|
||||
int main(int argc, char **args) {
|
||||
PRInt32 i;
|
||||
if (argc < 2) {
|
||||
printf("format clinet <server pid>\n");
|
||||
exit(1);
|
||||
}
|
||||
RPCClientService::Initialize(args[1]);
|
||||
RPCClientService * rpcService = RPCClientService::GetInstance();
|
||||
nsIID iid;
|
||||
nsIRPCTest *t1, *t2;
|
||||
|
||||
rpcService->CreateObjectProxy(1, NS_GET_IID(nsIRPCTest),(nsISupports**)&t1);
|
||||
#if 0
|
||||
i = 1999;
|
||||
printf("--before call %d\n",i);
|
||||
t1->Test2(4321,&i);
|
||||
printf("--after call %d\n",i);
|
||||
rpcService->CreateObjectProxy(5, NS_GET_IID(nsIRPCTest),(nsISupports**)&t2);
|
||||
i = 1998;
|
||||
printf("____________________________________________\n");
|
||||
printf("--before call %d\n",i);
|
||||
t2->Test2(4320,&i);
|
||||
printf("--after call %d\n",i);
|
||||
printf("---------------------------------------------\n");
|
||||
|
||||
char *s1 = "hello";
|
||||
char *s2 = "world";
|
||||
t1->Test3(s1,&s2);
|
||||
printf("s2 %s\n",s2);
|
||||
#endif
|
||||
printf("-----------------------------------------------\n");
|
||||
PRUint32 arrayCount = 2;
|
||||
char * array[2] = {"Hello","Pic"};
|
||||
t1->Test4(arrayCount,array);
|
||||
}
|
@ -1,312 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stream.h>
|
||||
#include <fstream.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "RPCClientService.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsISample.h"
|
||||
#include "nsIRPCTestComb.h"
|
||||
#include "deftest.h"
|
||||
#include "proto.h"
|
||||
|
||||
extern char* transportName;
|
||||
int main(int argc, char **args)
|
||||
{
|
||||
nsIID iid;
|
||||
nsIRPCTestComb *t1;
|
||||
PRBool b, b2;
|
||||
PRUint8 o;
|
||||
PRInt16 sInt;
|
||||
PRUint16 usInt, usInt2;
|
||||
PRInt32 lInt;
|
||||
double d;
|
||||
char c;
|
||||
PRUnichar wc;
|
||||
char* sio;
|
||||
char* s;
|
||||
char spid[20];
|
||||
|
||||
getProcessId(COMB_FDATA, &spid[0]);
|
||||
ofstream f_res(CLIENT_COMB_RES);
|
||||
if(!f_res) {
|
||||
cerr << "Cannot open result file.";
|
||||
}
|
||||
|
||||
RPCClientService::Initialize(spid);
|
||||
RPCClientService * rpcService = RPCClientService::GetInstance();
|
||||
rpcService->CreateObjectProxy(1, NS_GET_IID(nsIRPCTestComb),(nsISupports**)&t1);
|
||||
|
||||
b = PR_TRUE;
|
||||
c = 'A';
|
||||
printf("--before call TestComb1 %c\n",c);
|
||||
t1->TestComb1(b, &c);
|
||||
printf("--after call TestComb1 %c\n",c);
|
||||
f_res << form("TestComb1 %c\n",c);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
sio = "This is a test.";
|
||||
printf("--before call TestComb2 %s\n",sio);
|
||||
t1->TestComb2(b, &sio);
|
||||
printf("--after call TestComb2 %s\n",sio);
|
||||
f_res << form("TestComb2 %s\n",sio);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
c = 'A';
|
||||
sio = "This is a test.";
|
||||
printf("--before call TestComb3 %c\n",c);
|
||||
printf("--before call TestComb3 %s\n",sio);
|
||||
t1->TestComb3(&c, &sio);
|
||||
printf("--after call TestComb3 %c\n",c);
|
||||
printf("--after call TestComb3 %s\n",sio);
|
||||
f_res << form("TestComb3 %c %s\n",c,sio);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
|
||||
b = PR_TRUE;
|
||||
c = 'A';
|
||||
s = "This is a test.";
|
||||
printf("--before call TestComb4 %c\n",c);
|
||||
printf("--before call TestComb4 %s\n",s);
|
||||
t1->TestComb4(&s, b, &c);
|
||||
printf("--after call TestComb4 %c\n",c);
|
||||
printf("--after call TestComb4 %s\n",s);
|
||||
f_res << form("TestComb4 %c %s\n",c,s);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
sInt = 555;
|
||||
c = 'A';
|
||||
printf("--before call TestComb5 %c\n",c);
|
||||
t1->TestComb5(sInt, &c);
|
||||
printf("--after call TestComb5 %c\n",c);
|
||||
f_res << form("TestComb5 %c\n",c);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
sInt = 555;
|
||||
printf("--before call TestComb6 %d\n",sInt);
|
||||
t1->TestComb6(b, &sInt);
|
||||
printf("--after call TestComb6 %d\n",sInt);
|
||||
f_res << form("TestComb6 %d\n",sInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
sInt = 555;
|
||||
printf("--before call TestComb7 %d\n",sInt);
|
||||
t1->TestComb7(b, &sInt);
|
||||
printf("--after call TestComb7 %d\n",sInt);
|
||||
f_res << form("TestComb7 %d\n",sInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
sInt = 555;
|
||||
printf("--before call TestComb8 %d\n",b);
|
||||
printf("--before call TestComb8 %d\n",sInt);
|
||||
t1->TestComb8(b, sInt);
|
||||
f_res << form("TestComb8 %d %d\n",b, sInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
c = 'a';
|
||||
printf("--before call TestComb9 %d\n",b);
|
||||
printf("--before call TestComb9 %c\n",c);
|
||||
t1->TestComb9(b, c);
|
||||
printf("--after call TestComb9 %c\n",c);
|
||||
f_res << form("TestComb9 %d %c\n",b, c);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
s = (char *) malloc(sizeof(char) * 50);
|
||||
strcpy(s,"This is a test.");
|
||||
t1->TestComb10(b, &s);
|
||||
printf("--after call TestComb10 %s\n",s);
|
||||
f_res << form("TestComb10 %s\n", s);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
c = 'A';
|
||||
printf("--before call TestComb11 %c\n",c);
|
||||
t1->TestComb11(b, &c);
|
||||
printf("--after call TestComb11 %c\n",c);
|
||||
f_res << form("TestComb11 %c\n",c);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
lInt = 100;
|
||||
printf("--before call TestComb12 %d\n",lInt);
|
||||
t1->TestComb12(b, &lInt);
|
||||
printf("--after call TestComb12 %d\n",lInt);
|
||||
f_res << form("TestComb12 %d\n",lInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
lInt = 100;
|
||||
printf("--before call TestComb13 %d\n",lInt);
|
||||
t1->TestComb13(b, &lInt);
|
||||
printf("--after call TestComb13 %d\n",lInt);
|
||||
f_res << form("TestComb13 %d\n",lInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
lInt = 100;
|
||||
printf("--before call TestComb14 %d\n",b);
|
||||
printf("--before call TestComb14 %d\n",lInt);
|
||||
t1->TestComb14(b, lInt);
|
||||
f_res << form("TestComb14 %d %d\n",b, lInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
d = 100.99;
|
||||
printf("--before call TestComb15 %d\n",b);
|
||||
printf("--before call TestComb15 %.50f\n",d);
|
||||
t1->TestComb15(b, &d);
|
||||
printf("--after call TestComb15 %.50f\n",d);
|
||||
f_res << form("TestComb15 %.50f\n",d);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
d = 100.99;
|
||||
printf("--before call TestComb16 %d\n",b);
|
||||
printf("--before call TestComb16 %.50f\n",d);
|
||||
t1->TestComb16(b, &d);
|
||||
printf("--after call TestComb16 %.50f\n",d);
|
||||
f_res << form("TestComb16 %.50f\n",d);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
usInt = 555;
|
||||
printf("--before call TestComb17 %d\n",b);
|
||||
printf("--before call TestComb17 %u\n",usInt);
|
||||
t1->TestComb17(b, &usInt);
|
||||
printf("--after call TestComb17 %u\n",usInt);
|
||||
f_res << form("TestComb17 %d\n",usInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
usInt = 555;
|
||||
printf("--before call TestComb18 %d\n",b);
|
||||
printf("--before call TestComb18 %u\n",usInt);
|
||||
t1->TestComb18(b, &usInt);
|
||||
printf("--after call TestComb18 %u\n",usInt);
|
||||
f_res << form("TestComb18 %d\n",usInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
o = 7;
|
||||
printf("--before call TestComb19 %d\n",b);
|
||||
printf("--before call TestComb19 %d\n",o);
|
||||
t1->TestComb19(b, &o);
|
||||
printf("--after call TestComb19 %d\n",o);
|
||||
f_res << form("TestComb19 %o\n",o);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
o = 7;
|
||||
printf("--before call TestComb20 %d\n",b);
|
||||
printf("--before call TestComb20 %d\n",o);
|
||||
t1->TestComb20(b, &o);
|
||||
printf("--after call TestComb20 %d\n",o);
|
||||
f_res << form("TestComb20 %o\n",o);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
o = 7;
|
||||
printf("--before call TestComb21 %d\n",o);
|
||||
t1->TestComb21(b, o);
|
||||
f_res << form("TestComb21 %d %o\n",b,o);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
b2 = PR_TRUE;
|
||||
printf("--before call TestComb22 %d\n",b2);
|
||||
t1->TestComb22(b, b2);
|
||||
f_res << form("TestComb22 %d %d\n",b,b2);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
b2 = PR_TRUE;
|
||||
printf("--before call TestComb23 %d\n",b2);
|
||||
t1->TestComb23(b, &b2);
|
||||
printf("--after call TestComb23 %d\n",b2);
|
||||
f_res << form("TestComb23 %d\n",b2);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
b2 = PR_TRUE;
|
||||
printf("--before call TestComb24 %d\n",b2);
|
||||
t1->TestComb24(b, &b2);
|
||||
printf("--after call TestComb24 %d\n",b2);
|
||||
f_res << form("TestComb24 %d\n",b2);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
c = 'A';
|
||||
printf("--before call TestComb25 %d\n",b);
|
||||
printf("--before call TestComb25 %d\n",c);
|
||||
t1->TestComb25(&b, &c);
|
||||
printf("--after call TestComb25 %d\n",b);
|
||||
printf("--after call TestComb25 %d\n",c);
|
||||
f_res << form("TestComb25 %d %c\n",b,c);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
c = 'A';
|
||||
printf("--before call TestComb26 %d\n",b);
|
||||
printf("--before call TestComb26 %d\n",c);
|
||||
t1->TestComb26(&b, &c);
|
||||
printf("--after call TestComb26 %d\n",c);
|
||||
printf("--after call TestComb26 %d\n",b);
|
||||
f_res << form("TestComb26 %d %c\n",b,c);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
wc = 'A';
|
||||
printf("--before call TestComb27 %c\n",wc);
|
||||
t1->TestComb27(b, &wc);
|
||||
printf("--after call TestComb27 %c\n",wc);
|
||||
f_res << form("TestComb27 %c\n",wc);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
sio = "This is a test.";
|
||||
s = "This is a second test.";
|
||||
printf("--before call TestComb30 %s\n",sio);
|
||||
printf("--before call TestComb30 %s\n",s);
|
||||
t1->TestComb30(s, &sio);
|
||||
printf("--after call TestComb30 %s\n",sio);
|
||||
f_res << form("TestComb30 %s\n",sio);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
o = 55;
|
||||
usInt = 55;
|
||||
printf("--before call TestComb31 %o\n",o);
|
||||
printf("--before call TestComb31 %u\n",usInt);
|
||||
t1->TestComb31(&o, &usInt);
|
||||
printf("--after call TestComb31 %o\n",o);
|
||||
printf("--after call TestComb31 %u\n",usInt);
|
||||
f_res << form("TestComb31 %o %u\n",o,usInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
o = 55;
|
||||
lInt = 55;
|
||||
printf("--before call TestComb32 %o\n",o);
|
||||
printf("--before call TestComb32 %d\n",lInt);
|
||||
t1->TestComb32(&o, &lInt);
|
||||
printf("--after call TestComb32 %o\n",o);
|
||||
printf("--after call TestComb32 %d\n",lInt);
|
||||
f_res << form("TestComb32 %o %d\n",o,lInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
lInt = 55;
|
||||
usInt2 = 55;
|
||||
printf("--before call TestComb33 %u\n",usInt2);
|
||||
printf("--before call TestComb33 %d\n",lInt);
|
||||
t1->TestComb33(&lInt, &usInt);
|
||||
printf("--after call TestComb33 %u\n",usInt2);
|
||||
printf("--after call TestComb33 %d\n",lInt);
|
||||
f_res << form("TestComb33 %d %u\n",lInt,usInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
f_res.close();
|
||||
}
|
||||
|
@ -1,268 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stream.h>
|
||||
#include <fstream.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
#include "RPCClientService.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsISample.h"
|
||||
#include "nsIRPCTestIn.h"
|
||||
#include "deftest.h"
|
||||
#include "proto.h"
|
||||
|
||||
extern char* transportName;
|
||||
int main(int argc, char **args) {
|
||||
|
||||
nsIID iid;
|
||||
nsIRPCTestIn *t1;
|
||||
PRBool b;
|
||||
PRUint8 o;
|
||||
PRInt16 sInt;
|
||||
PRInt32 lInt;
|
||||
PRInt64 llInt;
|
||||
PRUint16 usInt;
|
||||
PRUint32 ulInt;
|
||||
PRUint64 ullInt;
|
||||
float f;
|
||||
double d;
|
||||
char c;
|
||||
PRUnichar wc;
|
||||
char* s;
|
||||
PRUnichar *ws;
|
||||
char spid[20];
|
||||
int i;
|
||||
|
||||
getProcessId(IN_FDATA, &spid[0]);
|
||||
ofstream f_res(CLIENT_IN_RES);
|
||||
if(!f_res) {
|
||||
cerr << "Cannot open result file.";
|
||||
}
|
||||
|
||||
RPCClientService::Initialize(spid);
|
||||
RPCClientService * rpcService = RPCClientService::GetInstance();
|
||||
rpcService->CreateObjectProxy(1, NS_GET_IID(nsIRPCTestIn),(nsISupports**)&t1);
|
||||
|
||||
b = PR_TRUE;
|
||||
printf("--before call TestIn1 %d\n",b);
|
||||
t1->TestIn1(b);
|
||||
f_res << form("TestIn1 %d\n",b);
|
||||
b = PR_FALSE;
|
||||
printf("--before call TestIn1 %d\n",b);
|
||||
t1->TestIn1(b);
|
||||
f_res << form("TestIn1 %d\n",b);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
o = 0;
|
||||
printf("--before call TestIn2 %d\n",o);
|
||||
t1->TestIn2(o);
|
||||
f_res << form("TestIn2 %o\n",o);
|
||||
o = 124;
|
||||
printf("--before call TestIn2 %d\n",o);
|
||||
t1->TestIn2(o);
|
||||
f_res << form("TestIn2 %o\n",o);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
sInt = SHRT_MIN;
|
||||
printf("--before call TestIn3 %d\n",sInt);
|
||||
t1->TestIn3(sInt);
|
||||
f_res << form("TestIn3 %d\n",sInt);
|
||||
sInt = SHRT_MAX;
|
||||
printf("--before call TestIn3 %d\n",sInt);
|
||||
t1->TestIn3(sInt);
|
||||
f_res << form("TestIn3 %d\n",sInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
lInt = LONG_MIN;
|
||||
printf("--before call TestIn4 %d\n",lInt);
|
||||
t1->TestIn4(lInt);
|
||||
f_res << form("TestIn4 %d\n",lInt);
|
||||
lInt = LONG_MAX;
|
||||
printf("--before call TestIn4 %d\n",lInt);
|
||||
t1->TestIn4(lInt);
|
||||
f_res << form("TestIn4 %d\n",lInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
llInt = LONG_MIN;
|
||||
printf("--before call TestIn5 %d\n",llInt);
|
||||
t1->TestIn5(llInt);
|
||||
f_res << form("TestIn5 %d\n",llInt);
|
||||
llInt = LONG_MAX;
|
||||
printf("--before call TestIn5 %d\n",llInt);
|
||||
t1->TestIn5(llInt);
|
||||
f_res << form("TestIn5 %d\n",llInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
usInt = 555;
|
||||
printf("--before call TestIn6 %u\n",usInt);
|
||||
t1->TestIn6(usInt);
|
||||
f_res << form("TestIn6 %u\n",usInt);
|
||||
usInt = USHRT_MAX;
|
||||
printf("--before call TestIn6 %u\n",usInt);
|
||||
t1->TestIn6(usInt);
|
||||
f_res << form("TestIn6 %u\n",usInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
ulInt = 555;
|
||||
printf("--before call TestIn7 %u\n",ulInt);
|
||||
t1->TestIn7(ulInt);
|
||||
f_res << form("TestIn7 %u\n",ulInt);
|
||||
ulInt = ULONG_MAX;
|
||||
printf("--before call TestIn7 %u\n",ulInt);
|
||||
t1->TestIn7(ulInt);
|
||||
f_res << form("TestIn7 %u\n",ulInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
ullInt = 555;
|
||||
printf("--before call TestIn8 %u\n",ullInt);
|
||||
t1->TestIn8(ullInt);
|
||||
f_res << form("TestIn8 %u\n",ullInt);
|
||||
ullInt = ULONG_MAX;
|
||||
printf("--before call TestIn8 %u\n",ullInt);
|
||||
t1->TestIn8(ullInt);
|
||||
f_res << form("TestIn8 %u\n",ullInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
f = FLT_MIN;
|
||||
printf("--before call TestIn9 %.50f\n",f);
|
||||
t1->TestIn9(f);
|
||||
f_res << form("TestIn9 %.50f\n",f);
|
||||
f = FLT_MAX;
|
||||
printf("--before call TestIn9 %f\n",f);
|
||||
t1->TestIn9(f);
|
||||
f_res << form("TestIn9 %.50f\n",f);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
d = DBL_MIN;
|
||||
printf("--before call TestIn10 %.50f\n",d);
|
||||
t1->TestIn10(d);
|
||||
f_res << form("TestIn10 %.50f\n",d);
|
||||
d = DBL_MAX;
|
||||
printf("--before call TestIn10 %f\n",d);
|
||||
t1->TestIn10(d);
|
||||
f_res << form("TestIn10 %.50f\n",d);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
c = 'A';
|
||||
printf("--before call TestIn11 %d\n",c);
|
||||
t1->TestIn11(c);
|
||||
f_res << form("TestIn11 %c\n",c);
|
||||
c = 'Z';
|
||||
printf("--before call TestIn11 %d\n",c);
|
||||
t1->TestIn11(c);
|
||||
f_res << form("TestIn11 %c\n",c);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
wc = 'A';
|
||||
printf("--before call TestIn12 %d\n",wc);
|
||||
t1->TestIn12(wc);
|
||||
f_res << form("TestIn12 %c\n",wc);
|
||||
wc = 'Z';
|
||||
printf("--before call TestIn12 %d\n",wc);
|
||||
t1->TestIn12(wc);
|
||||
f_res << form("TestIn12 %c\n",wc);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
s = "";
|
||||
printf("--before call TestIn13 %s\n",s);
|
||||
t1->TestIn13(s);
|
||||
f_res << form("TestIn13 %s\n",s);
|
||||
strcpy(s,"This is a test.");
|
||||
printf("--before call TestIn13 %s\n",s);
|
||||
t1->TestIn13(s);
|
||||
f_res << form("TestIn13 %s\n",s);
|
||||
|
||||
printf("____________________________________________\n");
|
||||
/*
|
||||
ws = new PRUnichar[50];
|
||||
ws[0] = '\0';
|
||||
printf("--before call TestIn14 %s\n",ws);
|
||||
t1->TestIn14(ws);
|
||||
f_res << form("TestIn14 %s\n",ws);
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
ws[i] = 'z';
|
||||
}
|
||||
ws[i] = '\0';
|
||||
printf("--before call TestIn14 %s\n",ws);
|
||||
t1->TestIn14(ws);
|
||||
f_res << form("TestIn14 %s\n",ws);
|
||||
delete ws;
|
||||
printf("____________________________________________\n");
|
||||
*/
|
||||
|
||||
PRUint32 arrCount = 3;
|
||||
const char *array[3] = {"Blackwood","MCD","StarLite"};
|
||||
printf("--before call TestIn15 data array.\n");
|
||||
t1->TestIn15(arrCount, array);
|
||||
f_res << form("TestIn15 count %d\n", arrCount);
|
||||
for (i = 0; i < arrCount; i++) {
|
||||
f_res << form("TestIn15 Array[%d]=%s\n",i,array[i]);
|
||||
}
|
||||
printf("____________________________________________\n");
|
||||
|
||||
PRUint32 arrCount2 = 10;
|
||||
PRInt32 arrLong[10] = {1111111, 2222222, 3333333, 4444444, 5555555,
|
||||
6666666, 7777777, 8888888, 9999999, 0};
|
||||
printf("--before call TestIn16 data array.\n");
|
||||
t1->TestIn16(arrCount2, &arrLong[0]);
|
||||
f_res << form("TestIn16 count %d\n", arrCount2);
|
||||
for (i = 0; i < arrCount2; i++) {
|
||||
f_res << form("TestIn16 Array[%d]=%d\n",i,arrLong[i]);
|
||||
}
|
||||
printf("____________________________________________\n");
|
||||
|
||||
b = PR_TRUE;
|
||||
o = 8;
|
||||
sInt = 1;
|
||||
lInt = 2;
|
||||
llInt = 3;
|
||||
usInt = 4;
|
||||
ulInt = 5;
|
||||
ullInt = 6;
|
||||
f = 7;
|
||||
d = 8;
|
||||
c = 'A';
|
||||
|
||||
printf("--before call TestIn17 combination.\n");
|
||||
t1->TestIn17(b, c, o, sInt, usInt, lInt, ulInt, llInt, ullInt, f, d, s, arrCount2, &arrLong[0]);
|
||||
f_res << form("TestIn17 PRBool %d\n",b);
|
||||
f_res << form("TestIn17 PRUint8 %o\n",o);
|
||||
f_res << form("TestIn17 PRInt16 %d\n",sInt);
|
||||
f_res << form("TestIn17 PRInt32 %d\n",lInt);
|
||||
f_res << form("TestIn17 PRInt64 %d\n",llInt);
|
||||
f_res << form("TestIn17 PRUint16 %u\n",usInt);
|
||||
f_res << form("TestIn17 PRUint32 %u\n",ulInt);
|
||||
f_res << form("TestIn17 PRUint64 %u\n",ullInt);
|
||||
f_res << form("TestIn17 float %.50f\n",f);
|
||||
f_res << form("TestIn17 double %.50f\n",d);
|
||||
f_res << form("TestIn17 char %c\n",c);
|
||||
f_res << form("TestIn17 string %s\n",s);
|
||||
f_res << form("TestIn17 count %d\n", arrCount2);
|
||||
for (i = 0; i < arrCount2; i++) {
|
||||
f_res << form("TestIn17 Array[%d]=%d\n",i,arrLong[i]);
|
||||
}
|
||||
printf("____________________________________________\n");
|
||||
|
||||
printf("--before call TestIn18 combination.\n");
|
||||
t1->TestIn18(c, o, sInt, usInt, lInt, ulInt, llInt, ullInt, f, d, s, arrCount2, &arrLong[0]);
|
||||
f_res << form("TestIn18 PRUint8 %o\n",o);
|
||||
f_res << form("TestIn18 PRInt16 %d\n",sInt);
|
||||
f_res << form("TestIn18 PRInt32 %d\n",lInt);
|
||||
f_res << form("TestIn18 PRInt64 %d\n",llInt);
|
||||
f_res << form("TestIn18 PRUint16 %u\n",usInt);
|
||||
f_res << form("TestIn18 PRUint32 %u\n",ulInt);
|
||||
f_res << form("TestIn18 PRUint64 %u\n",ullInt);
|
||||
f_res << form("TestIn18 float %.50f\n",f);
|
||||
f_res << form("TestIn18 double %.50f\n",d);
|
||||
f_res << form("TestIn18 char %c\n",c);
|
||||
f_res << form("TestIn18 string %s\n",s);
|
||||
f_res << form("TestIn18 count %d\n", arrCount2);
|
||||
for (i = 0; i < arrCount2; i++) {
|
||||
f_res << form("TestIn18 Array[%d]=%d\n",i,arrLong[i]);
|
||||
}
|
||||
printf("____________________________________________\n");
|
||||
|
||||
f_res.close();
|
||||
}
|
||||
|
@ -1,285 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stream.h>
|
||||
#include <fstream.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
#include "RPCClientService.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsISample.h"
|
||||
#include "nsIRPCTestInOut.h"
|
||||
#include "deftest.h"
|
||||
#include "proto.h"
|
||||
|
||||
extern char* transportName;
|
||||
int main(int argc, char **args) {
|
||||
|
||||
nsIID iid;
|
||||
nsIRPCTestInOut *t1;
|
||||
PRBool b;
|
||||
PRUint8 o;
|
||||
PRInt16 sInt;
|
||||
PRInt32 lInt;
|
||||
PRInt64 llInt;
|
||||
PRUint16 usInt;
|
||||
PRUint32 ulInt;
|
||||
PRUint64 ullInt;
|
||||
float f;
|
||||
double d;
|
||||
char c;
|
||||
PRUnichar wc;
|
||||
char* s;
|
||||
PRUnichar *ws;
|
||||
char spid[20];
|
||||
int i;
|
||||
|
||||
getProcessId(INOUT_FDATA, &spid[0]);
|
||||
ofstream f_res(CLIENT_INOUT_RES);
|
||||
if(!f_res) {
|
||||
cerr << "Cannot open result file.";
|
||||
}
|
||||
|
||||
RPCClientService::Initialize(spid);
|
||||
RPCClientService * rpcService = RPCClientService::GetInstance();
|
||||
rpcService->CreateObjectProxy(1, NS_GET_IID(nsIRPCTestInOut),(nsISupports**)&t1);
|
||||
|
||||
|
||||
b = PR_TRUE;
|
||||
printf("--before call TestInOut1 %d\n",b);
|
||||
f_res << form("TestInOut1 before %d\n",b);
|
||||
t1->TestInOut1(&b);
|
||||
printf("--after call TestInOut1 %d\n",b);
|
||||
f_res << form("TestInOut1 after %d\n",b);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
o = 10;
|
||||
printf("--before call TestInOut2 %o\n",o);
|
||||
f_res << form("TestInOut2 before %o\n",o);
|
||||
t1->TestInOut2(&o);
|
||||
printf("--after call TestInOut2 %o\n",o);
|
||||
f_res << form("TestInOut2 after %o\n",o);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
sInt = SHRT_MIN;
|
||||
printf("--before call TestInOut3 %d\n",sInt);
|
||||
f_res << form("TestInOut3 before %d\n",sInt);
|
||||
t1->TestInOut3(&sInt);
|
||||
printf("--after call TestInOut3 %d\n",sInt);
|
||||
f_res << form("TestInOut3 after %d\n",sInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
lInt = LONG_MIN;
|
||||
printf("--before call TestInOut4 %d\n",lInt);
|
||||
f_res << form("TestInOut4 before %l\n",lInt);
|
||||
t1->TestInOut4(&lInt);
|
||||
printf("--after call TestInOut4 %d\n",lInt);
|
||||
f_res << form("TestInOut4 after %l\n",lInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
llInt = LONG_MIN;
|
||||
printf("--before call TestInOut5 %d\n",llInt);
|
||||
f_res << form("TestInOut5 before %l\n",llInt);
|
||||
t1->TestInOut5(&llInt);
|
||||
printf("--after call TestInOut5 %d\n",llInt);
|
||||
f_res << form("TestInOut5 after %l\n",llInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
usInt = 555;
|
||||
printf("--before call TestInOut6 %u\n",usInt);
|
||||
f_res << form("TestInOut6 before %10u\n",usInt);
|
||||
t1->TestInOut6(&usInt);
|
||||
printf("--after call TestInOut6 %u\n",usInt);
|
||||
f_res << form("TestInOut6 after %10u\n",usInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
ulInt = 555;
|
||||
printf("--before call TestInOut7 %u\n",ulInt);
|
||||
f_res << form("TestInOut7 before %10u\n",ulInt);
|
||||
t1->TestInOut7(&ulInt);
|
||||
printf("--after call TestInOut7 %u\n",ulInt);
|
||||
f_res << form("TestInOut7 after %10u\n",ulInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
ullInt = 555;
|
||||
printf("--before call TestInOut8 %u\n",ullInt);
|
||||
f_res << form("TestInOut8 before %10u\n",ullInt);
|
||||
t1->TestInOut8(&ullInt);
|
||||
printf("--after call TestInOut8 %u\n",ullInt);
|
||||
f_res << form("TestInOut8 after %10u\n",ullInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
f = FLT_MIN;
|
||||
printf("--before call TestInOut9 %.50f\n",f);
|
||||
f_res << form("TestInOut9 before %.50f\n",f);
|
||||
t1->TestInOut9(&f);
|
||||
printf("--after call TestInOut9 %.50f\n",f);
|
||||
f_res << form("TestInOut9 after %.50f\n",f);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
d = DBL_MIN;
|
||||
printf("--before call TestInOut10 %.50f\n",d);
|
||||
f_res << form("TestInOut10 before %.50f\n",d);
|
||||
t1->TestInOut10(&d);
|
||||
printf("--after call TestInOut10 %.50f\n",d);
|
||||
f_res << form("TestInOut10 after %.50f\n",d);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
c = 'A';
|
||||
printf("--before call TestInOut11 %d\n",c);
|
||||
f_res << form("TestInOut11 before %c\n",c);
|
||||
t1->TestInOut11(&c);
|
||||
printf("--after call TestInOut11 %d\n",c);
|
||||
f_res << form("TestInOut11 after %c\n",c);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
wc = 'A';
|
||||
printf("--before call TestInOut12 %d\n",wc);
|
||||
f_res << form("TestInOut12 before %c\n",wc);
|
||||
t1->TestInOut12(&wc);
|
||||
printf("--after call TestInOut12 %d\n",wc);
|
||||
f_res << form("TestInOut12 after %c\n",wc);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
s = "This is a test.";
|
||||
printf("--before call TestInOut13 %s\n",s);
|
||||
f_res << form("TestInOut13 before %s\n",s);
|
||||
t1->TestInOut13(&s);
|
||||
printf("--before call TestInOut13 %s\n",s);
|
||||
f_res << form("TestInOut13 after %s\n",s);
|
||||
printf("____________________________________________\n");
|
||||
/*
|
||||
ws = new PRUnichar[50];
|
||||
for (i = 0; i < 10; i++) {
|
||||
ws[i] = 'z';
|
||||
}
|
||||
ws[i] = '\0';
|
||||
printf("--before call TestInOut14 %s\n",ws);
|
||||
f_res << form("TestInOut14 before %s\n",ws);
|
||||
t1->TestInOut14(&ws);
|
||||
printf("--before call TestInOut14 %s\n",ws);
|
||||
f_res << form("TestInOut14 after %s\n",ws);
|
||||
printf("____________________________________________\n");
|
||||
*/
|
||||
PRUint32 arrCount = 0;
|
||||
char *array = new char [100];
|
||||
strcpy(array,"Going out... remote ipc test.");
|
||||
arrCount = strlen(array);
|
||||
printf("TestInOut15 before count %d\n", arrCount);
|
||||
f_res << form("TestInOut15 before count %d\n", arrCount);
|
||||
printf("TestInOut15 before Array=%s\n", array);
|
||||
f_res << form("TestInOut15 before Array=%s\n",array);
|
||||
printf("--before call TestInOut15 data array.\n");
|
||||
t1->TestInOut15(&arrCount, &array);
|
||||
printf("TestInOut15 after count %d\n", arrCount);
|
||||
f_res << form("TestInOut15 after count %d\n", arrCount);
|
||||
printf("TestInOut15 after Array=%s\n", array);
|
||||
f_res << form("TestInOut15 after Array=%s\n",array);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
|
||||
printf("--before call TestInOut16 combination.\n");
|
||||
|
||||
b = PR_FALSE;
|
||||
o = 555;
|
||||
c = 'Z';
|
||||
sInt = 9;
|
||||
usInt = 9;
|
||||
lInt = 9;
|
||||
ulInt = 9;
|
||||
llInt = 9;
|
||||
ullInt = 9;
|
||||
f = 9;
|
||||
d = 9;
|
||||
s = "This is an inout parameter test.";
|
||||
|
||||
f_res << form("TestInOut16 before %d\n",b);
|
||||
f_res << form("TestInOut16 before %d\n",lInt);
|
||||
f_res << form("TestInOut16 before %d\n",llInt);
|
||||
f_res << form("TestInOut16 before %u\n",usInt);
|
||||
f_res << form("TestInOut16 before %u\n",ulInt);
|
||||
f_res << form("TestInOut16 before %u\n",ullInt);
|
||||
f_res << form("TestInOut16 before %.50f\n",f);
|
||||
f_res << form("TestInOut16 before %.50f\n",d);
|
||||
f_res << form("TestInOut16 before %c\n",c);
|
||||
f_res << form("TestInOut16 before %s\n",s);
|
||||
|
||||
t1->TestInOut16( &b, &c, &usInt, &lInt, &ulInt, &llInt, &ullInt, &f, &d, &s);
|
||||
|
||||
printf("After calling TestInOut16.\n");
|
||||
f_res << form("TestInOut16 after %d\n",b);
|
||||
f_res << form("TestInOut16 after %d\n",lInt);
|
||||
f_res << form("TestInOut16 after %d\n",llInt);
|
||||
f_res << form("TestInOut16 after %u\n",usInt);
|
||||
f_res << form("TestInOut16 after %u\n",ulInt);
|
||||
f_res << form("TestInOut16 after %u\n",ullInt);
|
||||
f_res << form("TestInOut16 after %.50f\n",f);
|
||||
f_res << form("TestInOut16 after %.50f\n",d);
|
||||
f_res << form("TestInOut16 after %c\n",c);
|
||||
f_res << form("TestInOut16 after %s\n",s);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
PRUint32 arrCount2 = 5;
|
||||
PRInt32 *arrLong = new PRInt32 [arrCount2];
|
||||
f_res << form("TestInOut17 before count %d\n", arrCount2);
|
||||
for (i = 0; i < arrCount2; i++) {
|
||||
arrLong[i] = 11111 + i;
|
||||
f_res << form("TestInOut17 before Array[%d]=%d\n",i,arrLong[i]);
|
||||
}
|
||||
printf("--before call TestInOut17 data array.\n");
|
||||
t1->TestInOut17(&arrCount2, &arrLong);
|
||||
f_res << form("TestInOut17 after count %d\n", arrCount2);
|
||||
for (i = 0; i < arrCount2; i++) {
|
||||
f_res << form("TestInOut17 after Array[%d]=%d\n",i,arrLong[i]);
|
||||
}
|
||||
delete arrLong;
|
||||
printf("____________________________________________\n");
|
||||
|
||||
printf("--before call TestInOut18 combination.\n");
|
||||
|
||||
b = PR_FALSE;
|
||||
o = 555;
|
||||
c = 'Z';
|
||||
sInt = 9;
|
||||
usInt = 9;
|
||||
lInt = 9;
|
||||
ulInt = 9;
|
||||
llInt = 9;
|
||||
ullInt = 9;
|
||||
f = 9;
|
||||
d = 9;
|
||||
s = "This is an inout parameter test.";
|
||||
|
||||
f_res << form("TestInOut18 before %d\n",b);
|
||||
f_res << form("TestInOut18 before %o\n",o);
|
||||
f_res << form("TestInOut18 before %d\n",sInt);
|
||||
f_res << form("TestInOut18 before %d\n",lInt);
|
||||
f_res << form("TestInOut18 before %d\n",llInt);
|
||||
f_res << form("TestInOut18 before %u\n",usInt);
|
||||
f_res << form("TestInOut18 before %u\n",ulInt);
|
||||
f_res << form("TestInOut18 before %u\n",ullInt);
|
||||
f_res << form("TestInOut18 before %.50f\n",f);
|
||||
f_res << form("TestInOut18 before %.50f\n",d);
|
||||
f_res << form("TestInOut18 before %c\n",c);
|
||||
f_res << form("TestInOut18 before %s\n",s);
|
||||
|
||||
t1->TestInOut18(&b, &c, &o, &sInt, &usInt, &lInt, &ulInt, &llInt, &ullInt, &f, &d, &s);
|
||||
|
||||
printf("After calling TestInOut18.\n");
|
||||
f_res << form("TestInOut18 after %d\n",b);
|
||||
f_res << form("TestInOut18 after %o\n",o);
|
||||
f_res << form("TestInOut18 after %d\n",sInt);
|
||||
f_res << form("TestInOut18 after %d\n",lInt);
|
||||
f_res << form("TestInOut18 after %d\n",llInt);
|
||||
f_res << form("TestInOut18 after %u\n",usInt);
|
||||
f_res << form("TestInOut18 after %u\n",ulInt);
|
||||
f_res << form("TestInOut18 after %u\n",ullInt);
|
||||
f_res << form("TestInOut18 after %.50f\n",f);
|
||||
f_res << form("TestInOut18 after %.50f\n",d);
|
||||
f_res << form("TestInOut18 after %c\n",c);
|
||||
f_res << form("TestInOut18 after %s\n",s);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
|
||||
f_res.close();
|
||||
|
||||
}
|
@ -1,190 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stream.h>
|
||||
#include <fstream.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
#include "RPCClientService.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsISample.h"
|
||||
#include "nsIRPCTestOut.h"
|
||||
#include "deftest.h"
|
||||
#include "proto.h"
|
||||
|
||||
extern char* transportName;
|
||||
int main(int argc, char **args) {
|
||||
|
||||
nsIID iid;
|
||||
nsIRPCTestOut *t1;
|
||||
PRBool b;
|
||||
PRUint8 o;
|
||||
PRInt16 sInt;
|
||||
PRInt32 lInt;
|
||||
PRInt64 llInt;
|
||||
PRUint16 usInt;
|
||||
PRUint32 ulInt;
|
||||
PRUint64 ullInt;
|
||||
float f;
|
||||
double d;
|
||||
char c;
|
||||
PRUnichar wc;
|
||||
char* s;
|
||||
PRUnichar *ws;
|
||||
char spid[20];
|
||||
|
||||
getProcessId(OUT_FDATA, &spid[0]);
|
||||
ofstream f_res(CLIENT_OUT_RES);
|
||||
if(!f_res) {
|
||||
cerr << "Cannot open result file.";
|
||||
}
|
||||
|
||||
RPCClientService::Initialize(spid);
|
||||
RPCClientService * rpcService = RPCClientService::GetInstance();
|
||||
rpcService->CreateObjectProxy(1, NS_GET_IID(nsIRPCTestOut),(nsISupports**)&t1);
|
||||
|
||||
b = PR_TRUE;
|
||||
printf("--before call TestOut1 %d\n",b);
|
||||
t1->TestOut1(&b);
|
||||
printf("--after call TestOut1 %d\n",b);
|
||||
f_res << form("TestOut1 %d\n",b);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
o = 124;
|
||||
printf("--before call TestOut2 %d\n",o);
|
||||
t1->TestOut2(&o);
|
||||
printf("--after call TestOut2 %d\n",o);
|
||||
f_res << form("TestOut2 %o\n",o);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
sInt = SHRT_MIN;
|
||||
printf("--before call TestOut3 %d\n",sInt);
|
||||
t1->TestOut3(&sInt);
|
||||
printf("--after call TestOut3 %d\n",sInt);
|
||||
f_res << form("TestOut3 %d\n",sInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
lInt = LONG_MIN;
|
||||
printf("--before call TestOut4 %d\n",lInt);
|
||||
t1->TestOut4(&lInt);
|
||||
printf("--after call TestOut4 %d\n",lInt);
|
||||
f_res << form("TestOut4 %d\n",lInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
llInt = LONG_MIN;
|
||||
printf("--before call TestOut5 %d\n",llInt);
|
||||
t1->TestOut5(&llInt);
|
||||
printf("--after call TestOut5 %d\n",llInt);
|
||||
f_res << form("TestOut5 %d\n",llInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
usInt = USHRT_MIN;
|
||||
printf("--before call TestOut6 %u\n",usInt);
|
||||
t1->TestOut6(&usInt);
|
||||
printf("--after call TestOut6 %u\n",usInt);
|
||||
f_res << form("TestOut6 %u\n",usInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
ulInt = ULONG_MIN;
|
||||
printf("--before call TestOut7 %u\n",ulInt);
|
||||
t1->TestOut7(&ulInt);
|
||||
printf("--after call TestOut7 %u\n",ulInt);
|
||||
f_res << form("TestOut7 %u\n",ulInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
ullInt = ULONG_MIN;
|
||||
printf("--before call TestOut8 %u\n",ullInt);
|
||||
t1->TestOut8(&ullInt);
|
||||
printf("--after call TestOut8 %u\n",ullInt);
|
||||
f_res << form("TestOut8 %u\n",ullInt);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
f = FLT_MIN;
|
||||
printf("--before call TestOut9 %.38f\n",f);
|
||||
t1->TestOut9(&f);
|
||||
printf("--after call TestOut9 %f\n",f);
|
||||
f_res << form("TestOut9 %.50f\n",f);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
d = DBL_MIN;
|
||||
printf("--before call TestOut10 %.50f\n",d);
|
||||
t1->TestOut10(&d);
|
||||
printf("--after call TestOut10 %f\n",d);
|
||||
f_res << form("TestOut10 %.50f\n",d);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
c = 'A';
|
||||
printf("--before call TestOut11 %d\n",c);
|
||||
t1->TestOut11(&c);
|
||||
printf("--after call TestOut11 %d\n",c);
|
||||
f_res << form("TestOut11 %c\n",c);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
wc = 'A';
|
||||
printf("--before call TestOut12 %d\n",wc);
|
||||
t1->TestOut12(&wc);
|
||||
printf("--after call TestOut12 %d\n",wc);
|
||||
f_res << form("TestOut12 %c\n",wc);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
s = new char[50];
|
||||
printf("--before call TestOut13 %s\n",s);
|
||||
t1->TestOut13(&s);
|
||||
printf("--after call TestOut13 %s\n",s);
|
||||
f_res << form("TestOut13 %s\n",s);
|
||||
delete s;
|
||||
printf("____________________________________________\n");
|
||||
/*
|
||||
ws = new PRUnichar[50];
|
||||
printf("--before call TestOut14 %s\n",ws);
|
||||
t1->TestOut14(&ws);
|
||||
printf("--after call TestOut14 %s\n",ws);
|
||||
f_res << form("TestOut14 %s\n",ws);
|
||||
delete ws;
|
||||
printf("____________________________________________\n");
|
||||
*/
|
||||
|
||||
PRUint32 arrCount = 0;
|
||||
char *array = new char [200];
|
||||
printf("--before call TestOut15 data array.\n");
|
||||
t1->TestOut15(&arrCount, &array);
|
||||
printf("TestOut15 count %d\n", arrCount);
|
||||
f_res << form("TestOut15 count %d\n", arrCount);
|
||||
printf("TestOut15 Array=%s\n", array);
|
||||
f_res << form("TestOut15 Array=%s\n",array);
|
||||
delete array;
|
||||
printf("____________________________________________\n");
|
||||
|
||||
|
||||
printf("--before call TestOut16 combination.\n");
|
||||
t1->TestOut16(&b, &c, &o, &sInt, &usInt, &lInt, &ulInt, &llInt, &ullInt, &f, &d, &s);
|
||||
printf("After calling TestOut16.\n");
|
||||
|
||||
f_res << form("TestOut16 PRBool %d\n",b);
|
||||
f_res << form("TestOut16 PRUint8 %o\n",o);
|
||||
f_res << form("TestOut16 PRInt16 %d\n",sInt);
|
||||
f_res << form("TestOut16 PRInt32 %d\n",lInt);
|
||||
f_res << form("TestOut16 PRInt64 %d\n",llInt);
|
||||
f_res << form("TestOut16 PRUint16 %u\n",usInt);
|
||||
f_res << form("TestOut16 PRUint32 %u\n",ulInt);
|
||||
f_res << form("TestOut16 PRUint64 %u\n",ullInt);
|
||||
f_res << form("TestOut16 float %.50f\n",f);
|
||||
f_res << form("TestOut16 double %.50f\n",d);
|
||||
f_res << form("TestOut16 char %c\n",c);
|
||||
f_res << form("TestOut16 string %s\n",s);
|
||||
printf("____________________________________________\n");
|
||||
|
||||
PRUint32 arrCount2 = 0;
|
||||
PRInt32 *arrLong = new PRInt32 [50];
|
||||
printf("--before call TestOut17 data array.\n");
|
||||
t1->TestOut17(&arrCount2, &arrLong);
|
||||
f_res << form("TestOut17 count %d\n", arrCount2);
|
||||
for (int i = 0; i < arrCount2; i++) {
|
||||
f_res << form("TestOut17 Array[%d]=%d\n",i,arrLong[i]);
|
||||
}
|
||||
delete arrLong;
|
||||
|
||||
printf("____________________________________________\n");
|
||||
|
||||
|
||||
f_res.close();
|
||||
}
|
@ -1,119 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stream.h>
|
||||
#include <fstream.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "proto.h"
|
||||
|
||||
/************************************************
|
||||
* Retrieves the server's process id
|
||||
* from the data file.
|
||||
************************************************/
|
||||
|
||||
void getProcessId(char *fname, char *s)
|
||||
{
|
||||
char ch;
|
||||
short i = 0;
|
||||
|
||||
ifstream f_in(fname);
|
||||
if (!f_in) {
|
||||
cerr << "Cannot open file %s.\n" << fname;
|
||||
exit(1);
|
||||
}
|
||||
while(1){
|
||||
if (f_in.eof()) break;
|
||||
f_in >> ch;
|
||||
s[i++] = ch;
|
||||
}
|
||||
s[i-1] = '\0';
|
||||
f_in.close();
|
||||
}
|
||||
|
||||
/***********************************************
|
||||
* Saves the server's process id
|
||||
* in to the data file.
|
||||
***********************************************/
|
||||
|
||||
void setProcessId(char *fname)
|
||||
{
|
||||
int pid = getpid();
|
||||
cout << "%x\n" << pid;
|
||||
ofstream f_out(fname);
|
||||
if(!f_out) {
|
||||
cerr << "Cannot open file" << fname;
|
||||
exit(1);
|
||||
}
|
||||
f_out << form("%x",pid);
|
||||
f_out.close();
|
||||
}
|
||||
|
||||
/***********************************************
|
||||
* Writes the string into the result data
|
||||
* file by appending it into the existing data.
|
||||
***********************************************/
|
||||
|
||||
void writeResult(char *fname, char *str) {
|
||||
|
||||
char **buf = new char *[500];
|
||||
int line = readFromFile(fname, buf);
|
||||
int len = strlen(str);
|
||||
buf[line] = new char[len];
|
||||
strcpy(buf[line], str);
|
||||
writeToFile(fname, line + 1, buf);
|
||||
for(int i = 0; i < line; i++){
|
||||
delete buf[i];
|
||||
}
|
||||
delete buf;
|
||||
}
|
||||
|
||||
/***********************************************
|
||||
* Reads the content of the result data file.
|
||||
*
|
||||
***********************************************/
|
||||
|
||||
int readFromFile(char *fname, char **buf) {
|
||||
|
||||
|
||||
int i = 0;
|
||||
ifstream f_in(fname);
|
||||
if (!f_in) {
|
||||
return i;
|
||||
}
|
||||
char *tmpbuf = new char[400];
|
||||
char ch;
|
||||
int j = 0;
|
||||
while(!f_in.eof()) {
|
||||
f_in.get(ch);
|
||||
tmpbuf[j++] = ch;
|
||||
if (ch == '\n') {
|
||||
tmpbuf[j] = '\0';
|
||||
buf[i] = new char[strlen(tmpbuf)];
|
||||
strcpy(buf[i++], tmpbuf);
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
delete tmpbuf;
|
||||
f_in.close();
|
||||
return i;
|
||||
}
|
||||
|
||||
/***********************************************
|
||||
* Writes the content of the buffer to the
|
||||
* of the result data file.
|
||||
|
||||
***********************************************/
|
||||
void writeToFile(char *fname, int numLine, char **buf) {
|
||||
|
||||
ofstream f_out(fname);
|
||||
if (!f_out) {
|
||||
cerr << "Error in reading file %s.\n" << fname;
|
||||
exit(1);
|
||||
}
|
||||
int i;
|
||||
for(i = 0; i < numLine; i++) {
|
||||
f_out << buf[i];
|
||||
}
|
||||
f_out.close();
|
||||
}
|
||||
|
@ -1,18 +0,0 @@
|
||||
#define BUF_MAX 500
|
||||
#define BUF_MIN 100
|
||||
#define SERVER_IN_RES "serverIn.res"
|
||||
#define CLIENT_IN_RES "clientIn.res"
|
||||
#define SERVER_OUT_RES "serverOut.res"
|
||||
#define CLIENT_OUT_RES "clientOut.res"
|
||||
#define SERVER_INOUT_RES "serverInOut.res"
|
||||
#define CLIENT_INOUT_RES "clientInOut.res"
|
||||
#define SERVER_COMB_RES "serverComb.res"
|
||||
#define CLIENT_COMB_RES "clientComb.res"
|
||||
#define IN_FDATA "fileIn.dat"
|
||||
#define OUT_FDATA "fileOut.dat"
|
||||
#define INOUT_FDATA "fileInOut.dat"
|
||||
#define COMB_FDATA "fileComb.dat"
|
||||
#define USHRT_MIN 555
|
||||
#define ULONG_MIN 555
|
||||
|
||||
|
@ -1,10 +0,0 @@
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(e7fc2bf4-1dd1-11b2-9253-8efe01a2f0d2)]
|
||||
interface nsIRPCTest : nsISupports
|
||||
{
|
||||
void test1(inout long l);
|
||||
void test2(in long l1,inout long l2);
|
||||
void test3(in string s1,inout string s2);
|
||||
void test4(in PRUint32 count,[array, size_is(count)] in string valueArray);
|
||||
};
|
@ -1,47 +0,0 @@
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(89eb8f10-c211-11d3-ad2a-005004159574)]
|
||||
interface nsIRPCTestComb : nsISupports
|
||||
{
|
||||
|
||||
void testComb1(in boolean bool, out char c);
|
||||
void testComb2(in boolean bool, inout string str);
|
||||
void testComb3(out char c, inout string str);
|
||||
void testComb4(inout string str, in boolean bool, out char c);
|
||||
void testComb5(in short s, out char c);
|
||||
void testComb6(in boolean bool, out short s);
|
||||
void testComb7(in boolean bool, inout short s);
|
||||
void testComb8(in boolean bool, in short s);
|
||||
void testComb9(in boolean bool, in char c);
|
||||
void testComb10(in boolean bool, out string str);
|
||||
void testComb11(in boolean bool, inout char c);
|
||||
void testComb12(in boolean bool, out long l);
|
||||
void testComb13(in boolean bool, inout long l);
|
||||
void testComb14(in boolean bool, in long l);
|
||||
void testComb15(in boolean bool, out double d);
|
||||
void testComb16(in boolean bool, inout double d);
|
||||
void testComb17(in boolean bool, inout unsigned short us);
|
||||
void testComb18(in boolean bool, out unsigned short us);
|
||||
void testComb19(in boolean bool, out octet o);
|
||||
void testComb20(in boolean bool, inout octet o);
|
||||
void testComb21(in boolean bool, in octet o);
|
||||
void testComb22(in boolean bool, in boolean bool2);
|
||||
void testComb23(in boolean bool, inout boolean bool2);
|
||||
void testComb24(in boolean bool, out boolean bool2);
|
||||
void testComb25(out boolean bool, out char c);
|
||||
void testComb26(inout boolean bool, out char c);
|
||||
void testComb27(in boolean bool, out wchar wc);
|
||||
|
||||
void testComb30(in string s1, out string s2);
|
||||
void testComb31(out octet o, out unsigned short us);
|
||||
void testComb32(out octet o, out long l);
|
||||
void testComb33(out long l, out unsigned short us);
|
||||
|
||||
// void testComb36(inout boolean bBool, inout char cChar, inout octet nByte,
|
||||
// inout short nShort, inout unsigned short nUShort,
|
||||
// inout long nLong, inout unsigned long nULong,
|
||||
// inout long long nHyper, inout unsigned long long nUHyper,
|
||||
// inout float fFloat, inout double fDouble,
|
||||
// inout wstring aString);
|
||||
|
||||
};
|
@ -1,38 +0,0 @@
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(9cc10d00-b191-11d3-ad1e-005004159574)]
|
||||
interface nsIRPCTestIn : nsISupports
|
||||
{
|
||||
void testIn1(in boolean bool);
|
||||
void testIn2(in octet oct);
|
||||
void testIn3(in short s);
|
||||
void testIn4(in long l);
|
||||
void testIn5(in long long ll);
|
||||
void testIn6(in unsigned short us);
|
||||
void testIn7(in unsigned long ul);
|
||||
void testIn8(in unsigned long long ull);
|
||||
void testIn9(in float f);
|
||||
void testIn10(in double d);
|
||||
void testIn11(in char c);
|
||||
void testIn12(in wchar wc);
|
||||
void testIn13(in string str);
|
||||
void testIn14(in wstring wstr);
|
||||
// WONT RUN void testIn15(in long count,[array, size_is(count)] in string valueArray);
|
||||
void testIn15(in unsigned long count,[array, size_is(count)] in string valueArray);
|
||||
void testIn16(in unsigned long count, [array, size_is(count)] in long longArray);
|
||||
void testIn17(in boolean bBool, in char cChar, in octet nByte,
|
||||
in short nShort, in unsigned short nUShort,
|
||||
in long nLong, in unsigned long nULong,
|
||||
in long long nHyper, in unsigned long long nUHyper,
|
||||
in float fFloat, in double fDouble,
|
||||
in string aString,
|
||||
in unsigned long count, [array, size_is(count)] in long longArray);
|
||||
void testIn18(in char cChar, in octet nByte,
|
||||
in short nShort, in unsigned short nUShort,
|
||||
in long nLong, in unsigned long nULong,
|
||||
in long long nHyper, in unsigned long long nUHyper,
|
||||
in float fFloat, in double fDouble,
|
||||
in string aString,
|
||||
in unsigned long count, [array, size_is(count)] in long longArray);
|
||||
|
||||
};
|
@ -1,34 +0,0 @@
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(16d17950-cdf5-11d3-ad2e-005004159574)]
|
||||
interface nsIRPCTestInOut : nsISupports
|
||||
{
|
||||
void testInOut1(inout boolean bool);
|
||||
void testInOut2(inout octet oct);
|
||||
void testInOut3(inout short s);
|
||||
void testInOut4(inout long l);
|
||||
void testInOut5(inout long long ll);
|
||||
void testInOut6(inout unsigned short us);
|
||||
void testInOut7(inout unsigned long ul);
|
||||
void testInOut8(inout unsigned long long ull);
|
||||
void testInOut9(inout float f);
|
||||
void testInOut10(inout double d);
|
||||
void testInOut11(inout char c);
|
||||
void testInOut12(inout wchar wc);
|
||||
void testInOut13(inout string str);
|
||||
void testInOut14(inout wstring wstr);
|
||||
void testInOut15(inout unsigned long count, [array, size_is(count)] inout char array);
|
||||
void testInOut16(inout boolean bBool, inout char cChar,
|
||||
inout unsigned short nUShort,
|
||||
inout long nLong, inout unsigned long nULong,
|
||||
inout long long nHyper, inout unsigned long long nUHyper,
|
||||
inout float fFloat, inout double fDouble,
|
||||
inout string aString);
|
||||
void testInOut17(inout unsigned long count, [array, size_is(count)] inout long array);
|
||||
void testInOut18(inout boolean bBool, inout char cChar, inout octet nByte,
|
||||
inout short nShort, inout unsigned short nUShort,
|
||||
inout long nLong, inout unsigned long nULong,
|
||||
inout long long nHyper, inout unsigned long long nUHyper,
|
||||
inout float fFloat, inout double fDouble,
|
||||
inout string aString);
|
||||
};
|
@ -1,28 +0,0 @@
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(e284f6a0-b701-11d3-ad26-005004159574)]
|
||||
interface nsIRPCTestOut : nsISupports
|
||||
{
|
||||
void testOut1(out boolean bool);
|
||||
void testOut2(out octet oct);
|
||||
void testOut3(out short s);
|
||||
void testOut4(out long l);
|
||||
void testOut5(out long long ll);
|
||||
void testOut6(out unsigned short us);
|
||||
void testOut7(out unsigned long ul);
|
||||
void testOut8(out unsigned long long ull);
|
||||
void testOut9(out float f);
|
||||
void testOut10(out double d);
|
||||
void testOut11(out char c);
|
||||
void testOut12(out wchar wc);
|
||||
void testOut13(out string str);
|
||||
void testOut14(out wstring wstr);
|
||||
void testOut15(out unsigned long count, [array, size_is(count)] out char array);
|
||||
void testOut16(out boolean bBool, out char cChar, out octet nByte,
|
||||
out short nShort, out unsigned short nUShort,
|
||||
out long nLong, out unsigned long nULong,
|
||||
out long long nHyper, out unsigned long long nUHyper,
|
||||
out float fFloat, out double fDouble,
|
||||
out string aString);
|
||||
void testOut17(out unsigned long count, [array, size_is(count)] out long array);
|
||||
};
|
@ -1,5 +0,0 @@
|
||||
void setProcessId(char *);
|
||||
void getProcessId(char *, char *s);
|
||||
void writeResult(char *, char *);
|
||||
void writeToFile(char *, int, char **);
|
||||
int readFromFile(char *, char **);
|
@ -1,2 +0,0 @@
|
||||
clean
|
||||
serverComb
|
@ -1,2 +0,0 @@
|
||||
clean
|
||||
serverInOut
|
@ -1,2 +0,0 @@
|
||||
clean
|
||||
serverIn
|
@ -1,2 +0,0 @@
|
||||
clean
|
||||
serverOut
|
@ -1,59 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include "RPCServerService.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIJVMManager.h"
|
||||
#include "nsIRPCTest.h"
|
||||
#include <unistd.h>
|
||||
#include "IDispatcher.h"
|
||||
#include "nsIThread.h"
|
||||
|
||||
class nsRPCTestImpl : public nsIRPCTest {
|
||||
NS_DECL_ISUPPORTS
|
||||
nsRPCTestImpl() {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
NS_IMETHOD Test1(PRInt32 *l) {
|
||||
printf("Test1 this=%p\n", this);
|
||||
printf("--nsRPCTestImpl::Test1 %d\n",*l);
|
||||
*l = 1234;
|
||||
printf("--nsRPCTestImpl::Test1 %d\n",*l);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD Test2(PRInt32 l1, PRInt32* l2) {
|
||||
printf("Test2 this=%p\n", this);
|
||||
printf("--nsRPCTestImpl::Test2 %d %d\n",l1,*l2);
|
||||
*l2 = l1;
|
||||
printf("--nsRPCTestImpl::Test2 %d %d\n",l1,*l2);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD Test3(const char *s1, char **s2) {
|
||||
printf("Test3 s1 %s s2 %s\n",s1,*s2);
|
||||
*s2 = "hi";
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD Test4(PRUint32 count, const char **valueArray) {
|
||||
printf("--Test4\n");
|
||||
printf("count %d\n",count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
printf("--valueArray[%d]=%s\n",i,valueArray[i]);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsRPCTestImpl, nsIRPCTest)
|
||||
int main(int argc, char **args) {
|
||||
printf("%x\n",getpid());
|
||||
nsRPCTestImpl * test1 = new nsRPCTestImpl();
|
||||
nsRPCTestImpl * test2 = new nsRPCTestImpl();
|
||||
RPCServerService * rpcService = RPCServerService::GetInstance();
|
||||
IDispatcher *dispatcher;
|
||||
rpcService->GetDispatcher(&dispatcher);
|
||||
dispatcher->RegisterWithOID(test1, 1);
|
||||
dispatcher->RegisterWithOID(test2, 5);
|
||||
while(1) {
|
||||
PR_Sleep(100);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,431 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stream.h>
|
||||
#include <fstream.h>
|
||||
#include <stdlib.h>
|
||||
#include "RPCServerService.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIJVMManager.h"
|
||||
#include "nsIRPCTestComb.h"
|
||||
#include "IDispatcher.h"
|
||||
#include "nsIThread.h"
|
||||
#include "deftest.h"
|
||||
#include "proto.h"
|
||||
|
||||
class nsRPCTestCombImpl : public nsIRPCTestComb {
|
||||
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
nsRPCTestCombImpl() {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb1(PRBool bool, char *c) {
|
||||
printf("TestComb1 this=%p\n", this);
|
||||
printf("--nsRPCTestCombImpl::Test1 %d\n",bool);
|
||||
printf("Before character assignment.\n");
|
||||
*c = 'Z';
|
||||
printf("After character assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb1 %c\n",*c);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb2(PRBool bool, char **s) {
|
||||
printf("TestComb2 this=%p\n", this);
|
||||
printf("--nsRPCTestCombImpl::Test2 %d\n",bool);
|
||||
printf("--nsRPCTestCombImpl::Test2 %s\n",*s);
|
||||
printf("Before string assignment.\n");
|
||||
*s = "Remote ipc tests.";
|
||||
printf("After string assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb2 %s\n",*s);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb3(char *c, char **s) {
|
||||
printf("TestComb3 this=%p\n", this);
|
||||
printf("--nsRPCTestCombImpl::Test3 %s\n",*s);
|
||||
printf("Before character assignment.\n");
|
||||
*c = 'Z';
|
||||
printf("After character assignment.\n");
|
||||
printf("Before string assignment.\n");
|
||||
*s = "Remote ipc tests.";
|
||||
printf("After string assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb3 %c %s\n",*c,*s);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb4(char **s, PRBool bool, char *c) {
|
||||
printf("TestComb4 this=%p\n", this);
|
||||
printf("--nsRPCTestCombImpl::Test4 %d\n",bool);
|
||||
printf("--nsRPCTestCombImpl::Test4 %s\n",*s);
|
||||
printf("Before character assignment.\n");
|
||||
*c = 'Z';
|
||||
printf("After character assignment.\n");
|
||||
printf("Before string assignment.\n");
|
||||
*s = "Remote ipc tests.";
|
||||
printf("After string assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb4 %c %s\n",*c,*s);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb5(PRInt16 sInt, char *c) {
|
||||
printf("TestComb5 this=%p\n", this);
|
||||
printf("Before character assignment.\n");
|
||||
*c = 'Z';
|
||||
printf("After character assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb5 %c\n",*c);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb6(PRBool bool, PRInt16 *sInt) {
|
||||
printf("TestComb6 this=%p\n", this);
|
||||
printf("Before short int assignment.\n");
|
||||
*sInt = 777;
|
||||
printf("After short int assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb6 %d\n",*sInt);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb7(PRBool bool, PRInt16 *sInt) {
|
||||
printf("TestComb7 this=%p\n", this);
|
||||
printf("--nsRPCTestCombInImpl::Test7 %d\n",*sInt);
|
||||
printf("Before short int assignment.\n");
|
||||
*sInt = 777;
|
||||
printf("After short int assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb7 %d\n",*sInt);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb8(PRBool bool, PRInt16 sInt) {
|
||||
printf("TestComb8 this=%p\n", this);
|
||||
printf("--nsRPCTestCombInImpl::Test8 %d\n",sInt);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb8 %d %d\n",bool, sInt);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb9(PRBool bool, char c) {
|
||||
printf("TestComb9 this=%p\n", this);
|
||||
printf("--nsRPCTestCombInImpl::Test9 %d\n",c);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb9 %d %c\n",bool, c);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb10(PRBool bool, char **s) {
|
||||
printf("TestComb10 this=%p\n", this);
|
||||
printf("--nsRPCTestCombImpl::Test10 %d\n",bool);
|
||||
printf("Before string assignment.\n");
|
||||
*s = "Remote ipc tests.";
|
||||
printf("After string assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb10 %s\n",*s);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb11(PRBool bool, char *c) {
|
||||
printf("TestComb11 this=%p\n", this);
|
||||
printf("--nsRPCTestCombImpl::Test11 %d\n",*c);
|
||||
*c = 'Z';
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb11 %c\n",*c);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb12(PRBool bool, PRInt32 *l) {
|
||||
printf("TestComb12 this=%p\n", this);
|
||||
printf("--nsRPCTestCombImpl::Test12 %d\n",bool);
|
||||
*l = 99999999;
|
||||
printf("After long integer assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb12 %d\n",*l);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb13(PRBool bool, PRInt32 *l) {
|
||||
printf("TestComb13 this=%p\n", this);
|
||||
printf("--nsRPCTestCombImpl::Test13 %d\n",bool);
|
||||
printf("--nsRPCTestCombImpl::Test13 %d\n",*l);
|
||||
*l = 99999999;
|
||||
printf("After long integer assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb13 %d\n",*l);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb14(PRBool bool, PRInt32 l) {
|
||||
printf("TestComb14 this=%p\n", this);
|
||||
printf("--nsRPCTestCombImpl::Test14 %d\n",bool);
|
||||
printf("--nsRPCTestCombImpl::Test14 %d\n",l);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb14 %d %d\n",bool, l);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb15(PRBool bool, double *d) {
|
||||
printf("TestComb15 this=%p\n", this);
|
||||
printf("--nsRPCTestCombImpl::Test15 %d\n",bool);
|
||||
*d = 9999999.9999999;
|
||||
printf("After long integer assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb15 %.50f\n",*d);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb16(PRBool bool, double *d) {
|
||||
printf("TestComb16 this=%p\n", this);
|
||||
printf("--nsRPCTestCombImpl::Test16 %d\n",bool);
|
||||
printf("--nsRPCTestCombImpl::Test16 %d\n",*d);
|
||||
*d = 9999999.9999999;
|
||||
printf("After long integer assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb16 %.50f\n", *d);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb17(PRBool bool, PRUint16 *usInt) {
|
||||
printf("TestComb17 this=%p\n", this);
|
||||
printf("--nsRPCTestCombInImpl::Test17 %d\n",*usInt);
|
||||
printf("Before unsigned short int assignment.\n");
|
||||
*usInt = 777;
|
||||
printf("After unsigned short int assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb17 %d\n",*usInt);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb18(PRBool bool, PRUint16 *usInt) {
|
||||
printf("TestComb18 this=%p\n", this);
|
||||
printf("Before unsigned short int assignment.\n");
|
||||
*usInt = 777;
|
||||
printf("After unsigned short int assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb18 %d\n",*usInt);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb19(PRBool bool, PRUint8 *oct) {
|
||||
printf("TestComb19 this=%p\n", this);
|
||||
printf("Before assignment.\n");
|
||||
*oct = 77;
|
||||
printf("After assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb19 %o\n",*oct);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb20(PRBool bool, PRUint8 *oct) {
|
||||
printf("TestComb20 this=%p\n", this);
|
||||
printf("--nsRPCTestCombInImpl::Test20 %d\n",*oct);
|
||||
printf("Before assignment.\n");
|
||||
*oct = 77;
|
||||
printf("After assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb20 %o\n",*oct);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb21(PRBool bool, PRUint8 oct) {
|
||||
printf("TestComb21 this=%p\n", this);
|
||||
printf("--nsRPCTestCombInImpl::Test21 %d\n",oct);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb21 %d %o\n",bool,oct);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb22(PRBool bool, PRBool bool2 ) {
|
||||
printf("TestComb22 this=%p\n", this);
|
||||
printf("--nsRPCTestCombInImpl::Test22 %d\n",bool2);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb22 %d %d\n",bool,bool2);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb23(PRBool bool, PRBool *bool2 ) {
|
||||
printf("TestComb23 this=%p\n", this);
|
||||
printf("--nsRPCTestCombInImpl::Test23 %d\n",*bool2);
|
||||
printf("Before assignment.\n");
|
||||
*bool2 = PR_FALSE;
|
||||
printf("After assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb23 %d\n",*bool2);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb24(PRBool bool, PRBool *bool2 ) {
|
||||
printf("TestComb24 this=%p\n", this);
|
||||
printf("Before assignment.\n");
|
||||
*bool2 = PR_FALSE;
|
||||
printf("After assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb24 %d\n",*bool2);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb25(PRBool *bool, char *c) {
|
||||
printf("TestComb25 this=%p\n", this);
|
||||
printf("Before assignment.\n");
|
||||
*bool = PR_FALSE;
|
||||
*c = 'Z';
|
||||
printf("After assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb25 %d %c\n",*bool,*c);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb26(PRBool *bool, char *c) {
|
||||
printf("TestComb26 this=%p\n", this);
|
||||
printf("--nsRPCTestCombInImpl::Test26 %d\n",*bool);
|
||||
printf("Before assignment.\n");
|
||||
*bool = PR_FALSE;
|
||||
*c = 'Z';
|
||||
printf("After assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb26 %d %c\n",*bool,*c);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb27(PRBool bool, PRUnichar *wc) {
|
||||
printf("TestComb27 this=%p\n", this);
|
||||
printf("Before assignment.\n");
|
||||
*wc = 'Z';
|
||||
printf("After assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb27 %c\n",*wc);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb30(const char *s1, char **s2) {
|
||||
printf("TestComb30 this=%p\n", this);
|
||||
printf("Before assignment.\n");
|
||||
*s2 = "Remote ipc test.";
|
||||
printf("After assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb30 %s\n",*s2);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb31(PRUint8 *o, PRUint16 *usInt) {
|
||||
printf("TestComb31 this=%p\n", this);
|
||||
printf("Before assignment.\n");
|
||||
*o = 777;
|
||||
*usInt = 999;
|
||||
printf("After assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb31 %o %u\n",*o,*usInt);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb32(PRUint8 *o, PRInt32 *lInt) {
|
||||
printf("TestComb32 this=%p\n", this);
|
||||
printf("Before assignment.\n");
|
||||
*o = 99;
|
||||
*lInt = 9999999;
|
||||
printf("After assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb32 %o %u\n",*o,*lInt);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestComb33(PRInt32 *lInt, PRUint16 *us) {
|
||||
printf("TestComb33 this=%p\n", this);
|
||||
printf("Before assignment.\n");
|
||||
*us = 777;
|
||||
*lInt = 9999999;
|
||||
printf("After assignment.\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestComb33 %d %u\n",*lInt,*us);
|
||||
writeResult(SERVER_COMB_RES,tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsRPCTestCombImpl, nsIRPCTestComb)
|
||||
int main(int argc, char **args)
|
||||
{
|
||||
int i;
|
||||
const short num = 4;
|
||||
nsRPCTestCombImpl * test[num];
|
||||
|
||||
setProcessId(COMB_FDATA);
|
||||
for(i = 0; i < num; i++) {
|
||||
test[i] = new nsRPCTestCombImpl();
|
||||
}
|
||||
RPCServerService * rpcService = RPCServerService::GetInstance();
|
||||
IDispatcher *dispatcher;
|
||||
rpcService->GetDispatcher(&dispatcher);
|
||||
for(i = 0; i < num; i++) {
|
||||
dispatcher->RegisterWithOID(test[i], i + 1);
|
||||
}
|
||||
while(1) {
|
||||
PR_Sleep(100);
|
||||
}
|
||||
|
||||
}
|
@ -1,304 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stream.h>
|
||||
#include <fstream.h>
|
||||
#include <stdlib.h>
|
||||
#include "RPCServerService.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIJVMManager.h"
|
||||
#include "nsIRPCTestIn.h"
|
||||
#include "IDispatcher.h"
|
||||
#include "nsIThread.h"
|
||||
#include "deftest.h"
|
||||
#include "proto.h"
|
||||
|
||||
|
||||
class nsRPCTestInImpl : public nsIRPCTestIn {
|
||||
NS_DECL_ISUPPORTS
|
||||
nsRPCTestInImpl() {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
NS_IMETHOD TestIn1(PRBool bool) {
|
||||
printf("TestIn1 this=%p\n", this);
|
||||
printf("--nsRPCTestInImpl::Test1 %d\n",bool);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestIn1 %d\n",bool);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestIn2(PRUint8 octet) {
|
||||
printf("TestIn2 this=%p\n", this);
|
||||
printf("--nsRPCTestInImpl::Test2 %d\n",octet);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestIn2 %o\n",octet);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestIn3(PRInt16 sInt) {
|
||||
printf("TestIn3 this=%p\n", this);
|
||||
printf("--nsRPCTestInImpl::Test3 %d\n",sInt);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestIn3 %d\n",sInt);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestIn4(PRInt32 lInt) {
|
||||
printf("TestIn4 this=%p\n", this);
|
||||
printf("--nsRPCTestInImpl::Test4 %d\n",lInt);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestIn4 %d\n",lInt);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestIn5(PRInt64 llInt) {
|
||||
printf("TestIn5 this=%p\n", this);
|
||||
printf("--nsRPCTestInImpl::Test5 %d\n",llInt);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestIn5 %d\n",llInt);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestIn6(PRUint16 usInt) {
|
||||
printf("TestIn6 this=%p\n", this);
|
||||
printf("--nsRPCTestInImpl::Test6 %u\n",usInt);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestIn6 %u\n",usInt);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestIn7(PRUint32 ulInt) {
|
||||
printf("TestIn7 this=%p\n", this);
|
||||
printf("--nsRPCTestInImpl::Test7 %u\n",ulInt);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestIn7 %u\n",ulInt);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestIn8(PRUint64 ullInt) {
|
||||
printf("TestIn8 this=%p\n", this);
|
||||
printf("--nsRPCTestInImpl::Test8 %u\n",ullInt);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestIn8 %u\n",ullInt);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestIn9(float f) {
|
||||
printf("TestIn9 this=%p\n", this);
|
||||
printf("--nsRPCTestInImpl::Test9 %.50f\n",f);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestIn9 %.50f\n",f);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestIn10(double d) {
|
||||
printf("TestIn10 this=%p\n", this);
|
||||
printf("--nsRPCTestInImpl::Test10 %.50f\n",d);
|
||||
char *tmpstr = new char[500];
|
||||
sprintf(tmpstr,"TestIn10 %.50f\n",d);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestIn11(char c) {
|
||||
printf("TestIn11 this=%p\n", this);
|
||||
printf("--nsRPCTestInImpl::Test11 %c\n",c);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestIn11 %c\n",c);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestIn12(PRUnichar unic) {
|
||||
printf("TestIn12 this=%p\n", this);
|
||||
printf("--nsRPCTestInImpl::Test12 %c\n",unic);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestIn12 %c\n",unic);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestIn13(const char* s) {
|
||||
printf("TestIn13 this=%p\n", this);
|
||||
printf("--nsRPCTestInImpl::Test13 %s\n",s);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestIn13 %s\n",s);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestIn14(const PRUnichar* unis) {
|
||||
printf("TestIn14 this=%p\n", this);
|
||||
printf("--nsRPCTestInImpl::Test14 %s\n",unis);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestIn14 %s\n",unis);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestIn15(PRUint32 count, const char **valueArray) {
|
||||
printf("--TestIn15\n");
|
||||
printf("count %d\n",count);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr, "TestIn15 count %d\n", count);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
for (int i = 0; i < count; i++) {
|
||||
printf("TestIn15 Array[%d]=%s\n",i,valueArray[i]);
|
||||
sprintf(tmpstr,"TestIn15 Array[%d]=%s\n",i,valueArray[i]);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
}
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestIn16(PRUint32 count, PRInt32 *longArray) {
|
||||
printf("--TestIn16\n");
|
||||
printf("count %d\n",count);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr, "TestIn16 count %d\n", count);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
for (int i = 0; i < count; i++) {
|
||||
printf("TestIn16 Array[%d]=%d\n",i,longArray[i]);
|
||||
sprintf(tmpstr,"TestIn16 Array[%d]=%d\n",i,longArray[i]);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
}
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestIn17(PRBool bBool, char cChar, PRUint8 nByte,
|
||||
PRInt16 nShort, PRUint16 nUShort,
|
||||
PRInt32 nLong,PRUint32 nULong,
|
||||
PRInt64 nHyper, PRUint64 nUHyper,
|
||||
float fFloat, double fDouble, const char *aString,
|
||||
PRUint32 count, PRInt32 *longArray)
|
||||
{
|
||||
|
||||
printf("TestIn17 this=%p\n", this) ;
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestIn17 PRBool %d\n",bBool);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn17 PRUint8 %o\n",nByte);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn17 PRInt16 %d\n",nShort);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn17 PRInt32 %d\n",nLong);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn17 PRInt64 %d\n",nHyper);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn17 PRUint16 %u\n",nUShort);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn17 PRUint32 %u\n",nULong);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn17 PRUint64 %u\n",nUHyper);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn17 float %.50f\n",fFloat);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn17 double %.50f\n",fDouble);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn17 char %c\n",cChar);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn17 string %s\n",aString);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn17 count %d\n", count);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
for (int i = 0; i < count; i++) {
|
||||
printf("TestIn17 Array[%d]=%d\n",i,longArray[i]);
|
||||
sprintf(tmpstr,"TestIn17 Array[%d]=%d\n",i,longArray[i]);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
}
|
||||
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHOD TestIn18(char cChar, PRUint8 nByte,
|
||||
PRInt16 nShort, PRUint16 nUShort,
|
||||
PRInt32 nLong,PRUint32 nULong,
|
||||
PRInt64 nHyper, PRUint64 nUHyper,
|
||||
float fFloat, double fDouble, const char *aString,
|
||||
PRUint32 count, PRInt32 *longArray)
|
||||
{
|
||||
printf("TestIn18 this=%p\n", this);
|
||||
char *tmpstr = new char[200];
|
||||
|
||||
sprintf(tmpstr,"TestIn18 PRUint8 %o\n",nByte);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn18 PRInt16 %d\n",nShort);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn18 PRInt32 %d\n",nLong);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn18 PRInt64 %d\n",nHyper);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn18 PRUint16 %u\n",nUShort);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn18 PRUint32 %u\n",nULong);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn18 PRUint64 %u\n",nUHyper);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn18 float %.50f\n",fFloat);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn18 double %.50f\n",fDouble);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn18 char %c\n",cChar);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn18 string %s\n",aString);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestIn18 count %d\n", count);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
for (int i = 0; i < count; i++) {
|
||||
printf("TestIn18 Array[%d]=%d\n",i,longArray[i]);
|
||||
sprintf(tmpstr,"TestIn18 Array[%d]=%d\n",i,longArray[i]);
|
||||
writeResult(SERVER_IN_RES, tmpstr);
|
||||
}
|
||||
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsRPCTestInImpl, nsIRPCTestIn)
|
||||
int main(int argc, char **args) {
|
||||
int i;
|
||||
const short num = 2;
|
||||
nsRPCTestInImpl * test[num];
|
||||
|
||||
setProcessId(IN_FDATA);
|
||||
for(i = 0; i < num; i++) {
|
||||
test[i] = new nsRPCTestInImpl();
|
||||
}
|
||||
RPCServerService * rpcService = RPCServerService::GetInstance();
|
||||
IDispatcher *dispatcher;
|
||||
rpcService->GetDispatcher(&dispatcher);
|
||||
for(i = 0; i < num; i++) {
|
||||
dispatcher->RegisterWithOID(test[i], i + 1);
|
||||
}
|
||||
while(1) {
|
||||
PR_Sleep(100);
|
||||
}
|
||||
}
|
@ -1,461 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stream.h>
|
||||
#include <fstream.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
#include "RPCServerService.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIJVMManager.h"
|
||||
#include "nsIRPCTestInOut.h"
|
||||
#include "IDispatcher.h"
|
||||
#include "nsIThread.h"
|
||||
#include "deftest.h"
|
||||
#include "proto.h"
|
||||
|
||||
class nsRPCTestInOutImpl : public nsIRPCTestInOut {
|
||||
NS_DECL_ISUPPORTS
|
||||
nsRPCTestInOutImpl() {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
NS_IMETHOD TestInOut1(PRBool *bool) {
|
||||
printf("TestInOut1 this=%p\n", this);
|
||||
printf("--nsRPCTestInOutImpl::Test1 %d\n",*bool);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestInOut1 before %d\n",*bool);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
*bool = PR_FALSE;
|
||||
sprintf(tmpstr,"TestInOut1 after %d\n",*bool);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestInOut2(PRUint8 *octet) {
|
||||
printf("TestInOut2 this=%p\n", this);
|
||||
printf("--nsRPCTestInOutImpl::Test2 %o\n",*octet);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestInOut2 before %o\n",*octet);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
*octet = 88;
|
||||
sprintf(tmpstr,"TestInOut2 after %o\n",*octet);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestInOut3(PRInt16 *sInt) {
|
||||
printf("TestInOut3 this=%p\n", this);
|
||||
printf("--nsRPCTestInOutImpl::Test3 %d\n",*sInt);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestInOut3 before %d\n",*sInt);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
*sInt = SHRT_MAX;
|
||||
sprintf(tmpstr,"TestInOut3 after %d\n",*sInt);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestInOut4(PRInt32 *lInt) {
|
||||
printf("TestInOut4 this=%p\n", this);
|
||||
printf("--nsRPCTestInOutImpl::Test4 %d\n",*lInt);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestInOut4 before %l\n",*lInt);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
*lInt = LONG_MAX;
|
||||
sprintf(tmpstr,"TestInOut4 after %l\n",*lInt);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestInOut5(PRInt64 *llInt) {
|
||||
printf("TestInOut5 this=%p\n", this);
|
||||
printf("--nsRPCTestInOutImpl::Test5 %d\n",*llInt);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestInOut5 before %l\n",*llInt);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
*llInt = LONG_MAX;
|
||||
sprintf(tmpstr,"TestInOut5 after %l\n",*llInt);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestInOut6(PRUint16 *usInt) {
|
||||
printf("TestInOut6 this=%p\n", this);
|
||||
printf("--nsRPCTestInOutImpl::Test6 %15u\n",*usInt);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestInOut6 before %10u\n",*usInt);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
*usInt = USHRT_MAX;
|
||||
sprintf(tmpstr,"TestInOut6 after %10u\n",*usInt);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestInOut7(PRUint32 *ulInt) {
|
||||
printf("TestInOut7 this=%p\n", this);
|
||||
printf("--nsRPCTestInOutImpl::Test7 %15u\n",*ulInt);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestInOut7 before %10u\n",*ulInt);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
*ulInt = ULONG_MAX;
|
||||
sprintf(tmpstr,"TestInOut7 after %10u\n",*ulInt);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestInOut8(PRUint64 *ullInt) {
|
||||
printf("TestInOut8 this=%p\n", this);
|
||||
printf("--nsRPCTestInOutImpl::Test8 %15u\n",*ullInt);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestInOut8 before %10u\n",*ullInt);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
*ullInt = ULONG_MAX;
|
||||
sprintf(tmpstr,"TestInOut8 after %10u\n",*ullInt);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestInOut9(float *f) {
|
||||
printf("TestInOut9 this=%p\n", this);
|
||||
printf("--nsRPCTestInOutImpl::Test9 %.50f\n",*f);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestInOut9 before %.50f\n",*f);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
*f = FLT_MAX;
|
||||
sprintf(tmpstr,"TestInOut9 after %.50f\n",*f);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestInOut10(double *d) {
|
||||
printf("TestInOut10 this=%p\n", this);
|
||||
printf("--nsRPCTestInOutImpl::Test10 %.50f\n",*d);
|
||||
char *tmpstr = new char[500];
|
||||
sprintf(tmpstr,"TestInOut10 before %.50f\n",*d);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
*d = DBL_MAX;
|
||||
sprintf(tmpstr,"TestInOut10 after %.50f\n",*d);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestInOut11(char *c) {
|
||||
printf("TestInOut11 this=%p\n", this);
|
||||
printf("--nsRPCTestInOutImpl::Test11 %c\n",*c);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestInOut11 before %c\n",*c);
|
||||
printf("THIS THIS THIS IS A TEST.... %s\n", tmpstr);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
*c = 'G';
|
||||
sprintf(tmpstr,"TestInOut11 after %c\n",*c);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestInOut12(PRUnichar *unic) {
|
||||
printf("TestInOut12 this=%p\n", this);
|
||||
printf("--nsRPCTestInOutImpl::Test12 %c\n",*unic);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestInOut12 before %c\n",*unic);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
*unic = 'G';
|
||||
sprintf(tmpstr,"TestInOut12 after %c\n",*unic);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestInOut13(char **s) {
|
||||
printf("TestInOut13 this=%p\n", this);
|
||||
printf("--nsRPCTestInOutImpl::Test13 %s\n",*s);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestInOut13 before %s\n",*s);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
*s = "remote ipc";
|
||||
sprintf(tmpstr,"TestInOut13 after %s\n",*s);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestInOut14(PRUnichar **unis) {
|
||||
printf("TestInOut14 this=%p\n", this);
|
||||
printf("--nsRPCTestInOutImpl::Test14 %s\n",*unis);
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestInOut14 before %s\n",*unis);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
//*unis = "remote ipc";
|
||||
for (int i = 0; i < 10; i++) {
|
||||
(*unis)[i] = 'a' + 1;
|
||||
}
|
||||
(*unis)[i] = '\0';
|
||||
sprintf(tmpstr,"TestInOut14 after %s\n",*unis);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestInOut15(PRUint32 *count, char **valueArray) {
|
||||
printf("--TestInOut15\n");
|
||||
char *tmpstr = new char[200];
|
||||
printf("TestInOut15 before count %d\n", *count);
|
||||
sprintf(tmpstr, "TestInOut15 before count %d\n", *count);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut15 before valueArray %s\n", *valueArray);
|
||||
sprintf(tmpstr,"TestInOut15 before Array=%s\n",*valueArray);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
*valueArray = "Going in... remote ipc test.";
|
||||
*count = strlen(*valueArray);
|
||||
printf("TestInOut15 after count %d\n", *count);
|
||||
sprintf(tmpstr, "TestInOut15 after count %d\n", *count);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut15 after valueArray %s\n", *valueArray);
|
||||
sprintf(tmpstr,"TestInOut15 after Array=%s\n",*valueArray);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHOD TestInOut16(PRBool *bBool, char *cChar,
|
||||
PRUint16 *nUShort,
|
||||
PRInt32 *nLong,PRUint32 *nULong,
|
||||
PRInt64 *nHyper, PRUint64 *nUHyper,
|
||||
float *fFloat, double *fDouble, char **aString)
|
||||
{
|
||||
|
||||
printf("TestInOut16 before this=%p\n", this) ;
|
||||
char *tmpstr = new char[200];
|
||||
printf("TestInOut16 before %d\n",*bBool);
|
||||
sprintf(tmpstr,"TestInOut16 before %d\n",*bBool);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut16 before %d\n",*nLong);
|
||||
sprintf(tmpstr,"TestInOut16 before %d\n",*nLong);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut16 before %d\n",*nHyper);
|
||||
sprintf(tmpstr,"TestInOut16 before %d\n",*nHyper);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut16 before %u\n",*nUShort);
|
||||
sprintf(tmpstr,"TestInOut16 before %u\n",*nUShort);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut16 before %u\n",*nULong);
|
||||
sprintf(tmpstr,"TestInOut16 before %u\n",*nULong);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut16 before %u\n",*nUHyper);
|
||||
sprintf(tmpstr,"TestInOut16 before %u\n",*nUHyper);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut16 before %.50f\n",*fFloat);
|
||||
sprintf(tmpstr,"TestInOut16 before %.50f\n",*fFloat);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut16 before %.50f\n",*fDouble);
|
||||
sprintf(tmpstr,"TestInOut16 before %.50f\n",*fDouble);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut16 before %c\n",*cChar);
|
||||
sprintf(tmpstr,"TestInOut16 before %c\n",*cChar);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut16 before %s\n",*aString);
|
||||
sprintf(tmpstr,"TestInOut16 before %s\n",*aString);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
|
||||
*bBool = PR_TRUE;
|
||||
*cChar = 'A';
|
||||
*nUShort = 2;
|
||||
*nLong = 3;
|
||||
*nULong = 4;
|
||||
*nHyper = 5;
|
||||
*nUHyper = 6;
|
||||
*fFloat = 7;
|
||||
*fDouble = 8;
|
||||
*aString = "Remote ipc test.";
|
||||
|
||||
printf("TestInOut16 after %d\n",*bBool);
|
||||
sprintf(tmpstr,"TestInOut16 after %d\n",*bBool);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut16 after %d\n",*nLong);
|
||||
sprintf(tmpstr,"TestInOut16 after %d\n",*nLong);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut16 after %d\n",*nHyper);
|
||||
sprintf(tmpstr,"TestInOut16 after %d\n",*nHyper);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut16 after %u\n",*nUShort);
|
||||
sprintf(tmpstr,"TestInOut16 after %u\n",*nUShort);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut16 after %u\n",*nULong);
|
||||
sprintf(tmpstr,"TestInOut16 after %u\n",*nULong);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut16 after %u\n",*nUHyper);
|
||||
sprintf(tmpstr,"TestInOut16 after %u\n",*nUHyper);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut16 after %.50f\n",*fFloat);
|
||||
sprintf(tmpstr,"TestInOut16 after %.50f\n",*fFloat);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut16 after %.50f\n",*fDouble);
|
||||
sprintf(tmpstr,"TestInOut16 after %.50f\n",*fDouble);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut16 after %c\n",*cChar);
|
||||
sprintf(tmpstr,"TestInOut16 after %c\n",*cChar);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut16 after %s\n",*aString);
|
||||
sprintf(tmpstr,"TestInOut16 after %s\n",*aString);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestInOut17(PRUint32 *count, PRInt32 **longArray) {
|
||||
printf("--TestInOut17\n");
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr, "TestInOut17 before count %d\n", *count);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
for (int i = 0; i < *count; i++) {
|
||||
printf("TestInOut17 before Array[%d]=%d\n",i,(*longArray)[i]);
|
||||
sprintf(tmpstr,"TestInOut17 before Array[%d]=%d\n",i,(*longArray)[i]);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
}
|
||||
*count = 5;
|
||||
sprintf(tmpstr, "TestInOut17 after count %d\n", *count);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
*longArray = new PRInt32[*count];
|
||||
for (i = 0; i < *count; i++) {
|
||||
//longArray[i] = new PRInt32;
|
||||
(*longArray)[i] = 55555 + i;
|
||||
printf("TestInOut17 after Array[%d]=%d\n",i,(*longArray)[i]);
|
||||
sprintf(tmpstr,"TestInOut17 after Array[%d]=%d\n",i,(*longArray)[i]);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
}
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestInOut18(PRBool *bBool, char *cChar, PRUint8 *nByte,
|
||||
PRInt16 *nShort, PRUint16 *nUShort,
|
||||
PRInt32 *nLong,PRUint32 *nULong,
|
||||
PRInt64 *nHyper, PRUint64 *nUHyper,
|
||||
float *fFloat, double *fDouble, char **aString)
|
||||
{
|
||||
|
||||
printf("TestInOut18 before this=%p\n", this) ;
|
||||
char *tmpstr = new char[200];
|
||||
printf("TestInOut18 before %d\n",*bBool);
|
||||
sprintf(tmpstr,"TestInOut18 before %d\n",*bBool);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestInOut18 before %o\n",*nByte);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestInOut18 before %d\n",*nShort);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut18 before %d\n",*nLong);
|
||||
sprintf(tmpstr,"TestInOut18 before %d\n",*nLong);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut18 before %d\n",*nHyper);
|
||||
sprintf(tmpstr,"TestInOut18 before %d\n",*nHyper);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut18 before %u\n",*nUShort);
|
||||
sprintf(tmpstr,"TestInOut18 before %u\n",*nUShort);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut18 before %u\n",*nULong);
|
||||
sprintf(tmpstr,"TestInOut18 before %u\n",*nULong);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut18 before %u\n",*nUHyper);
|
||||
sprintf(tmpstr,"TestInOut18 before %u\n",*nUHyper);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut18 before %.50f\n",*fFloat);
|
||||
sprintf(tmpstr,"TestInOut18 before %.50f\n",*fFloat);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut18 before %.50f\n",*fDouble);
|
||||
sprintf(tmpstr,"TestInOut18 before %.50f\n",*fDouble);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut18 before %c\n",*cChar);
|
||||
sprintf(tmpstr,"TestInOut18 before %c\n",*cChar);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut18 before %s\n",*aString);
|
||||
sprintf(tmpstr,"TestInOut18 before %s\n",*aString);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
|
||||
*bBool = PR_TRUE;
|
||||
*nByte = 777;
|
||||
*cChar = 'A';
|
||||
*nShort = 1;
|
||||
*nUShort = 2;
|
||||
*nLong = 3;
|
||||
*nULong = 4;
|
||||
*nHyper = 5;
|
||||
*nUHyper = 6;
|
||||
*fFloat = 7;
|
||||
*fDouble = 8;
|
||||
*aString = "Remote ipc test.";
|
||||
|
||||
printf("TestInOut18 after %d\n",*bBool);
|
||||
sprintf(tmpstr,"TestInOut18 after %d\n",*bBool);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestInOut18 after %o\n",*nByte);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestInOut18 after %d\n",*nShort);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut18 after %d\n",*nLong);
|
||||
sprintf(tmpstr,"TestInOut18 after %d\n",*nLong);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut18 after %d\n",*nHyper);
|
||||
sprintf(tmpstr,"TestInOut18 after %d\n",*nHyper);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut18 after %u\n",*nUShort);
|
||||
sprintf(tmpstr,"TestInOut18 after %u\n",*nUShort);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut18 after %u\n",*nULong);
|
||||
sprintf(tmpstr,"TestInOut18 after %u\n",*nULong);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut18 after %u\n",*nUHyper);
|
||||
sprintf(tmpstr,"TestInOut18 after %u\n",*nUHyper);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut18 after %.50f\n",*fFloat);
|
||||
sprintf(tmpstr,"TestInOut18 after %.50f\n",*fFloat);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut18 after %.50f\n",*fDouble);
|
||||
sprintf(tmpstr,"TestInOut18 after %.50f\n",*fDouble);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut18 after %c\n",*cChar);
|
||||
sprintf(tmpstr,"TestInOut18 after %c\n",*cChar);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
printf("TestInOut18 after %s\n",*aString);
|
||||
sprintf(tmpstr,"TestInOut18 after %s\n",*aString);
|
||||
writeResult(SERVER_INOUT_RES, tmpstr);
|
||||
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsRPCTestInOutImpl, nsIRPCTestInOut)
|
||||
int main(int argc, char **args) {
|
||||
|
||||
int i;
|
||||
const short num = 2;
|
||||
nsRPCTestInOutImpl * test[num];
|
||||
|
||||
setProcessId(INOUT_FDATA);
|
||||
for(i = 0; i < num; i++) {
|
||||
test[i] = new nsRPCTestInOutImpl();
|
||||
}
|
||||
RPCServerService * rpcService = RPCServerService::GetInstance();
|
||||
IDispatcher *dispatcher;
|
||||
rpcService->GetDispatcher(&dispatcher);
|
||||
for(i = 0; i < num; i++) {
|
||||
dispatcher->RegisterWithOID(test[i], i + 1);
|
||||
}
|
||||
while(1) {
|
||||
PR_Sleep(100);
|
||||
}
|
||||
}
|
@ -1,274 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stream.h>
|
||||
#include <fstream.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
#include "RPCServerService.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIJVMManager.h"
|
||||
#include "nsIRPCTestOut.h"
|
||||
#include "IDispatcher.h"
|
||||
#include "nsIThread.h"
|
||||
#include "deftest.h"
|
||||
#include "proto.h"
|
||||
|
||||
class nsRPCTestOutImpl : public nsIRPCTestOut {
|
||||
NS_DECL_ISUPPORTS
|
||||
nsRPCTestOutImpl () {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
NS_IMETHOD TestOut1(PRBool *bool) {
|
||||
printf("TestOut1 this=%p\n", this);
|
||||
*bool = PR_FALSE;
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestOut1 %d\n",*bool);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestOut2(PRUint8 *octet) {
|
||||
printf("TestOut2 this=%p\n", this);
|
||||
*octet = 88;
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestOut2 %o\n",*octet);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestOut3(PRInt16 *sInt) {
|
||||
printf("TestOut3 this=%p\n", this);
|
||||
*sInt = SHRT_MAX;
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestOut3 %d\n",*sInt);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestOut4(PRInt32 *lInt) {
|
||||
printf("TestOut4 this=%p\n", this);
|
||||
*lInt = LONG_MAX;
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestOut4 %d\n",*lInt);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestOut5(PRInt64 *llInt) {
|
||||
printf("TestOut5 this=%p\n", this);
|
||||
*llInt = LONG_MAX;
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestOut5 %d\n",*llInt);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestOut6(PRUint16 *usInt) {
|
||||
printf("TestOut6 this=%p\n", this);
|
||||
*usInt = USHRT_MAX;
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestOut6 %u\n",*usInt);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestOut7(PRUint32 *ulInt) {
|
||||
printf("TestOut7 this=%p\n", this);
|
||||
*ulInt = ULONG_MAX;
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestOut7 %u\n",*ulInt);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestOut8(PRUint64 *ullInt) {
|
||||
printf("TestOut8 this=%p\n", this);
|
||||
*ullInt = ULONG_MAX;
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestOut8 %u\n",*ullInt);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestOut9(float *f) {
|
||||
printf("TestOut9 this=%p\n", this);
|
||||
*f = FLT_MAX;
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestOut9 %.50f\n",*f);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestOut10(double *d) {
|
||||
printf("TestOut10 this=%p\n", this);
|
||||
*d = DBL_MAX;
|
||||
char *tmpstr = new char[500];
|
||||
sprintf(tmpstr,"TestOut10 %.50f\n",*d);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestOut11(char *c) {
|
||||
printf("TestOut11 this=%p\n", this);
|
||||
*c = 'G';
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestOut11 %c\n",*c);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestOut12(PRUnichar *unic) {
|
||||
printf("TestOut12 this=%p\n", this);
|
||||
*unic = 'G';
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestOut12 %c\n",*unic);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestOut13(char **s) {
|
||||
printf("TestOut13 this=%p\n", this);
|
||||
*s = "remote ipc";
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestOut13 %s\n",*s);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestOut14(PRUnichar **unis) {
|
||||
printf("TestOut14 this=%p\n", this);
|
||||
//*unis = "remote ipc";
|
||||
*unis = new PRUnichar[50];
|
||||
for (int i = 0; i < 10; i++) {
|
||||
(*unis)[i] = 'a' + 1;
|
||||
}
|
||||
(*unis)[i] = '\0';
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestOut14 %s\n",*unis);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestOut15(PRUint32 *count, char **valueArray) {
|
||||
printf("--TestOut15\n");
|
||||
*valueArray = "This is a remote ipc test.";
|
||||
*count = strlen(*valueArray);
|
||||
char *tmpstr = new char[200];
|
||||
printf("TestOut15 count %d\n", *count);
|
||||
sprintf(tmpstr, "TestOut15 count %d\n", *count);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
printf("TestOut15 valueArray %s\n", *valueArray);
|
||||
sprintf(tmpstr,"TestOut15 Array=%s\n",*valueArray);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestOut16(PRBool *bBool, char *cChar, PRUint8 *nByte,
|
||||
PRInt16 *nShort, PRUint16 *nUShort,
|
||||
PRInt32 *nLong,PRUint32 *nULong,
|
||||
PRInt64 *nHyper, PRUint64 *nUHyper,
|
||||
float *fFloat, double *fDouble, char **aString)
|
||||
{
|
||||
*bBool = PR_TRUE;
|
||||
*nByte = 777;
|
||||
*cChar = 'A';
|
||||
*nShort = 1;
|
||||
*nUShort = 2;
|
||||
*nLong = 3;
|
||||
*nULong = 4;
|
||||
*nHyper = 5;
|
||||
*nUHyper = 6;
|
||||
*fFloat = 7;
|
||||
*fDouble = 8;
|
||||
*aString = "Remote ipc test.";
|
||||
|
||||
printf("TestOut16 this=%p\n", this) ;
|
||||
char *tmpstr = new char[200];
|
||||
sprintf(tmpstr,"TestOut16 PRBool %d\n",*bBool);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestOut16 PRUint8 %o\n",*nByte);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestOut16 PRInt16 %d\n",*nShort);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestOut16 PRInt32 %d\n",*nLong);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestOut16 PRInt64 %d\n",*nHyper);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestOut16 PRUint16 %u\n",*nUShort);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestOut16 PRUint32 %u\n",*nULong);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestOut16 PRUint64 %u\n",*nUHyper);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestOut16 float %.50f\n",*fFloat);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestOut16 double %.50f\n",*fDouble);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestOut16 char %c\n",*cChar);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
sprintf(tmpstr,"TestOut16 string %s\n",*aString);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD TestOut17(PRUint32 *count, PRInt32 **longArray) {
|
||||
printf("--TestOut17\n");
|
||||
char *tmpstr = new char[200];
|
||||
*count = 5;
|
||||
sprintf(tmpstr, "TestOut17 count %d\n", *count);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
*longArray = new PRInt32[*count];
|
||||
for (int i = 0; i < *count; i++) {
|
||||
(*longArray)[i] = 55555 + i;
|
||||
printf("TestOut17 Array[%d]=%d\n",i,(*longArray)[i]);
|
||||
sprintf(tmpstr,"TestOut17 Array[%d]=%d\n",i,(*longArray)[i]);
|
||||
writeResult(SERVER_OUT_RES, tmpstr);
|
||||
}
|
||||
delete tmpstr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsRPCTestOutImpl, nsIRPCTestOut)
|
||||
int main(int argc, char **args) {
|
||||
int i;
|
||||
const short num = 5;
|
||||
nsRPCTestOutImpl * test[num];
|
||||
|
||||
setProcessId(OUT_FDATA);
|
||||
for(i = 0; i < num; i++) {
|
||||
test[i] = new nsRPCTestOutImpl();
|
||||
}
|
||||
RPCServerService * rpcService = RPCServerService::GetInstance();
|
||||
IDispatcher *dispatcher;
|
||||
rpcService->GetDispatcher(&dispatcher);
|
||||
for(i = 0; i < num; i++) {
|
||||
dispatcher->RegisterWithOID(test[i], i + 1);
|
||||
}
|
||||
while(1) {
|
||||
PR_Sleep(100);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user