# HG changeset patch # User chpeckha # Date 1239049128 18000 # Node ID 9d2210c8eed2b5662f2178c90ec2135df7689d04 # Parent c892c53c664e6aaef23ae47d7c84fae26577fad1 Commit changes for 2.1.0 diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/Common/Headers/ErrorMonitorData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/Common/Headers/ErrorMonitorData.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __ERRRORMONITORDATA_H__ +#define __ERRRORMONITORDATA_H__ + +#include "shareddata.h" +#include "mutex.h" + +// Error memory written by Server for 1 client +#define MAX_ERRORS 200 +typedef struct tagErrorEntry +{ + BOOL osErrorUsed; + LONG tcfError; + DWORD osError; +} *pErrorEntry, ErrorEntry; +typedef struct tagErrorData +{ + int first; // first error in queue + int next; // last error in queue + int numberErrors; // number of errors in queue + ErrorEntry errors[MAX_ERRORS]; +} *pErrorData, ErrorData; + + +// base name (each client has different name) +#define ERRORMONITORDATA_MAP_BASENAME "TCFErrorMonitorData" +#define ERRORMONITORDATA_MAP_SIZE (sizeof(ErrorData)) + +// mutex to restrict access (each client has different name) +#define ERRORMONITORDATA_MUTEX_BASENAME "TCFErrorMonitorMutex" +#define ERRORMONITORDATA_MUTEX_TIMEOUT (60000L) + +class CErrorMonitorData : public CSharedData +{ +public: + BOOL Init(); +}; + +class CErrorMonitor +{ +public: + CErrorMonitor(); + CErrorMonitor(long inClientID); + ~CErrorMonitor(); + + BOOL CreateData(); + BOOL IsThisClient(long inClientID) { return (inClientID == m_ClientID); } + long GetClientId() { return m_ClientID; } + + BOOL PutError(LONG tcfError, BOOL osErrorUsed=FALSE, DWORD osError=0); + BOOL GetError(LONG* tcfError, BOOL* osErrorUsed=NULL, DWORD* osError=NULL); + void ResetErrorQueue(pErrorData pData) { pData->first = pData->next = pData->numberErrors = 0; } + BOOL IsErrorQueueEmpty(pErrorData pData) { return (pData->numberErrors <= 0); } + BOOL IsErrorQueueFull(pErrorData pData) { return (pData->numberErrors >= MAX_ERRORS); } + +private: + pErrorData GetDataPtr() { return (pErrorData)m_Data.GetDataPtr(); } + + BOOL WaitForAccess() { return m_Mutex.Wait(); }; + BOOL ReleaseAccess() { return m_Mutex.Release(); }; + + long m_ClientID; + CErrorMonitorData m_Data; + Mutex m_Mutex; +}; +#endif// __ERRRORMONITORDATA_H__ diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/Common/Headers/InputStream.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/Common/Headers/InputStream.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __INPUTSTREAM_H__ +#define __INPUTSTREAM_H__ + +#ifdef TCF_CLIENT +#include +#endif + +#include "shareddata.h" +#include "mutex.h" +#include "TCDebugLog.h" +#include "ServerClient.h" + +#define USE_CIRCULAR_BUFFER +// +// Input Stream - one per client +// + +//---------------------------------- +// Input Stream Mutex +//---------------------------------- +// Mutex name is basename + clientID +#define INPUTSTREAMDATA_MUTEX_BASENAME "TCFInputStreamDataMutex" +#define INPUTSTREAMDATA_MUTEX_TIMEOUT (60000L) + +//---------------------------------- +// Input Stream Buffer +//---------------------------------- +typedef BYTE *pInputStreamData; +// Mapping name is basename + clientID +#define INPUTSTREAMDATA_MAP_BASENAME "TCFInputStreamData" +class CInputStreamData : public CSharedData +{ +public: + BOOL Init(); +}; + +#ifdef USE_CIRCULAR_BUFFER +//---------------------------------- +// Input Stream Buffer & File Information +//---------------------------------- +typedef struct tagInputStreamInfo +{ + DWORD numberMessages; // total messages (buffer and file) + DWORD numberBytes; // total bytes (buffer and file) + DWORD numberMessagesInFile; // number of messages in file + DWORD numberBytesInFile; // number of bytes in file + DWORD bufferRead; // where to read from buffer + DWORD bufferPeek; // where to peek some data from buffer + DWORD bufferWrite; // where to write to buffer + DWORD bufferSize; // current size of buffer + DWORD bufferCapacity; // total capacity of buffer +} *pInputStreamInfo, InputStreamInfo; +#else +//---------------------------------- +// Input Stream Buffer & File Information +//---------------------------------- +typedef struct tagInputStreamInfo +{ + DWORD numberMessages; // total messages (buffer and file) + DWORD numberBytes; // total bytes (buffer and file) + DWORD numberMessagesInFile; // number of messages in file + DWORD numberBytesInFile; // number of bytes in file +} *pInputStreamInfo, InputStreamInfo; +#endif +// Mapping name is basename + clientID +#define INPUTSTREAMINFO_MAP_BASENAME "TCFInputStreamInfo" +#define INPUTSTREAMINFO_MAP_SIZE (sizeof(InputStreamInfo)) + +class CInputStreamInfo : public CSharedData +{ +public: + BOOL Init(); +}; + +//---------------------------------- +// Input Stream Overflow Files +//---------------------------------- +#define INPUTSTREAMOVERFLOW_FILE_SIZE (20*1024*1024L) + +typedef BYTE* pInputStreamFile; + +// Mapping name is basename + clientID +#define INPUTSTREAMOVERFLOW_MAP_BASENAME "TCFInputStreamOverflowFile" +class CInputStreamFile : public CSharedData +{ +public: + void SetClientId(long id); + BOOL Open(DWORD dwSize, CHAR *filePath); + BOOL Init(); + Close(); + + long m_ClientID; + HANDLE m_hFile; // handle from CreateFile +}; + +//---------------------------------- +// Input Stream class +//---------------------------------- +class CInputStream +{ +public: + CInputStream(); + CInputStream(CHAR* pOverflowPath, DWORD inBufferSize, BOOL inOverFlowToFile, long inClientID); + ~CInputStream(); + + BOOL CreateStream(); + long AddMessage(DWORD inLength, BYTE* inMessage); + LONG GetNumberMessages(); + + DWORD GetNextMessage(DWORD inLength, BYTE* outMessage); + DWORD GetNextMessageSize(); + void GetMessageSizes(long inNumberMessages, DWORD* outMessageSizes); + void GetTotalMessageSize(long inNumberMessages, DWORD& outTotalSize); + BOOL IsThisClient(long inClientID) { return (inClientID == m_ClientID); } + long GetClientId() { return m_ClientID; } +#ifdef TCF_CLIENT + DWORD GetMessages(JNIEnv* env, long inNumberMessages, long inNumberMaxBytes, long& outNumberBytesRead, long& outNumberMessagesRead, jbyteArray outMessageData); +#endif + void UnLockStream() { ReleaseAccess(); } + +#ifdef USE_CIRCULAR_BUFFER + void DoReadBuffer(pInputStreamInfo pInfo, BYTE* pBuffer, BYTE* outData, DWORD inLength); + void DoWriteBuffer(pInputStreamInfo pInfo, BYTE* pBuffer, BYTE* inData, DWORD inLength); + void IncrementReadPosition(pInputStreamInfo pInfo, DWORD inLength); + void IncrementWritePosition(pInputStreamInfo pInfo, DWORD inLength); + void DoPeekBuffer(pInputStreamInfo pInfo, BYTE* pBuffer, BYTE* outData, DWORD inLength); + void IncrementPeekPosition(pInputStreamInfo pInfo, DWORD inLength); +#endif + +private: + pInputStreamData GetDataPtr() { return (pInputStreamData)m_Data.GetDataPtr(); } + pInputStreamInfo GetInfoPtr() { return (pInputStreamInfo)m_Info.GetDataPtr(); } + pInputStreamFile GetFilePtr() { if (m_File == NULL) return NULL; else return (pInputStreamFile)m_File->GetDataPtr(); } + + BOOL WaitForAccess() { if (m_StreamLocked) return TRUE; else { m_StreamLocked = TRUE; return m_Mutex.Wait();} }; + BOOL ReleaseAccess() { if (m_StreamLocked) { m_StreamLocked = FALSE; return m_Mutex.Release();} else return TRUE; }; + + long m_ClientID; + Mutex m_Mutex; + CInputStreamData m_Data; + CInputStreamInfo m_Info; + DWORD m_BufferSize; + DWORD m_FileSize; + CHAR m_OverFlowBaseName[MAX_FILEPATH]; + BOOL m_OverFlowToFile; + CInputStreamFile* m_File; + BOOL m_StreamLocked; +}; + +#endif __INPUTSTREAM_H__ diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/Common/Headers/PSerialCommPref.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/Common/Headers/PSerialCommPref.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,103 @@ +/* + * PSerialCommPref.h + * + * Copyright 2002 metrowerks inc. All rights reserved. + * + */ + +#ifndef __PSERIALCOMMPREF_H__ +#define __PSERIALCOMMPREF_H__ + +//#include "DEPrefTypes.h" + +enum menu_port +{ + PortCOM1=0, + PortCOM2=1, + PortCOM3=2, + PortCOM4=3, + PortCOM5=4, + PortCOM6=5, + PortCOM7=6, + PortCOM8=7, + PortCOM9=8 +}; + +enum menu_rate +{ + Baud300=0, + Baud1200=1, + Baud2400=2, + Baud4800=3, + Baud9600=4, + Baud19200=5, + Baud38400=6, + Baud57600=7, + Baud115200=8, + Baud230400=9 +}; + +enum menu_databits +{ + DataBits4=0, + DataBits5=1, + DataBits6=2, + DataBits7=3, + DataBits8=4 +}; + +enum menu_stopbits +{ + StopBits1=0, + StopBits15=1, + StopBits2=2 +}; + +enum menu_parity +{ + ParNone=0, + ParOdd=1, + ParEven=2 +}; + +enum menu_flowcontrol +{ + FlowNone=0, + FlowHardware=1, + FlowSoftware=2 +}; + +#if (0) +#define PSerialCommPrefPanelDisplayName "Serial" + +// --- DEPREF --- +// Comment line above is required by deprefs.pl tool, which this header is run +// through as part of the DE builds (standalone debugger engine). There are +// various restrictions and requirements that tool imposes on this header, so +// if you change anything past here, please run this header through deprefs.pl +// and ensure no errors result. + +#define PSerialCommPrefPanelName "Serial Communications" + +#define PSERIALCOMMPREFVERSION 2 + +typedef struct PSerialCommPref { + short version; + + // serial 1 + signed char port; + signed char rate; + signed char databits; + signed char stopbits; + signed char parity; + signed char flowcontrol; + BOOLCHAR logdata; +//#if (HOSTOS == SOLARIS) || (HOSTOS == LINUX) +// unsigned char pad1[3]; +// char dynamicPort[256]; +//#endif + +} PSerialCommPref, **PSerialCommPrefHandle; +#endif + +#endif // __PSERIALCOMMPREF_H__ diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/Common/Headers/ServerClient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/Common/Headers/ServerClient.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,326 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __SERVERCLIENT_H__ +#define __SERVERCLIENT_H__ + +#include "shareddata.h" +#include "mutex.h" + +#define MAX_IPADDRESS_SIZE (20) +#define MAX_PORT_SIZE (6) +typedef struct tagTcpConnectData +{ + char ipAddress[MAX_IPADDRESS_SIZE]; + char ipPort[MAX_PORT_SIZE]; +} *pTcpConnectData, TcpConnectData; + +enum eFlowControl +{ + eFlowControlNone, + eFlowControlHW, + eFlowControlSW, +}; +enum eStopBits +{ + eStopBits1, + eStopBits15, + eStopBits2, +}; +enum eParity +{ + eParityNone, + eParityOdd, + eParityEven, +}; + +#define MAX_COMPORT_SIZE (20) +typedef struct tagRealSerialConnectData +{ + eFlowControl flowControl; + eStopBits stopBits; + eParity parity; + DWORD baudRate; + DWORD dataBits; + char comPort[MAX_COMPORT_SIZE]; +} *pRealSerialConnectData, RealSerialConnectData; + +typedef struct tagVirtualSerialConnectData +{ + char comPort[MAX_COMPORT_SIZE]; +} *pVirtualSerialConnectData, VirtualSerialConnectData; + +#define MAX_USBDEVICE_SIZE (100) +typedef struct tagUSBConnectData +{ + // TODO + char device[MAX_USBDEVICE_SIZE]; +} *pUSBConnectData, USBConnectData; + +#define MAX_NUMBER_OPTIONS (20) +#define MAX_DECODE_FORMAT (16) +#define MAX_CONNECTION_TYPE (16) + +// per connection settings +typedef struct tagConnectData +{ + DWORD retryInterval; // retry interval option + DWORD retryTimeout; // retry timeout option + DWORD traceBoxChannel; // added TraceBox information + char decodeFormat[MAX_DECODE_FORMAT]; // decode format (e.g. "ost") option + char connectType[MAX_CONNECTION_TYPE]; // connection type (e.g. "tcp") + TcpConnectData tcpSettings; // TCP/IP settings + RealSerialConnectData realSerialSettings; // real serial + VirtualSerialConnectData virtualSerialSettings; // virtual serial + USBConnectData usbSettings; // real USB + +} *pConnectData, ConnectData; + +// per client options - done at connect time +typedef struct tagClientOptions +{ + DWORD unWrapFormat; // message unwrapping option (PN or OST) + DWORD ostVersion; // which OST version to use on sendmessage (unused in native) + +} *pClientOptions, ClientOptions; + +// per client options - done on opening stream +enum eMessageDestination +{ + eDestinationInputStream = 0, // input stream + eDestinationFile, // message file +}; +#define MAX_FILEPATH (2048L) +typedef struct tagDestinationOptions +{ + eMessageDestination destination; // eMessageDestination + DWORD streamSize; // input stream size + BOOL overFlowToFile; // overflow stream to file option + CHAR destinationFile[MAX_FILEPATH]; // stream overflow file or message file + +} *pDestinationOptions, DestinationOptions; + +enum eServerCommand +{ + eCmdNone = 0, // no command to process + eCmdConnect, // connect (connectSettings clientOptions *clientId) + eCmdDisconnect, // disconnect (clientId) + eCmdGetClientStatus, // getclientstatus (clientId *clientStatus) + eCmdGetConnectionStatus, // getconnstatus + eCmdSetMessageIds, // setmessageIds (clientId number messageIds) + eCmdGetNumberVersions, // getnumberversions (clientId *number) + eCmdGetVersion, // getversion (clientId index *version) + eCmdGetNumberConnections, // getnumberconnections (*number) + eCmdGetConnectionType, // getconnectiontype (index *connectionSettings.connectType) + eCmdGetConnection, // getconnection (index *connectionSettings) + eCmdGetNumberClients, // getnumclients (*number) + eCmdOpenStream, // openstream (clientId destinationoptions) + eCmdCloseStream, // closestream (clientId) + eCmdStart, // start (clientId) + eCmdStop, // stop (clientId) + eCmdSendMessage, // sendmessage (clientId number message) + eCmdTestClientConnection, // testconnection (clientId) + eCmdTestConnection, // testconnection (connectSettings) + eCmdExit, // tell server to exit its main command thread + eCmdOpenMessageFile, // openfile (clientId destinationoptions) + eCmdCloseMessageFile, // closefile (clientId) + eCmdClearMessageFile, // clearfile (clientId) + +}; + +enum eServerResponse +{ + eRspNone = 0, // no response generated + eRspOK, // response with no errors + eRspError, // error response: error + eRspExitted, // server has exitted +}; + +enum eClientStatus +{ + eStarted, // message processing started + eStopped, // message processing stopped + eUnknownClient, // client not found +}; + +enum eConnectionStatus +{ + eConnected, // connection is OK + eDisconnected, // disconnected + eRetryInProgress, // inside retry interval (connected) + eRetryTimedOut, // retry timedout (disconnected) +}; + +// ----------- Command/Response Data ------------------- +#define MAX_VERSION_STRING (80) +#define MAX_MESSAGEIDS (256) +typedef struct tagServerCommandData +{ + eServerCommand command; // command type + eServerResponse response; // response type + eClientStatus clientStatus; // client status + eConnectionStatus connectionStatus; // connection status + long error; // response error + unsigned long osError; // error from the OS if applicable + long clientId; // clientID for command/response + long index; // eGetVersion command/eGetConnection command + long number; // length or other number value (see commands) + char version[MAX_VERSION_STRING]; // eGetVersion response + ConnectData connectSettings; // eConnect command/eGetConnection response + ClientOptions clientOptions; // per client options + DestinationOptions destinationOptions; // input stream or message file options + long numClients; // eGetNumberClients response + long numConnections; // eGetNumberConnections response + long encodeOption; // eSendMessage - what to do with protocol headers + BYTE protocolVersion; // eSendMessage - OST version byte if OST protocol + BOOL useMyId; // eSendMessage + BYTE myId; // eSendMessage + BYTE messageIds[MAX_MESSAGEIDS]; // eSetMessageIds command + +} *pServerCommandData, ServerCommandData; + +#define SERVERCOMMANDDATA_MAP_SIZE (sizeof(ServerCommandData)) +#define SERVERCOMMANDDATA_MAP_NAME "TCFServerCommandData" + +#define SERVERCOMMANDDATA_MUTEX_NAME "TCFServerCommandDataMutex" +//#define SERVERCOMMANDDATA_MUTEX_TIMEOUT (60000L) +#define SERVERCOMMANDDATA_MUTEX_TIMEOUT (1000L) + +class CServerCommandData : public CSharedData +{ +public: + BOOL Init() { if (IsCreator()) \ + {\ + pServerCommandData pData = (pServerCommandData)GetDataPtr();\ + pData->command = eCmdNone;\ + pData->response = eRspNone;\ + pData->clientStatus = eStopped;\ + pData->connectionStatus = eDisconnected;\ + pData->clientId = -1;\ + pData->index = 0;\ + pData->number = 0;\ + pData->version[0] = 0;\ + pData->numClients = 0;\ + pData->numConnections = 0;\ + memset(&pData->messageIds, 0, MAX_MESSAGEIDS);\ + }\ + return TRUE; } +}; +// ----------- Command/Response Data ------------------- + +// ----------- Send Message Data ------------------- +#define MAX_SENDMESSAGE (64*1024L+12) +typedef struct tagServerMessageData +{ + long length; + BYTE message[MAX_SENDMESSAGE]; // eSendMessage command +} *pServerMessageData, ServerMessageData; + +#define SERVERMESSAGEDATA_MAP_SIZE (sizeof(ServerMessageData)) +#define SERVERMESSAGEDATA_MAP_NAME "TCFServerMessageData" + +class CServerMessageData : public CSharedData +{ +public: + BOOL Init() { if (IsCreator()) \ + {\ + pServerMessageData pData = (pServerMessageData)GetDataPtr();\ + memset(&pData->message, 0, MAX_SENDMESSAGE);\ + pData->length = 0;\ + }\ + return TRUE; } +}; +// ----------- Send Message Data ------------------- + +// ----------- Server Process Data ------------------- +typedef struct tagServerProcessData +{ + long numRefs; // reference count (first creates server process/last destroys server process) + PROCESS_INFORMATION serverProcess; // Server process information +} *pServerProcessData, ServerProcessData; + +#define SERVERPROCESSDATA_MAP_SIZE (sizeof(ServerProcessData)) +#define SERVERPROCESSDATA_MAP_NAME "TCFServerProcessData" + +class CServerProcessData : public CSharedData +{ +public: + BOOL Init() { if (IsCreator()) \ + {\ + pServerProcessData pData = (pServerProcessData)GetDataPtr();\ + pData->numRefs = 0;\ + memset(&pData->serverProcess, 0, sizeof(pData->serverProcess));\ + pData->serverProcess.hProcess = NULL;\ + }\ + return TRUE; } +}; +// ----------- Server Process Data ------------------- + + +// Main server command/response class +#define SERVERPIPE_MUTEX_NAME "TCFServerPipeMutex" +#define SERVERPIPE_MUTEX_TIMEOUT (60000L) + +// Server command/response events +#define SERVER_COMMAND_READY_EVENTNAME "TCFServerCommandReadyEvent" +#define SERVER_RESPONSE_READY_EVENTNAME "TCFServerResponseReadyEvent" +#define SERVER_CMDRSP_EVENT_TIMEOUT 60000L + +class CServerCommand +{ +public: + CServerCommand(); + ~CServerCommand(); + + // Client methods + BOOL SendCommand(pServerCommandData pCmd, DWORD msgLength=0, BYTE* message=NULL); + BOOL GetResponse(pServerCommandData pRsp); + + // Server methods + BOOL GetCommand(pServerCommandData pCmd, pServerMessageData pMsg); + BOOL SendResponse(pServerCommandData pRsp); + + BOOL WaitforServerPipeAccess() { return m_ServerPipeMutex.Wait(); } + BOOL ReleaseServerPipeAccess() { return m_ServerPipeMutex.Release(); } + + pServerProcessData GetProcessPtr() { return (pServerProcessData)m_ServerProcessData.GetDataPtr(); } + +private: + pServerCommandData GetDataPtr() { return (pServerCommandData)m_ServerCommandData.GetDataPtr(); } + pServerMessageData GetMsgPtr() { return (pServerMessageData)m_ServerMessageData.GetDataPtr(); } + +private: + // Server Commands/Responses + BOOL WaitForServerCommandAccess() { return m_ServerCommandMutex.Wait(); }; + BOOL ReleaseServerCommandAccess() { return m_ServerCommandMutex.Release(); }; +// BOOL WaitForServerCommandAccess() { return TRUE; }; +// BOOL ReleaseServerCommandAccess() { return TRUE; }; + CServerCommandData m_ServerCommandData; + CServerMessageData m_ServerMessageData; + CServerProcessData m_ServerProcessData; + + Mutex m_ServerCommandMutex; + Mutex m_ServerPipeMutex; + + // client + void SetCommandReady(); + // server + void SetResponseReady(); + HANDLE m_hServerCommandReadyEvent; + HANDLE m_hServerResponseReadyEvent; +}; + +#endif// __SERVERCLIENT_H__ diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/Common/Headers/TCConstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/Common/Headers/TCConstants.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __TCCONSTANTS_H__ +#define __TCCONSTANTS_H__ + +#include + +// com.nokia.tcf.api.ITCConnection.java +#define DEFAULT_COMM_ERROR_RETRY_INTERVAL 1i64 +#define DEFAULT_COMM_ERROR_RETRY_TIMEOUT 300i64 + +// com.nokia.tcf.api.ITCMessageOptions.java + +#define DESTINATION_INPUTSTREAM 0i64 +#define DESTINATION_CLIENTFILE 1i64 +#define DEFAULT_DESTINATION 0i64 +#define DEFAULT_INPUTSTREAM_OVERFLOW 1i64 +#define UNWRAP_LEAVE_HEADERS 0i64 +#define UNWRAP_DELETE_HEADERS 1i64 +#define DEFAULT_UNWRAP_OPTION 0i64 +#define ENCODE_NO_FORMAT 0i64 +#define ENCODE_FORMAT 1i64 +#define ENCODE_TRK_FORMAT 2i64 +#define DEFAULT_ENCODE_FORMAT 0i64 +#define DEFAULT_OST_VERSION 1L + +#endif //__TCCONSTANTS_H__ diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/Common/Headers/TCDebugLog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/Common/Headers/TCDebugLog.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __TCDEBUGLOG_H__ +#define __TCDEBUGLOG_H__ +#include +#include +#include "mutex.h" + + +#define LOG_BASENAME "c:\\TCDebugLog" +#define LOG_MUTEX_BASENAME "TCDebugLogMutex" +#define LOG_MUTEX_TIMEOUT (60000L) + +class TCDebugLog +{ +public: + TCDebugLog(); + TCDebugLog(char* baseName, DWORD id); + TCDebugLog(char* baseName, DWORD id, DWORD timeout); + ~TCDebugLog(); + + void log(char* msg); + +//private: +// BOOL WaitForAccess() { return m_Mutex.Wait(); }; +// BOOL ReleaseAccess() { return m_Mutex.Release(); }; + BOOL WaitForAccess(); + BOOL ReleaseAccess(); + + void logTime(); + Mutex m_Mutex; + FILE* m_fLog; + char m_FileName[80]; + +}; +#endif //__TCDEBUGLOG_H__ diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/Common/Headers/TCErrorConstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/Common/Headers/TCErrorConstants.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __TCERRORCONSTANTS_H__ +#define __TCERRORCONSTANTS_H__ + +#include + +// these must match com.nokia.tcf.api.TCErrorContants.java + + #define TCAPI_ERR_NONE 0 // no error + #define TCAPI_ERR_CANNOT_OPEN 1 // cannot open port + #define TCAPI_ERR_ALREADY_OPEN 2 // port already open + #define TCAPI_ERR_INVALID_HANDLE 3 // invalid handle + #define TCAPI_ERR_TIMEOUT 4 // timeout on port + #define TCAPI_ERR_FILE_IS_OPEN 5 // a file is already open + #define TCAPI_ERR_FILE_DOES_NOT_EXIST 6 // file does not exist + #define TCAPI_ERR_NO_FILE 7 // no file is open + #define TCAPI_ERR_ROUTING_STOPPED 8 // routing is stopped + #define TCAPI_ERR_ROUTING_IN_PROGRESS 9 // routing in progress + #define TCAPI_ERR_WRITING_FILE 10 // could not write to file + #define TCAPI_ERR_NO_MESSAGESIDS_REGISTERED 11 // no message Ids are registered + #define TCAPI_ERR_MEDIA_NOT_OPEN 12 // handle indicates openMedia not called + #define TCAPI_ERR_MEDIA_NOT_SUPPORTED 13 // media type is not supported yet + #define TCAPI_ERR_UNKNOWN_MEDIA_TYPE 14 // media not known + #define TCAPI_ERR_MISSING_MEDIA_DATA 15 // media type known, but missing data + #define TCAPI_ERR_INVALID_MEDIA_DATA 16 // media type known, but has invalid prefs + #define TCAPI_ERR_WHILE_CONFIGURING_MEDIA 17 // media type known, but couldn't be configured + #define TCAPI_ERR_CANNOT_FIND_ROUTER 18 // cannot find TCFServer.exe + #define TCAPI_ERR_CANNOT_CREATE_ROUTER_PROCESS 19 // found " but error returned on CreateProcess + #define TCAPI_ERR_MEDIA_IS_BUSY 20 // used for Trace bpx when someone else is connected + #define TCAPI_ERR_PROTOCOL_NOT_SUPPORTED_BY_MEDIA 21 // TraceBox does not support protocol + #define TCAPI_ERR_FEATURE_NOT_IMPLEMENTED 22 // API feature not implemented yet + #define TCAPI_ERR_COMM_ERROR 23 // error while polling/reading COMM port + #define TCAPI_ERR_COMM_TIMEOUT 24 // comm error retry timeout + #define TCAPI_ERR_COMM_MULTIPLE_OPEN 25 // there are multiple connections open - cannot attach + #define TCAPI_ERR_NO_COMM_OPEN 26 // there are no connections open - cannot attach + #define TCAPI_ERR_ALREADY_CONNECTED 27 // this client is already connected to some target + #define TCAPI_ERR_INVALID_DECODE_FORMAT 28 // invalid decode format (PN or OST is required) + #define TCAPI_ERR_INVALID_RETRY_PERIODS 29 // invalid retry timeout or interval + #define TCAPI_ERR_INVALID_STREAM_OVERFLOW_OPTION 30 // invalid option for overflowing input stream + #define TCAPI_ERR_INVALID_ENCODE_FORMAT 31 // invalid trace encoding format option + #define TCAPI_ERR_INVALID_MESSAGE_UNWRAP_OPTION 32 // invalid trace message unwrapping option + #define TCAPI_ERR_INVALID_STREAM_BUFFER_SIZE 33 // input stream buffer size is restricted (> 0 currently) + #define TCAPI_ERR_MISSING_MESSAGE_OPTIONS 34 // messages options (ITCMessageOptions) not specified + #define TCAPI_ERR_MISSING_CONNECTION_SPEC 35 // missing ITCConnection specification + #define TCAPI_ERR_MISSING_MESSAGE 36 // ITCMessage is missing on send Message + #define TCAPI_ERR_MESSAGE_OPTIONS_CONFLICT 37 // ITCMessage message options conflict with client's options + #define TCAPI_ERR_MESSAGEID_MAXIMUM 38 // ITCMessageIds number > 256 (probably duplicates) + #define TCAPI_ERR_INPUTSTREAM_FILECREATE 39 // cannot create overflow file + #define TCAPI_ERR_INPUTSTREAM_CLOSED 40 // operation not allowed - input stream is closed + #define TCAPI_ERR_PLATFORM_CONFIG 41 // Platform configuration not found + #define TCAPI_ERR_ERRLISTENER_NULL 42 // error listener cannot be null (add) + #define TCAPI_ERR_COMM_RETRY_IN_PROGRESS 43 // comm retry in progress + #define TCAPI_INFO_COMM_RECONNECTED 44 // reconnected during retry + #define TCAPI_ERR_COMM_INVALID_BAUDRATE 45 // Real Serial parameter checking + #define TCAPI_ERR_COMM_INVALID_DATABITS 46 // Real Serial parameter checking + #define TCAPI_ERR_COMM_INVALID_PARITY 47 // Real Serial parameter checking + #define TCAPI_ERR_COMM_INVALID_STOPBITS 48 // Real Serial parameter checking + #define TCAPI_ERR_COMM_INVALID_FLOWCONTROL 49 // Real Serial parameter checking + #define TCAPI_ERR_COMM_SERVER_RESPONSE_TIMEOUT 50 // TCFServer response timed out + #define TCAPI_ERR_INPUTSTREAM_BUFFER_OVERFLOW_MISSED_MSGS 51 // buffer overflowed (no overflow file) - msgs missed + #define TCAPI_INFO_INPUTSTREAM_BUFFER_OVERFLOW_TO_FILE 52 // buffer overflowed (overflow file in use) + #define TCAPI_ERR_INPUTSTREAM_FILE_OVERFLOW_MISSED_MSGS 53 // file overflowed - msgs missed + #define TCAPI_ERR_FILE_SPEC_MISSING 54 // Message file not specified + #define TCAPI_ERR_CREATE_FILE 55 // Message file could not be created + #define TCAPI_INFO_TRACEBOX_MEMORY_WARNING 56 // TRACEBOX buffer is close to overflowing + #define TCAPI_ERR_TRACEBOX_MEMORY_IS_CLOSED 57 // TRACEBOX buffer overflowed and is now closed + #define TCAPI_INFO_TRACEBOX_MEMORY_IS_NORMAL 58 // TRACEBOX buffer overflowed and is now closed + #define TCAPI_ERR_TRACEBOX_DATA_CORRUPTED 59 // TRACEBOX received corrupted trace data from phone + #define TCAPI_ERR_TRACEBOX_PROTOCOL_MEMORY_OVERFLOW 60 // TRACEBOX protocol processing buffer overflowed - fatal + +#endif //__TCERRORCONSTANTS_H__ diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/Common/Headers/mutex.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/Common/Headers/mutex.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __MUTEX_H__ +#define __MUTEX_H__ + +class Mutex +{ +public: + Mutex(); + ~Mutex(); + + BOOL Open(CHAR* mutexName, DWORD waitTimeout); + void Close(); + BOOL Wait(); + BOOL Release(); + +private: +#ifdef WIN32 + HANDLE m_hMutex; +#else +#error non WIN32 +#endif + + DWORD m_waitTimeout; + BOOL m_mutexOpen; +}; +#endif __MUTEX_H__ diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/Common/Headers/shareddata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/Common/Headers/shareddata.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __SHAREDDATA_H__ +#define __SHAREDDATA_H__ + +class CSharedData +{ +public: + CSharedData(); + ~CSharedData(); + + BOOL Open(DWORD dwSize, CHAR *sharedName); + BOOL Open(HANDLE hFile, DWORD dwSize, CHAR *sharedName); + Close(); + virtual BOOL Init(); + LPVOID GetDataPtr(); + BOOL IsCreator(); + +private: + HANDLE m_hSharedData; + LPVOID m_lpDataPtr; // pointer to mapped data + BOOL m_fCreator; // am i the creator? +}; + +#endif // __SHAREDDATA_H__ diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/Common/Source/ErrorMonitorData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/Common/Source/ErrorMonitorData.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,300 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "stdafx.h" +#include "ErrorMonitorData.h" +#include "TCErrorConstants.h" +#include +#include + +#ifdef TCF_CLIENT +#include "..\..\TCFClient\ClientManager.h" +extern CClientManager* gManager; +#endif + +#ifdef TCF_SERVER +#include "..\..\TCFServer\ServerManager.h" +extern CServerManager* gManager; +#endif + +#ifdef _DEBUG +extern BOOL gDoLogging; +#endif + +//#define LOG_PERFORMANCE +#ifdef LOG_PERFORMANCE +# ifdef TCF_CLIENT +static char* perfFileName="c:\\tcf\\clienterrorperf.txt"; +# else +static char* perfFileName="c:\\tcf\\servererrorperf.txt"; +# endif +static FILE *fpLog = NULL; +static int numLogged=0; +static void logPerf(char* msg); +static void openPerf(); +static void closePerf(); +#define OPENPERF() openPerf() +#define LOGPERF(s) logPerf(s) +#define CLOSEPERF() closePerf() +#else +#define OPENPERF() +#define LOGPERF(s) +#define CLOSEPERF() +#endif + +//#define LOG_ERRORMONITOR +#if defined(LOG_ERRORMONITOR) && defined(_DEBUG) +extern char TCDebugMsg[]; +#define TCDEBUGOPEN() if (gDoLogging) gManager->m_DebugLog->WaitForAccess(); +#define TCDEBUGLOGS(s) if (gDoLogging) sprintf(TCDebugMsg,"%s", s); if (gDoLogging) gManager->m_DebugLog->log(TCDebugMsg); +#define TCDEBUGLOGA1(s, a1) if (gDoLogging) sprintf(TCDebugMsg, s, a1); if (gDoLogging) gManager->m_DebugLog->log(TCDebugMsg); +#define TCDEBUGLOGA2(s, a1, a2) if (gDoLogging) sprintf(TCDebugMsg, s, a1, a2); if (gDoLogging) gManager->m_DebugLog->log(TCDebugMsg); +#define TCDEBUGLOGA3(s, a1, a2, a3) if (gDoLogging) sprintf(TCDebugMsg, s, a1, a2, a3); if (gDoLogging) gManager->m_DebugLog->log(TCDebugMsg); +#define TCDEBUGCLOSE() if (gDoLogging) gManager->m_DebugLog->ReleaseAccess(); +#else +#define TCDEBUGOPEN() +#define TCDEBUGLOGS(s) +#define TCDEBUGLOGA1(s, a1) +#define TCDEBUGLOGA2(s, a1, a2) +#define TCDEBUGLOGA3(s, a1, a2, a3) +#define TCDEBUGCLOSE() +#endif + +CErrorMonitor::CErrorMonitor() +{ +} +CErrorMonitor::CErrorMonitor(long inClientID) +{ + TCDEBUGOPEN(); + TCDEBUGLOGA2("CErrorMonitor::CErrorMonitor clientId = %d this = %x\n", inClientID, this); + + m_ClientID = inClientID; + + TCDEBUGLOGS("CErrorMonitor::CErrorMonitor done\n"); + TCDEBUGCLOSE(); + + OPENPERF(); +} +CErrorMonitor::~CErrorMonitor() +{ + TCDEBUGOPEN(); + TCDEBUGLOGA2("CErrorMonitor::~CErrorMonitor clientId = %d this = %x\n", m_ClientID, this); + + m_Data.Close(); + m_Mutex.Close(); + + TCDEBUGLOGS("CErrorMonitor::~CErrorMonitor done\n"); + TCDEBUGCLOSE(); + + CLOSEPERF(); +} + +BOOL CErrorMonitor::CreateData() +{ + TCDEBUGOPEN(); + TCDEBUGLOGA2("CErrorMonitor::CreateData clientId = %d this = %x\n", m_ClientID, this); + + // create shared data location + char toString[30]; + sprintf(toString, "%s%04.4ld",ERRORMONITORDATA_MAP_BASENAME, m_ClientID); + m_Data.Open(ERRORMONITORDATA_MAP_SIZE, toString); + m_Data.Init(); + + sprintf(toString, "%s%04.4ld",ERRORMONITORDATA_MUTEX_BASENAME, m_ClientID); + + m_Mutex.Open(toString, ERRORMONITORDATA_MUTEX_TIMEOUT); + + TCDEBUGLOGS("CErrorMonitor::CreateData done\n"); + TCDEBUGCLOSE(); + + return TRUE; +} + +BOOL CErrorMonitor::GetError(LONG* tcfError, BOOL* osErrorUsed, DWORD* osError) +{ + TCDEBUGOPEN(); +// TCDEBUGLOGA2("CErrorMonitor::GetError clientId = %d this = %x\n", m_ClientID, this); + BOOL found = FALSE; + + WaitForAccess(); + + pErrorData pData = GetDataPtr(); + +#if (0) + if (pData->errorOccurred) + { + TCDEBUGLOGA3("CErrorMonitor::GetError tcfError = %d osErrorUsed = %d osError = %d\n", + pData->tcfError, pData->osErrorUsed, pData->osError); + + found = TRUE; + *tcfError = pData->tcfError; + *osErrorUsed = pData->osErrorUsed; + *osError = pData->osError; + + pData->errorOccurred = FALSE; + } +#endif +#ifdef LOG_PERFORMANCE + char msg[100]; + sprintf(msg, "GetError numErrors=%d\n", pData->numberErrors); + LOGPERF(msg); +#endif + if (!IsErrorQueueEmpty(pData)) + { + LOGPERF("GetError\n"); + found = TRUE; + *tcfError = pData->errors[pData->first].tcfError; + *osErrorUsed = pData->errors[pData->first].osErrorUsed; + *osError = pData->errors[pData->first].osError; + TCDEBUGLOGA3("CErrorMonitor::GetError tcfError = %d osErrorUsed = %d osError = %d\n", + *tcfError, *osErrorUsed, *osError); + pData->numberErrors--; + if (pData->numberErrors <= 0) + { + ResetErrorQueue(pData); + } + else + { + pData->first++; + if (pData->first >= MAX_ERRORS) + pData->first = 0; + } + } +#ifdef LOG_PERFORMANCE +// char msg[100]; + sprintf(msg, "GetError numErrors=%d tcfError=%d\n", pData->numberErrors, *tcfError); + LOGPERF(msg); +#endif + ReleaseAccess(); + +// TCDEBUGLOGS("CErrorMonitor::GetError done\n"); + TCDEBUGCLOSE(); + return found; +} + +BOOL CErrorMonitor::PutError(LONG tcfError, BOOL osErrorUsed, DWORD osError) +{ + TCDEBUGOPEN(); +// TCDEBUGLOGA2("CErrorMonitor::PutError clientId = %d this = %x\n", m_ClientID, this); + + BOOL done = FALSE; + + WaitForAccess(); + + pErrorData pData = GetDataPtr(); + if (pData == NULL) + return done; +#if (0) + if (!pData->errorOccurred) + { + done = TRUE; + pData->tcfError = tcfError; + pData->osErrorUsed = osErrorUsed; + pData->osError = osError; + +// TCDEBUGLOGA3("CErrorMonitor::PutError tcfError = %d osErrorUsed = %d osError = %d\n", +// pData->tcfError, pData->osErrorUsed, pData->osError); + + pData->errorOccurred = TRUE; + } +#endif +#ifdef LOG_PERFORMANCE + char msg[100]; + sprintf(msg, "PutError numErrors=%d tcfError=%d\n", pData->numberErrors, tcfError); + LOGPERF(msg); +#endif + if (!IsErrorQueueFull(pData)) + { + LOGPERF("PutError\n"); + TCDEBUGLOGA3("CErrorMonitor::PutError tcfError = %d osErrorUsed = %d osError = %d\n", + tcfError, osErrorUsed, osError); + done = TRUE; + pData->errors[pData->next].tcfError = tcfError; + pData->errors[pData->next].osErrorUsed = osErrorUsed; + pData->errors[pData->next].osError = osError; + pData->numberErrors++; + pData->next++; + if (pData->next >= MAX_ERRORS) + pData->next = 0; + } +#ifdef LOG_PERFORMANCE +// char msg[100]; + sprintf(msg, "PutError numErrors=%d\n", pData->numberErrors); + LOGPERF(msg); +#endif + ReleaseAccess(); + +// TCDEBUGLOGS("CErrorMonitor::GetError done\n"); + TCDEBUGCLOSE(); + return done; +} + +BOOL CErrorMonitorData::Init() +{ + if (IsCreator()) + { + pErrorData pData = (pErrorData)GetDataPtr(); +// pData->errorOccurred = FALSE; +// pData->osErrorUsed = FALSE; +// pData->osError = 0; +// pData->tcfError = TCAPI_ERR_NONE; + pData->first = pData->next = pData->numberErrors = 0; + } + return TRUE; +} +#ifdef LOG_PERFORMANCE +static void logPerf(char* msg) +{ + if (fpLog) + { + SYSTEMTIME sTime; + GetLocalTime(&sTime); + fprintf(fpLog, + "%02.2d%02.2d-%02.2d:%02.2d:%02.2d.%03.3d: %s", + sTime.wDay, sTime.wMonth, sTime.wHour, sTime.wMinute, sTime.wSecond, sTime.wMilliseconds, + msg); + + numLogged++; + if ((numLogged % 1000) == 0) + fflush(fpLog); + } +} +static void openPerf() +{ + struct _stat buf; + char* dirname = "c:\\tcf"; + int result = _stat(dirname, &buf); + if (result == 0) // exists + { + if (fpLog == NULL) + fpLog = _fsopen(perfFileName, "at", _SH_DENYNO); + } + else + { + fpLog = NULL; + } +} +static void closePerf() +{ + if (fpLog) + { + fflush(fpLog); + fclose(fpLog); + } + fpLog = NULL; +} +#endif diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/Common/Source/InputStream.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/Common/Source/InputStream.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,1044 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "stdafx.h" +#include "InputStream.h" +#include +#include + +#ifdef TCF_CLIENT +#include "..\..\TCFClient\ClientManager.h" +extern CClientManager* gManager; +#endif +#ifdef TCF_SERVER +#include "..\..\TCFServer\ServerManager.h" +extern CServerManager* gManager; +//#define LOG_PERFORMANCE +#endif + +#ifdef _DEBUG +extern BOOL gDoLogging; +#endif + +// for performance - independent of debug logging +//#define LOG_PERFORMANCE +#ifdef LOG_PERFORMANCE +# ifdef TCF_CLIENT +static char* perfFileName="c:\\tcf\\clientperf.txt"; +# else +static char* perfFileName="c:\\tcf\\serverperf.txt"; +# endif +static FILE *fpLog = NULL; +static int numLogged=0; +static void logPerf(char* msg); +static void openPerf(); +static void closePerf(); +#define OPENPERF() openPerf() +#define LOGPERF(s) logPerf(s) +#define CLOSEPERF() closePerf() +#else +#define OPENPERF() +#define LOGPERF(s) +#define CLOSEPERF() +#endif + +//#define LOG_INPUTSTREAM +#if defined(LOG_INPUTSTREAM) && defined(_DEBUG) +extern char TCDebugMsg[]; +#define TCDEBUGOPEN() if (gDoLogging) { gManager->m_DebugLog->WaitForAccess(); } +#define TCDEBUGLOGS(s) if (gDoLogging) { sprintf(TCDebugMsg,"%s", s); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGLOGA1(s, a1) if (gDoLogging) { sprintf(TCDebugMsg, s, a1); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGLOGA2(s, a1, a2) if (gDoLogging) { sprintf(TCDebugMsg, s, a1, a2); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGLOGA3(s, a1, a2, a3) if (gDoLogging) { sprintf(TCDebugMsg, s, a1, a2, a3); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGCLOSE() if (gDoLogging) { gManager->m_DebugLog->ReleaseAccess(); } +#else +#define TCDEBUGOPEN() +#define TCDEBUGLOGS(s) +#define TCDEBUGLOGA1(s, a1) +#define TCDEBUGLOGA2(s, a1, a2) +#define TCDEBUGLOGA3(s, a1, a2, a3) +#define TCDEBUGCLOSE() +#endif + +CInputStream::CInputStream() +{ +} + +CInputStream::CInputStream(CHAR* pOverflowPath, DWORD inBufferSize, BOOL inOverFlowToFile, long inClientID) +{ + TCDEBUGOPEN(); + TCDEBUGLOGA2("CInputStream::CInputStream clientId = %d this = %x\n", inClientID, this); + + m_ClientID = inClientID; + m_BufferSize = inBufferSize; + m_FileSize = INPUTSTREAMOVERFLOW_FILE_SIZE; +// m_FileSize = 2*1024L; for testing only + + if (pOverflowPath == NULL) + { + m_OverFlowBaseName[0] = NULL; + m_OverFlowToFile = FALSE; + } + else + { + strncpy(m_OverFlowBaseName, pOverflowPath, MAX_FILEPATH); + m_OverFlowToFile = inOverFlowToFile; + } + + m_File = NULL; + + m_StreamLocked = FALSE; + + TCDEBUGLOGS("CInputStream::CInputStream done\n"); + TCDEBUGCLOSE(); +} + +CInputStream::~CInputStream() +{ + TCDEBUGOPEN(); + TCDEBUGLOGA2("CInputStream::~CInputStream clientId = %d this = %x\n", m_ClientID, this); + + m_Mutex.Close(); + m_Data.Close(); + m_Info.Close(); + + if (m_File != NULL) + { + m_File->Close(); + delete m_File; + } + + TCDEBUGLOGS("CInputStream::~CInputStream done\n"); + TCDEBUGCLOSE(); + + CLOSEPERF(); +} + +BOOL CInputStream::CreateStream() +{ + BOOL ok = TRUE; +#if (0) +#ifdef _DEBUGLOG + #ifdef TCF_CLIENT + m_DebugLog = new TCDebugLog("TCF_ClientStreamLog", m_ClientID); + #else + m_DebugLog = new TCDebugLog("TCF_ServerStreamLog", m_ClientID); + #endif +#else + m_DebugLog = NULL; +#endif +#endif + TCDEBUGOPEN(); + TCDEBUGLOGA2("CInputStream::CreateStream clientId = %d this = %x\n", m_ClientID, this); + + char toString[30]; + sprintf(toString, "%s%04.4d", INPUTSTREAMDATA_MAP_BASENAME, m_ClientID); + + TCDEBUGLOGA1("CInputStream::CreateStream dataname = %s\n", toString); + + m_Data.Open(m_BufferSize, toString); + m_Data.Init(); + + sprintf(toString, "%s%04.4d", INPUTSTREAMDATA_MUTEX_BASENAME, m_ClientID); + TCDEBUGLOGA1("CInputStream::CreateStream mutexname = %s\n", toString); + + m_Mutex.Open(toString, INPUTSTREAMDATA_MUTEX_TIMEOUT); + + sprintf(toString, "%s%04.4d", INPUTSTREAMINFO_MAP_BASENAME, m_ClientID); + TCDEBUGLOGA1("CInputStream::CreateStream infoname = %s\n", toString); + + m_Info.Open(INPUTSTREAMINFO_MAP_SIZE, toString); + m_Info.Init(); +#ifdef USE_CIRCULAR_BUFFER + GetInfoPtr()->bufferCapacity = m_BufferSize; +#endif + + // overflow file? + if (m_OverFlowToFile) + { + m_File = new CInputStreamFile(); + m_File->SetClientId(m_ClientID); + if (!m_File->Open(m_FileSize, m_OverFlowBaseName)) + { + delete m_File; + m_File = NULL; + ok = FALSE; + } + } + TCDEBUGLOGS("CInputStream::CreateStream done\n"); + TCDEBUGCLOSE(); + + OPENPERF(); + + return ok; +} +#ifdef USE_CIRCULAR_BUFFER +void CInputStream::DoReadBuffer(pInputStreamInfo pInfo, BYTE* pBuffer, BYTE* outData, DWORD inLength) +{ + DWORD lenToEnd = pInfo->bufferCapacity - pInfo->bufferRead; + if (lenToEnd > inLength) + lenToEnd = inLength; + + if (lenToEnd > 0) + memcpy(outData, &pBuffer[pInfo->bufferRead], lenToEnd); + + DWORD lenRemaining = inLength - lenToEnd; + if (lenRemaining > 0) + memcpy(&outData[lenToEnd], &pBuffer[0], lenRemaining); + + pInfo->bufferSize -= inLength; + + IncrementReadPosition(pInfo, inLength); +} +void CInputStream::DoWriteBuffer(pInputStreamInfo pInfo, BYTE* pBuffer, BYTE* inData, DWORD inLength) +{ + DWORD lenToEnd = pInfo->bufferCapacity - pInfo->bufferWrite; + if (lenToEnd > inLength) + lenToEnd = inLength; + memcpy(&pBuffer[pInfo->bufferWrite], inData, lenToEnd); + DWORD lenRemaining = inLength - lenToEnd; + if (lenRemaining > 0) + memcpy(&pBuffer[0], (const void*)&inData[lenToEnd], lenRemaining); + + pInfo->bufferSize += inLength; + + IncrementWritePosition(pInfo, inLength); +} +void CInputStream::IncrementReadPosition(pInputStreamInfo pInfo, DWORD inLength) +{ + DWORD lenToEnd = pInfo->bufferCapacity - pInfo->bufferRead; + if (inLength <= lenToEnd) + pInfo->bufferRead += inLength; + else + pInfo->bufferRead = inLength - lenToEnd; +} +void CInputStream::IncrementWritePosition(pInputStreamInfo pInfo, DWORD inLength) +{ + DWORD lenToEnd = pInfo->bufferCapacity - pInfo->bufferWrite; + if (inLength <= lenToEnd) + pInfo->bufferWrite += inLength; + else + pInfo->bufferWrite = inLength - lenToEnd; +} +void CInputStream::DoPeekBuffer(pInputStreamInfo pInfo, BYTE* pBuffer, BYTE* outData, DWORD inLength) +{ + DWORD lenToEnd = pInfo->bufferCapacity - pInfo->bufferPeek; + if (lenToEnd > inLength) + lenToEnd = inLength; + + if (lenToEnd > 0) + memcpy(outData, &pBuffer[pInfo->bufferPeek], lenToEnd); + + DWORD lenRemaining = inLength - lenToEnd; + if (lenRemaining > 0) + memcpy(&outData[lenToEnd], &pBuffer[0], lenRemaining); +} +void CInputStream::IncrementPeekPosition(pInputStreamInfo pInfo, DWORD inLength) +{ + DWORD lenToEnd = pInfo->bufferCapacity - pInfo->bufferPeek; + if (inLength <= lenToEnd) + pInfo->bufferPeek += inLength; + else + pInfo->bufferPeek = inLength - lenToEnd; +} +long CInputStream::AddMessage(DWORD inLength, BYTE* inMessage) +{ + TCDEBUGOPEN(); + TCDEBUGLOGA3("CInputStream::AddMessage clientId = %d inLength = %d this = %x\n", m_ClientID, inLength, this); + + long err = TCAPI_ERR_NONE; + + BOOL done = FALSE; + if (inLength == 0 || inMessage == NULL) + return TCAPI_ERR_NONE; + + BOOL gotIt = WaitForAccess(); // will lock on first access only + + pInputStreamInfo pInfo = GetInfoPtr(); + pInputStreamData pData = GetDataPtr(); + pInputStreamFile pFile = GetFilePtr(); + + long nfile = pInfo->numberBytesInFile; // number bytes in file + long nbuffer = pInfo->numberBytes - pInfo->numberBytesInFile; // number bytes in buffer + + TCDEBUGLOGA2("CInputStream::AddMessage numberMessages =%d numberBytes =%d\n",pInfo->numberMessages, pInfo->numberBytes); + + DWORD nWriteSize = pInfo->bufferCapacity - pInfo->bufferSize; + if (nWriteSize > (inLength+sizeof(DWORD))) + { + DoWriteBuffer(pInfo, pData, (BYTE*)&inLength, sizeof(DWORD)); + DoWriteBuffer(pInfo, pData, inMessage, inLength); + pInfo->numberBytes += inLength + sizeof(DWORD); + pInfo->numberMessages++; + done = TRUE; + } + else + { + // not enough room + // we just lost a message + TCDEBUGLOGS("CInputStream::AddMessage buffer overflowed and no file - msg lost\n"); + LOGPERF("AddMessage buffer overflowed\n"); + err = TCAPI_ERR_INPUTSTREAM_BUFFER_OVERFLOW_MISSED_MSGS; + } + + TCDEBUGLOGA2("CInputStream::AddMessage numberMessages =%d numberBytes =%d\n",pInfo->numberMessages, pInfo->numberBytes); + +#ifdef LOG_PERFORMANCE + char msg[200]; + sprintf(msg, "AddMessage numMsgs = %d numByts = %d\n", pInfo->numberMessages, pInfo->numberBytes); + LOGPERF(msg); +#endif +// ReleaseAccess(); // server will unlock all streams once the buffer is processed if any added + + TCDEBUGLOGA1("CInputStream::AddMessage err=%d\n", err); + TCDEBUGCLOSE(); + + return err; +} +// now only used still by the C++ api +DWORD CInputStream::GetNextMessage(DWORD inLength, BYTE* outMessage) +{ + TCDEBUGOPEN(); + TCDEBUGLOGA3("CInputStream::GetNextMessage clientId = %d inLength = %d this = %x\n", m_ClientID, inLength, this); + + DWORD outMsgLen = 0; + + BOOL gotIt = WaitForAccess(); + if (gotIt) + { + DWORD dwMsgSize = 0; + + pInputStreamInfo pInfo = GetInfoPtr(); + pInputStreamData pData = GetDataPtr(); + pInputStreamFile pFile = GetFilePtr(); + + TCDEBUGLOGA2("CInputStream::GetNextMessage numberMessages =%d numberBytes =%d\n",pInfo->numberMessages, pInfo->numberBytes); + + if (pInfo->numberBytes > 0) + { + DoReadBuffer(pInfo, pData, (BYTE*)&dwMsgSize, sizeof(DWORD)); + if (inLength > dwMsgSize) + inLength = dwMsgSize; + + DoReadBuffer(pInfo, pData, outMessage, inLength); + outMsgLen = inLength; + pInfo->numberMessages--; + pInfo->numberBytes = pInfo->numberBytes - dwMsgSize - sizeof(DWORD); + } + + TCDEBUGLOGA2("CInputStream::GetNextMessage numberMessages =%d numberBytes =%d\n",pInfo->numberMessages, pInfo->numberBytes); + + ReleaseAccess(); + } + +#ifdef LOG_PERFORMANCE +// char msg[200]; +// sprintf(msg, "GetNextMessage.outMsgLen = %d\n", outMsgLen); +// LOGPERF(msg); + LOGPERF("GetNextMessage\n"); +#endif + + TCDEBUGLOGS("CInputStream::GetNextMessage done\n"); + TCDEBUGCLOSE(); + + return outMsgLen; +} + +DWORD CInputStream::GetNextMessageSize() +{ + TCDEBUGOPEN(); + TCDEBUGLOGA2("CInputStream::GetNextMessageSize clientId = %d this = %x\n", m_ClientID, this); + + DWORD length = 0; + + BOOL gotIt = WaitForAccess(); + if (gotIt) + { + + pInputStreamInfo pInfo = GetInfoPtr(); + pInputStreamData pData = GetDataPtr(); + + if (pInfo->numberMessages > 0) + { + pInfo->bufferPeek = pInfo->bufferRead; + DoPeekBuffer(pInfo, pData, (BYTE*)&length, sizeof(DWORD)); + } + + ReleaseAccess(); + } + + TCDEBUGLOGA1("CInputStream::GetNextMessageSize length = %d\n", length); + TCDEBUGCLOSE(); + +#ifdef LOG_PERFORMANCE +// char msg[200]; +// sprintf(msg, "GetNextMessageSize.length = %d\n", length); +// LOGPERF(msg); + LOGPERF("GetNextMessageSize\n"); +#endif + return length; +} +void CInputStream::GetMessageSizes(long inNumberMessages, DWORD* outMessageSizes) +{ + TCDEBUGOPEN(); + TCDEBUGLOGA3("CInputStream::GetMessageSizes clientId = %d this = %x inNum = %d\n", m_ClientID, this, inNumberMessages); + + BOOL gotIt = WaitForAccess(); + if (gotIt) + { + + pInputStreamData pData = GetDataPtr(); + pInputStreamFile pFile = GetFilePtr(); + pInputStreamInfo pInfo = GetInfoPtr(); + + DWORD numberToGet = inNumberMessages; + if (numberToGet > pInfo->numberMessages) numberToGet = pInfo->numberMessages; + + if (numberToGet > 0) + { + pInfo->bufferPeek = pInfo->bufferRead; + for (DWORD i = 0; i < numberToGet; i++) + { + DWORD len = 0; + DoPeekBuffer(pInfo, pData, (BYTE*)&len, sizeof(DWORD)); + outMessageSizes[i] = len; + IncrementPeekPosition(pInfo, len+sizeof(DWORD)); + } + } + + ReleaseAccess(); + } + + TCDEBUGLOGS("CInputStream::GetMessageSizes done\n"); + TCDEBUGCLOSE(); + LOGPERF("GetMessageSizes\n"); +} + +#ifdef TCF_CLIENT +DWORD CInputStream::GetMessages(JNIEnv* env, long inNumberMessages, long inNumberMaxBytes, long& outNumberBytesRead, long& outNumberMessagesRead, jbyteArray outMessageData) +{ + TCDEBUGOPEN(); + TCDEBUGLOGA2("CInputStream::GetMessages inNumberMaxBytes = %d inNumberMessages = %d\n", inNumberMaxBytes, inNumberMessages); + + DWORD dwMsgSize = 0; + outNumberBytesRead = outNumberMessagesRead = 0; + + BOOL gotIt = WaitForAccess(); + if (gotIt) + { + + pInputStreamInfo pInfo = GetInfoPtr(); + pInputStreamData pData = GetDataPtr(); + + if (pInfo->numberMessages > 0) + { + if (inNumberMessages == 0 || (inNumberMessages > pInfo->numberMessages)) + inNumberMessages = pInfo->numberMessages; + for (long i = 0; i < inNumberMessages; i++) + { + pInfo->bufferPeek = pInfo->bufferRead; + DoPeekBuffer(pInfo, pData, (BYTE*)&dwMsgSize, sizeof(DWORD)); + + if ((outNumberBytesRead + dwMsgSize) > inNumberMaxBytes) + break; + + IncrementReadPosition(pInfo, sizeof(DWORD)); + pInfo->numberBytes -= sizeof(DWORD); + + DWORD lenToEnd = pInfo->bufferCapacity - pInfo->bufferRead; + if (lenToEnd > dwMsgSize) + lenToEnd = dwMsgSize; + + if (lenToEnd > 0) + env->SetByteArrayRegion(outMessageData, outNumberBytesRead, lenToEnd, (jbyte*)&pData[pInfo->bufferRead]); + + DWORD lenRemaining = dwMsgSize - lenToEnd; + if (lenRemaining > 0) + env->SetByteArrayRegion(outMessageData, outNumberBytesRead+lenToEnd, lenRemaining, (jbyte*)&pData[0]); + + pInfo->bufferSize -= dwMsgSize; + + IncrementReadPosition(pInfo, dwMsgSize); + + outNumberBytesRead += dwMsgSize; + outNumberMessagesRead++; + pInfo->numberBytes -= dwMsgSize; + pInfo->numberMessages--; + + if ((i % 500) == 0) + Sleep(1); + } + } + if (pInfo->numberBytes == 0) + { + pInfo->bufferRead = pInfo->bufferWrite = 0; + } + ReleaseAccess(); + } + +#ifdef LOG_PERFORMANCE + char msg[200]; + sprintf(msg, "GetMessages numMsgs = %d numByts = %d\n", outNumberMessagesRead, outNumberBytesRead); + LOGPERF(msg); +#endif + + TCDEBUGLOGA2("CInputStream::GetMessages outNumberBytesRead = %d outNumberMessagesRead = %d\n", outNumberBytesRead, outNumberMessagesRead); + TCDEBUGCLOSE(); + return outNumberMessagesRead; +} +#endif // TCF_CLIENT + +void CInputStream::GetTotalMessageSize(long inNumberMessages, DWORD& outTotalSize) +{ + TCDEBUGOPEN(); + TCDEBUGLOGA3("CInputStream::GetTotalMessageSize clientId = %d this = %x inNum = %d\n", m_ClientID, this, inNumberMessages); + + outTotalSize = 0; + BOOL gotIt = WaitForAccess(); + if (gotIt) + { + + DWORD len = 0; + + pInputStreamData pData = GetDataPtr(); + pInputStreamFile pFile = GetFilePtr(); + pInputStreamInfo pInfo = GetInfoPtr(); + + DWORD numberToGet = inNumberMessages; + if (numberToGet > pInfo->numberMessages) numberToGet = pInfo->numberMessages; + + if (numberToGet > 0) + { + TCDEBUGLOGA1("CInputStream::GetTotalMessageSize numberToGet = %d\n", numberToGet); + pInfo->bufferPeek = pInfo->bufferRead; + for (DWORD i = 0; i < numberToGet; i++) + { + DoPeekBuffer(pInfo, pData, (BYTE*)&len, sizeof(DWORD)); + outTotalSize += len; + IncrementPeekPosition(pInfo, len+sizeof(DWORD)); + } + } + + + ReleaseAccess(); + } + +#ifdef LOG_PERFORMANCE +// char msg[200]; +// sprintf(msg, "GetTotalMessageSize.outTotalSize = %d\n", outTotalSize); + LOGPERF("GetTotalMessageSize\n"); +#endif + TCDEBUGLOGA1("CInputStream::GetTotalMessageSize done = %d\n", outTotalSize); + TCDEBUGCLOSE(); + +} + +#else // !USE_CIRCULAR_BUFFER + +long CInputStream::AddMessage(DWORD inLength, BYTE* inMessage) +{ + TCDEBUGOPEN(); + TCDEBUGLOGA3("CInputStream::AddMessage clientId = %d inLength = %d this = %x\n", m_ClientID, inLength, this); + + long err = TCAPI_ERR_NONE; + + BOOL done = FALSE; + if (inLength == 0 || inMessage == NULL) + return TCAPI_ERR_NONE; + + WaitForAccess(); + + pInputStreamInfo pInfo = GetInfoPtr(); + pInputStreamData pData = GetDataPtr(); + pInputStreamFile pFile = GetFilePtr(); + + long nfile = pInfo->numberBytesInFile; // number bytes in file + long nbuffer = pInfo->numberBytes - pInfo->numberBytesInFile; // number bytes in buffer + + TCDEBUGLOGA2("CInputStream::AddMessage numberMessages =%d numberBytes =%d\n",pInfo->numberMessages, pInfo->numberBytes); + TCDEBUGLOGA2("CInputStream::AddMessage numberMessagesInBuff=%d numberBytesInBuff=%d\n",pInfo->numberMessages-pInfo->numberMessagesInFile, pInfo->numberBytes-pInfo->numberBytesInFile); + TCDEBUGLOGA2("CInputStream::AddMessage numberMessagesInFile=%d numberBytesInFile=%d\n",pInfo->numberMessagesInFile, pInfo->numberBytesInFile); + + if (nfile > 0) + { + // we've already overflowed + // and we are using an overflow file + // so attempt to put message there + if ((nfile + inLength + sizeof(DWORD)) <= m_FileSize) + { + // room to put msg into file + BYTE* ptr = pFile; + ptr += nfile; + *(DWORD*)ptr = inLength; + ptr += sizeof(DWORD); + memcpy(ptr, inMessage, inLength); + pInfo->numberMessages++; + pInfo->numberMessagesInFile++; + pInfo->numberBytes += inLength + sizeof(DWORD); + pInfo->numberBytesInFile += inLength + sizeof(DWORD); + done = TRUE; + } + else + { + // we just lost a message + TCDEBUGLOGS("CInputStream::AddMessage file overflowed - msg lost\n"); + err = TCAPI_ERR_INPUTSTREAM_FILE_OVERFLOW_MISSED_MSGS; + } + } + else // number of bytes in file == 0 ==> either not overflowed or not using file + { + // attempt to put message into buffer + if ((nbuffer + inLength + sizeof(DWORD)) <= m_BufferSize) + { + // room to put msg into buffer + BYTE* ptr = pData; + ptr += nbuffer; + *(DWORD*)ptr = inLength; + ptr += sizeof(DWORD); + memcpy(ptr, inMessage, inLength); + pInfo->numberMessages++; + pInfo->numberBytes += inLength + sizeof(DWORD); + done = TRUE; + } + else + { + // overflow to file? + if (m_File != NULL) + { + // room to put msg into file + BYTE* ptr = pFile; + ptr += nfile; + *(DWORD*)ptr = inLength; + ptr += sizeof(DWORD); + memcpy(ptr, inMessage, inLength); + pInfo->numberMessages++; + pInfo->numberMessagesInFile++; + pInfo->numberBytes += inLength + sizeof(DWORD); + pInfo->numberBytesInFile += inLength + sizeof(DWORD); + done = TRUE; + TCDEBUGLOGS("CInputStream::AddMessage buffer overflowed to file\n"); + LOGPERF("AddMessage buffer overflowed\n"); + err = TCAPI_INFO_INPUTSTREAM_BUFFER_OVERFLOW_TO_FILE; + } + else + { + // we just lost a message + TCDEBUGLOGS("CInputStream::AddMessage buffer overflowed and no file - msg lost\n"); + err = TCAPI_ERR_INPUTSTREAM_BUFFER_OVERFLOW_MISSED_MSGS; + } + } + } + TCDEBUGLOGA2("CInputStream::AddMessage numberMessages =%d numberBytes =%d\n",pInfo->numberMessages, pInfo->numberBytes); + TCDEBUGLOGA2("CInputStream::AddMessage numberMessagesInBuff=%d numberBytesInBuff=%d\n",pInfo->numberMessages-pInfo->numberMessagesInFile, pInfo->numberBytes-pInfo->numberBytesInFile); + TCDEBUGLOGA2("CInputStream::AddMessage numberMessagesInFile=%d numberBytesInFile=%d\n",pInfo->numberMessagesInFile, pInfo->numberBytesInFile); + + LOGPERF("AddMessage\n"); + + ReleaseAccess(); + + TCDEBUGLOGA1("CInputStream::AddMessage err=%d\n", err); + TCDEBUGCLOSE(); + + return err; +} +DWORD CInputStream::GetNextMessage(DWORD inLength, BYTE* outMessage) +{ + TCDEBUGOPEN(); + TCDEBUGLOGA3("CInputStream::GetNextMessage clientId = %d inLength = %d this = %x\n", m_ClientID, inLength, this); + + BYTE* ptr, *ptrStart; + DWORD outMsgLen = 0; + + WaitForAccess(); + + DWORD dwMsgSize = 0; + + pInputStreamInfo pInfo = GetInfoPtr(); + pInputStreamData pData = GetDataPtr(); + pInputStreamFile pFile = GetFilePtr(); + + ptr = ptrStart = pData; + TCDEBUGLOGA2("CInputStream::GetNextMessage numberMessages =%d numberBytes =%d\n",pInfo->numberMessages, pInfo->numberBytes); + TCDEBUGLOGA2("CInputStream::GetNextMessage numberMessagesInBuff=%d numberBytesInBuff=%d\n",pInfo->numberMessages-pInfo->numberMessagesInFile, pInfo->numberBytes-pInfo->numberBytesInFile); + TCDEBUGLOGA2("CInputStream::GetNextMessage numberMessagesInFile=%d numberBytesInFile=%d\n",pInfo->numberMessagesInFile, pInfo->numberBytesInFile); + + if (pInfo->numberBytes > 0) + { + // get 1 msg from buffer + dwMsgSize = *(DWORD*)pData; + TCDEBUGLOGA1("CInputStream::GetNextMessage 1st msg in buffer = %d\n", dwMsgSize); + ptr += sizeof(DWORD); + if (inLength > dwMsgSize) + inLength = dwMsgSize; + + memcpy(outMessage, ptr, inLength); + outMsgLen = inLength; + ptr += dwMsgSize; + + // move up rest of buffer msgs to beginning of buffer + long moveLen = m_BufferSize - dwMsgSize - sizeof(DWORD); +// memcpy(ptrStart, ptr, moveLen); + TCDEBUGLOGA1("CInputStream::GetNextMessage move bytes up in buffer = %d\n", moveLen); + + // adjust totals + pInfo->numberMessages--; + pInfo->numberBytes = pInfo->numberBytes - dwMsgSize - sizeof(DWORD); + + // move next file message up to buffer + if (m_File != NULL) + { + // using file + if (pInfo->numberBytesInFile > 0) + { + // messages exist in file + dwMsgSize = *(DWORD*)pFile; + TCDEBUGLOGA1("CInputStream::GetNextMessage 1st msg in file = %d\n", dwMsgSize); + long nbuffer = pInfo->numberBytes - pInfo->numberBytesInFile; // number bytes in buffer + if ((nbuffer + dwMsgSize + sizeof(DWORD)) <= m_BufferSize) + { + // room in buffer - move to buffer + ptrStart = &pData[nbuffer]; + moveLen = dwMsgSize + sizeof(DWORD); + memcpy(ptrStart, pFile, moveLen); + TCDEBUGLOGA1("CInputStream::GetNextMessage move from file to buffer = %d\n", moveLen); + LOGPERF("GetNextMessage move from file to buffer\n"); + + // adjust file totals + pInfo->numberMessagesInFile--; + pInfo->numberBytesInFile = pInfo->numberBytesInFile - moveLen; + + // move msgs in file up + if (pInfo->numberMessagesInFile > 0) + { + ptr = &pFile[moveLen]; // new end + moveLen = pInfo->numberBytesInFile; + memcpy(pFile, ptr, moveLen); + TCDEBUGLOGA1("CInputStream::GetNextMessage move bytes up in file = %d\n", moveLen); + } + } + else + { + // no room in buffer for next file msg - leave it there + TCDEBUGLOGS("CInputStream::GetNextMessage no room in buffer for message in file - leave it there\n"); + } + } + } + } + + TCDEBUGLOGA2("CInputStream::GetNextMessage numberMessages =%d numberBytes =%d\n",pInfo->numberMessages, pInfo->numberBytes); + TCDEBUGLOGA2("CInputStream::GetNextMessage numberMessagesInBuff=%d numberBytesInBuff=%d\n",pInfo->numberMessages-pInfo->numberMessagesInFile, pInfo->numberBytes-pInfo->numberBytesInFile); + TCDEBUGLOGA2("CInputStream::GetNextMessage numberMessagesInFile=%d numberBytesInFile=%d\n",pInfo->numberMessagesInFile, pInfo->numberBytesInFile); + + LOGPERF("GetNextMessage\n"); + + ReleaseAccess(); + + TCDEBUGLOGS("CInputStream::GetNextMessage done\n"); + TCDEBUGCLOSE(); + + return outMsgLen; +} +DWORD CInputStream::GetNextMessageSize() +{ + TCDEBUGOPEN(); + TCDEBUGLOGA2("CInputStream::GetNextMessageSize clientId = %d this = %x\n", m_ClientID, this); + + DWORD length = 0; + + WaitForAccess(); + + pInputStreamInfo pInfo = GetInfoPtr(); + pInputStreamData pData = GetDataPtr(); + + if (pInfo->numberMessages > 0) + { + BYTE* ptr = pData; + length = *(DWORD*)ptr; + } + + ReleaseAccess(); + + TCDEBUGLOGA1("CInputStream::GetNextMessageSize length = %d\n", length); + TCDEBUGCLOSE(); + + LOGPERF("GetNextMessageSize\n"); + return length; +} +void CInputStream::GetMessageSizes(long inNumberMessages, DWORD* outMessageSizes) +{ + TCDEBUGOPEN(); + TCDEBUGLOGA3("CInputStream::GetMessageSizes clientId = %d this = %x inNum = %d\n", m_ClientID, this, inNumberMessages); + + WaitForAccess(); + pInputStreamData pData = GetDataPtr(); + pInputStreamFile pFile = GetFilePtr(); + pInputStreamInfo pInfo = GetInfoPtr(); + + long ntotal = pInfo->numberMessages; // number of total messages (buffer + file) + long nfile = pInfo->numberMessagesInFile; // number of file messages + long nbuffer = ntotal - nfile; // number of buffer messages + long nreadtotal = min(ntotal, inNumberMessages); // number of total messages to read + long nreadbuffer = min(nbuffer, nreadtotal); // number of buffer messages to read + long nreadfile = nreadtotal - nreadbuffer; // number of file messages to read + TCDEBUGLOGA3("CInputStream::GetMessageSizes ntotal=%d nfile=%d nbuffer=%d\n", ntotal, nfile, nbuffer); + TCDEBUGLOGA3("CInputStream::GetMessageSizes nreadtotal=%d nreadfile=%d nreadbuffer=%d\n", nreadtotal, nreadfile, nreadbuffer); + + + if (nreadtotal > 0) + { + if (nreadbuffer > 0) + { + BYTE* ptr = pData; + DWORD prevSize = 0; + for (long i = 0; i < nreadbuffer; i++) + { + DWORD len = *(DWORD*)&ptr[prevSize]; + outMessageSizes[i] = len; + prevSize += len + sizeof(DWORD); + } + } + if (nreadfile > 0) + { + BYTE* ptr = pFile; + DWORD prevSize = 0; + for (long i = 0; i < nreadfile; i++) + { + DWORD len = *(DWORD*)&ptr[prevSize]; + outMessageSizes[nreadbuffer+i] = len; + prevSize += len + sizeof(DWORD); + } + } + } + + + ReleaseAccess(); + + TCDEBUGLOGS("CInputStream::GetMessageSizes done\n"); + TCDEBUGCLOSE(); + LOGPERF("GetMessageSizes\n"); +} + +void CInputStream::GetTotalMessageSize(long inNumberMessages, DWORD& outTotalSize) +{ + TCDEBUGOPEN(); + TCDEBUGLOGA3("CInputStream::GetTotalMessageSize clientId = %d this = %x inNum = %d\n", m_ClientID, this, inNumberMessages); + + WaitForAccess(); + pInputStreamData pData = GetDataPtr(); + pInputStreamFile pFile = GetFilePtr(); + pInputStreamInfo pInfo = GetInfoPtr(); + + long ntotal = pInfo->numberMessages; // number of total messages (buffer + file) + long nfile = pInfo->numberMessagesInFile; // number of file messages + long nbuffer = ntotal - nfile; // number of buffer messages + long nreadtotal = min(ntotal, inNumberMessages); // number of total messages to read + long nreadbuffer = min(nbuffer, nreadtotal); // number of buffer messages to read + long nreadfile = nreadtotal - nreadbuffer; // number of file messages to read + TCDEBUGLOGA3("CInputStream::GetTotalMessageSize ntotal=%d nfile=%d nbuffer=%d\n", ntotal, nfile, nbuffer); + TCDEBUGLOGA3("CInputStream::GetTotalMessageSize nreadtotal=%d nreadfile=%d nreadbuffer=%d\n", nreadtotal, nreadfile, nreadbuffer); + + outTotalSize = 0; + + if (nreadtotal > 0) + { + if (nreadbuffer > 0) + { + BYTE* ptr = pData; + DWORD prevSize = 0; + for (long i = 0; i < nreadbuffer; i++) + { + DWORD len = *(DWORD*)&ptr[prevSize]; + outTotalSize += len; + prevSize += len + sizeof(DWORD); + } + } + if (nreadfile > 0) + { + BYTE* ptr = pFile; + DWORD prevSize = 0; + for (long i = 0; i < nreadfile; i++) + { + DWORD len = *(DWORD*)&ptr[prevSize]; + outTotalSize += len; + prevSize += len + sizeof(DWORD); + } + } + } + + + ReleaseAccess(); + + TCDEBUGLOGS("CInputStream::GetTotalMessageSize done\n"); + TCDEBUGCLOSE(); + LOGPERF("GetTotalMessageSize\n"); +} +#endif // USE_CIRCULAR_BUFFER + +LONG CInputStream::GetNumberMessages() +{ + TCDEBUGOPEN(); + TCDEBUGLOGA2("CInputStream::GetNumberMessages clientId = %d this = %x\n", m_ClientID, this); + + LONG number = 0; + + WaitForAccess(); + + pInputStreamInfo pInfo = GetInfoPtr(); + + number = pInfo->numberMessages; + + ReleaseAccess(); + + TCDEBUGLOGA1("CInputStream::GetNumberMessages number = %d\n", number); + TCDEBUGCLOSE(); + + LOGPERF("GetNumberMessages\n"); + return number; +} + + + +BOOL CInputStreamData::Init() +{ + if (IsCreator()) + { + } + return TRUE; +} +BOOL CInputStreamInfo::Init() +{ + if (IsCreator()) + { + pInputStreamInfo pInfo = (pInputStreamInfo)GetDataPtr(); + pInfo->numberBytes = 0; + pInfo->numberMessages = 0; + pInfo->numberBytesInFile = 0; + pInfo->numberMessagesInFile = 0; +#ifdef USE_CIRCULAR_BUFFER + pInfo->bufferRead = 0; // where to read from buffer + pInfo->bufferPeek = 0; // where to peek some data from buffer + pInfo->bufferWrite = 0; // where to write to buffer + pInfo->bufferSize = 0; // current size of buffer + pInfo->bufferCapacity = 0; // total capacity of buffer +#endif + } + return TRUE; +} + +// real file on disk (ie, not tied to swap file) +void CInputStreamFile::SetClientId(long clientId) +{ + m_ClientID = clientId; +} +BOOL CInputStreamFile::Open(DWORD dwSize, CHAR* filePath) +{ + BOOL fOk = FALSE; + + // first process (clients) will create and map file + // second process (server) will get an error on create, but will go ahead and map + m_hFile = CreateFile( + filePath, + GENERIC_READ|GENERIC_WRITE, + FILE_SHARE_READ|FILE_SHARE_WRITE, + 0, + CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL|FILE_FLAG_DELETE_ON_CLOSE, + 0); + + char mapname[80]; + sprintf(mapname, "%s%d", INPUTSTREAMOVERFLOW_MAP_BASENAME, m_ClientID); + if (m_hFile != INVALID_HANDLE_VALUE) + { + // we got a good handle (we might have gotten an error, but create was successful) + // create a mapping to this file + fOk = CSharedData::Open(m_hFile, dwSize, mapname); + TCDEBUGOPEN(); + TCDEBUGLOGS("CInputStreamFile::Open CreateFile successful\n"); + TCDEBUGCLOSE(); + } + else + { + // this causes the open to do an OpenFileMapping instead of a CreateFileMapping (file handle not needed in former) + fOk = CSharedData::Open(INVALID_HANDLE_VALUE, dwSize, mapname); + TCDEBUGOPEN(); + TCDEBUGLOGS("CInputStreamFile::Open CreateFile failed\n"); + TCDEBUGCLOSE(); + } + + return fOk; +} + +CInputStreamFile::Close() +{ + // close all mapping handles + CSharedData::Close(); + + // close file + if (m_hFile != INVALID_HANDLE_VALUE) + { + CloseHandle(m_hFile); + m_hFile = INVALID_HANDLE_VALUE; + } +} + +BOOL CInputStreamFile::Init() +{ + return TRUE; +} + +#ifdef LOG_PERFORMANCE +static void logPerf(char* msg) +{ + if (fpLog) + { + SYSTEMTIME sTime; + GetLocalTime(&sTime); + fprintf(fpLog, + "%02.2d%02.2d-%02.2d:%02.2d:%02.2d.%03.3d: %s", + sTime.wDay, sTime.wMonth, sTime.wHour, sTime.wMinute, sTime.wSecond, sTime.wMilliseconds, + msg); + + numLogged++; + if ((numLogged % 1000) == 0) + fflush(fpLog); + } +} +static void openPerf() +{ + struct _stat buf; + char* dirname = "c:\\tcf"; + int result = _stat(dirname, &buf); + if (result == 0) // exists + { + if (fpLog == NULL) + fpLog = _fsopen(perfFileName, "at", _SH_DENYNO); + } + else + { + fpLog = NULL; + } +} +static void closePerf() +{ + if (fpLog) + { + fflush(fpLog); + fclose(fpLog); + } + fpLog = NULL; +} +#endif \ No newline at end of file diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/Common/Source/ServerClient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/Common/Source/ServerClient.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,241 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "stdafx.h" +#include "ServerClient.h" +#include "TCErrorConstants.h" +#include + +#ifdef TCF_CLIENT +#include "..\..\TCFClient\ClientManager.h" +extern CClientManager* gManager; +#endif +#ifdef TCF_SERVER +#include "..\..\TCFServer\ServerManager.h" +extern CServerManager* gManager; +#endif + +#ifdef _DEBUG +extern BOOL gDoLogging; +#endif + +//#define LOG_SERVERCLIENT +#if defined(LOG_SERVERCLIENT) && defined(_DEBUG) +extern BOOL gDoLogging; +extern char TCDebugMsg[]; +#define TCDEBUGOPEN() if (gDoLogging) { gManager->m_DebugLog->WaitForAccess(); } +#define TCDEBUGLOGS(s) if (gDoLogging) { sprintf(TCDebugMsg,"%s", s); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGLOGA1(s, a1) if (gDoLogging) { sprintf(TCDebugMsg, s, a1); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGLOGA2(s, a1, a2) if (gDoLogging) { sprintf(TCDebugMsg, s, a1, a2); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGLOGA3(s, a1, a2, a3) if (gDoLogging) { sprintf(TCDebugMsg, s, a1, a2, a3); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGCLOSE() if (gDoLogging) { gManager->m_DebugLog->ReleaseAccess(); } +#else +#define TCDEBUGOPEN() +#define TCDEBUGLOGS(s) +#define TCDEBUGLOGA1(s, a1) +#define TCDEBUGLOGA2(s, a1, a2) +#define TCDEBUGLOGA3(s, a1, a2, a3) +#define TCDEBUGCLOSE() +#endif + +CServerCommand::CServerCommand() +{ + // Server commands/responses + m_ServerCommandMutex.Open(SERVERCOMMANDDATA_MUTEX_NAME, SERVERCOMMANDDATA_MUTEX_TIMEOUT); + m_ServerCommandData.Open(SERVERCOMMANDDATA_MAP_SIZE, SERVERCOMMANDDATA_MAP_NAME); + m_ServerCommandData.Init(); + m_ServerMessageData.Open(SERVERMESSAGEDATA_MAP_SIZE, SERVERMESSAGEDATA_MAP_NAME); + m_ServerMessageData.Init(); + + m_ServerProcessData.Open(SERVERPROCESSDATA_MAP_SIZE, SERVERPROCESSDATA_MAP_NAME); + m_ServerProcessData.Init(); + + // General server access + m_ServerPipeMutex.Open(SERVERPIPE_MUTEX_NAME, SERVERPIPE_MUTEX_TIMEOUT); + + // command/response events + m_hServerCommandReadyEvent = ::CreateEvent(NULL, FALSE, FALSE, SERVER_COMMAND_READY_EVENTNAME); + m_hServerResponseReadyEvent = ::CreateEvent(NULL, FALSE, FALSE, SERVER_RESPONSE_READY_EVENTNAME); +} + +CServerCommand::~CServerCommand() +{ + m_ServerCommandMutex.Close(); + m_ServerCommandData.Close(); + m_ServerMessageData.Close(); + + m_ServerProcessData.Close(); + + m_ServerPipeMutex.Close(); + + ::CloseHandle(m_hServerCommandReadyEvent); + ::CloseHandle(m_hServerResponseReadyEvent); + +} + +// Client methods +BOOL CServerCommand::SendCommand(pServerCommandData pCmd, DWORD msgLength, BYTE* message) +{ + BOOL sent = FALSE; + +// if (pCmd == NULL) return sent; + + TCDEBUGOPEN(); + TCDEBUGLOGS("CServerCommand::SendCommand\n"); + TCDEBUGCLOSE(); + + WaitForServerCommandAccess(); + + pServerCommandData pData1 = GetDataPtr(); + + if (pCmd->command != eCmdNone) + { + memcpy(pData1, pCmd, sizeof(ServerCommandData)); + if (msgLength > 0 && message != NULL) + { + pServerMessageData pData2 = GetMsgPtr(); + pData2->length = msgLength; + if (msgLength > 0) + memcpy(pData2->message, message, msgLength); + } + pData1->response = eRspNone; // setup for response + sent = TRUE; + ::SetEvent(m_hServerCommandReadyEvent); + } + + ReleaseServerCommandAccess(); + TCDEBUGOPEN(); + TCDEBUGLOGS("CServerCommand::SendCommand done\n"); + TCDEBUGCLOSE(); + + return sent; +} + +BOOL CServerCommand::GetResponse(pServerCommandData pRsp) +{ + BOOL found = FALSE; + + TCDEBUGOPEN(); + TCDEBUGLOGS("CServerCommand::GetResponse\n"); + TCDEBUGCLOSE(); + + if (::WaitForSingleObject(m_hServerResponseReadyEvent, SERVER_CMDRSP_EVENT_TIMEOUT) == WAIT_OBJECT_0) + { + WaitForServerCommandAccess(); + pServerCommandData pData = GetDataPtr(); + if (pData->response != eRspNone) + { + // response is ready when command is cleared + memcpy(pRsp, pData, sizeof(ServerCommandData)); + found = TRUE; + } + ReleaseServerCommandAccess(); + } + else + { + TCDEBUGLOGS("CServerCommand::GetResponse timeout\n"); + pRsp->response = eRspError; + pRsp->error = TCAPI_ERR_COMM_SERVER_RESPONSE_TIMEOUT; + } +#if (0) + + BOOL timeoutoccurred = FALSE; + pServerCommandData pData = GetDataPtr(); + time_t ctime = time(NULL); + time_t timeout = ctime + 60; // wait 60 seconds only + +// if (pRsp == NULL) return found; + + TCDEBUGOPEN(); + TCDEBUGLOGA2("CServerCommand::GetResponse time = %d timeout = %d\n", ctime, timeout); + TCDEBUGCLOSE(); + + while(!found && !timeoutoccurred) + { + WaitForServerCommandAccess(); + if (pData->response != eRspNone) + { + // response is ready when command is cleared + memcpy(pRsp, pData, sizeof(ServerCommandData)); + found = TRUE; + } + else + { + time_t ctime = time(NULL); + if (ctime >= timeout) + { + TCDEBUGLOGS("CServerCommand::GetResponse timeout\n"); + pRsp->response = eRspError; + pRsp->error = TCAPI_ERR_COMM_SERVER_RESPONSE_TIMEOUT; + timeoutoccurred = TRUE; + } + } + ReleaseServerCommandAccess(); + Sleep(1); + } +#endif + TCDEBUGOPEN(); + TCDEBUGLOGA1("CServerCommand::GetResponse waiting for response found=%d\n", found); + TCDEBUGCLOSE(); + + return found; +} +// Server methods +BOOL CServerCommand::GetCommand(pServerCommandData pCmd, pServerMessageData pMsg) +{ + BOOL found = FALSE; + + if (::WaitForSingleObject(m_hServerCommandReadyEvent, SERVER_CMDRSP_EVENT_TIMEOUT) == WAIT_OBJECT_0) + { + pServerCommandData pData1 = GetDataPtr(); + + WaitForServerCommandAccess(); + if (pData1->command != eCmdNone) + { + memcpy(pCmd, pData1, sizeof(ServerCommandData)); + if (pMsg) + { + pServerMessageData pData2 = GetMsgPtr(); + pMsg->length = pData2->length; + memcpy(pMsg->message, pData2->message, pData2->length); + } + found = TRUE; + } + ReleaseServerCommandAccess(); + } + + return found; +} + +BOOL CServerCommand::SendResponse(pServerCommandData pRsp) +{ + BOOL sent = FALSE; + pServerCommandData pData = GetDataPtr(); + + WaitForServerCommandAccess(); + if (pRsp->response != eRspNone) + { + memcpy(pData, pRsp, sizeof(ServerCommandData)); + pData->command = eCmdNone; // setup for next command + sent = TRUE; + ::SetEvent(m_hServerResponseReadyEvent); + } + + ReleaseServerCommandAccess(); + + return sent; +} diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/Common/Source/TCDebugLog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/Common/Source/TCDebugLog.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "stdafx.h" +#include "TCDebugLog.h" + +TCDebugLog::TCDebugLog() +{ + m_fLog = NULL; +} + +TCDebugLog::TCDebugLog(char* baseName, DWORD pid) +{ + m_fLog = NULL; + char name[30]; + sprintf(name, "%sMutex%d", baseName, pid); + m_Mutex.Open(name, LOG_MUTEX_TIMEOUT); + + sprintf(m_FileName, "c:\\tcf\\%s%d.txt", baseName, pid); + m_fLog = _fsopen(m_FileName, "at", _SH_DENYNO); +} + +TCDebugLog::TCDebugLog(char* baseName, DWORD pid, DWORD timeout) +{ + m_fLog = NULL; + char name[30]; + sprintf(name, "%sMutex%d", baseName, pid); + m_Mutex.Open(name, timeout); + + sprintf(m_FileName, "c:\\tcf\\%s%d.txt", baseName, pid); + m_fLog = _fsopen(m_FileName, "at", _SH_DENYNO); + +#ifdef _DEBUG + FILE* f = fopen("c:\\tcf\\tcdebuglog.txt", "at"); + fprintf(f, "name=%s m_FileName=%s\n", name, m_FileName); + fclose(f); +#endif +} +TCDebugLog::~TCDebugLog() +{ + if (m_fLog) + { + fflush(m_fLog); + fclose(m_fLog); + m_fLog = NULL; + } + m_Mutex.Close(); +} + +void TCDebugLog::log(char* msg) +{ +// WaitForAccess(); + + if (m_fLog) + { + SYSTEMTIME sTime; + GetLocalTime(&sTime); + fprintf(m_fLog, + "%02.2d%02.2d-%02.2d:%02.2d:%02.2d.%03.3d: %s", + sTime.wDay, sTime.wMonth, sTime.wHour, sTime.wMinute, sTime.wSecond, sTime.wMilliseconds, + msg); + fflush(m_fLog); + } +// ReleaseAccess(); +} +/* +void TCDebugLog::log(char* msg, argType type1, void* arg1) +{ + switch(type1) + { + case eCHAR: + char t = *(char*)arg1; + break; + } +} + +void TCDebugLog::log(char* msg, argType type1, void* arg1, argType type2, void* arg2) +{ +} +void TCDebugLog::log(char* msg, argType type1, void* arg1, argType type2, void* arg2, argType type3, void* arg3) +{ +} +*/ +void TCDebugLog::logTime() +{ + SYSTEMTIME sTime; + GetLocalTime(&sTime); + fprintf(m_fLog, "%02.2d%02.2d-%02.2d:%02.2d:%02.2d.%03.3d: ", sTime.wDay, sTime.wMonth, sTime.wHour, sTime.wMinute, sTime.wSecond, sTime.wMilliseconds); +} +#ifdef TCF_SERVER +//#define _LOG_DEBUG_MUTEX +#else +#endif +BOOL TCDebugLog::WaitForAccess() +{ +#ifdef _LOG_DEBUG_MUTEX + BOOL ok = m_Mutex.Wait(); + if (ok == FALSE) + { + log("TCDebugLog::WaitForAccess failed\n"); + } + else + { + log("TCDebugLog::WaitForAccess OK\n"); + } + return ok; +#else + return m_Mutex.Wait(); +#endif +} + +BOOL TCDebugLog::ReleaseAccess() +{ +#ifdef _LOG_DEBUG_MUTEX + BOOL ok = m_Mutex.Release(); + if (ok == FALSE) + { + log("TCDebugLog::ReleaseAccess failed\n"); + } + else + { + log("TCDebugLog::ReleaseAccess OK\n"); + } + return ok; +#else + return m_Mutex.Release(); +#endif +} diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/Common/Source/mutex.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/Common/Source/mutex.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "stdafx.h" +#include "mutex.h" + +Mutex::Mutex() +{ + m_hMutex = NULL; + m_waitTimeout = 0L; + m_mutexOpen = FALSE; +} +Mutex::~Mutex() +{ + Close(); +} + +BOOL Mutex::Open(CHAR *mutexName, DWORD waitTimeout) +{ +#ifdef WIN32 + m_hMutex = ::CreateMutex(NULL, FALSE, mutexName); +#else +#error non Win32 +#endif + if (m_hMutex == NULL) + m_mutexOpen = FALSE; + else + { + m_mutexOpen = TRUE; + m_waitTimeout = waitTimeout; + } + + return m_mutexOpen; +} +void Mutex::Close() +{ + if (m_mutexOpen) + { +#ifdef WIN32 + ::ReleaseMutex(m_hMutex); + ::CloseHandle(m_hMutex); +#else +#error non WIN32 +#endif + m_hMutex = NULL; + m_mutexOpen = FALSE; + } +} +BOOL Mutex::Wait() +{ +#ifdef WIN32 + DWORD dwWaitResult = ::WaitForSingleObject(m_hMutex, m_waitTimeout); + if (dwWaitResult == WAIT_OBJECT_0) + { + return TRUE; + } + return FALSE; +#else +#error non WIN32 +#endif +} +BOOL Mutex::Release() +{ + BOOL ret = FALSE; +#ifdef WIN32 + ret = ::ReleaseMutex(m_hMutex); +#else +#error non WIN32 +#endif + + return ret; +} diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/Common/Source/shareddata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/Common/Source/shareddata.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "stdafx.h" +#include "shareddata.h" + +CSharedData::CSharedData() +{ + m_fCreator = FALSE; + m_hSharedData = NULL; + m_lpDataPtr = NULL; + +} +CSharedData::~CSharedData() +{ + Close(); +} + +// open map backed by OS paging file +BOOL +CSharedData::Open(DWORD dwSize, CHAR* name) +{ + BOOL fOK = FALSE; + m_hSharedData = m_lpDataPtr = NULL; + + m_hSharedData = CreateFileMapping((HANDLE)0xFFFFFFFF, NULL, PAGE_READWRITE, 0, dwSize, name); + + m_fCreator = (GetLastError() != ERROR_ALREADY_EXISTS); + if (!m_fCreator) + { + // not creator, re-open using Open + CloseHandle(m_hSharedData); + m_hSharedData = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, name); + + } + if (m_hSharedData) + { + m_lpDataPtr = MapViewOfFile(m_hSharedData, FILE_MAP_ALL_ACCESS, 0, 0, 0); + if (m_lpDataPtr == NULL) + { + CloseHandle(this->m_hSharedData); + m_hSharedData = NULL; + } + else + fOK = TRUE; + } + return fOK; +} + +// open map backed by a real file handle +BOOL +CSharedData::Open(HANDLE hFile, DWORD dwSize, CHAR* name) +{ + BOOL fOK = FALSE; + + m_hSharedData = m_lpDataPtr = NULL; + + // if hFile is invalid do not create mapping - go directly to open mapping by name + if (hFile == INVALID_HANDLE_VALUE) + { + m_hSharedData = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, name); + m_fCreator = FALSE; + } + else + { + m_hSharedData = CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, dwSize, name); + if (m_hSharedData == NULL) // failed + { + } + else + { + // succeeded + m_fCreator = (GetLastError() != ERROR_ALREADY_EXISTS); + if (!m_fCreator) + { + // not creator, re-open using Open + CloseHandle(m_hSharedData); + m_hSharedData = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, name); + } + } + + } + if (m_hSharedData) + { + m_lpDataPtr = MapViewOfFile(m_hSharedData, FILE_MAP_ALL_ACCESS, 0, 0, 0); + if (m_lpDataPtr == NULL) + { + CloseHandle(m_hSharedData); + m_hSharedData = NULL; + } + else + fOK = TRUE; + } + return fOK; +} +CSharedData::Close() +{ + BOOL fIgnore = FALSE; + + if (m_lpDataPtr != NULL) + { + fIgnore = UnmapViewOfFile(m_lpDataPtr); + m_lpDataPtr = NULL; + } + + if (m_hSharedData != NULL) + { + fIgnore = CloseHandle(m_hSharedData); + m_hSharedData = NULL; + } +} +BOOL CSharedData::Init() +{ + // intended to be overridden + return TRUE; +} + +LPVOID CSharedData::GetDataPtr() +{ + return m_lpDataPtr; +} + +BOOL CSharedData::IsCreator() +{ + return m_fCreator; +} + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/ClientManager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/ClientManager.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,836 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// ClientManager.cpp: implementation of the CClientManager class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ClientManager.h" +#include "TCErrorConstants.h" +#include "resource.h" +#include + +#ifdef _DEBUG +extern BOOL gDoLogging; +extern char TCDebugMsg[100]; +#define TCDEBUGOPEN() if (gDoLogging) m_DebugLog->WaitForAccess(); +#define TCDEBUGLOGS(s) if (gDoLogging) sprintf(TCDebugMsg,"%s", s); if (gDoLogging) m_DebugLog->log(TCDebugMsg); +#define TCDEBUGLOGA1(s, a1) if (gDoLogging) sprintf(TCDebugMsg, s, a1); if (gDoLogging) m_DebugLog->log(TCDebugMsg); +#define TCDEBUGLOGA2(s, a1, a2) if (gDoLogging) sprintf(TCDebugMsg, s, a1, a2); if (gDoLogging) m_DebugLog->log(TCDebugMsg); +#define TCDEBUGLOGA3(s, a1, a2, a3) if (gDoLogging) sprintf(TCDebugMsg, s, a1, a2, a3); if (gDoLogging) m_DebugLog->log(TCDebugMsg); +#define TCDEBUGCLOSE() if (gDoLogging) m_DebugLog->ReleaseAccess(); +#else +#define TCDEBUGOPEN() +#define TCDEBUGLOGS(s) +#define TCDEBUGLOGA1(s, a1) +#define TCDEBUGLOGA2(s, a1, a2) +#define TCDEBUGLOGA3(s, a1, a2, a3) +#define TCDEBUGCLOSE() +#endif + +#ifdef _DEBUG +static char* GetErrorText(DWORD inError); +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// +CClientManager::CClientManager() +{ + m_Server = NULL; + m_StreamList = NULL; + m_ErrorMonitorList = NULL; + m_DebugLog = NULL; + m_DllLocation = NULL; + m_hServer = NULL; + m_hServerThread = NULL; + m_Version[0] = NULL; + m_ServerLockFile = NULL; + m_ServerExeFile = NULL; +} +CClientManager::CClientManager(HINSTANCE hinstDLL) +{ +#ifdef _DEBUG + if (gDoLogging) + m_DebugLog = new TCDebugLog("TCF_ClientLog", ::GetCurrentProcessId()); + else + m_DebugLog = NULL; + +#else + m_DebugLog = NULL; +#endif + TCDEBUGOPEN(); + TCDEBUGLOGS("CClientManager::CClientManager\n"); + + m_Server = new CServerCommand(); + + // lock server access (it might be running) + m_Server->WaitforServerPipeAccess(); + + m_StreamList = new InputStreamList(); + m_StreamList->clear(); + + m_ErrorMonitorList = new ErrorMonitorList(); + m_ErrorMonitorList->clear(); + + m_DllLocation = new char[MAX_DLLPATHNAME]; + ::GetModuleFileName(hinstDLL, m_DllLocation, MAX_DLLPATHNAME); + + char exeDirectory[MAX_DLLPATHNAME] = {0}; + strncpy(exeDirectory, m_DllLocation, MAX_DLLPATHNAME); + size_t len = strlen(exeDirectory); + // remove file + for (int i = len-1; i > 0; i--) + { + if (exeDirectory[i] == PATH_DELIMITER) + break; + } + exeDirectory[i] = NULL; + + m_ServerExeFile = new char[MAX_DLLPATHNAME]; + sprintf(m_ServerExeFile, "\"%s%c%s\"", exeDirectory, PATH_DELIMITER, SERVER_PROCESS_NAME); + + m_ServerLockFile = new char[MAX_DLLPATHNAME]; + sprintf(m_ServerLockFile, "%s%c%s", exeDirectory, PATH_DELIMITER, SERVER_LOCKFILE_NAME); + + char name[100]; + sprintf(name, "%s%ld", ERRORMONITORLIST_MUTEX_BASENAME, ::GetCurrentProcessId()); + m_ErrorMonitorListMutex.Open(name, ERRORMONITORLIST_MUTEX_TIMEOUT); + + sprintf(name, "%s%ld", INPUTSTREAMLIST_MUTEX_BASENAME, ::GetCurrentProcessId()); + m_StreamListMutex.Open(name, INPUTSTREAMLIST_MUTEX_TIMEOUT); + + m_hServer = NULL; + m_hServerThread = NULL; + + // release server access + m_Server->ReleaseServerPipeAccess(); + int ret = ::LoadString(hinstDLL, IDS_VERSION, m_Version, MAX_VERSION_STRING); + + TCDEBUGCLOSE(); +} + +CClientManager::~CClientManager() +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CClientManager::~CClientManager\n"); + pServerProcessData pData = m_Server->GetProcessPtr(); + + if (m_Server) + { + delete m_Server; + m_Server = NULL; + } + + WaitForStreamListAccess(); + TCDEBUGLOGA1("CClientManager::~CClientManager: erasing stream list size=%d\n", InputStreamListSize()); + if (m_StreamList) + { + InputStreamList::iterator iter; + for (iter = m_StreamList->begin(); iter != m_StreamList->end(); iter++) + { + TCDEBUGLOGS("CClientManager::~CClientManager: erasing stream list next 1\n"); +// m_StreamList->erase(iter); + delete *iter; +// TCDEBUGLOGS("CClientManager::~CClientManager: erasing stream list next 2\n"); + } + m_StreamList->clear(); + TCDEBUGLOGS("CClientManager::~CClientManager: erasing stream list done 1\n"); + delete m_StreamList; + TCDEBUGLOGS("CClientManager::~CClientManager: erasing stream list done 2\n"); + } + ReleaseStreamListAccess(); + m_StreamListMutex.Close(); + + WaitForErrorMonitorListAccess(); + TCDEBUGLOGA1("CClientManager::~CClientManager: erasing monitor list size=%d\n", ErrorMonitorListSize()); + if (m_ErrorMonitorList) + { + ErrorMonitorList::iterator iter; + for (iter = m_ErrorMonitorList->begin(); iter != m_ErrorMonitorList->end(); iter++) + { + TCDEBUGLOGS("CClientManager::~CClientManager: erasing monitor list next 1\n"); +// m_ErrorMonitorList->erase(iter); + delete *iter; +// TCDEBUGLOGS("CClientManager::~CClientManager: erasing monitor list next 1\n"); + } + m_ErrorMonitorList->clear(); + TCDEBUGLOGS("CClientManager::~CClientManager: erasing monitor list done 1\n"); + delete m_ErrorMonitorList; + TCDEBUGLOGS("CClientManager::~CClientManager: erasing monitor list done 2\n"); + } + ReleaseErrorMonitorListAccess(); + m_ErrorMonitorListMutex.Close(); + + if (m_DllLocation) + { + delete[] m_DllLocation; + m_DllLocation = NULL; + } + + if (m_ServerLockFile) + { + delete[] m_ServerLockFile; + m_ServerLockFile = NULL; + } + + if (m_ServerExeFile) + { + delete[] m_ServerExeFile; + m_ServerExeFile = NULL; + } + TCDEBUGLOGS("CClientManager::~CClientManager: closing log\n"); + TCDEBUGCLOSE(); + if (m_DebugLog) + { + delete m_DebugLog; + m_DebugLog = NULL; + } +} +CErrorMonitor* +CClientManager::FindErrorMonitor(long inClientId) +{ + CErrorMonitor* errorMonitor = NULL; + ErrorMonitorList::iterator iter; + + for (iter = m_ErrorMonitorList->begin(); iter != m_ErrorMonitorList->end(); iter++) + { + if ((*iter)->IsThisClient(inClientId)) + { + errorMonitor = *iter; + break; + } + } + return errorMonitor; +} +long CClientManager::ErrorMonitorListSize() +{ + long size = m_ErrorMonitorList->size(); + + return size; +} +void CClientManager::AddErrorMonitor(CErrorMonitor* monitor) +{ + m_ErrorMonitorList->push_back(monitor); +} +void CClientManager::RemoveErrorMonitor(CErrorMonitor* monitor) +{ + ErrorMonitorList::iterator iter; + + for (iter = m_ErrorMonitorList->begin(); iter != m_ErrorMonitorList->end(); iter++) + { + if ((*iter)->IsThisClient(monitor->GetClientId())) + { + m_ErrorMonitorList->erase(iter); + break; + } + } +} + +CInputStream* +CClientManager::FindInputStream(long inClientId) +{ + CInputStream* inputStream = NULL; + InputStreamList::iterator iter; + + for (iter = m_StreamList->begin(); iter != m_StreamList->end(); iter++) + { + if ((*iter)->IsThisClient(inClientId)) +// if ((*iter).IsThisClient(inClientId)) + { + inputStream = *iter; +// inputStream = iter; + break; + } + } + return inputStream; +} +long CClientManager::InputStreamListSize() +{ + long size = m_StreamList->size(); + + return size; +} +void CClientManager::AddInputStream(CInputStream* stream) +{ + m_StreamList->push_back(stream); +// m_StreamList->push_back(*stream); + +} +void CClientManager::RemoveInputStream(CInputStream* stream) +{ + InputStreamList::iterator iter; + + for (iter = m_StreamList->begin(); iter != m_StreamList->end(); iter++) + { + if ((*iter)->IsThisClient(stream->GetClientId())) +// if ((*iter).IsThisClient(stream->GetClientId())) + { + m_StreamList->erase(iter); + break; + } + } +} + +BOOL CClientManager::StartServer(pServerProcessData pData) +{ + TCDEBUGLOGA1("CClientManager::StartServer numRefs = %d\n",pData->numRefs); + + BOOL serverStarted = FALSE; + // server is ref counted + // refcount = 0 => server is not running + // refcount > 0 => server already started by some other process + if (pData->numRefs == 0) + { + // server not running + // get exe location + char exeLocation[MAX_DLLPATHNAME] = {0}; + strncpy(exeLocation, m_DllLocation, MAX_DLLPATHNAME); + size_t len = strlen(exeLocation); + // remove file + for (int i = len-1; i > 0; i--) + { + if (exeLocation[i] == PATH_DELIMITER) + break; + } + exeLocation[i] = NULL; + char quotedLocation[MAX_DLLPATHNAME] = {0}; + sprintf(quotedLocation, "\"%s%c%s\"", exeLocation, PATH_DELIMITER, SERVER_PROCESS_NAME); + + TCDEBUGLOGA1(" exeLocation=%s\n", quotedLocation); + + // create process + STARTUPINFO si; + memset(&si,0,sizeof(si)); + si.cb = sizeof(si); + memset(&pData->serverProcess, 0, sizeof(pData->serverProcess)); + pData->serverProcess.hProcess = NULL; + if (!::CreateProcess( + NULL, // module location + quotedLocation, // command line + NULL, // process attributes + NULL, // thread attributes + FALSE, // inherit our handles + CREATE_NO_WINDOW, // no window + NULL, // use our environment + NULL, // user our current directory + &si, // startup info + &pData->serverProcess)) // process info + { + // TODO: error creating process + } + else + { + // we are the creator so save handles for later + m_hServer = pData->serverProcess.hProcess; + m_hServerThread = pData->serverProcess.hThread; + // add a refcount + pData->numRefs++; + serverStarted = TRUE; + } + } + else + { + // already running + // add a refcount and open our process handle to it + pData->numRefs++; + m_hServer = ::OpenProcess(0, FALSE, pData->serverProcess.dwProcessId); + serverStarted = TRUE; + } + TCDEBUGLOGA1("CClientManager::StartServer serverStarted=%d\n", serverStarted); + return serverStarted; +} + +BOOL CClientManager::StopServer(pServerProcessData pData) +{ + TCDEBUGLOGS("CClientManager::StopServer\n"); + + BOOL serverStopped = FALSE; + + if (pData->serverProcess.hProcess == NULL || pData->numRefs <= 0) + { + serverStopped = TRUE; + } + else + { + TCDEBUGLOGA1(" numRefs = %d\n",pData->numRefs); + + // substract ref count + pData->numRefs--; + // if refcount == 0 then really stop the server process + if (pData->numRefs <= 0) + { + // last client process is closing + // tell server to exit + ServerCommandData cmdrsp; + cmdrsp.command = eCmdExit; + TCDEBUGLOGS(" SendCommand eCmdExit\n"); + m_Server->SendCommand(&cmdrsp); + TCDEBUGLOGS(" GetResponse eExit\n"); + m_Server->GetResponse(&cmdrsp); + // wait for process to exit + TCDEBUGLOGS(" WaitForSingleObject start\n"); + WaitForSingleObject(m_hServer, 10000L /*INFINITE*/); + TCDEBUGLOGS(" WaitForSingleObject found\n"); + + if (m_hServer != NULL) + CloseHandle(m_hServer); + + if (m_hServerThread != NULL) + CloseHandle(m_hServerThread); + } + else + { + // just close our handle to server process + if (m_hServer != NULL) + CloseHandle(m_hServer); + + if (m_hServerThread != NULL) + CloseHandle(m_hServerThread); + } + } + + TCDEBUGLOGS("CClientManager::StopServer end\n"); + return TRUE; +} +long CClientManager::StartServer() +{ + long ret = TCAPI_ERR_NONE; + pServerProcessData pData = m_Server->GetProcessPtr(); + + TCDEBUGLOGA3("CClientManager::StartServer this = %x m_hServer = %x numRefs = %d\n", this, m_hServer, pData->numRefs); +// TCDEBUGLOGA1(" mgrRefs = %d\n", m_MgrServerRef); + + BOOL serverStarted = FALSE; + // server is ref counted + // refcount = 0 => server is not running + // refcount > 0 => server already started by some other process + + // terminate the TCFServer if it is already running + TerminateServerThroughLockFile(pData); + + if (pData->numRefs == 0) + { + // server not running + TCDEBUGLOGA1(" TCFServer exe =%s\n", m_ServerExeFile); + TCDEBUGLOGA1(" TCFServer lock=%s\n", m_ServerLockFile); + + + // create process + STARTUPINFO si; + memset(&si,0,sizeof(si)); + si.cb = sizeof(si); + memset(&pData->serverProcess, 0, sizeof(pData->serverProcess)); + pData->serverProcess.hProcess = NULL; + if (!::CreateProcess( + NULL, // module location + m_ServerExeFile, // command line + NULL, // process attributes + NULL, // thread attributes + FALSE, // inherit our handles + CREATE_NO_WINDOW, // no window + NULL, // use our environment + NULL, // user our current directory + &si, // startup info + &pData->serverProcess)) // process info + { + // TODO: error creating process + } + else + { + // we are the creator so save handles for later + m_hServer = pData->serverProcess.hProcess; + m_hServerThread = pData->serverProcess.hThread; + // add a refcount + pData->numRefs++; + serverStarted = TRUE; + TCDEBUGLOGA3("CClientManager::StartServer created m_hServer = %x processId = %d numRefs = %d\n", m_hServer, pData->serverProcess.dwProcessId, pData->numRefs); + + // create lock file and save process ID + TCDEBUGLOGS("CClientManager::StartServer CreateLockFile\n"); + CreateLockFile(pData->serverProcess.dwProcessId); + } + } + else + { + // already running + // add a refcount and open our process handle to it only if we haven't opened it already + pData->numRefs++; + if (m_hServer == NULL) + m_hServer = ::OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, pData->serverProcess.dwProcessId); + if (m_hServer == 0) + { + TCDEBUGLOGA1("CClientManager::StartServer opened m_hServer null error=%d\n", ::GetLastError()); + } + m_hServerThread = NULL; // only creator gets real thread handle + serverStarted = TRUE; + TCDEBUGLOGA3("CClientManager::StartServer opened m_hServer = %x processId = %d numRefs = %d\n", m_hServer, pData->serverProcess.dwProcessId, pData->numRefs); + // save our process id to lock file + AppendToLockFile(pData->serverProcess.dwProcessId); + } + if (serverStarted) + m_ServerRunning = TRUE; + + TCDEBUGLOGA1("CClientManager::StartServer end numRefs = %d\n", pData->numRefs); + return ret; +} + +long CClientManager::StopServer() +{ + long ret = TCAPI_ERR_NONE; + pServerProcessData pData = m_Server->GetProcessPtr(); + + TCDEBUGLOGA3("CClientManager::StopServer this = %x m_hServer = %x numRefs = %d\n", this, m_hServer, pData->numRefs); + + BOOL serverStopped = FALSE; + + if (pData->serverProcess.hProcess == NULL || pData->numRefs <= 0) + { + TCDEBUGLOGS("CClientManager::StopServer hProcess NULL or numRefs <= 0\n"); + serverStopped = TRUE; + } +#if (0) + else if (m_hServer == NULL) + { + // we've already closed our handle to server + // don't close it again + TCDEBUGLOGS("CClientManager::StopServer m_hServer null\n"); + } +#endif + else + { + // substract ref count + pData->numRefs--; + if (pData->numRefs < 0) pData->numRefs = 0; + // if refcount == 0 then really stop the server process + if (pData->numRefs == 0) + { + // last client process is closing + // tell server to exit + ServerCommandData cmdrsp; + cmdrsp.command = eCmdExit; + + TCDEBUGLOGS(" SendCommand eCmdExit\n"); + m_Server->SendCommand(&cmdrsp); + TCDEBUGLOGS(" GetResponse eExit\n"); + m_Server->GetResponse(&cmdrsp); + + // wait for process to exit + TCDEBUGLOGS(" WaitForSingleObject start\n"); + DWORD waitErr = ::WaitForSingleObject(m_hServer, 10000L /*INFINITE*/); + TCDEBUGLOGA1("CClientManager::StopServer WaitForSingleObject = %d\n", waitErr); + + // now close our handle to server process + if (m_hServer != NULL) + { + CloseHandle(m_hServer); + m_hServer = NULL; + } + + if (m_hServerThread != NULL) + { + CloseHandle(m_hServerThread); + m_hServerThread = NULL; + } + serverStopped = TRUE; + + // delete lock file + TCDEBUGLOGS("CClientManager::StopServer DeleteLockFile\n"); + DeleteLockFile(); + } + else + { + // just close our handle to server process + + if (m_hServer != NULL) + { + CloseHandle(m_hServer); + m_hServer = NULL; + } + + if (m_hServerThread != NULL) + { + CloseHandle(m_hServerThread); + m_hServerThread = NULL; + } + DeleteFromLockFile(pData->serverProcess.dwProcessId); + } + } + if (serverStopped) + m_ServerRunning = FALSE; + + TCDEBUGLOGA1("CClientManager::StopServer end numRefs = %d\n", pData->numRefs); + return ret; +} + +BOOL CClientManager::IsServerRunning() +{ + pServerProcessData pData = m_Server->GetProcessPtr(); + if (pData->serverProcess.hProcess != NULL) + return TRUE; + else + return FALSE; + +} + +void CClientManager::CreateLockFile(DWORD processId) +{ + if (m_ServerLockFile != NULL) + { + FILE* f = fopen(m_ServerLockFile, "wt"); + TCDEBUGLOGA1("CClientManager::CreateLockFile f=%x\n", f); + + if (f) + { + DWORD callingProcessId = ::GetCurrentProcessId(); + TCDEBUGLOGA2("CClientManager::CreateLockFile callingProcessId=%d processId=%d\n", callingProcessId, processId); + fprintf(f, "%ld %ld\n", callingProcessId, processId); + fclose(f); + } + else + { + DWORD err = ::GetLastError(); + TCDEBUGLOGA2("CClientManager::CreateLockFile fopenErr=%d:%s\n", err, GetErrorText(err)); + } + } +} +void CClientManager::AppendToLockFile(DWORD processId) +{ + if (m_ServerLockFile != NULL) + { + FILE* f = fopen(m_ServerLockFile, "at"); + TCDEBUGLOGA1("CClientManager::AppendToLockFile f=%x\n", f); + + if (f) + { + DWORD callingProcessId = ::GetCurrentProcessId(); + TCDEBUGLOGA2("CClientManager::AppendToLockFile callingProcessId=%d processId=%d\n", callingProcessId, processId); + fprintf(f, "%ld %ld\n", callingProcessId, processId); + fclose(f); + } + else + { + DWORD err = ::GetLastError(); + TCDEBUGLOGA2("CClientManager::AppendToLockFile fopenErr=%d:%s\n", err, GetErrorText(err)); + } + } +} +void CClientManager::DeleteLockFile() +{ + if (m_ServerLockFile != NULL) + { + TCDEBUGLOGS("CClientManager::DeleteLockFile\n"); + ::remove(m_ServerLockFile); + } +} + +void CClientManager::DeleteFromLockFile(DWORD serverProcessId) +{ + DWORD callingId[10]; + DWORD serverId[10]; + int numIds = 0; + + DWORD ourProcessId = ::GetCurrentProcessId(); + + if (m_ServerLockFile != NULL) + { + DWORD attr = ::GetFileAttributes(m_ServerLockFile); + TCDEBUGLOGA1("CClientManager::DeleteFromLockFile attr=%x\n", attr); + + if (attr != 0xffffffff) // error + { + // file exists + // read the process Ids from it + + FILE *f = fopen(m_ServerLockFile, "rt"); + TCDEBUGLOGA1("CClientManager::DeleteFromLockFile f=%x\n", f); + if (f) + { + BOOL done = FALSE; + while (!done) + { + DWORD cId = 0xffffffff; + DWORD sId = 0xffffffff; + int n = fscanf(f, "%ld %ld\n", &cId, &sId); + if (n == 2) + { + TCDEBUGLOGA3("CClientManager::DeleteFromLockFile numIds=%d sId=%d pId=%d\n", numIds, cId, sId); + if (cId != ourProcessId || sId != serverProcessId) + { + callingId[numIds] = cId; + serverId[numIds] = sId; + numIds++; + if (numIds > 9) + done = TRUE; + } + } + else + { + done = TRUE; + } + } + fclose(f); + } + + // now rewrite lock file without us + ::remove(m_ServerLockFile); + if (numIds > 0) + { + f = fopen(m_ServerLockFile, "wt"); + if (f) + { + for (int i = 0; i < numIds; i++) + { + fprintf(f, "%ld %ld\n", callingId[i], serverId[i]); + } + fclose(f); + } + } + } + } +} + +// Currently assumes there is only ONE TCFServer, but multiple client processes (that use that server) +// we should not have more than a few Carbide processes connecting to the same TCFServer +void CClientManager::TerminateServerThroughLockFile(pServerProcessData pData) +{ + DWORD callingId[10]; + DWORD serverId[10]; + BOOL liveCaller[10]; + int numIds = 0; + if (m_ServerLockFile != NULL) + { + DWORD attr = ::GetFileAttributes(m_ServerLockFile); + TCDEBUGLOGA1("CClientManager::TerminateServerThroughLockFile attr=%x\n", attr); + + if (attr != 0xffffffff) // error + { + // file exists + // read the process Ids from it + + FILE *f = fopen(m_ServerLockFile, "rt"); + TCDEBUGLOGA1("CClientManager::TerminateServerThroughLockFile f=%x\n", f); + if (f) + { + BOOL done = FALSE; + while (!done) + { + DWORD cId = 0xffffffff; + DWORD sId = 0xffffffff; + int n = fscanf(f, "%ld %ld\n", &cId, &sId); + if (n == 2) + { + TCDEBUGLOGA3("CClientManager::TerminateServerThroughLockFile n=%d sId=%d pId=%d\n", n, cId, sId); + callingId[numIds] = cId; + serverId[numIds] = sId; + numIds++; + if (numIds > 9) + done = TRUE; + } + else + { + done = TRUE; + } + } + fclose(f); + + int numDeadCallers = 0; + for (int i = 0; i < numIds; i++) + { + HANDLE h = ::OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, callingId[i]); + if (h) + { + // calling process is still alive + liveCaller[i] = TRUE; + ::CloseHandle(h); + TCDEBUGLOGA1("CClientManager::TerminateServerThroughLockFile %d alive\n", callingId[i]); + } + else + { + liveCaller[i] = FALSE; + numDeadCallers++; + DWORD err = ::GetLastError(); + TCDEBUGLOGA3("CClientManager::TerminateServerThroughLockFile %d dead err=%d:%s\n", callingId[i], err, GetErrorText(err)); + } + } + if (numDeadCallers == numIds) + { + // terminate the TCFServer, and delete lock file + pData->numRefs = 0; + ::remove(m_ServerLockFile); + HANDLE h = ::OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, serverId[0]); + if (h) + { + BOOL ret = ::TerminateProcess(h, -1); + if (ret == 0) + { + DWORD err = ::GetLastError(); + TCDEBUGLOGA2("CClientManager::TerminateServerThroughLockFile TerminateProcess=%d:%s\n", err, GetErrorText(err)); + } + ::CloseHandle(h); + } + } + else + { + // leave TCFServer running, recreate lock file and save live callers + ::remove(m_ServerLockFile); + f = fopen(m_ServerLockFile, "wt"); + if (f) + { + for (int i = 0; i < numIds; i++) + { + if (liveCaller[i]) + { + fprintf(f, "%ld %ld\n", callingId[i], serverId[i]); + } + } + fclose(f); + } + pData->numRefs -= numDeadCallers; + if (pData->numRefs < 0) pData->numRefs = 0; + } + } + else + { + // error opening lock file + DWORD err = ::GetLastError(); + TCDEBUGLOGA2("CClientManager::TerminateServerThroughLockFile fopenErr=%d:%s\n", err, GetErrorText(err)); + } + } + } +} +#ifdef _DEBUG +static char* GetErrorText(DWORD inError) +{ + static char msg[256]; + FormatMessage( + FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + inError, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &msg, + sizeof(msg) - 1, + NULL); + + return msg; +} +#else +static char* GetErrorText(DWORD inError) +{ + return NULL; +} +#endif diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/ClientManager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/ClientManager.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// ClientManager.h: interface for the CClientManager class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_CLIENTMANAGER_H__D8CD8281_5D57_43E9_922D_9532DC8669C4__INCLUDED_) +#define AFX_CLIENTMANAGER_H__D8CD8281_5D57_43E9_922D_9532DC8669C4__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +#include +#include +#include "ServerClient.h" +#include "InputStream.h" +#include "ErrorMonitorData.h" +#include "TCErrorConstants.h" +#include "TCDebugLog.h" + +typedef std::vector InputStreamList; +typedef std::vector ErrorMonitorList; +//typedef std::vector InputStreamList; + +#define ERRORMONITORLIST_MUTEX_BASENAME "TCFErrorMonitorList" +#define ERRORMONITORLIST_MUTEX_TIMEOUT (60000L) +#define INPUTSTREAMLIST_MUTEX_BASENAME "TCFInputStreamList" +#define INPUTSTREAMLIST_MUTEX_TIMEOUT (60000L) + +#ifdef WIN32 +#define SERVER_PROCESS_NAME "TCFServer.exe" +#define SERVER_LOCKFILE_NAME "TCFServer.lock" +#define PATH_DELIMITER '\\' +#else +#error not WIN32 +#endif + +#define MAX_DLLPATHNAME (2048) + +class CClientManager +{ +public: + CClientManager(); + CClientManager(HINSTANCE hinstDLL); + virtual ~CClientManager(); + + // starting/stopping server + BOOL StartServer(pServerProcessData pData); + BOOL StopServer(pServerProcessData pData); + long StartServer(); + long StopServer(); + BOOL IsServerRunning(); // { return m_ServerRunning; } + BOOL m_ServerRunning; + void TerminateServerThroughLockFile(pServerProcessData pData); + void CreateLockFile(DWORD processId); + void AppendToLockFile(DWORD processId); + void DeleteLockFile(); + void DeleteFromLockFile(DWORD processId); + + // input stream + CInputStream* FindInputStream(long inClientId); + long InputStreamListSize(); + void RemoveInputStream(CInputStream* inputStream); + void AddInputStream(CInputStream* stream); + BOOL WaitForStreamListAccess() { return m_StreamListMutex.Wait(); } + BOOL ReleaseStreamListAccess() { return m_StreamListMutex.Release(); } + Mutex m_StreamListMutex; + + // error monitors + CErrorMonitor* FindErrorMonitor(long inClientId); + long ErrorMonitorListSize(); + void RemoveErrorMonitor(CErrorMonitor* errorMonitor); + void AddErrorMonitor(CErrorMonitor* monitor); + BOOL WaitForErrorMonitorListAccess() { return m_ErrorMonitorListMutex.Wait(); } + BOOL ReleaseErrorMonitorListAccess() { return m_ErrorMonitorListMutex.Release(); } + Mutex m_ErrorMonitorListMutex; + + CServerCommand* m_Server; + TCDebugLog* m_DebugLog; + InputStreamList* m_StreamList; + ErrorMonitorList* m_ErrorMonitorList; + char* m_DllLocation; + HANDLE m_hServer; // our handle to the server process (per process) + HANDLE m_hServerThread; // handle to server main thread (creator process only) + char m_Version[MAX_VERSION_STRING]; // our version string + + char* m_ServerLockFile; // TCFServer lock file name at the DLL location + char* m_ServerExeFile; // TCFServer exe + +}; + +#endif // !defined(AFX_CLIENTMANAGER_H__D8CD8281_5D57_43E9_922D_9532DC8669C4__INCLUDED_) diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/ReadMe.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/ReadMe.txt Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,41 @@ +======================================================================== + DYNAMIC LINK LIBRARY : TCFClient +======================================================================== + + +AppWizard has created this TCFClient DLL for you. + +This file contains a summary of what you will find in each of the files that +make up your TCFClient application. + +TCFClient.dsp + This file (the project file) contains information at the project level and + is used to build a single project or subproject. Other users can share the + project (.dsp) file, but they should export the makefiles locally. + +TCFClient.cpp + This is the main DLL source file. + + When created, this DLL does not export any symbols. As a result, it + will not produce a .lib file when it is built. If you wish this project + to be a project dependency of some other project, you will either need to + add code to export some symbols from the DLL so that an export library + will be produced, or you can check the "doesn't produce lib" checkbox in + the Linker settings page for this project. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named TCFClient.pch and a precompiled types file named StdAfx.obj. + + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + + +///////////////////////////////////////////////////////////////////////////// diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/StdAfx.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/StdAfx.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// stdafx.cpp : source file that includes just the standard includes +// TCFClient.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/StdAfx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/StdAfx.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__EED2AD88_9849_4B81_852F_D207E6D97FE2__INCLUDED_) +#define AFX_STDAFX_H__EED2AD88_9849_4B81_852F_D207E6D97FE2__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define TCF_CLIENT + +// Insert your headers here +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + + +#include + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__EED2AD88_9849_4B81_852F_D207E6D97FE2__INCLUDED_) diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCAPIConnectionJni.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCAPIConnectionJni.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,1639 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "stdafx.h" +#include "TCAPIConnectionJni.h" +#include "TCConstants.h" +#include "TCErrorConstants.h" +#include "ClientManager.h" +#include "ServerClient.h" +#include "TCDebugLog.h" +#include "InputStream.h" +#include "ErrorMonitorData.h" +#include +#include + +extern CClientManager* gManager; + +#ifdef _DEBUG +extern BOOL gDoLogging; +char TCDebugMsg[100]; +#define TCDEBUGOPEN() if (gDoLogging) { gManager->m_DebugLog->WaitForAccess(); } +#define TCDEBUGLOGS(s) if (gDoLogging) { sprintf(TCDebugMsg,"%s", s); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGLOGA1(s, a1) if (gDoLogging) { sprintf(TCDebugMsg, s, a1); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGLOGA2(s, a1, a2) if (gDoLogging) { sprintf(TCDebugMsg, s, a1, a2); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGLOGA3(s, a1, a2, a3) if (gDoLogging) { sprintf(TCDebugMsg, s, a1, a2, a3); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGCLOSE() if (gDoLogging) { gManager->m_DebugLog->ReleaseAccess(); } +#else +#define TCDEBUGOPEN() +#define TCDEBUGLOGS(s) +#define TCDEBUGLOGA1(s, a1) +#define TCDEBUGLOGA2(s, a1, a2) +#define TCDEBUGLOGA3(s, a1, a2, a3) +#define TCDEBUGCLOSE() +#endif + +#ifdef _DEBUG +FILE* fLog1 = NULL; +FILE* fLog2 = NULL; +static void OpenLogFile1(char* filename); +static void CloseLogFile1(); +static void OpenLogFile2(char* filename); +static void CloseLogFile2(); +#define OPENLOGf1(f) OpenLogFile1(f) +#define CLOSELOG1() CloseLogFile1() +#define OPENLOGf2(f) OpenLogFile2(f) +#define CLOSELOG2() CloseLogFile2() +#else +#define OPENLOGf1(f) +#define CLOSELOG1() +#endif + +static void ConvertRealSerialSettingsToHost(char* pBaud, char* pDataBits, char* pParity, char* pStopBits, char* pFlowControl, pRealSerialConnectData pData); +static void ConvertRealSerialSettingsToServer(const char* pBaud, const char* pDataBits, const char* pParity, const char* pStopBits, const char* pFlowControl, pRealSerialConnectData pData); +static const char* GetErrorText(unsigned long error); +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeConnect + * Signature: (Ljava/lang/String;[J[Ljava/lang/String;[JLjava/lang/String;[J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeConnect + (JNIEnv *env, jobject pThis, jstring inType, jlongArray inOptions, jobjectArray inSettings, jlongArray inMessageOptions, jstring inFilePath, jlongArray outClientId) + { + // inOptions are connection options + // inMessageOptions are client's message options + // inFilePath will be null if message destination is not DESTINATION_CLIENTFILE + long ret = TCAPI_ERR_NONE; + unsigned long osError = 0; + long clientId; + + TCDEBUGOPEN(); + + TCDEBUGLOGS("nativeConnect\n"); + + gManager->m_Server->WaitforServerPipeAccess(); + + { + jboolean isCopy = false; + // options per connection + jlong* pOptions = env->GetLongArrayElements(inOptions, &isCopy); + DWORD retryInterval = (DWORD)pOptions[0]; + DWORD retryTimeout = (DWORD)pOptions[1]; + + + + env->ReleaseLongArrayElements(inOptions, pOptions, 0); + + pOptions = env->GetLongArrayElements(inMessageOptions, &isCopy); + + // options per client + long unWrapFormat = pOptions[0]; + long ostVersion = pOptions[1]; + env->ReleaseLongArrayElements(inMessageOptions, pOptions, 0); + + + TCDEBUGLOGA2(" retryInterval=%d, retryTimeout=%d\n", retryInterval, retryTimeout); + + TCDEBUGLOGA3(" unWrapFormat=%d, ostVersion=%d destination=%s\n", unWrapFormat, ostVersion, ((inFilePath == NULL) ? "stream" : "file")); + + char* pType = (char*)env->GetStringUTFChars(inType, &isCopy); + TCDEBUGLOGA1(" pType = %s\n", pType); + + if (strcmp(pType, "musti") == 0 || strcmp(pType, "platsim") == 0) + { + jstring addString = (jstring)env->GetObjectArrayElement(inSettings, 0); + jstring portString = (jstring)env->GetObjectArrayElement(inSettings, 1); + jstring chanString = (jstring)env->GetObjectArrayElement(inSettings, 2); + jstring decodeString = (jstring)env->GetObjectArrayElement(inSettings, 3); + + const char* pAddress = env->GetStringUTFChars(addString, NULL); + const char* pPort = env->GetStringUTFChars(portString, NULL); + const char* pChan = env->GetStringUTFChars(chanString, NULL); + const char* pDecode = env->GetStringUTFChars(decodeString, NULL); + + TCDEBUGLOGA2(" TCP: ipAddress=%s, ipPort=%s\n", pAddress, pPort); + TCDEBUGLOGA2(" TCP: channel=%s, decode=%s\n", pChan, pDecode); + + ServerCommandData cmd; + cmd.command = eCmdConnect; + strncpy(cmd.connectSettings.connectType, pType, MAX_CONNECTION_TYPE); + strncpy(cmd.connectSettings.tcpSettings.ipAddress, pAddress, MAX_IPADDRESS_SIZE); + strncpy(cmd.connectSettings.tcpSettings.ipPort, pPort, MAX_PORT_SIZE); + + cmd.connectSettings.retryInterval = retryInterval; + cmd.connectSettings.retryTimeout = retryTimeout; + strncpy(cmd.connectSettings.decodeFormat, pDecode, MAX_DECODE_FORMAT); + + if (pChan != NULL) + { + if (strcmp(pChan, "1") == 0) + { + cmd.connectSettings.traceBoxChannel = 1; + } + else + { + cmd.connectSettings.traceBoxChannel = 2; + } + } + else + { + cmd.connectSettings.traceBoxChannel = 2; + } + + + cmd.clientOptions.unWrapFormat = unWrapFormat; + cmd.clientOptions.ostVersion = ostVersion; + + gManager->m_Server->SendCommand(&cmd); + gManager->m_Server->GetResponse(&cmd); + + if (cmd.response == eRspError) + { + TCDEBUGLOGA1(" from server: ret = %d\n", cmd.error); + ret = cmd.error; + osError = cmd.osError; + } + else + { + TCDEBUGLOGA1(" from server: id = %d\n", cmd.clientId); + clientId = cmd.clientId; + + gManager->WaitForErrorMonitorListAccess(); + TCDEBUGLOGS(" TODO: create error monitor storage if server connected\n"); + CErrorMonitor* monitor = new CErrorMonitor(clientId); + if (monitor != NULL) + { + monitor->CreateData(); + gManager->AddErrorMonitor(monitor); + } + + gManager->ReleaseErrorMonitorListAccess(); + + TCDEBUGLOGA1(" clientId=%d\n", clientId); + jlong jClientId = clientId; + env->SetLongArrayRegion(outClientId, 0, 1, &jClientId); + + } + env->ReleaseStringUTFChars(addString, pAddress); + env->ReleaseStringUTFChars(portString, pPort); + env->ReleaseStringUTFChars(chanString, pChan); + env->ReleaseStringUTFChars(decodeString, pDecode); + } + else if (strcmp(pType, "tcp") == 0) + { + jstring addString = (jstring)env->GetObjectArrayElement(inSettings, 0); + jstring portString = (jstring)env->GetObjectArrayElement(inSettings, 1); + jstring decodeString = (jstring)env->GetObjectArrayElement(inSettings, 2); + + const char* pAddress = env->GetStringUTFChars(addString, NULL); + const char* pPort = env->GetStringUTFChars(portString, NULL); + const char* pDecode = env->GetStringUTFChars(decodeString, NULL); + + TCDEBUGLOGA3(" TCP: ipAddress=%s, ipPort=%s decode=%s\n", pAddress, pPort, pDecode); + + ServerCommandData cmd; + cmd.command = eCmdConnect; + strncpy(cmd.connectSettings.connectType, pType, MAX_CONNECTION_TYPE); + strncpy(cmd.connectSettings.tcpSettings.ipAddress, pAddress, MAX_IPADDRESS_SIZE); + strncpy(cmd.connectSettings.tcpSettings.ipPort, pPort, MAX_PORT_SIZE); + + cmd.connectSettings.retryInterval = retryInterval; + cmd.connectSettings.retryTimeout = retryTimeout; + strncpy(cmd.connectSettings.decodeFormat, pDecode, MAX_DECODE_FORMAT); + cmd.clientOptions.unWrapFormat = unWrapFormat; + cmd.clientOptions.ostVersion = ostVersion; + + gManager->m_Server->SendCommand(&cmd); + gManager->m_Server->GetResponse(&cmd); + + if (cmd.response == eRspError) + { + TCDEBUGLOGA1(" from server: ret = %d\n", cmd.error); + ret = cmd.error; + osError = cmd.osError; + } + else + { + TCDEBUGLOGA1(" from server: id = %d\n", cmd.clientId); + clientId = cmd.clientId; + + gManager->WaitForErrorMonitorListAccess(); + TCDEBUGLOGS(" TODO: create error monitor storage if server connected\n"); + CErrorMonitor* monitor = new CErrorMonitor(clientId); + if (monitor != NULL) + { + monitor->CreateData(); + gManager->AddErrorMonitor(monitor); + } + + gManager->ReleaseErrorMonitorListAccess(); + + TCDEBUGLOGA1(" clientId=%d\n", clientId); + jlong jClientId = clientId; + env->SetLongArrayRegion(outClientId, 0, 1, &jClientId); + + } + env->ReleaseStringUTFChars(addString, pAddress); + env->ReleaseStringUTFChars(portString, pPort); + env->ReleaseStringUTFChars(decodeString, pDecode); + } + else if (strcmp(pType, "virtualserial") == 0) + { + jstring portString = (jstring)env->GetObjectArrayElement(inSettings, 0); + const char* pPort = env->GetStringUTFChars(portString, NULL); + jstring decodeString = (jstring)env->GetObjectArrayElement(inSettings, 1); + const char* pDecode = env->GetStringUTFChars(decodeString, NULL); + + TCDEBUGLOGA2(" vserial: pPort=%s decode=%s\n", pPort, pDecode); + + ServerCommandData cmd; + cmd.command = eCmdConnect; + strncpy(cmd.connectSettings.connectType, pType, MAX_CONNECTION_TYPE); + strncpy(cmd.connectSettings.virtualSerialSettings.comPort, pPort, MAX_COMPORT_SIZE); + + cmd.connectSettings.retryInterval = retryInterval; + cmd.connectSettings.retryTimeout = retryTimeout; + strncpy(cmd.connectSettings.decodeFormat, pDecode, MAX_DECODE_FORMAT); + cmd.clientOptions.unWrapFormat = unWrapFormat; + cmd.clientOptions.ostVersion = ostVersion; + + gManager->m_Server->SendCommand(&cmd); + gManager->m_Server->GetResponse(&cmd); + + if (cmd.response == eRspError) + { + TCDEBUGLOGA1(" from server: ret = %d\n", cmd.error); + ret = cmd.error; + osError = cmd.osError; + } + else + { + TCDEBUGLOGA1(" from server: id = %d\n", cmd.clientId); + clientId = cmd.clientId; + + gManager->WaitForErrorMonitorListAccess(); + CErrorMonitor* monitor = new CErrorMonitor(clientId); + if (monitor != NULL) + { + monitor->CreateData(); + gManager->AddErrorMonitor(monitor); + } + + gManager->ReleaseErrorMonitorListAccess(); + + TCDEBUGLOGA1(" clientId=%d\n", clientId); + jlong jClientId = clientId; + env->SetLongArrayRegion(outClientId, 0, 1, &jClientId); + } + env->ReleaseStringUTFChars(portString, pPort); + env->ReleaseStringUTFChars(decodeString, pDecode); + } + else if (strcmp(pType, "serial") == 0) + { + jstring portString = (jstring)env->GetObjectArrayElement(inSettings, 0); + const char* pPort = env->GetStringUTFChars(portString, NULL); + + jstring baudString = (jstring)env->GetObjectArrayElement(inSettings, 1); + const char* pBaud = env->GetStringUTFChars(baudString, NULL); + + jstring dataBitsString = (jstring)env->GetObjectArrayElement(inSettings, 2); + const char* pDataBits = env->GetStringUTFChars(dataBitsString, NULL); + + jstring parityString = (jstring)env->GetObjectArrayElement(inSettings, 3); + const char* pParity = env->GetStringUTFChars(parityString, NULL); + + jstring stopBitsString = (jstring)env->GetObjectArrayElement(inSettings, 4); + const char* pStopBits = env->GetStringUTFChars(stopBitsString, NULL); + + jstring flowControlString = (jstring)env->GetObjectArrayElement(inSettings, 5); + const char* pFlowControl = env->GetStringUTFChars(flowControlString, NULL); + + jstring decodeString = (jstring)env->GetObjectArrayElement(inSettings, 6); + const char* pDecode = env->GetStringUTFChars(decodeString, NULL); + + TCDEBUGLOGA3(" real serial: pPort=%s pBaud=%s pDataBits=%s\n", pPort, pBaud, pDataBits); + + ServerCommandData cmd; + cmd.command = eCmdConnect; + strncpy(cmd.connectSettings.connectType, pType, MAX_CONNECTION_TYPE); + strncpy(cmd.connectSettings.realSerialSettings.comPort, pPort, MAX_COMPORT_SIZE); + ConvertRealSerialSettingsToServer(pBaud, pDataBits, pParity, pStopBits, pFlowControl, &cmd.connectSettings.realSerialSettings); + + cmd.connectSettings.retryInterval = retryInterval; + cmd.connectSettings.retryTimeout = retryTimeout; + strncpy(cmd.connectSettings.decodeFormat, pDecode, MAX_DECODE_FORMAT); + cmd.clientOptions.unWrapFormat = unWrapFormat; + cmd.clientOptions.ostVersion = ostVersion; + + gManager->m_Server->SendCommand(&cmd); + gManager->m_Server->GetResponse(&cmd); + + if (cmd.response == eRspError) + { + TCDEBUGLOGA1(" from server: ret = %d\n", cmd.error); + ret = cmd.error; + osError = cmd.osError; + } + else + { + TCDEBUGLOGA1(" from server: id = %d\n", cmd.clientId); + clientId = cmd.clientId; + + gManager->WaitForErrorMonitorListAccess(); + CErrorMonitor* monitor = new CErrorMonitor(clientId); + if (monitor != NULL) + { + monitor->CreateData(); + gManager->AddErrorMonitor(monitor); + } + + gManager->ReleaseErrorMonitorListAccess(); + + TCDEBUGLOGA1(" clientId=%d\n", clientId); + jlong jClientId = clientId; + env->SetLongArrayRegion(outClientId, 0, 1, &jClientId); + } + env->ReleaseStringUTFChars(portString, pPort); + env->ReleaseStringUTFChars(baudString, pBaud); + env->ReleaseStringUTFChars(dataBitsString, pDataBits); + env->ReleaseStringUTFChars(parityString, pParity); + env->ReleaseStringUTFChars(stopBitsString, pStopBits); + env->ReleaseStringUTFChars(flowControlString, pFlowControl); + env->ReleaseStringUTFChars(decodeString, pDecode); + } + else + { + TCDEBUGLOGS(" TCAPI_ERR_MEDIA_NOT_SUPPORTED\n"); + ret = TCAPI_ERR_MEDIA_NOT_SUPPORTED; + } + + env->ReleaseStringUTFChars(inType, pType); + + + // handle message destinations + // input stream is done by java on open input stream not here + // message file is done here + if (ret == TCAPI_ERR_NONE) + { + long destination = DESTINATION_INPUTSTREAM; + char* pMessageFile = NULL; + if (inFilePath != NULL) + { + destination = DESTINATION_CLIENTFILE; + jboolean isCopy=FALSE; + pMessageFile = (char*)env->GetStringUTFChars(inFilePath, &isCopy); + + // send to TCFServer + ServerCommandData cmd; + cmd.command = eCmdOpenMessageFile; + cmd.clientId = clientId; + cmd.destinationOptions.destination = eDestinationFile; + strncpy(cmd.destinationOptions.destinationFile, pMessageFile, MAX_FILEPATH); + gManager->m_Server->SendCommand(&cmd); + gManager->m_Server->GetResponse(&cmd); + + env->ReleaseStringUTFChars(inFilePath, pMessageFile); + } + } + } + + gManager->m_Server->ReleaseServerPipeAccess(); + + TCDEBUGLOGA3("nativeConnect return ret=%d, osError=%d : %s\n", ret, osError, GetErrorText(osError)); + + TCDEBUGCLOSE(); + + if (ret != TCAPI_ERR_NONE && osError > 0) + { + jclass clazz = env->FindClass("Ljava/lang/Exception;"); + env->ThrowNew(clazz, GetErrorText(osError)); + } + + return ret; +} + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeDisconnect + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeDisconnect + (JNIEnv *env, jobject pThis, jlong inClientId) +{ + long ret = TCAPI_ERR_NONE; + + TCDEBUGOPEN(); + TCDEBUGLOGS("nativeDisconnect\n"); + + if (gManager->m_Server == NULL) + { + TCDEBUGLOGS(" TCAPI_ERR_INVALID_HANDLE - gServer NULL\n"); + ret = TCAPI_ERR_INVALID_HANDLE; + } + else if (inClientId <= 0) + { + TCDEBUGLOGS(" TCAPI_ERR_INVALID_HANDLE - inClientId <= 0\n"); + ret = TCAPI_ERR_INVALID_HANDLE; + } + else + { + gManager->m_Server->WaitforServerPipeAccess(); + + BOOL found = FALSE; + long id = inClientId; + + TCDEBUGLOGA1(" look for clientId=%d\n", id); + + TCDEBUGLOGS(" TODO: tell server to disconnect this client\n"); + ServerCommandData cmdrsp; + pServerCommandData pCmdrsp = &cmdrsp; + pCmdrsp->command = eCmdDisconnect; + pCmdrsp->clientId = id; + + gManager->m_Server->SendCommand(pCmdrsp); + gManager->m_Server->GetResponse(pCmdrsp); + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + } + + { + gManager->WaitForErrorMonitorListAccess(); + TCDEBUGLOGS(" TODO: destroy error monitor for this client\n"); + CErrorMonitor *monitor = gManager->FindErrorMonitor(id); + if (monitor != NULL) + { + gManager->RemoveErrorMonitor(monitor); + delete monitor; + } + gManager->ReleaseErrorMonitorListAccess(); + } + gManager->m_Server->ReleaseServerPipeAccess(); + } + + TCDEBUGLOGA1(" return ret=%d\n", ret); + TCDEBUGCLOSE(); + return ret; +} +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeGetNumberConnections + * Signature: ([J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeGetNumberConnections + (JNIEnv *env, jobject pThis, jlongArray outNumber) +{ + long ret = TCAPI_ERR_NONE; + long number = 0; + + TCDEBUGOPEN(); + gManager->m_Server->WaitforServerPipeAccess(); + + TCDEBUGLOGS("nativeGetNumberConnections\n"); + ServerCommandData cmdrsp; + pServerCommandData pCmdrsp = &cmdrsp; + pCmdrsp->command = eCmdGetNumberConnections; + + BOOL sent = gManager->m_Server->SendCommand(pCmdrsp); + + BOOL recd = gManager->m_Server->GetResponse(pCmdrsp); + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + } + else + { + number = pCmdrsp->numConnections; + + jlong jNumber = number; + env->SetLongArrayRegion(outNumber, 0, 1, &jNumber); + + TCDEBUGLOGA1(" number=%d\n", number); + } + + gManager->m_Server->ReleaseServerPipeAccess(); + + TCDEBUGLOGA1(" return ret=%d\n", ret); + TCDEBUGCLOSE(); + return ret; +} + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeGetTypeOfConnection + * Signature: (J[Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeGetTypeOfConnection + (JNIEnv *env, jobject pThis, jlong inIndex, jobjectArray outType) +{ + long ret = TCAPI_ERR_NONE; + + TCDEBUGOPEN(); + gManager->m_Server->WaitforServerPipeAccess(); + + TCDEBUGLOGS("nativeGetTypeOfConnection\n"); + ServerCommandData cmdrsp; + pServerCommandData pCmdrsp = &cmdrsp; + pCmdrsp->command = eCmdGetConnectionType; + pCmdrsp->index = inIndex; + + BOOL sent = gManager->m_Server->SendCommand(pCmdrsp); + + BOOL recd = gManager->m_Server->GetResponse(pCmdrsp); + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + } + else + { + env->SetObjectArrayElement(outType, 0, env->NewStringUTF(pCmdrsp->connectSettings.connectType)); + } + + + gManager->m_Server->ReleaseServerPipeAccess(); + + TCDEBUGLOGA1(" return ret=%d\n", ret); + TCDEBUGCLOSE(); + + return ret; +} + + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeGetConnectionSettings + * Signature: (J[Ljava/lang/String;[J[Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeGetConnectionSettings + (JNIEnv *env, jobject pThis, jlong inIndex, jobjectArray outType, jlongArray outOptions, jobjectArray outSettings) +{ + long ret = TCAPI_ERR_FEATURE_NOT_IMPLEMENTED; + + TCDEBUGOPEN(); + gManager->m_Server->WaitforServerPipeAccess(); + + TCDEBUGLOGS("nativeGetConnectionSettings\n"); + ServerCommandData cmdrsp; + pServerCommandData pCmdrsp = &cmdrsp; + pCmdrsp->command = eCmdGetConnection; + pCmdrsp->index = inIndex; + + BOOL sent = gManager->m_Server->SendCommand(pCmdrsp); + + BOOL recd = gManager->m_Server->GetResponse(pCmdrsp); + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + } + else + { + env->SetObjectArrayElement(outType, 0, env->NewStringUTF(pCmdrsp->connectSettings.connectType)); + if (strcmp(pCmdrsp->connectSettings.connectType, "musti") == 0 || strcmp(pCmdrsp->connectSettings.connectType, "platsim") == 0) + { + env->SetObjectArrayElement(outSettings, 0, env->NewStringUTF(pCmdrsp->connectSettings.tcpSettings.ipAddress)); + env->SetObjectArrayElement(outSettings, 1, env->NewStringUTF(pCmdrsp->connectSettings.tcpSettings.ipPort)); + char *pChan = NULL; + if (pCmdrsp->connectSettings.traceBoxChannel == 1) + pChan = "1"; + else + pChan = "2"; + env->SetObjectArrayElement(outSettings, 2, env->NewStringUTF(pChan)); + env->SetObjectArrayElement(outSettings, 3, env->NewStringUTF(pCmdrsp->connectSettings.decodeFormat)); + } + else if (strcmp(pCmdrsp->connectSettings.connectType, "tcp") == 0) + { + env->SetObjectArrayElement(outSettings, 0, env->NewStringUTF(pCmdrsp->connectSettings.tcpSettings.ipAddress)); + env->SetObjectArrayElement(outSettings, 1, env->NewStringUTF(pCmdrsp->connectSettings.tcpSettings.ipPort)); + env->SetObjectArrayElement(outSettings, 2, env->NewStringUTF(pCmdrsp->connectSettings.decodeFormat)); + } + else if (strcmp(pCmdrsp->connectSettings.connectType, "virtualserial") == 0) + { + env->SetObjectArrayElement(outSettings, 0, env->NewStringUTF(pCmdrsp->connectSettings.virtualSerialSettings.comPort)); + env->SetObjectArrayElement(outSettings, 1, env->NewStringUTF(pCmdrsp->connectSettings.decodeFormat)); + } + else if (strcmp(pCmdrsp->connectSettings.connectType, "serial") == 0) + { + env->SetObjectArrayElement(outSettings, 0, env->NewStringUTF(pCmdrsp->connectSettings.realSerialSettings.comPort)); + + char baud[10], databits[10], parity[10], stopbits[10], flowcontrol[15]; + ConvertRealSerialSettingsToHost(baud, databits, parity, stopbits, flowcontrol, &pCmdrsp->connectSettings.realSerialSettings); + env->SetObjectArrayElement(outSettings, 1, env->NewStringUTF(baud)); + env->SetObjectArrayElement(outSettings, 2, env->NewStringUTF(databits)); + env->SetObjectArrayElement(outSettings, 3, env->NewStringUTF(parity)); + env->SetObjectArrayElement(outSettings, 4, env->NewStringUTF(stopbits)); + env->SetObjectArrayElement(outSettings, 5, env->NewStringUTF(flowcontrol)); + env->SetObjectArrayElement(outSettings, 6, env->NewStringUTF(pCmdrsp->connectSettings.decodeFormat)); + } + else if (strcmp(pCmdrsp->connectSettings.connectType, "usb") == 0) + { + env->SetObjectArrayElement(outSettings, 0, env->NewStringUTF(pCmdrsp->connectSettings.usbSettings.device)); + } + jlong jRetryInterval = pCmdrsp->connectSettings.retryInterval; + env->SetLongArrayRegion(outOptions, 0, 1, &jRetryInterval); + jlong jRetryTimeout = pCmdrsp->connectSettings.retryTimeout; + env->SetLongArrayRegion(outOptions, 1, 1, &jRetryTimeout); + } + + gManager->m_Server->ReleaseServerPipeAccess(); + + TCDEBUGLOGA1(" return ret=%d\n", ret); + TCDEBUGCLOSE(); + return ret; +} + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativePollError + * Signature: (J[I[Z[J)Z + */ +JNIEXPORT jboolean JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativePollError + (JNIEnv *env, jobject pThis, jlong inClientId, jintArray outErrorCode, + jbooleanArray outHasOSErrorCode, jlongArray outOSErrorCode) +{ + jboolean foundError = false; + long id = inClientId; + LONG tcfError = TCAPI_ERR_NONE; + + TCDEBUGOPEN(); + TCDEBUGLOGS("nativePollError\n"); +// TCDEBUGLOGA1(" inClientId=%d\n", inClientId); + + gManager->WaitForErrorMonitorListAccess(); + + if (gManager->ErrorMonitorListSize() > 0) + { +// TCDEBUGLOGA1(" size of gManager->ErrorMonitorListSize=%d\n", gManager->ErrorMonitorListSize()); + + CErrorMonitor* errorMonitor = gManager->FindErrorMonitor(id); +// TCDEBUGLOGA1(" errorMonitor = %x\n", errorMonitor); + + if (errorMonitor != NULL) + { +// TCDEBUGLOGS(" found client\n"); + + BOOL osErrorUsed = FALSE; + DWORD osError = 0; + BOOL found = errorMonitor->GetError(&tcfError, &osErrorUsed, &osError); + if (found) + { +// TCDEBUGLOGA1("nativePollError error for client=%d\n", inClientId); +// TCDEBUGLOGA3(" found tcfError=%d, osErrorUsed=%d, osError=%d\n", +// tcfError, osErrorUsed, osError); + + foundError = true; + jint jval = tcfError; + env->SetIntArrayRegion(outErrorCode, 0, 1, &jval); + jboolean jos = osErrorUsed; + env->SetBooleanArrayRegion(outHasOSErrorCode, 0, 1, &jos); + jlong jlval = osError; + env->SetLongArrayRegion(outOSErrorCode, 0, 1, &jlval); + +// TCDEBUGOPEN(); +// TCDEBUGLOGS("nativePollError found error\n"); +// TCDEBUGCLOSE(); + } + } + } + gManager->ReleaseErrorMonitorListAccess(); + + TCDEBUGLOGA2(" return foundError=%d tcfError=%d\n", foundError, tcfError); + + TCDEBUGCLOSE(); + return foundError; +} + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeGetNumberVersionEntities + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeGetNumberVersionEntities + (JNIEnv *env, jobject pThis, jlong inClientId) +{ + long number = 0; + long id = inClientId; + + TCDEBUGOPEN(); + TCDEBUGLOGS("nativeGetNumberVersionEntities\n"); + TCDEBUGLOGA1(" inClientId=%d\n", inClientId); + + gManager->m_Server->WaitforServerPipeAccess(); + + // eCmdGetNumberVersions + ServerCommandData cmdrsp; + pServerCommandData pCmdrsp = &cmdrsp; + pCmdrsp->command = eCmdGetNumberVersions; + pCmdrsp->clientId = id; + + BOOL sent = gManager->m_Server->SendCommand(pCmdrsp); + + BOOL recd = gManager->m_Server->GetResponse(pCmdrsp); + if (pCmdrsp->response == eRspError) + { + } + else + { + number = pCmdrsp->number + 1; // + 1 for DLL version + } + + gManager->m_Server->ReleaseServerPipeAccess(); + + TCDEBUGLOGA1(" numberVersions = %d\n", number); + TCDEBUGCLOSE(); + return number; +} + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeGetVersion + * Signature: (JJ[Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeGetVersion + (JNIEnv *env, jobject pThis, jlong inClientId, jlong inNumToGet, jobjectArray outVersion) +{ + long ret = TCAPI_ERR_NONE; + long id = inClientId; + + TCDEBUGOPEN(); + TCDEBUGLOGS("nativeGetVersion\n"); + TCDEBUGLOGA1(" inClientId=%d\n", inClientId); + + gManager->m_Server->WaitforServerPipeAccess(); + + // eCmdGetVersion + ServerCommandData cmdrsp; + pServerCommandData pCmdrsp = &cmdrsp; + pCmdrsp->command = eCmdGetVersion; + pCmdrsp->clientId = id; + + + // index = 0 ==> TCFClient.dll version + env->SetObjectArrayElement(outVersion, 0, env->NewStringUTF(gManager->m_Version)); + long numberGot = 1; + + if (inNumToGet > 0) + { + // index = 1 ==> TCFServer.exe version + pCmdrsp->command = eCmdGetVersion; + pCmdrsp->clientId = id; + pCmdrsp->index = 1; + BOOL sent = gManager->m_Server->SendCommand(pCmdrsp); + BOOL recd = gManager->m_Server->GetResponse(pCmdrsp); + if (pCmdrsp->response == eRspOK) + { + env->SetObjectArrayElement(outVersion, 1, env->NewStringUTF(pCmdrsp->version)); + numberGot++; + + if (inNumToGet > 1) + { + // index = 2 ==> connection version + pCmdrsp->command = eCmdGetVersion; + pCmdrsp->clientId = id; + pCmdrsp->index = 2; + BOOL sent = gManager->m_Server->SendCommand(pCmdrsp); + BOOL recd = gManager->m_Server->GetResponse(pCmdrsp); + if (pCmdrsp->response == eRspOK) + { + env->SetObjectArrayElement(outVersion, 2, env->NewStringUTF(pCmdrsp->version)); + numberGot++; + } + } + } + } + + gManager->m_Server->ReleaseServerPipeAccess(); + + TCDEBUGLOGA1(" return numberGot=%d\n", numberGot); + TCDEBUGCLOSE(); + return numberGot; +} + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativePollInputStream + * Signature: (J[J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativePollInputStream + (JNIEnv *env, jobject pThis, jlong inClientId, jlongArray outNumberMessages) +{ + long ret = TCAPI_ERR_NONE; + long number = 0; + long id = inClientId; + + TCDEBUGOPEN(); + TCDEBUGLOGS("nativePollInputStream\n"); + TCDEBUGLOGA1(" inClientId=%d\n", inClientId); + + TCDEBUGLOGS(" TODO: get number from client's input stream\n"); + + gManager->WaitForStreamListAccess(); + + CInputStream* inputStream = gManager->FindInputStream(id); + + if (inputStream != NULL) + { + TCDEBUGLOGA1(" -- found id inputStream=%x\n", inputStream); + number = inputStream->GetNumberMessages(); + } + + gManager->ReleaseStreamListAccess(); + jlong jNumber = number; + env->SetLongArrayRegion(outNumberMessages, 0, 1, &jNumber); + + TCDEBUGLOGA2(" numberMessages=%d ret=%d\n", number, ret); + + TCDEBUGCLOSE(); + return ret; +} +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativePollInputStream2 + * Signature: (JJ[J[J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativePollInputStream2 + (JNIEnv *env, jobject pThis, jlong inClientId, jlong inNumberMessagesToPeek, jlongArray outNumberMessagesPeeked, jlongArray outNumberBytesPeeked) +{ + long ret = TCAPI_ERR_NONE; + long id = inClientId; + long numberToGet = inNumberMessagesToPeek; + long numberStored = 0; + DWORD numberBytes = 0; + + TCDEBUGOPEN(); + TCDEBUGLOGS("nativePollInputStream2\n"); + TCDEBUGLOGA1(" inClientId=%d\n", inClientId); + + gManager->WaitForStreamListAccess(); + + CInputStream* inputStream = gManager->FindInputStream(id); + + if (inputStream != NULL) + { + TCDEBUGLOGA1(" -- found id inputStream=%x\n", inputStream); + numberStored = inputStream->GetNumberMessages(); + + if ((numberToGet == 0) || (numberToGet > numberStored)) + { + numberToGet = numberStored; + } + if (numberToGet > 0) + { + inputStream->GetTotalMessageSize(numberToGet, numberBytes); + } + } + + gManager->ReleaseStreamListAccess(); + + jlong jNumber = numberToGet; + env->SetLongArrayRegion(outNumberMessagesPeeked, 0, 1, &jNumber); + jNumber = numberBytes; + env->SetLongArrayRegion(outNumberBytesPeeked, 0, 1, &jNumber); + + TCDEBUGLOGA3(" numberMessages=%d numberBytes=%d ret=%d\n", numberToGet, numberBytes, ret); + + TCDEBUGCLOSE(); + return ret; +} + + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeGetInputStreamMessageBytes + * Signature: (JJ[J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeGetInputStreamMessageBytes + (JNIEnv *env, jobject pThis, jlong inClientId, jlong inNumberMessages, jlongArray outMessageSizes) +{ + long ret = TCAPI_ERR_NONE; + long id = inClientId; + long numberToGet = inNumberMessages; + + TCDEBUGOPEN(); + TCDEBUGLOGS("nativeGetInputStreamMessageBytes\n"); + TCDEBUGLOGA1(" inClientId=%d\n", inClientId); + + gManager->WaitForStreamListAccess(); + + CInputStream* inputStream = gManager->FindInputStream(id); + + if (inputStream != NULL) + { + TCDEBUGLOGA1(" -- found id inputStream=%x\n", inputStream); + DWORD* pSizes = new DWORD[numberToGet]; + inputStream->GetMessageSizes(numberToGet, pSizes); + for (int i = 0; i < numberToGet; i++) + { + TCDEBUGLOGA2(" -- message size[%d] = %d\n", i, pSizes[i]); + jlong jsize = pSizes[i]; + env->SetLongArrayRegion(outMessageSizes, i, 1, &jsize); + } + delete[] pSizes; + } + + gManager->ReleaseStreamListAccess(); + + TCDEBUGLOGA1("nativeGetInputStreamMessageBytes ret=%d\n", ret); + + TCDEBUGCLOSE(); + + return ret; +} +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeReadInputStream + * Signature: (JJ[J[JJ[B)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeReadInputStream + (JNIEnv *env, jobject pThis, jlong inClientId, jlong inNumberMessages, jlongArray outNumberMessages, jlongArray outNumberBytesRead, jlong inNumberMaxBytes, jbyteArray outMessageData) +{ + long ret = TCAPI_ERR_NONE; + long id = inClientId; + long numberToGet = inNumberMessages; + long numberMaxBytes = inNumberMaxBytes; + + TCDEBUGOPEN(); + TCDEBUGLOGS("nativeReadInputStream start\n"); + TCDEBUGLOGA1(" inClientId=%d\n", inClientId); + + gManager->WaitForStreamListAccess(); + + CInputStream* inputStream = gManager->FindInputStream(id); + if (inputStream != NULL) + { + long numberBytesRead = 0; + long numberMessagesRead = 0; +#if (0) + DWORD mSize = 0; + DWORD outOffset = 0; + BYTE* pData = new BYTE[64*1024]; + for (int i = 0; i < numberToGet; i++) + { + TCDEBUGLOGS("nativeReadInputStream 1\n"); + mSize = inputStream->GetNextMessageSize(); + if ((numberBytesRead + mSize) > numberMaxBytes) + break; + if (mSize != 0) + { + mSize = inputStream->GetNextMessage(mSize, pData); + TCDEBUGLOGA3("outOffset = %d mSize = %d pData[0] = %02.2x\n", outOffset, mSize, pData[0]); + jbyte* pByte = (jbyte*)pData; + env->SetByteArrayRegion(outMessageData, outOffset, mSize, pByte); + outOffset += mSize; + numberBytesRead += mSize; + numberMessagesRead++; + + if ((i % 500) == 0) + Sleep(1); + } + } + delete [] pData; +#endif + numberMessagesRead = inputStream->GetMessages(env, numberToGet, numberMaxBytes, numberBytesRead, numberMessagesRead, outMessageData); + jlong jMsgs = numberMessagesRead; + env->SetLongArrayRegion(outNumberMessages, 0, 1, &jMsgs); + jlong jNum = numberBytesRead; + env->SetLongArrayRegion(outNumberBytesRead, 0, 1, &jNum); + + TCDEBUGLOGS("nativeReadInputStream 2\n"); + } + + gManager->ReleaseStreamListAccess(); + + TCDEBUGLOGA1(" return ret=%d\n", ret); + TCDEBUGCLOSE(); + return ret; +} + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeOpenInputStream + * Signature: (JLjava/lang/String;JZ)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeOpenInputStream + (JNIEnv *env, jobject pThis, jlong inClientId, jstring inFileBaseName, jlong inStreamSize, jboolean inOverflowToFile) +{ + long ret = TCAPI_ERR_NONE; + + TCDEBUGOPEN(); + TCDEBUGLOGS("nativeOpenInputStream\n"); + TCDEBUGLOGA1(" inClientId=%d\n", inClientId); + TCDEBUGLOGA1(" inFileBaseName=%x\n", inFileBaseName); + TCDEBUGLOGA1(" inStreamSize=%d\n", inStreamSize); + TCDEBUGLOGA1(" inOverflowToFile=%d\n", inOverflowToFile); + + gManager->m_Server->WaitforServerPipeAccess(); + gManager->WaitForStreamListAccess(); + + char* pFileName = NULL; + + if (inFileBaseName != NULL) + { + TCDEBUGLOGS("nativeOpenInputStream GetStringUTFChars on inFileBaseName\n"); + jboolean isCopy=FALSE; + pFileName = (char*)env->GetStringUTFChars(inFileBaseName, &isCopy); + TCDEBUGLOGS("nativeOpenInputStream return GetStringUTFChars\n"); + TCDEBUGLOGA1(" pFileName=%x\n", pFileName); +// if (pFileName != NULL) +// { +// TCDEBUGLOGA1(" pFileName=%s\n", pFileName); +// } + } + else + { + TCDEBUGLOGS("nativeOpenInputStream inFileBaseName == NULL\n"); + } + + + TCDEBUGLOGS("nativeOpenInputStream continue after GetStringUTFChars\n"); + DWORD streamSize = inStreamSize; + TCDEBUGLOGA1(" streamSize=%d\n", streamSize); + + BOOL overflowOption = FALSE; + TCDEBUGLOGA1(" overflowOption=%d\n", overflowOption); + + long id = inClientId; + + TCDEBUGLOGA1(" gManager->InputStreamListSize=%d\n", gManager->InputStreamListSize()); + + // create stream + CInputStream* stream = new CInputStream(pFileName, streamSize, overflowOption, id); + stream->CreateStream(); + gManager->AddInputStream(stream); + + ServerCommandData cmdrsp; pServerCommandData pCmdrsp = &cmdrsp; + pCmdrsp->command = eCmdOpenStream; + pCmdrsp->clientId = id; + pCmdrsp->destinationOptions.destination = eDestinationInputStream; + pCmdrsp->destinationOptions.streamSize = streamSize; + pCmdrsp->destinationOptions.overFlowToFile = FALSE; + if (pFileName != NULL) + { + strncpy(pCmdrsp->destinationOptions.destinationFile, pFileName, MAX_FILEPATH); + } + else + { + pCmdrsp->destinationOptions.destinationFile[0] = NULL; + } + if (inFileBaseName != NULL) + { + TCDEBUGLOGS("nativeOpenInputStream ReleaseStringUTFChars on inFileBaseName\n"); + env->ReleaseStringUTFChars(inFileBaseName, pFileName); + } + + gManager->m_Server->SendCommand(pCmdrsp); + gManager->m_Server->GetResponse(pCmdrsp); + + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + } + + TCDEBUGLOGA1(" gManager->InputStreamListSize=%d\n", gManager->InputStreamListSize()); + + gManager->ReleaseStreamListAccess(); + + gManager->m_Server->ReleaseServerPipeAccess(); + + TCDEBUGLOGA1(" return ret=%d\n", ret); + TCDEBUGCLOSE(); + + return ret; +} + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeCloseInputStream + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeCloseInputStream + (JNIEnv *env, jobject pThis, jlong inClientId) +{ + long ret = TCAPI_ERR_NONE; + + TCDEBUGOPEN(); + TCDEBUGLOGS("nativeCloseInputStream\n"); + TCDEBUGLOGA1(" inClientId=%d\n", inClientId); + + gManager->m_Server->WaitforServerPipeAccess(); + gManager->WaitForStreamListAccess(); + + long id = inClientId; + + TCDEBUGLOGA1(" gManager->InputStreamListSize=%d\n", gManager->InputStreamListSize()); + + TCDEBUGLOGS(" TODO: tell server to close this stream\n"); + + ServerCommandData cmdrsp; pServerCommandData pCmdrsp = &cmdrsp; + pCmdrsp->command = eCmdCloseStream; + pCmdrsp->clientId = id; + + gManager->m_Server->SendCommand(pCmdrsp); + gManager->m_Server->GetResponse(pCmdrsp); + + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + } + + CInputStream* inputStream = gManager->FindInputStream(id); + if (inputStream != NULL) + { + TCDEBUGLOGA1(" -- found id inputStream=%x\n", inputStream); + gManager->RemoveInputStream(inputStream); + delete inputStream; + } + + TCDEBUGLOGA1(" gManager->InputStreamListSize=%d\n", gManager->InputStreamListSize()); + gManager->ReleaseStreamListAccess(); + + gManager->m_Server->ReleaseServerPipeAccess(); + + TCDEBUGLOGA1(" return ret=%d\n", ret); + TCDEBUGCLOSE(); + return ret; +} + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeSetMessageIds + * Signature: (J[B)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeSetMessageIds + (JNIEnv *env, jobject pThis, jlong inClientId, jbyteArray inIds) +{ + long ret = TCAPI_ERR_NONE; + + TCDEBUGOPEN(); + TCDEBUGLOGS("nativeSetMessageIds\n"); + TCDEBUGLOGA1(" inClientId=%d\n", inClientId); + + gManager->m_Server->WaitforServerPipeAccess(); + + ServerCommandData cmdrsp; pServerCommandData pCmdrsp = &cmdrsp; + + pCmdrsp->command = eCmdSetMessageIds; + pCmdrsp->clientId = inClientId; + jsize numberIds = env->GetArrayLength(inIds); + pCmdrsp->number = numberIds; + jboolean isCopy = FALSE; + jbyte* bytes = env->GetByteArrayElements(inIds, &isCopy); + for (int i = 0; i < numberIds; i++) + { + pCmdrsp->messageIds[i] = bytes[i]; + TCDEBUGLOGA1(" -- msgId = 0x%02.2X\n", pCmdrsp->messageIds[i]); + } + env->ReleaseByteArrayElements(inIds, bytes, 0); + gManager->m_Server->SendCommand(pCmdrsp); + gManager->m_Server->GetResponse(pCmdrsp); + + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + } + + gManager->m_Server->ReleaseServerPipeAccess(); + + TCDEBUGLOGA1(" return ret=%d\n", ret); + TCDEBUGCLOSE(); + return ret; +} + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeClearFile + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeClearFile + (JNIEnv *env, jobject pThis, jlong inClientId) +{ + long ret = TCAPI_ERR_NONE; + gManager->m_Server->WaitforServerPipeAccess(); + + long id = inClientId; + + ServerCommandData cmdrsp; + pServerCommandData pCmdrsp = &cmdrsp; + pCmdrsp->command = eCmdClearMessageFile; + pCmdrsp->clientId = id; + + gManager->m_Server->SendCommand(pCmdrsp); + gManager->m_Server->GetResponse(pCmdrsp); + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + } + gManager->m_Server->ReleaseServerPipeAccess(); + + return ret; +} + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeSendMessage + * Signature: (J[J[Ljava/lang/String;[B)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeSendMessage + (JNIEnv *env, jobject pThis, jlong inClientId, jlongArray inFormattingOptions, jobjectArray inSettings, jbyteArray inMessage) +{ + long ret = TCAPI_ERR_NONE; + unsigned long osError = 0; + + TCDEBUGOPEN(); + TCDEBUGLOGS("nativeSendMessage\n"); + TCDEBUGLOGA1(" inClientId=%d\n", inClientId); + + gManager->m_Server->WaitforServerPipeAccess(); + + jboolean isCopy = false; + // formatting options + jlong* pOptions = env->GetLongArrayElements(inFormattingOptions, &isCopy); +// long encodeFormat = (long)pOptions[0]; // not used + long encodeOption = (long)pOptions[1]; // formatting option for protocol + long protocolVersion = (long)pOptions[2]; // OST version byte to use if protocol is OST + BYTE myId = (BYTE)(pOptions[3] & 0xff); // my message ID to use of adding protocol + BOOL useMyId = (pOptions[4] == 1) ? TRUE : FALSE; // use my ID or not + env->ReleaseLongArrayElements(inFormattingOptions, pOptions, 0); + + jstring decodeString = (jstring)env->GetObjectArrayElement(inSettings, 0); + const char* pDecode = env->GetStringUTFChars(decodeString, NULL); // not used + env->ReleaseStringUTFChars(decodeString, pDecode); + + jsize numberBytes = 0; + if (inMessage != NULL) + numberBytes = env->GetArrayLength(inMessage); + long inLength = numberBytes; // this can be null + + jbyte* inData = NULL; + if (inLength > 0) + inData = env->GetByteArrayElements(inMessage, &isCopy); + + ServerCommandData cmdrsp; pServerCommandData pCmdrsp = &cmdrsp; + + pCmdrsp->command = eCmdSendMessage; + pCmdrsp->clientId = inClientId; + pCmdrsp->encodeOption = encodeOption; + pCmdrsp->useMyId = useMyId; + pCmdrsp->myId = myId; + pCmdrsp->protocolVersion = protocolVersion & 0xff; + + // send message to server + pCmdrsp->osError = 0; + gManager->m_Server->SendCommand(pCmdrsp, inLength, (BYTE*)inData); + + TCDEBUGLOGS(" nativeSendMessage GetResponse\n"); + + // get response from server + gManager->m_Server->GetResponse(pCmdrsp); + + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + osError = pCmdrsp->osError; + } + if (inData != NULL) + env->ReleaseByteArrayElements(inMessage, inData, 0); + + gManager->m_Server->ReleaseServerPipeAccess(); + + TCDEBUGLOGA3("nativeSendMessage return ret=%d, osError=%d : %s\n", ret, osError, GetErrorText(osError)); + TCDEBUGCLOSE(); + + if (ret == TCAPI_ERR_COMM_ERROR && osError > 0) + { + jclass clazz = env->FindClass("Ljava/lang/Exception;"); + env->ThrowNew(clazz, GetErrorText(osError)); + } + return ret; +} + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeStart + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeStart + (JNIEnv *env, jobject pThis, jlong inClientId) +{ + long ret = TCAPI_ERR_NONE; + + TCDEBUGOPEN(); + TCDEBUGLOGS("nativeStart\n"); + TCDEBUGLOGA1(" inClientId=%d\n", inClientId); + + gManager->m_Server->WaitforServerPipeAccess(); + + TCDEBUGLOGS(" TODO: tell server to start this client\n"); + ServerCommandData cmdrsp; pServerCommandData pCmdrsp = &cmdrsp; + + pCmdrsp->command = eCmdStart; + pCmdrsp->clientId = inClientId; + + gManager->m_Server->SendCommand(pCmdrsp); + + gManager->m_Server->GetResponse(pCmdrsp); + + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + } + gManager->m_Server->ReleaseServerPipeAccess(); + + TCDEBUGLOGA1(" return ret=%d\n", ret); + TCDEBUGCLOSE(); + return ret; +} + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeStop + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeStop + (JNIEnv *env, jobject pThis, jlong inClientId) +{ + long ret = TCAPI_ERR_NONE; + + TCDEBUGOPEN(); + TCDEBUGLOGS("nativeStop\n"); + TCDEBUGLOGA1(" inClientId=%d\n", inClientId); + + gManager->m_Server->WaitforServerPipeAccess(); + + TCDEBUGLOGS(" TODO: tell server to stop this client\n"); + ServerCommandData cmdrsp; pServerCommandData pCmdrsp = &cmdrsp; + + pCmdrsp->command = eCmdStop; + pCmdrsp->clientId = inClientId; + + gManager->m_Server->SendCommand(pCmdrsp); + + gManager->m_Server->GetResponse(pCmdrsp); + + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + } + + gManager->m_Server->ReleaseServerPipeAccess(); + + TCDEBUGLOGA1(" return ret=%d\n", ret); + TCDEBUGCLOSE(); + return ret; +} + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeTestConnection + * Signature: (I[J[Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeTestConnection__I_3J_3Ljava_lang_String_2 + (JNIEnv *env, jobject pThis, jint inType, jlongArray inOptions, jobjectArray inSettings) +{ + long ret = TCAPI_ERR_FEATURE_NOT_IMPLEMENTED; + + TCDEBUGOPEN(); + TCDEBUGLOGS("nativeTestConnection\n"); + + gManager->m_Server->WaitforServerPipeAccess(); + + TCDEBUGLOGS(" TODO: ask server to test this connection\n"); + + gManager->m_Server->ReleaseServerPipeAccess(); + + TCDEBUGLOGA1(" return ret=%d\n", ret); + TCDEBUGCLOSE(); + + return ret; +} + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeTestConnection + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeTestConnection__J + (JNIEnv *env, jobject pThis, jlong inClientId) +{ + long ret = TCAPI_ERR_FEATURE_NOT_IMPLEMENTED; + + TCDEBUGOPEN(); + TCDEBUGLOGS("nativeTestConnection\n"); + TCDEBUGLOGA1(" inClientId=%d\n", inClientId); + + gManager->m_Server->WaitforServerPipeAccess(); + + TCDEBUGLOGS(" TODO: ask server to test this client's connection\n"); + + gManager->m_Server->ReleaseServerPipeAccess(); + + TCDEBUGLOGA1(" return ret=%d\n", ret); + TCDEBUGCLOSE(); + + return ret; +} +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeStartServer + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeStartServer + (JNIEnv *env, jobject pThis) +{ + long ret = TCAPI_ERR_NONE; + + TCDEBUGOPEN(); + TCDEBUGLOGS("nativeStartServer\n"); + + gManager->m_Server->WaitforServerPipeAccess(); + + ret = gManager->StartServer(); + + gManager->m_Server->ReleaseServerPipeAccess(); + + TCDEBUGLOGA1(" return ret=%d\n", ret); + TCDEBUGCLOSE(); + + return ret; +} + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeStopServer + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeStopServer + (JNIEnv *env, jobject pThis) +{ + long ret = TCAPI_ERR_NONE; + + TCDEBUGOPEN(); + TCDEBUGLOGS("nativeStopServer\n"); + + gManager->m_Server->WaitforServerPipeAccess(); + + ret = gManager->StopServer(); + + gManager->m_Server->ReleaseServerPipeAccess(); + + TCDEBUGLOGA1(" return ret=%d\n", ret); + TCDEBUGCLOSE(); + + return ret; +} + +void ConvertRealSerialSettingsToServer(const char* pBaud, const char* pDataBits, const char* pParity, const char* pStopBits, const char* pFlowControl, pRealSerialConnectData pData) +{ + // no error checking - all error checking is done at the Java level + pData->baudRate = atol(pBaud); + pData->dataBits = atol(pDataBits); + + pData->parity = eParityNone; + if (strcmp(pParity, "odd") == 0) + { + pData->parity = eParityOdd; + } + else if (strcmp(pParity, "even") == 0) + { + pData->parity = eParityEven; + } + + pData->stopBits = eStopBits1; + if (strcmp(pStopBits, "1.5") == 0) + { + pData->stopBits = eStopBits15; + } + else if (strcmp(pStopBits, "2") == 0) + { + pData->stopBits = eStopBits2; + } + + pData->flowControl = eFlowControlNone; + if (strcmp(pFlowControl, "software") == 0) + { + pData->flowControl = eFlowControlSW; + } + else if (strcmp(pFlowControl, "hardware") == 0) + { + pData->flowControl = eFlowControlHW; + } +} +void ConvertRealSerialSettingsToHost(char* pBaud, char* pDataBits, char* pParity, char* pStopBits, char* pFlowControl, pRealSerialConnectData pData) +{ + sprintf(pBaud, "%ld", pData->baudRate); + sprintf(pDataBits, "%ld", pData->dataBits); + + switch (pData->parity) + { + default: + case eParityNone: + strcpy(pParity, "none"); + break; + case eParityEven: + strcpy(pParity, "even"); + break; + case eParityOdd: + strcpy(pParity, "odd"); + break; + } + + switch (pData->stopBits) + { + default: + case eStopBits1: + strcpy(pStopBits, "1"); + break; + case eStopBits15: + strcpy(pStopBits, "1.5"); + break; + case eStopBits2: + strcpy(pStopBits, "2"); + break; + } + + switch (pData->flowControl) + { + default: + case eFlowControlNone: + strcpy(pFlowControl, "none"); + break; + case eFlowControlHW: + strcpy(pFlowControl, "hardware"); + break; + case eFlowControlSW: + strcpy(pFlowControl, "software"); + break; + } +} + +#ifdef _DEBUG +void OpenLogFile1(char* filename) +{ + if (fLog1 == NULL) + fLog1 = _fsopen(filename, "at", _SH_DENYNO); +} + +void CloseLogFile1() +{ + if (fLog1 != NULL) + { + fclose(fLog1); + fLog1 = NULL; + } +} +void OpenLogFile2(char* filename) +{ + if (fLog2 == NULL) + fLog2 = _fsopen(filename, "at", _SH_DENYNO); +} + +void CloseLogFile2() +{ + if (fLog2 != NULL) + { + fclose(fLog2); + fLog2 = NULL; + } +} +void LogTime(FILE* f) +{ + SYSTEMTIME sTime; + GetLocalTime(&sTime); + if (f) + fprintf(f, "%02.2d%02.2d-%02.2d:%02.2d:%02.2d.%03.3d: ", sTime.wDay, sTime.wMonth, sTime.wHour, sTime.wMinute, sTime.wSecond, sTime.wMilliseconds); +} +#endif + +static const char* GetErrorText(unsigned long error) +{ + if (error == ERROR_FILE_NOT_FOUND) + return "Could not open the device\n"; + + else if (error == ERROR_ACCESS_DENIED) + return "The device is currently in use\n"; + + static char msg[256]; + FormatMessage( + FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + error, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &msg, + sizeof(msg) - 1, + NULL); + + return msg; +} diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCAPIConnectionJni.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCAPIConnectionJni.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,213 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_nokia_tcf_impl_TCAPIConnection */ + +#ifndef _Included_com_nokia_tcf_impl_TCAPIConnection +#define _Included_com_nokia_tcf_impl_TCAPIConnection +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeConnect + * Signature: (Ljava/lang/String;[J[Ljava/lang/String;[JLjava/lang/String;[J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeConnect + (JNIEnv *, jobject, jstring, jlongArray, jobjectArray, jlongArray, jstring, jlongArray); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeDisconnect + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeDisconnect + (JNIEnv *, jobject, jlong); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeGetNumberConnections + * Signature: ([J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeGetNumberConnections + (JNIEnv *, jobject, jlongArray); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeGetTypeOfConnection + * Signature: (J[Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeGetTypeOfConnection + (JNIEnv *, jobject, jlong, jobjectArray); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeGetConnectionSettings + * Signature: (J[Ljava/lang/String;[J[Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeGetConnectionSettings + (JNIEnv *, jobject, jlong, jobjectArray, jlongArray, jobjectArray); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativePollError + * Signature: (J[I[Z[J)Z + */ +JNIEXPORT jboolean JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativePollError + (JNIEnv *, jobject, jlong, jintArray, jbooleanArray, jlongArray); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeGetNumberVersionEntities + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeGetNumberVersionEntities + (JNIEnv *, jobject, jlong); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeGetVersion + * Signature: (JJ[Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeGetVersion + (JNIEnv *, jobject, jlong, jlong, jobjectArray); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativePollInputStream + * Signature: (J[J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativePollInputStream + (JNIEnv *, jobject, jlong, jlongArray); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativePollInputStream2 + * Signature: (JJ[J[J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativePollInputStream2 + (JNIEnv *, jobject, jlong, jlong, jlongArray, jlongArray); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeGetInputStreamMessageBytes + * Signature: (JJ[J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeGetInputStreamMessageBytes + (JNIEnv *, jobject, jlong, jlong, jlongArray); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeReadInputStream + * Signature: (JJ[J[JJ[B)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeReadInputStream + (JNIEnv *, jobject, jlong, jlong, jlongArray, jlongArray, jlong, jbyteArray); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeOpenInputStream + * Signature: (JLjava/lang/String;JZ)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeOpenInputStream + (JNIEnv *, jobject, jlong, jstring, jlong, jboolean); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeCloseInputStream + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeCloseInputStream + (JNIEnv *, jobject, jlong); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeClearFile + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeClearFile + (JNIEnv *, jobject, jlong); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeSendMessage + * Signature: (J[J[Ljava/lang/String;[B)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeSendMessage + (JNIEnv *, jobject, jlong, jlongArray, jobjectArray, jbyteArray); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeSetMessageIds + * Signature: (J[B)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeSetMessageIds + (JNIEnv *, jobject, jlong, jbyteArray); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeStart + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeStart + (JNIEnv *, jobject, jlong); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeStop + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeStop + (JNIEnv *, jobject, jlong); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeTestConnection + * Signature: (Ljava/lang/String;[J[Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeTestConnection__Ljava_lang_String_2_3J_3Ljava_lang_String_2 + (JNIEnv *, jobject, jstring, jlongArray, jobjectArray); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeTestConnection + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeTestConnection__J + (JNIEnv *, jobject, jlong); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeStartServer + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeStartServer + (JNIEnv *, jobject); + +/* + * Class: com_nokia_tcf_impl_TCAPIConnection + * Method: nativeStopServer + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_nokia_tcf_impl_TCAPIConnection_nativeStopServer + (JNIEnv *, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCFClient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCFClient.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// TCFClient.cpp : Defines the entry point for the DLL application. +// + +#include "stdafx.h" +#include +#include +#include "ClientManager.h" +#include "ServerClient.h" +#include "InputStream.h" +#include "ErrorMonitorData.h" +#include "TCDebugLog.h" +#include + +// process wide data +CClientManager* gManager; +#ifdef _DEBUG +BOOL gDoLogging = FALSE; +#endif + +#ifdef _DEBUG +static void LogTime(FILE* f); +#endif + + +BOOL APIENTRY DllMain( HINSTANCE hinstDLL, + DWORD fdwReason, + LPVOID lpReserved + ) +{ + // Perform actions based on the reason for calling. + switch( fdwReason ) + { + case DLL_PROCESS_ATTACH: + { + // Initialize once for each new process. + // Return FALSE to fail DLL load. + DWORD currentProcessId = ::GetCurrentProcessId(); + + // Create client manager for this process +#ifdef _DEBUG + struct _stat buf; + char* dirname = "c:\\tcf"; + int result = _stat(dirname, &buf); + if (result == 0) // exists + { + gDoLogging = TRUE; + } + else + { + gDoLogging = FALSE; + } + +#endif + gManager = new CClientManager(hinstDLL); +#ifdef _DEBUG + if (gDoLogging) + { + FILE* f = fopen("c:\\tcf\\TCF_DllMainDLL_PROCESS_ATTACH.txt", "at"); + LogTime(f); + fprintf(f,"DLL_PROCESS_ATTACH:\n hinstDLL=%x\n processId=%d\n DllLocation=%s\n DebugLog->m_FileName=%s\n", + hinstDLL, + currentProcessId, + gManager->m_DllLocation, + gManager->m_DebugLog->m_FileName); + fclose(f); + } +#endif + } + break; + + case DLL_THREAD_ATTACH: + { + // Do thread-specific initialization. + DWORD currentThreadId = ::GetCurrentThreadId(); +#ifdef _DEBUG + if (gDoLogging) + { + FILE* f = fopen("c:\\tcf\\TCF_DllMainDLL_THREAD_ATTACH.txt", "at"); + LogTime(f); + fprintf(f,"DLL_THREAD_ATTACH: hinstDLL=%x currentThreadId=%d\n", hinstDLL, currentThreadId); + fclose(f); + } +#endif + } + break; + + case DLL_THREAD_DETACH: + { + // Do thread-specific cleanup. + DWORD currentThreadId = ::GetCurrentThreadId(); +#ifdef _DEBUG + if (gDoLogging) + { + FILE* f = fopen("c:\\tcf\\TCF_DllMainDLL_THREAD_DETACH.txt", "at"); + LogTime(f); + fprintf(f,"DLL_THREAD_DETTACH: hinstDLL=%x currentThreadId=%d\n", hinstDLL, currentThreadId); + fclose(f); + } +#endif + } + break; + + case DLL_PROCESS_DETACH: + { + // Perform any necessary cleanup. + DWORD currentProcessId = ::GetCurrentProcessId(); + // delete the client manager for this process +#ifdef _DEBUG + if (gDoLogging) + { + FILE* f = fopen("c:\\tcf\\TCF_DllMainDLL_PROCESS_DETACH.txt", "at"); + LogTime(f); + fprintf(f,"DLL_PROCESS_DETACH processId=%d\n", currentProcessId); + fclose(f); + } +#endif + if (gManager) + { + delete gManager; + } + } + break; + } + return TRUE; // Successful DLL_PROCESS_ATTACH. +} +#ifdef _DEBUG +static void LogTime(FILE* f) +{ + SYSTEMTIME sTime; + GetLocalTime(&sTime); + if (f) + fprintf(f, "%02.2d%02.2d-%02.2d:%02.2d:%02.2d.%03.3d: ", sTime.wDay, sTime.wMonth, sTime.wHour, sTime.wMinute, sTime.wSecond, sTime.wMilliseconds); +} +#endif + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCFClient.dep --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCFClient.dep Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,99 @@ +# Microsoft Developer Studio Generated Dependency File, included by TCFClient.mak + +.\ClientManager.cpp : \ + "..\Common\Headers\ErrorMonitorData.h"\ + "..\Common\Headers\InputStream.h"\ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\ServerClient.h"\ + "..\Common\Headers\shareddata.h"\ + "..\Common\Headers\TCDebugLog.h"\ + "..\Common\Headers\TCErrorConstants.h"\ + ".\ClientManager.h"\ + + +..\Common\Source\ErrorMonitorData.cpp : \ + "..\Common\Headers\ErrorMonitorData.h"\ + "..\Common\Headers\InputStream.h"\ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\ServerClient.h"\ + "..\Common\Headers\shareddata.h"\ + "..\Common\Headers\TCDebugLog.h"\ + "..\Common\Headers\TCErrorConstants.h"\ + ".\ClientManager.h"\ + + +..\Common\Source\InputStream.cpp : \ + "..\Common\Headers\ErrorMonitorData.h"\ + "..\Common\Headers\InputStream.h"\ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\ServerClient.h"\ + "..\Common\Headers\shareddata.h"\ + "..\Common\Headers\TCDebugLog.h"\ + ".\ClientManager.h"\ + + +..\Common\Source\mutex.cpp : \ + "..\Common\Headers\mutex.h"\ + + +..\Common\Source\ServerClient.cpp : \ + "..\Common\Headers\ErrorMonitorData.h"\ + "..\Common\Headers\InputStream.h"\ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\ServerClient.h"\ + "..\Common\Headers\shareddata.h"\ + "..\Common\Headers\TCDebugLog.h"\ + "..\Common\Headers\TCErrorConstants.h"\ + ".\ClientManager.h"\ + + +..\Common\Source\shareddata.cpp : \ + "..\Common\Headers\shareddata.h"\ + + +.\StdAfx.cpp : \ + ".\StdAfx.h"\ + + +.\TCAPIConnectionJni.cpp : \ + "..\Common\Headers\ErrorMonitorData.h"\ + "..\Common\Headers\InputStream.h"\ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\ServerClient.h"\ + "..\Common\Headers\shareddata.h"\ + "..\Common\Headers\TCConstants.h"\ + "..\Common\Headers\TCDebugLog.h"\ + "..\Common\Headers\TCErrorConstants.h"\ + ".\ClientManager.h"\ + ".\jdk1.5.0_10\include\jni.h"\ + ".\jdk1.5.0_10\include\win32\jni_md.h"\ + ".\TCAPIConnectionJni.h"\ + + +..\Common\Source\TCDebugLog.cpp : \ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\TCDebugLog.h"\ + + +.\TCFClient.cpp : \ + "..\Common\Headers\ErrorMonitorData.h"\ + "..\Common\Headers\InputStream.h"\ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\ServerClient.h"\ + "..\Common\Headers\shareddata.h"\ + "..\Common\Headers\TCDebugLog.h"\ + ".\ClientManager.h"\ + + +.\TCFCppApi.cpp : \ + "..\Common\Headers\ErrorMonitorData.h"\ + "..\Common\Headers\InputStream.h"\ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\pn_const.h"\ + "..\Common\Headers\ServerClient.h"\ + "..\Common\Headers\shareddata.h"\ + "..\Common\Headers\TCDebugLog.h"\ + "..\Common\Headers\TCErrorConstants.h"\ + ".\ClientManager.h"\ + ".\TCFCppApi.h"\ + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCFClient.dsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCFClient.dsp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,229 @@ +# Microsoft Developer Studio Project File - Name="TCFClient" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=TCFClient - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "TCFClient.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "TCFClient.mak" CFG="TCFClient - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "TCFClient - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "TCFClient - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TCFClient - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib shlwapi.lib /nologo /dll /map /machine:I386 +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +PostBuild_Cmds=copybinaries Release +# End Special Build Tool + +!ELSEIF "$(CFG)" == "TCFClient - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /FR /Yu"stdafx.h" /FD /GZ /c +# SUBTRACT CPP /X +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib shlwapi.lib /nologo /dll /map /debug /machine:I386 /pdbtype:sept +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +PostBuild_Cmds=copybinaries Debug +# End Special Build Tool + +!ENDIF + +# Begin Target + +# Name "TCFClient - Win32 Release" +# Name "TCFClient - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\ClientManager.cpp +# ADD CPP /Zp2 +# End Source File +# Begin Source File + +SOURCE=..\Common\Source\ErrorMonitorData.cpp +# ADD CPP /Zp2 +# End Source File +# Begin Source File + +SOURCE=..\Common\Source\InputStream.cpp +# ADD CPP /Zp2 +# End Source File +# Begin Source File + +SOURCE=..\Common\Source\mutex.cpp +# ADD CPP /Zp2 +# End Source File +# Begin Source File + +SOURCE=..\Common\Source\ServerClient.cpp +# ADD CPP /Zp2 +# End Source File +# Begin Source File + +SOURCE=..\Common\Source\shareddata.cpp +# ADD CPP /Zp2 +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Zp2 /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\TCAPIConnectionJni.cpp +# ADD CPP /Zp2 +# End Source File +# Begin Source File + +SOURCE=..\Common\Source\TCDebugLog.cpp +# ADD CPP /Zp2 +# End Source File +# Begin Source File + +SOURCE=.\TCFClient.cpp +# ADD CPP /Zp2 +# End Source File +# Begin Source File + +SOURCE=.\TCFCppApi.cpp +# ADD CPP /Zp2 +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\ClientManager.h +# End Source File +# Begin Source File + +SOURCE=..\Common\Headers\ErrorMonitorData.h +# End Source File +# Begin Source File + +SOURCE=..\Common\Headers\InputStream.h +# End Source File +# Begin Source File + +SOURCE=..\Common\Headers\mutex.h +# End Source File +# Begin Source File + +SOURCE=..\Common\Headers\ServerClient.h +# End Source File +# Begin Source File + +SOURCE=..\Common\Headers\shareddata.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\TCAPIConnectionJni.h +# End Source File +# Begin Source File + +SOURCE=..\Common\Headers\TCConstants.h +# End Source File +# Begin Source File + +SOURCE=..\Common\Headers\TCDebugLog.h +# End Source File +# Begin Source File + +SOURCE=..\Common\Headers\TCErrorConstants.h +# End Source File +# Begin Source File + +SOURCE=.\TCFCppApi.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\resource.rc +# End Source File +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCFClient.mak --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCFClient.mak Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,530 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on TCFClient.dsp +!IF "$(CFG)" == "" +CFG=TCFClient - Win32 Debug +!MESSAGE No configuration specified. Defaulting to TCFClient - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "TCFClient - Win32 Release" && "$(CFG)" != "TCFClient - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "TCFClient.mak" CFG="TCFClient - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "TCFClient - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "TCFClient - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TCFClient - Win32 Release" + +OUTDIR=.\Release +INTDIR=.\Release +# Begin Custom Macros +OutDir=.\Release +# End Custom Macros + +ALL : "$(OUTDIR)\TCFClient.dll" + + +CLEAN : + -@erase "$(INTDIR)\ClientManager.obj" + -@erase "$(INTDIR)\ErrorMonitorData.obj" + -@erase "$(INTDIR)\InputStream.obj" + -@erase "$(INTDIR)\mutex.obj" + -@erase "$(INTDIR)\resource.res" + -@erase "$(INTDIR)\ServerClient.obj" + -@erase "$(INTDIR)\shareddata.obj" + -@erase "$(INTDIR)\StdAfx.obj" + -@erase "$(INTDIR)\TCAPIConnectionJni.obj" + -@erase "$(INTDIR)\TCDebugLog.obj" + -@erase "$(INTDIR)\TCFClient.obj" + -@erase "$(INTDIR)\TCFClient.pch" + -@erase "$(INTDIR)\TCFCppApi.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\TCFClient.dll" + -@erase "$(OUTDIR)\TCFClient.exp" + -@erase "$(OUTDIR)\TCFClient.lib" + -@erase "$(OUTDIR)\TCFClient.map" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\resource.res" /d "NDEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\TCFClient.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib shlwapi.lib /nologo /dll /incremental:no /pdb:"$(OUTDIR)\TCFClient.pdb" /map:"$(INTDIR)\TCFClient.map" /machine:I386 /out:"$(OUTDIR)\TCFClient.dll" /implib:"$(OUTDIR)\TCFClient.lib" +LINK32_OBJS= \ + "$(INTDIR)\ClientManager.obj" \ + "$(INTDIR)\ErrorMonitorData.obj" \ + "$(INTDIR)\InputStream.obj" \ + "$(INTDIR)\mutex.obj" \ + "$(INTDIR)\ServerClient.obj" \ + "$(INTDIR)\shareddata.obj" \ + "$(INTDIR)\StdAfx.obj" \ + "$(INTDIR)\TCAPIConnectionJni.obj" \ + "$(INTDIR)\TCDebugLog.obj" \ + "$(INTDIR)\TCFClient.obj" \ + "$(INTDIR)\TCFCppApi.obj" \ + "$(INTDIR)\resource.res" + +"$(OUTDIR)\TCFClient.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep + +ALL : $(DS_POSTBUILD_DEP) + +# Begin Custom Macros +OutDir=.\Release +# End Custom Macros + +$(DS_POSTBUILD_DEP) : "$(OUTDIR)\TCFClient.dll" + copybinaries Release + echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)" + +!ELSEIF "$(CFG)" == "TCFClient - Win32 Debug" + +OUTDIR=.\Debug +INTDIR=.\Debug +# Begin Custom Macros +OutDir=.\Debug +# End Custom Macros + +ALL : "$(OUTDIR)\TCFClient.dll" "$(OUTDIR)\TCFClient.bsc" + + +CLEAN : + -@erase "$(INTDIR)\ClientManager.obj" + -@erase "$(INTDIR)\ClientManager.sbr" + -@erase "$(INTDIR)\ErrorMonitorData.obj" + -@erase "$(INTDIR)\ErrorMonitorData.sbr" + -@erase "$(INTDIR)\InputStream.obj" + -@erase "$(INTDIR)\InputStream.sbr" + -@erase "$(INTDIR)\mutex.obj" + -@erase "$(INTDIR)\mutex.sbr" + -@erase "$(INTDIR)\resource.res" + -@erase "$(INTDIR)\ServerClient.obj" + -@erase "$(INTDIR)\ServerClient.sbr" + -@erase "$(INTDIR)\shareddata.obj" + -@erase "$(INTDIR)\shareddata.sbr" + -@erase "$(INTDIR)\StdAfx.obj" + -@erase "$(INTDIR)\StdAfx.sbr" + -@erase "$(INTDIR)\TCAPIConnectionJni.obj" + -@erase "$(INTDIR)\TCAPIConnectionJni.sbr" + -@erase "$(INTDIR)\TCDebugLog.obj" + -@erase "$(INTDIR)\TCDebugLog.sbr" + -@erase "$(INTDIR)\TCFClient.obj" + -@erase "$(INTDIR)\TCFClient.pch" + -@erase "$(INTDIR)\TCFClient.sbr" + -@erase "$(INTDIR)\TCFCppApi.obj" + -@erase "$(INTDIR)\TCFCppApi.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\TCFClient.bsc" + -@erase "$(OUTDIR)\TCFClient.dll" + -@erase "$(OUTDIR)\TCFClient.exp" + -@erase "$(OUTDIR)\TCFClient.ilk" + -@erase "$(OUTDIR)\TCFClient.lib" + -@erase "$(OUTDIR)\TCFClient.map" + -@erase "$(OUTDIR)\TCFClient.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\resource.res" /d "_DEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\TCFClient.bsc" +BSC32_SBRS= \ + "$(INTDIR)\ClientManager.sbr" \ + "$(INTDIR)\ErrorMonitorData.sbr" \ + "$(INTDIR)\InputStream.sbr" \ + "$(INTDIR)\mutex.sbr" \ + "$(INTDIR)\ServerClient.sbr" \ + "$(INTDIR)\shareddata.sbr" \ + "$(INTDIR)\StdAfx.sbr" \ + "$(INTDIR)\TCAPIConnectionJni.sbr" \ + "$(INTDIR)\TCDebugLog.sbr" \ + "$(INTDIR)\TCFClient.sbr" \ + "$(INTDIR)\TCFCppApi.sbr" + +"$(OUTDIR)\TCFClient.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib shlwapi.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\TCFClient.pdb" /map:"$(INTDIR)\TCFClient.map" /debug /machine:I386 /out:"$(OUTDIR)\TCFClient.dll" /implib:"$(OUTDIR)\TCFClient.lib" /pdbtype:sept +LINK32_OBJS= \ + "$(INTDIR)\ClientManager.obj" \ + "$(INTDIR)\ErrorMonitorData.obj" \ + "$(INTDIR)\InputStream.obj" \ + "$(INTDIR)\mutex.obj" \ + "$(INTDIR)\ServerClient.obj" \ + "$(INTDIR)\shareddata.obj" \ + "$(INTDIR)\StdAfx.obj" \ + "$(INTDIR)\TCAPIConnectionJni.obj" \ + "$(INTDIR)\TCDebugLog.obj" \ + "$(INTDIR)\TCFClient.obj" \ + "$(INTDIR)\TCFCppApi.obj" \ + "$(INTDIR)\resource.res" + +"$(OUTDIR)\TCFClient.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep + +ALL : $(DS_POSTBUILD_DEP) + +# Begin Custom Macros +OutDir=.\Debug +# End Custom Macros + +$(DS_POSTBUILD_DEP) : "$(OUTDIR)\TCFClient.dll" "$(OUTDIR)\TCFClient.bsc" + copybinaries Debug + echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)" + +!ENDIF + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("TCFClient.dep") +!INCLUDE "TCFClient.dep" +!ELSE +!MESSAGE Warning: cannot find "TCFClient.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "TCFClient - Win32 Release" || "$(CFG)" == "TCFClient - Win32 Debug" +SOURCE=.\ClientManager.cpp + +!IF "$(CFG)" == "TCFClient - Win32 Release" + +CPP_SWITCHES=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\ClientManager.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "TCFClient - Win32 Debug" + +CPP_SWITCHES=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\ClientManager.obj" "$(INTDIR)\ClientManager.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=..\Common\Source\ErrorMonitorData.cpp + +!IF "$(CFG)" == "TCFClient - Win32 Release" + +CPP_SWITCHES=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\ErrorMonitorData.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "TCFClient - Win32 Debug" + +CPP_SWITCHES=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\ErrorMonitorData.obj" "$(INTDIR)\ErrorMonitorData.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=..\Common\Source\InputStream.cpp + +!IF "$(CFG)" == "TCFClient - Win32 Release" + +CPP_SWITCHES=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\InputStream.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "TCFClient - Win32 Debug" + +CPP_SWITCHES=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\InputStream.obj" "$(INTDIR)\InputStream.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=..\Common\Source\mutex.cpp + +!IF "$(CFG)" == "TCFClient - Win32 Release" + +CPP_SWITCHES=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\mutex.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "TCFClient - Win32 Debug" + +CPP_SWITCHES=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\mutex.obj" "$(INTDIR)\mutex.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=..\Common\Source\ServerClient.cpp + +!IF "$(CFG)" == "TCFClient - Win32 Release" + +CPP_SWITCHES=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\ServerClient.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "TCFClient - Win32 Debug" + +CPP_SWITCHES=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\ServerClient.obj" "$(INTDIR)\ServerClient.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=..\Common\Source\shareddata.cpp + +!IF "$(CFG)" == "TCFClient - Win32 Release" + +CPP_SWITCHES=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\shareddata.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "TCFClient - Win32 Debug" + +CPP_SWITCHES=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\shareddata.obj" "$(INTDIR)\shareddata.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\StdAfx.cpp + +!IF "$(CFG)" == "TCFClient - Win32 Release" + +CPP_SWITCHES=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Fp"$(INTDIR)\TCFClient.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\StdAfx.obj" "$(INTDIR)\TCFClient.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "TCFClient - Win32 Debug" + +CPP_SWITCHES=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\TCFClient.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\StdAfx.obj" "$(INTDIR)\StdAfx.sbr" "$(INTDIR)\TCFClient.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\TCAPIConnectionJni.cpp + +!IF "$(CFG)" == "TCFClient - Win32 Release" + +CPP_SWITCHES=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\TCAPIConnectionJni.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "TCFClient - Win32 Debug" + +CPP_SWITCHES=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\TCAPIConnectionJni.obj" "$(INTDIR)\TCAPIConnectionJni.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=..\Common\Source\TCDebugLog.cpp + +!IF "$(CFG)" == "TCFClient - Win32 Release" + +CPP_SWITCHES=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\TCDebugLog.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "TCFClient - Win32 Debug" + +CPP_SWITCHES=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\TCDebugLog.obj" "$(INTDIR)\TCDebugLog.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\TCFClient.cpp + +!IF "$(CFG)" == "TCFClient - Win32 Release" + +CPP_SWITCHES=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\TCFClient.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "TCFClient - Win32 Debug" + +CPP_SWITCHES=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\TCFClient.obj" "$(INTDIR)\TCFClient.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\TCFCppApi.cpp + +!IF "$(CFG)" == "TCFClient - Win32 Release" + +CPP_SWITCHES=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\TCFCppApi.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "TCFClient - Win32 Debug" + +CPP_SWITCHES=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\TCFClient.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\TCFCppApi.obj" "$(INTDIR)\TCFCppApi.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFClient.pch" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\resource.rc + +"$(INTDIR)\resource.res" : $(SOURCE) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + + +!ENDIF + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCFClient.plg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCFClient.plg Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,83 @@ + + +
+

Build Log

+

+--------------------Configuration: TCFClient - Win32 Debug-------------------- +

+

Command Lines

+Creating command line "rc.exe /l 0x409 /fo"Debug/resource.res" /d "_DEBUG" "C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFClient\resource.rc"" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP3228.tmp" with contents +[ +/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /FR"Debug/" /Fp"Debug/TCFClient.pch" /Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFClient\ClientManager.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\ErrorMonitorData.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\InputStream.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\mutex.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\ServerClient.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\shareddata.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFClient\TCAPIConnectionJni.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\TCDebugLog.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFClient\TCFClient.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFClient\TCFCppApi.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP3228.tmp" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP3229.tmp" with contents +[ +/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /FR"Debug/" /Fp"Debug/TCFClient.pch" /Yc"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFClient\StdAfx.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP3229.tmp" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP322A.tmp" with contents +[ +kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib shlwapi.lib /nologo /dll /incremental:yes /pdb:"Debug/TCFClient.pdb" /map:"Debug/TCFClient.map" /debug /machine:I386 /out:"Debug/TCFClient.dll" /implib:"Debug/TCFClient.lib" /pdbtype:sept +.\Debug\ClientManager.obj +.\Debug\ErrorMonitorData.obj +.\Debug\InputStream.obj +.\Debug\mutex.obj +.\Debug\ServerClient.obj +.\Debug\shareddata.obj +.\Debug\StdAfx.obj +.\Debug\TCAPIConnectionJni.obj +.\Debug\TCDebugLog.obj +.\Debug\TCFClient.obj +.\Debug\TCFCppApi.obj +.\Debug\resource.res +] +Creating command line "link.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP322A.tmp" +

Output Window

+Compiling resources... +Compiling... +StdAfx.cpp +Compiling... +ClientManager.cpp +ErrorMonitorData.cpp +InputStream.cpp +mutex.cpp +ServerClient.cpp +shareddata.cpp +TCAPIConnectionJni.cpp +TCDebugLog.cpp +TCFClient.cpp +TCFCppApi.cpp +Generating Code... +Linking... +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP322B.bat" with contents +[ +@echo off +copybinaries Debug +] +Creating command line "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP322B.bat" +copy libs +Copy binaries to ..\..\..\os\win32\x86 + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + + + +

Results

+TCFClient.dll - 0 error(s), 0 warning(s) +
+ + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCFCppApi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCFCppApi.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,955 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "stdafx.h" +#include "TCFCppApi.h" +#include "ServerClient.h" +#include "ClientManager.h" +#include "TCConstants.h" +#include + +extern CClientManager* gManager; +#ifdef _DEBUG +extern BOOL gDoLogging; +extern char TCDebugMsg[100]; +#define TCDEBUGOPEN() if (gDoLogging) { gManager->m_DebugLog->WaitForAccess(); } +#define TCDEBUGLOGS(s) if (gDoLogging) { sprintf(TCDebugMsg,"%s", s); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGLOGA1(s, a1) if (gDoLogging) { sprintf(TCDebugMsg, s, a1); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGLOGA2(s, a1, a2) if (gDoLogging) { sprintf(TCDebugMsg, s, a1, a2); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGLOGA3(s, a1, a2, a3) if (gDoLogging) { sprintf(TCDebugMsg, s, a1, a2, a3); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGCLOSE() if (gDoLogging) { gManager->m_DebugLog->ReleaseAccess(); } +#else +#define TCDEBUGOPEN() +#define TCDEBUGLOGS(s) +#define TCDEBUGLOGA1(s, a1) +#define TCDEBUGLOGA2(s, a1, a2) +#define TCDEBUGLOGA3(s, a1, a2, a3) +#define TCDEBUGCLOSE() +#endif + +// for internal testing with 2.x USB TRK define this +//#define FOR_2X_USB + +// client Ids connected for this C++ process +static std::vector *pcppClientIds = NULL; + +static long CheckClient(long id); +static long CheckConnection(pTCFCppConnectData inConnection); +static long CheckRealSerialSettings(pTCFCppConnectData inConnection); +static long CheckMessageOptions(pTCFCppMessageOptions inMessageOptions); +static long CheckMessageIds(pTCFCppMessageIds inMessageIds); +static long CheckMessage(pTCFCppMessage inMessage); +static void ConvertRealSerialSettingsToServer(pTCFCppConnectData inConnection, pRealSerialConnectData pData); +static void ConvertRealSerialSettingsToHost(pTCFCppConnectData inConnection, pRealSerialConnectData pData); + +TCF_EXP long TCF_CALL TCFConnect(pTCFCppConnectData inConnection, pTCFCppMessageOptions inMessageOptions, pTCFCppMessageIds inMessageIds, long* outClientId) +{ + long ret = TCAPI_ERR_NONE; + ServerCommandData cmdrsp; + pServerCommandData pCmdrsp = &cmdrsp; + + TCDEBUGOPEN(); + TCDEBUGLOGS("TCFConnect\n"); +// if (!gManager->IsServerRunning()) +// return TCAPI_ERR_COMM_SERVER_RESPONSE_TIMEOUT; + + gManager->m_Server->WaitforServerPipeAccess(); + + ret = CheckConnection(inConnection); +#ifdef FOR_2X_USB + inMessageOptions->unWrapFormat = eTCFCppNone; +#endif + if (ret == TCAPI_ERR_NONE) + { + ret = CheckMessageOptions(inMessageOptions); + } + + if (ret == TCAPI_ERR_NONE) + { + ret = CheckMessageIds(inMessageIds); + } + + if (ret == TCAPI_ERR_NONE) + { + if (strcmp(inConnection->connectType, "tcp") == 0) + { + char* pAddress = inConnection->tcpSettings.ipAddress; + char* pPort = inConnection->tcpSettings.ipPort; + + pCmdrsp->command = eCmdConnect; + strncpy(pCmdrsp->connectSettings.connectType, inConnection->connectType, MAX_CONNECTION_TYPE); + strncpy(pCmdrsp->connectSettings.tcpSettings.ipAddress, pAddress, MAX_IPADDRESS_SIZE); + strncpy(pCmdrsp->connectSettings.tcpSettings.ipPort, pPort, MAX_PORT_SIZE); + + pCmdrsp->connectSettings.retryInterval = inConnection->retryInterval; + pCmdrsp->connectSettings.retryTimeout = inConnection->retryTimeout; + strncpy(pCmdrsp->connectSettings.decodeFormat, inConnection->decodeFormat, MAX_DECODE_FORMAT); + pCmdrsp->clientOptions.unWrapFormat = inMessageOptions->unWrapFormat; + pCmdrsp->clientOptions.ostVersion = inMessageOptions->ostVersion; + } + else if (strcmp(inConnection->connectType, "virtualserial") == 0) + { + char* pComPort = inConnection->virtualSerialSettings.comPort; + + pCmdrsp->command = eCmdConnect; + strncpy(pCmdrsp->connectSettings.connectType, inConnection->connectType, MAX_CONNECTION_TYPE); + strncpy(pCmdrsp->connectSettings.virtualSerialSettings.comPort, pComPort, MAX_COMPORT_SIZE); + + pCmdrsp->connectSettings.retryInterval = inConnection->retryInterval; + pCmdrsp->connectSettings.retryTimeout = inConnection->retryTimeout; + strncpy(pCmdrsp->connectSettings.decodeFormat, inConnection->decodeFormat, MAX_DECODE_FORMAT); + pCmdrsp->clientOptions.unWrapFormat = inMessageOptions->unWrapFormat; + pCmdrsp->clientOptions.ostVersion = inMessageOptions->ostVersion; + } + else if (strcmp(inConnection->connectType, "serial") == 0) + { + char* pComPort = inConnection->realSerialSettings.comPort; + + pCmdrsp->command = eCmdConnect; + strncpy(pCmdrsp->connectSettings.connectType, inConnection->connectType, MAX_CONNECTION_TYPE); + strncpy(pCmdrsp->connectSettings.realSerialSettings.comPort, pComPort, MAX_COMPORT_SIZE); + + ConvertRealSerialSettingsToServer(inConnection, &pCmdrsp->connectSettings.realSerialSettings); + + pCmdrsp->connectSettings.retryInterval = inConnection->retryInterval; + pCmdrsp->connectSettings.retryTimeout = inConnection->retryTimeout; + strncpy(pCmdrsp->connectSettings.decodeFormat, inConnection->decodeFormat, MAX_DECODE_FORMAT); + pCmdrsp->clientOptions.unWrapFormat = inMessageOptions->unWrapFormat; + pCmdrsp->clientOptions.ostVersion = inMessageOptions->ostVersion; + } + else + { + // Add other connections here + } + // send connect command + long id = 0; + + if (ret == TCAPI_ERR_NONE) + { + gManager->m_Server->SendCommand(pCmdrsp); + gManager->m_Server->GetResponse(pCmdrsp); + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + TCDEBUGLOGA1("TCFConnect eCmdConnect: ret = %d\n", ret); + } + else + { + id = pCmdrsp->clientId; + TCDEBUGLOGA1("TCFConnect eCmdConnect: id = %d\n", id); + } + } + + // send message Ids to capture + if (ret == TCAPI_ERR_NONE) + { + pCmdrsp->command = eCmdSetMessageIds; + pCmdrsp->clientId = id; + pCmdrsp->number = inMessageIds->numberIds; + for (int i = 0; i < inMessageIds->numberIds; i++) + { + pCmdrsp->messageIds[i] = inMessageIds->messageIds[i]; + } + + gManager->m_Server->SendCommand(pCmdrsp); + gManager->m_Server->GetResponse(pCmdrsp); + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + TCDEBUGLOGA1("TCFConnect eCmdSetMessageIds: ret = %d\n", ret); + } + else + { + TCDEBUGLOGA1("TCFConnect eCmdSetMessageIds: ret = %d\n", ret); + } + } + + // create input stream overflow temp file + // create input stream + if (ret == TCAPI_ERR_NONE) + { +// eTCPCppStreamOverflowOption overflowOption = inMessageOptions->streamOverflowOption; +// char* pFileName = inMessageOptions->overflowFile; + long streamSize = inMessageOptions->inputStreamSize; + CInputStream* stream = new CInputStream(NULL, streamSize, eTCPCppStreamOverflowOff, id); + stream->CreateStream(); + gManager->AddInputStream(stream); + + pCmdrsp->command = eCmdOpenStream; + pCmdrsp->clientId = id; + // TODO: implement message file in the future? + pCmdrsp->destinationOptions.destination = eDestinationInputStream; + pCmdrsp->destinationOptions.streamSize = streamSize; + pCmdrsp->destinationOptions.overFlowToFile = FALSE;//(overflowOption == eTCPCppStreamOverflowOn); +// if (pFileName != NULL) +// { +// strncpy(pCmdrsp->destinationOptions.destinationFile, pFileName, MAX_INPUTSTREAMPATH); +// } +// else + { + pCmdrsp->destinationOptions.destinationFile[0] = NULL; + } + gManager->m_Server->SendCommand(pCmdrsp); + gManager->m_Server->GetResponse(pCmdrsp); + + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + TCDEBUGLOGA1("TCFConnect eCmdOpenStream: ret = %d\n", ret); + } + else + { + TCDEBUGLOGA1("TCFConnect eCmdOpenStream: ret = %d\n", ret); + } + } + + // create error monitor + if (ret == TCAPI_ERR_NONE) + { + CErrorMonitor* monitor = new CErrorMonitor(id); + if (monitor != NULL) + { + monitor->CreateData(); + gManager->AddErrorMonitor(monitor); + } + } + + // start client capture + if (ret == TCAPI_ERR_NONE) + { + pCmdrsp->command = eCmdStart; + pCmdrsp->clientId = id; + gManager->m_Server->SendCommand(pCmdrsp); + gManager->m_Server->GetResponse(pCmdrsp); + + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + TCDEBUGLOGA1("TCFConnect eCmdStart: ret = %d\n", ret); + } + else + { + TCDEBUGLOGA1("TCFConnect eCmdStart: ret = %d\n", ret); + } + } + + if (ret == TCAPI_ERR_NONE) + { + TCDEBUGLOGA1("TCFConnect pcppClientIds: %x\n", pcppClientIds); + if (pcppClientIds == NULL) + { + pcppClientIds = new std::vector; + pcppClientIds->empty(); + } + pcppClientIds->push_back(id); + *outClientId = id; + TCDEBUGLOGA1("TCFConnect pcppClientIds: size = %d\n", pcppClientIds->size()); + } + } + + gManager->m_Server->ReleaseServerPipeAccess(); + TCDEBUGLOGA1("TCFConnect return ret=%d\n", ret); + TCDEBUGCLOSE(); + return ret; +} + + +TCF_EXP long TCF_CALL TCFDisconnect(long inClientId) +{ + long ret = TCAPI_ERR_NONE; + ServerCommandData cmdrsp; + pServerCommandData pCmdrsp = &cmdrsp; + + TCDEBUGOPEN(); + TCDEBUGLOGA1("TCFDisconnect id=%d\n", inClientId); + + gManager->m_Server->WaitforServerPipeAccess(); + gManager->WaitForErrorMonitorListAccess(); + gManager->WaitForStreamListAccess(); + + // check client ID + ret = CheckClient(inClientId); + TCDEBUGLOGA1("TCFDisconnect CheckClient: ret = %d\n", ret); + + // stop client + if (ret == TCAPI_ERR_NONE) + { + pCmdrsp->clientId = inClientId; + pCmdrsp->command = eCmdStop; + gManager->m_Server->SendCommand(pCmdrsp); + gManager->m_Server->GetResponse(pCmdrsp); + } + + // close error monitor + TCDEBUGLOGS("TCFDisconnect clear error monitor\n"); + CErrorMonitor *monitor = gManager->FindErrorMonitor(inClientId); + if (monitor != NULL) + { + gManager->RemoveErrorMonitor(monitor); + delete monitor; + } + + // close input stream + TCDEBUGLOGS("TCFDisconnect remove input stream\n"); + CInputStream* inputStream = gManager->FindInputStream(inClientId); + if (inputStream != NULL) + { + gManager->RemoveInputStream(inputStream); + delete inputStream; + } + + // send disconnect + TCDEBUGLOGS("TCFDisconnect send disconnect\n"); + if (ret == TCAPI_ERR_NONE) + { + pCmdrsp->command = eCmdDisconnect; + pCmdrsp->clientId = inClientId; + + gManager->m_Server->SendCommand(pCmdrsp); + gManager->m_Server->GetResponse(pCmdrsp); + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + } + } + + TCDEBUGLOGS("TCFDisconnect clear erase id\n"); + if (pcppClientIds != NULL && ret == TCAPI_ERR_NONE) + { + std::vector::iterator idIter; + for (idIter = pcppClientIds->begin(); idIter != pcppClientIds->end(); idIter++) + { + if (*idIter == inClientId) + { + pcppClientIds->erase(idIter); + break; + } + } + if (pcppClientIds->size() == 0) + { + pcppClientIds->empty(); + delete pcppClientIds; + pcppClientIds = NULL; + } + } + + gManager->ReleaseStreamListAccess(); + gManager->ReleaseErrorMonitorListAccess(); + + TCDEBUGLOGS("TCFDisconnect stop server\n"); + gManager->m_Server->ReleaseServerPipeAccess(); + + TCDEBUGLOGA1("TCFDisconnect return ret=%d\n", ret); + TCDEBUGCLOSE(); + return ret; +} + +TCF_EXP long TCF_CALL TCFGetVersions(long inClientId, long& outNumberVersions, char** outVersions) +{ + long ret = TCAPI_ERR_FEATURE_NOT_IMPLEMENTED; + outNumberVersions = 0; + + // check client ID + + // get # versions from server + + // get version[i] from server + + + return ret; +} +TCF_EXP long TCF_CALL TCFGetConnections(long& outNumberConnections, pTCFCppConnectData* outConnections) +{ + long ret = TCAPI_ERR_FEATURE_NOT_IMPLEMENTED; + + outNumberConnections = 0; + + return ret; +} +TCF_EXP long TCF_CALL TCFSendMessage(long inClientId, pTCFCppMessage inMessage, long inLength, BYTE* inData) +{ + long ret = TCAPI_ERR_NONE; + ServerCommandData cmdrsp; pServerCommandData pCmdrsp = &cmdrsp; + +#ifdef FOR_2X_USB + inMessage->useMyId = FALSE; +#endif + + TCDEBUGOPEN(); + TCDEBUGLOGA1("TCFSendMessage id=%d\n", inClientId); + + // check client ID + ret = CheckClient(inClientId); + TCDEBUGLOGA1("TCFSendMessage CheckClient: ret=%d\n", ret); + + gManager->m_Server->WaitforServerPipeAccess(); + // send message to server + if (ret == TCAPI_ERR_NONE) + { + ret = CheckMessage(inMessage); + if (ret == TCAPI_ERR_NONE) + { + pCmdrsp->command = eCmdSendMessage; + pCmdrsp->clientId = inClientId; + pCmdrsp->encodeOption = (inMessage->encodeFormat == eTCFCppEncodeNone) ? ENCODE_NO_FORMAT : ENCODE_FORMAT; + pCmdrsp->useMyId = inMessage->useMyId; + pCmdrsp->protocolVersion = inMessage->ostVersion; + pCmdrsp->myId = inMessage->myId; + + gManager->m_Server->SendCommand(pCmdrsp, inLength, inData); + gManager->m_Server->GetResponse(pCmdrsp); + + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + TCDEBUGLOGA1("TCFSendMessage eCmdSendMessage: ret=%d\n", ret); + } + } + } + + gManager->m_Server->ReleaseServerPipeAccess(); + + TCDEBUGLOGA1("TCFSendMessage return ret=%d\n", ret); + TCDEBUGCLOSE(); + return ret; +} +TCF_EXP long TCF_CALL TCFStart(long inClientId) +{ + long ret = TCAPI_ERR_NONE; + + // check client Id + ret = CheckClient(inClientId); + if (ret == TCAPI_ERR_NONE) + { + gManager->m_Server->WaitforServerPipeAccess(); + + ServerCommandData cmdrsp; pServerCommandData pCmdrsp = &cmdrsp; + + pCmdrsp->command = eCmdStart; + pCmdrsp->clientId = inClientId; + + gManager->m_Server->SendCommand(pCmdrsp); + gManager->m_Server->GetResponse(pCmdrsp); + + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + } + gManager->m_Server->ReleaseServerPipeAccess(); + + } + + return ret; +} + +TCF_EXP long TCF_CALL TCFStop(long inClientId) +{ + long ret = TCAPI_ERR_NONE; + + // check client Id + ret = CheckClient(inClientId); + if (ret == TCAPI_ERR_NONE) + { + gManager->m_Server->WaitforServerPipeAccess(); + + ServerCommandData cmdrsp; pServerCommandData pCmdrsp = &cmdrsp; + + pCmdrsp->command = eCmdStop; + pCmdrsp->clientId = inClientId; + + gManager->m_Server->SendCommand(pCmdrsp); + gManager->m_Server->GetResponse(pCmdrsp); + + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + } + gManager->m_Server->ReleaseServerPipeAccess(); + + } + + return ret; +} + +TCF_EXP long TCF_CALL TCFSetMessageIds(long inClientId, pTCFCppMessageIds inMessageIds) +{ + long ret = TCAPI_ERR_NONE; + ServerCommandData cmdrsp; pServerCommandData pCmdrsp = &cmdrsp; + + // check client Id + ret = CheckClient(inClientId); + + // check message ids + if (ret == TCAPI_ERR_NONE) + { + ret = CheckMessageIds(inMessageIds); + } + + gManager->m_Server->WaitforServerPipeAccess(); + // check client status + if (ret == TCAPI_ERR_NONE) + { + pCmdrsp->command = eCmdGetClientStatus; + pCmdrsp->clientId = inClientId; + + gManager->m_Server->SendCommand(pCmdrsp); + gManager->m_Server->GetResponse(pCmdrsp); + + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + } + else + { + if (pCmdrsp->clientStatus == eStarted) + { + ret = TCAPI_ERR_ROUTING_IN_PROGRESS; + } + else if (pCmdrsp->clientStatus == eUnknownClient) + { + ret = TCAPI_ERR_MEDIA_NOT_OPEN; + } + } + } + + // set message ids + if (ret == TCAPI_ERR_NONE) + { + pCmdrsp->command = eCmdSetMessageIds; + pCmdrsp->clientId = inClientId; + pCmdrsp->number = inMessageIds->numberIds; + for (int i = 0; i < inMessageIds->numberIds; i++) + { + pCmdrsp->messageIds[i] = inMessageIds->messageIds[i]; + } + gManager->m_Server->SendCommand(pCmdrsp); + gManager->m_Server->GetResponse(pCmdrsp); + + if (pCmdrsp->response == eRspError) + { + ret = pCmdrsp->error; + } + + } + gManager->m_Server->ReleaseServerPipeAccess(); + + return ret; +} + +TCF_EXP long TCF_CALL TCFPollInputStream(long inClientId, long& outLength) +{ + long ret = TCAPI_ERR_NONE; + outLength = 0; + + TCDEBUGOPEN(); + TCDEBUGLOGA1("TCFPollInputStream id=%d\n", inClientId); + + gManager->WaitForStreamListAccess(); + + // check client ID + ret = CheckClient(inClientId); + if (ret == TCAPI_ERR_NONE) + { + // get client's input stream + CInputStream* inputStream = gManager->FindInputStream(inClientId); + + if (inputStream != NULL) + { + outLength = inputStream->GetNextMessageSize(); + } + else + { + ret = TCAPI_ERR_INPUTSTREAM_CLOSED; + } + } + + gManager->ReleaseStreamListAccess(); + + TCDEBUGLOGA2("TCFPollInputStream return ret=%d outLength=%d\n", ret, outLength); + TCDEBUGCLOSE(); + return ret; +} +TCF_EXP long TCF_CALL TCFReadInputStream(long inClientId, pTCFCppMessage outMessage, long& inLength, BYTE* outData) +{ + long ret = TCAPI_ERR_NONE; + + if (outData == NULL || inLength <= 0) + return ret; + + gManager->WaitForStreamListAccess(); + + // check client ID + ret = CheckClient(inClientId); + if (ret == TCAPI_ERR_NONE) + { + // get client's input stream + CInputStream* inputStream = gManager->FindInputStream(inClientId); + + if (inputStream != NULL) + { + DWORD length = inputStream->GetNextMessageSize(); + if (length > inLength) length = inLength; + if (length > 0) + { + inLength = length; + inputStream->GetNextMessage(inLength, outData); + + } + else + { + inLength = 0; + } + } + else + { + ret = TCAPI_ERR_INPUTSTREAM_CLOSED; + } + } + + gManager->ReleaseStreamListAccess(); + + return ret; +} +TCF_EXP BOOL TCF_CALL TCFPollError(long inClientId, int* outErrorCode, BOOL* outHasOSErrorCode, long* outOSErrorCode) +{ + BOOL foundError = FALSE; + gManager->WaitForErrorMonitorListAccess(); + + if (gManager->ErrorMonitorListSize() > 0) + { + CErrorMonitor* errorMonitor = gManager->FindErrorMonitor(inClientId); + if (errorMonitor != NULL) + { + LONG tcfError = TCAPI_ERR_NONE; + BOOL osErrorUsed = FALSE; + DWORD osError = 0; + BOOL found = errorMonitor->GetError(&tcfError, &osErrorUsed, &osError); + if (found) + { + foundError = true; + *outErrorCode = (int)tcfError; + *outHasOSErrorCode = osErrorUsed; + *outOSErrorCode = osError; + } + } + } + gManager->ReleaseErrorMonitorListAccess(); + + return foundError; +} + +long CheckClient(long id) +{ + long ret = TCAPI_ERR_NONE; + BOOL found = FALSE; + + if (id <= 0) + { + ret = TCAPI_ERR_INVALID_HANDLE; + } + else if (gManager->IsServerRunning() == FALSE) + { + ret = TCAPI_ERR_MEDIA_NOT_OPEN; + } + else + { + if (pcppClientIds == NULL) + { + ret = TCAPI_ERR_MEDIA_NOT_OPEN; + } + else + { + std::vector::iterator idIter; + for (idIter = pcppClientIds->begin(); idIter != pcppClientIds->end(); idIter++) + { + if (*idIter == id) + { + found = TRUE; + break; + } + } + if (!found) + { + ret = TCAPI_ERR_INVALID_HANDLE; + } + } + } + + return ret; +} +long CheckConnection(pTCFCppConnectData inConnection) +{ + long ret = TCAPI_ERR_NONE; + + if (inConnection == NULL) + { + ret = TCAPI_ERR_MISSING_CONNECTION_SPEC; + } + else + { + long retryI = inConnection->retryInterval; + long retryT = inConnection->retryTimeout; + if (retryI == 0 || retryT == 0 || retryI > retryT) + ret = TCAPI_ERR_INVALID_RETRY_PERIODS; + } + if (ret == TCAPI_ERR_NONE) + { + if (strcmp(inConnection->connectType, "tcp") == 0) + { + if (inConnection->tcpSettings.ipAddress == NULL) + { + ret = TCAPI_ERR_MISSING_MEDIA_DATA; + } + else if (inConnection->tcpSettings.ipPort == NULL) + { + ret = TCAPI_ERR_MISSING_MEDIA_DATA; + } + } + else if (strcmp(inConnection->connectType, "virtualserial") == 0) + { + if (inConnection->virtualSerialSettings.comPort == NULL) + { + ret = TCAPI_ERR_MISSING_MEDIA_DATA; + } + } + else if (strcmp(inConnection->connectType, "serial") == 0) + { + ret = CheckRealSerialSettings(inConnection); + } + else + { + } + } + + return ret; +} + +long CheckRealSerialSettings(pTCFCppConnectData inConnection) +{ + long ret = TCAPI_ERR_NONE; + + if (inConnection->realSerialSettings.comPort == NULL) + { + ret = TCAPI_ERR_MISSING_MEDIA_DATA; + } + else if (inConnection->realSerialSettings.dataBits < 4 || inConnection->realSerialSettings.dataBits > 8) + { + ret = TCAPI_ERR_COMM_INVALID_DATABITS; + } + else if (inConnection->realSerialSettings.baudRate < 110UL || inConnection->realSerialSettings.baudRate > 256000UL) + { + ret = TCAPI_ERR_MISSING_MEDIA_DATA; + } + else + { + switch(inConnection->realSerialSettings.stopBits) + { + case eTCFCppStopBits1: + case eTCFCppStopBits15: + case eTCFCppStopBits2: + break; + default: + ret = TCAPI_ERR_COMM_INVALID_STOPBITS; + break; + } + + } + if (ret == TCAPI_ERR_NONE) + { + switch(inConnection->realSerialSettings.flowControl) + { + case eTCFCppFlowControlNone: + case eTCFCppFlowControlHW: + case eTCFCppFlowControlSW: + break; + default: + ret = TCAPI_ERR_COMM_INVALID_FLOWCONTROL; + break; + } + } + if (ret == TCAPI_ERR_NONE) + { + switch(inConnection->realSerialSettings.parity) + { + case eTCFCppParityNone: + case eTCFCppParityOdd: + case eTCFCppParityEven: + break; + default: + ret = TCAPI_ERR_COMM_INVALID_PARITY; + break; + } + } + + return ret; +} +long CheckMessageOptions(pTCFCppMessageOptions inMessageOptions) +{ + long ret = TCAPI_ERR_NONE; + + if (inMessageOptions == NULL) + { + ret = TCAPI_ERR_MISSING_MESSAGE_OPTIONS; + } + else + { + if (ret == TCAPI_ERR_NONE) + { + if (inMessageOptions->unWrapFormat != eTCFCppNone && + inMessageOptions->unWrapFormat != eTCFCppDeleteHeader) + { + ret = TCAPI_ERR_INVALID_MESSAGE_UNWRAP_OPTION; + } + } + if (ret == TCAPI_ERR_NONE) + { + if (inMessageOptions->inputStreamSize <= 0) + { + ret = TCAPI_ERR_INVALID_STREAM_BUFFER_SIZE; + } + } + } + return ret; +} +long CheckMessageIds(pTCFCppMessageIds inMessageIds) +{ + long ret = TCAPI_ERR_NONE; + + if (inMessageIds == NULL) + { + ret = TCAPI_ERR_NO_MESSAGESIDS_REGISTERED; + } + else if (inMessageIds->numberIds <= 0 || inMessageIds->messageIds == NULL) + { + ret = TCAPI_ERR_NO_MESSAGESIDS_REGISTERED; + } + else if (inMessageIds->numberIds > 256) + { + ret = TCAPI_ERR_MESSAGEID_MAXIMUM; + } + + return ret; +} +long CheckMessage(pTCFCppMessage inMessage) +{ + long ret = TCAPI_ERR_NONE; + + if (inMessage == NULL) + return TCAPI_ERR_MISSING_MESSAGE; + + if (inMessage->useMyId) + { + if ((inMessage->encodeFormat != eTCFCppEncodeNone) && (inMessage->encodeFormat != eTCFCppEncode)) + { + ret = TCAPI_ERR_INVALID_ENCODE_FORMAT; + } + } + + return ret; +} + +void ConvertRealSerialSettingsToServer(pTCFCppConnectData inConnection, pRealSerialConnectData pData) +{ + pData->baudRate = inConnection->realSerialSettings.baudRate; + pData->dataBits = inConnection->realSerialSettings.dataBits; + switch(inConnection->realSerialSettings.flowControl) + { + default: + case eTCFCppFlowControlNone: + pData->flowControl = eFlowControlNone; + break; + case eTCFCppFlowControlHW: + pData->flowControl = eFlowControlHW; + break; + case eTCFCppFlowControlSW: + pData->flowControl = eFlowControlSW; + break; + } + switch(inConnection->realSerialSettings.parity) + { + default: + case eTCFCppParityNone: + pData->parity = eParityNone; + break; + case eTCFCppParityOdd: + pData->parity = eParityOdd; + break; + case eTCFCppParityEven: + pData->parity = eParityEven; + break; + } + switch(inConnection->realSerialSettings.stopBits) + { + default: + case eTCFCppStopBits1: + pData->stopBits = eStopBits1; + break; + case eTCFCppStopBits15: + pData->stopBits = eStopBits15; + break; + case eTCFCppStopBits2: + pData->stopBits = eStopBits2; + break; + } +} + +void ConvertRealSerialSettingsToHost(pTCFCppConnectData inConnection, pRealSerialConnectData pData) +{ + inConnection->realSerialSettings.baudRate = pData->baudRate; + inConnection->realSerialSettings.dataBits = pData->dataBits; + switch(pData->flowControl) + { + default: + case eFlowControlNone: + inConnection->realSerialSettings.flowControl = eTCFCppFlowControlNone; + break; + case eFlowControlHW: + inConnection->realSerialSettings.flowControl = eTCFCppFlowControlHW; + break; + case eFlowControlSW: + inConnection->realSerialSettings.flowControl = eTCFCppFlowControlSW; + break; + } + + switch(pData->parity) + { + default: + case eParityNone: + inConnection->realSerialSettings.parity = eTCFCppParityNone; + break; + case eParityEven: + inConnection->realSerialSettings.parity = eTCFCppParityEven; + break; + case eParityOdd: + inConnection->realSerialSettings.parity = eTCFCppParityOdd; + break; + } + + switch(pData->stopBits) + { + default: + case eStopBits1: + inConnection->realSerialSettings.stopBits = eTCFCppStopBits1; + break; + case eStopBits15: + inConnection->realSerialSettings.stopBits = eTCFCppStopBits15; + break; + case eStopBits2: + inConnection->realSerialSettings.stopBits = eTCFCppStopBits2; + break; + } +} diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCFCppApi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCFCppApi.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,202 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __TCFCPPAPI_H__ +#define __TCFCPPAPI_H__ + +#include "TCErrorConstants.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef TCFCLIENT_EXPORTS +#define TCF_EXP __declspec(dllexport) +#else +#define TCF_EXP __declspec(dllimport) +#endif + +#define TCF_CALL + +// TCP/IP +#define MAX_IPADDRESS_SIZE (20) +#define MAX_PORT_SIZE (6) +typedef struct tagTCFCppTcpConnectData +{ + char ipAddress[MAX_IPADDRESS_SIZE]; // e.g., "127.0.0.1" + char ipPort[MAX_PORT_SIZE]; // e.g., "7654" +} *pTCFCppTcpConnectData, TCFCppTcpConnectData; + +// Virtual Serial (BT and USB over Serial port) +#define MAX_COMPORT_SIZE (20) +typedef struct tagTCFCppVirtualSerialConnectData +{ + char comPort[MAX_COMPORT_SIZE]; // only COM port required: e.g. COM0 +} *pTCFCppVirtualSerialConnectData, TCFCppVirtualSerialConnectData; + +// Real Serial +enum eTCFCppFlowControl +{ + eTCFCppFlowControlNone, + eTCFCppFlowControlHW, + eTCFCppFlowControlSW, +}; +enum eTCFCppStopBits +{ + eTCFCppStopBits1, + eTCFCppStopBits15, + eTCFCppStopBits2, +}; +enum eTCFCppParity +{ + eTCFCppParityNone, + eTCFCppParityOdd, + eTCFCppParityEven, +}; + +typedef struct tagTCFCppRealSerialConnectData +{ + eTCFCppFlowControl flowControl; + eTCFCppStopBits stopBits; + eTCFCppParity parity; + DWORD baudRate; + DWORD dataBits; + char comPort[MAX_COMPORT_SIZE]; +} *pTCFCppRealSerialConnectData, TCFCppRealSerialConnectData; + +// Real USB +#define MAX_USBDEVICE_SIZE (100) +typedef struct tagTCFCppUSBConnectData +{ + char device[MAX_USBDEVICE_SIZE]; +} *pTCFCppUSBConnectData, TCFCppUSBConnectData; + +#define MAX_DECODE_FORMAT (16) +#define MAX_CONNECTION_TYPE (16) +typedef struct tagTCFCppConnectData +{ + long retryInterval; // retry interval in seconds when port access is lost + long retryTimeout; // retry timeout in seconds when port access is lost + long traceBoxChannel; // Tracebox parameter + char decodeFormat[MAX_DECODE_FORMAT]; // protocol decode format on incoming messages + char connectType[MAX_CONNECTION_TYPE]; // connection type + TCFCppTcpConnectData tcpSettings; // TCP/IP + TCFCppVirtualSerialConnectData virtualSerialSettings; // Virtual serial + TCFCppRealSerialConnectData realSerialSettings; // Real Serial + TCFCppUSBConnectData usbSettings; // Real USB +} *pTCFCppConnectData, TCFCppConnectData; + +// Various options for this client +// Incoming message handling +enum eTCFCppUnWrapFormat +{ + eTCFCppNone, // return whole message (including protocol) + eTCFCppDeleteHeader, // return only message data (excluding headers) +}; +// Outgoing message encoding options for this client +enum eTCFCppEncodeFormat +{ + eTCFCppEncodeNone, // leave message as-is + eTCFCppEncode, // encode message using decode format +}; +// input stream overflow +enum eTCPCppStreamOverflowOption +{ + eTCPCppStreamOverflowOff, // no overflow to file + eTCPCppStreamOverflowOn, // overflow to file +}; +#define MAX_INPUTSTREAMPATH (2048L) + +typedef struct tagTCFCppMessageOptions +{ + long inputStreamSize; // input stream size +// eTCPCppStreamOverflowOption streamOverflowOption; // stream overflow option +// char overflowFile[MAX_INPUTSTREAMPATH]; // overflow file to use + eTCFCppUnWrapFormat unWrapFormat; // message unwrapping option + long ostVersion; // OST version to use for decoding messages +} *pTCFCppMessageOptions, TCFCppMessageOptions; + +#define MAX_VERSION_STRING (80) +#define MAX_MESSAGEIDS (256) +typedef struct tagTCFCppMessageIds +{ + long numberIds; + BYTE messageIds[MAX_MESSAGEIDS]; +} *pTCFCppMessageIds, TCFCppMessageIds; + +#define MAX_SENDMESSAGE (64*1024L+12) +typedef struct tagTCFCppMessage +{ + eTCFCppEncodeFormat encodeFormat; // encode or do not encode protocol using current protocol + long ostVersion; // OST version to use when above and encodeFormat = "ost" + BOOL useMyId; // format for protocol + BYTE myId; // my message ID to use (if useMyId=true) +} *pTCFCppMessage, TCFCppMessage; + +// APIs + +TCF_EXP long TCF_CALL TCFConnect(pTCFCppConnectData inConnection, pTCFCppMessageOptions inMessageOptions, pTCFCppMessageIds inMessageIds, long* outClientId); +TCF_EXP long TCF_CALL TCFDisconnect(long inClientId); +TCF_EXP long TCF_CALL TCFGetVersions(long inClientId, long& outNumberVersions, char** outVersions); +TCF_EXP long TCF_CALL TCFGetConnections(long& outNumberConnections, pTCFCppConnectData* outConnections); +TCF_EXP long TCF_CALL TCFSendMessage(long inClientId, pTCFCppMessage inMessage, long length, BYTE* data); +TCF_EXP long TCF_CALL TCFStart(long inClientId); +TCF_EXP long TCF_CALL TCFStop(long inClientId); +TCF_EXP long TCF_CALL TCFSetMessageIds(long inClientId, pTCFCppMessageIds inMessageIds); +TCF_EXP long TCF_CALL TCFPollInputStream(long inClientId, long& outLength); +TCF_EXP long TCF_CALL TCFReadInputStream(long inClientId, pTCFCppMessage outMessage, long& inLength, BYTE* outData); +TCF_EXP BOOL TCF_CALL TCFPollError(long inClientId, int* outErrorCode, BOOL* outHasOSErrorCode, long* outOSErrorCode); + + +typedef long (*TCFCONNECT)(pTCFCppConnectData inConnection, pTCFCppMessageOptions inMessageOptions, pTCFCppMessageIds inMessageIds, long* outClientId); +#define TCFCONNECT_FNNAME "TCFConnect" + +typedef long (*TCFDISCONNECT)(long inClientId); +#define TCFDISCONNECT_FNNAME "TCFDisconnect" + +typedef long (*TCFGETVERIONS)(long inClientId, long& outNumberVersions, char** outVersions); +#define TCFGETVERIONS_FNNAME "TCFGetVersions" + +typedef long (*TCFGETCONNECTIONS)(long& outNumberConnections, pTCFCppConnectData* outConnections); +#define TCFGETCONNECTIONS_FNNAME "TCFGetConnections" + +typedef long (*TCFSENDMESSAGE)(long inClientId, pTCFCppMessage inMessage, long length, BYTE* data); +#define TCFSENDMESSAGE_FNNAME "TCFSendMessage" + +typedef long (*TCFSTART)(long inClientId); +#define TCFSTART_FNNAME "TCFStart" + +typedef long (*TCFSTOP)(long inClientId); +#define TCFSTOP_FNNAME "TCFStop" + +typedef long (*TCFSETMESSAGEIDS)(long inClientId, pTCFCppMessageIds inMessageIds); +#define TCFSETMESSAGEIDS_FNNAME "TCFSetMessageIds" + +typedef long (*TCFPOLLINPUTSTREAM)(long inClientId, long& outLength); +#define TCFPOLLINPUTSTREAM_FNNAME "TCFPollInputStream" + +typedef long (*TCFREADINPUTSTREAM)(long inClientId, pTCFCppMessage outMessage, long& inLength, BYTE* outData); +#define TCFREADINPUTSTREAM_FNNAME "TCFReadInputStream" + +typedef long (*TCFPOLLERROR)(long inClientId, int* outErrorCode, BOOL* outHasOSErrorCode, long* outOSErrorCode); +#define TCFPOLLERROR_FNNAME "TCFPollError" + +#ifdef __cplusplus +} +#endif + + +#endif // __TCFCPPAPI_H__ diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/copyBinaries.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/copyBinaries.cmd Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,5 @@ +echo off +echo Copy binaries to ..\..\..\os\win32\x86 +copy /V %1\TCFClient.dll ..\..\..\os\win32\x86 +copy /V %1\TCFClient.map ..\..\..\os\win32\x86 +copy /V %1\TCFClient.lib ..\..\..\os\win32\x86 diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/copyLib.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/copyLib.cmd Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,10 @@ +echo off +echo Copy binaries to ..\..\..\os\win32\x86 +REM copy /V %1\TCFClient.dll ..\..\..\os\win32\x86 already done by project settings +copy /V %1\TCFClient.map ..\..\..\os\win32\x86 +copy /V %1\TCFClient.lib ..\..\..\os\win32\x86 +echo Copy binaries to ..\..\..\..\com.nokia.tcf\os\win32\x86 +copy /V ..\..\..\os\win32\x86\TCFClient.dll ..\..\..\..\com.nokia.tcf\os\win32\x86 +copy /V ..\..\..\os\win32\x86\TCFClient.map ..\..\..\..\com.nokia.tcf\os\win32\x86 +copy /V ..\..\..\os\win32\x86\TCFClient.lib ..\..\..\..\com.nokia.tcf\os\win32\x86 + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/javah_build.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/javah_build.cmd Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,5 @@ +REM echo off + +REM create API +attrib -R TCAPIConnectionJni.h +javah -classpath ..\..\..\..\com.nokia.tcf\bin -o TCAPIConnectionJni.h -jni com.nokia.tcf.impl.TCAPIConnection diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/jdk1.5.0_10/include/jawt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/jdk1.5.0_10/include/jawt.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,278 @@ +/* + * @(#)jawt.h 1.10 03/12/19 + * + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + */ + +#ifndef _JAVASOFT_JAWT_H_ +#define _JAVASOFT_JAWT_H_ + +#include "jni.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * AWT native interface (new in JDK 1.3) + * + * The AWT native interface allows a native C or C++ application a means + * by which to access native structures in AWT. This is to facilitate moving + * legacy C and C++ applications to Java and to target the needs of the + * community who, at present, wish to do their own native rendering to canvases + * for performance reasons. Standard extensions such as Java3D also require a + * means to access the underlying native data structures of AWT. + * + * There may be future extensions to this API depending on demand. + * + * A VM does not have to implement this API in order to pass the JCK. + * It is recommended, however, that this API is implemented on VMs that support + * standard extensions, such as Java3D. + * + * Since this is a native API, any program which uses it cannot be considered + * 100% pure java. + */ + +/* + * AWT Native Drawing Surface (JAWT_DrawingSurface). + * + * For each platform, there is a native drawing surface structure. This + * platform-specific structure can be found in jawt_md.h. It is recommended + * that additional platforms follow the same model. It is also recommended + * that VMs on Win32 and Solaris support the existing structures in jawt_md.h. + * + ******************* + * EXAMPLE OF USAGE: + ******************* + * + * In Win32, a programmer wishes to access the HWND of a canvas to perform + * native rendering into it. The programmer has declared the paint() method + * for their canvas subclass to be native: + * + * + * MyCanvas.java: + * + * import java.awt.*; + * + * public class MyCanvas extends Canvas { + * + * static { + * System.loadLibrary("mylib"); + * } + * + * public native void paint(Graphics g); + * } + * + * + * myfile.c: + * + * #include "jawt_md.h" + * #include + * + * JNIEXPORT void JNICALL + * Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics) + * { + * JAWT awt; + * JAWT_DrawingSurface* ds; + * JAWT_DrawingSurfaceInfo* dsi; + * JAWT_Win32DrawingSurfaceInfo* dsi_win; + * jboolean result; + * jint lock; + * + * // Get the AWT + * awt.version = JAWT_VERSION_1_3; + * result = JAWT_GetAWT(env, &awt); + * assert(result != JNI_FALSE); + * + * // Get the drawing surface + * ds = awt.GetDrawingSurface(env, canvas); + * assert(ds != NULL); + * + * // Lock the drawing surface + * lock = ds->Lock(ds); + * assert((lock & JAWT_LOCK_ERROR) == 0); + * + * // Get the drawing surface info + * dsi = ds->GetDrawingSurfaceInfo(ds); + * + * // Get the platform-specific drawing info + * dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo; + * + * ////////////////////////////// + * // !!! DO PAINTING HERE !!! // + * ////////////////////////////// + * + * // Free the drawing surface info + * ds->FreeDrawingSurfaceInfo(dsi); + * + * // Unlock the drawing surface + * ds->Unlock(ds); + * + * // Free the drawing surface + * awt.FreeDrawingSurface(ds); + * } + * + */ + +/* + * JAWT_Rectangle + * Structure for a native rectangle. + */ +typedef struct jawt_Rectangle { + jint x; + jint y; + jint width; + jint height; +} JAWT_Rectangle; + +struct jawt_DrawingSurface; + +/* + * JAWT_DrawingSurfaceInfo + * Structure for containing the underlying drawing information of a component. + */ +typedef struct jawt_DrawingSurfaceInfo { + /* + * Pointer to the platform-specific information. This can be safely + * cast to a JAWT_Win32DrawingSurfaceInfo on Windows or a + * JAWT_X11DrawingSurfaceInfo on Solaris. See jawt_md.h for details. + */ + void* platformInfo; + /* Cached pointer to the underlying drawing surface */ + struct jawt_DrawingSurface* ds; + /* Bounding rectangle of the drawing surface */ + JAWT_Rectangle bounds; + /* Number of rectangles in the clip */ + jint clipSize; + /* Clip rectangle array */ + JAWT_Rectangle* clip; +} JAWT_DrawingSurfaceInfo; + +#define JAWT_LOCK_ERROR 0x00000001 +#define JAWT_LOCK_CLIP_CHANGED 0x00000002 +#define JAWT_LOCK_BOUNDS_CHANGED 0x00000004 +#define JAWT_LOCK_SURFACE_CHANGED 0x00000008 + +/* + * JAWT_DrawingSurface + * Structure for containing the underlying drawing information of a component. + * All operations on a JAWT_DrawingSurface MUST be performed from the same + * thread as the call to GetDrawingSurface. + */ +typedef struct jawt_DrawingSurface { + /* + * Cached reference to the Java environment of the calling thread. + * If Lock(), Unlock(), GetDrawingSurfaceInfo() or + * FreeDrawingSurfaceInfo() are called from a different thread, + * this data member should be set before calling those functions. + */ + JNIEnv* env; + /* Cached reference to the target object */ + jobject target; + /* + * Lock the surface of the target component for native rendering. + * When finished drawing, the surface must be unlocked with + * Unlock(). This function returns a bitmask with one or more of the + * following values: + * + * JAWT_LOCK_ERROR - When an error has occurred and the surface could not + * be locked. + * + * JAWT_LOCK_CLIP_CHANGED - When the clip region has changed. + * + * JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed. + * + * JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed + */ + jint (JNICALL *Lock) + (struct jawt_DrawingSurface* ds); + /* + * Get the drawing surface info. + * The value returned may be cached, but the values may change if + * additional calls to Lock() or Unlock() are made. + * Lock() must be called before this can return a valid value. + * Returns NULL if an error has occurred. + * When finished with the returned value, FreeDrawingSurfaceInfo must be + * called. + */ + JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo) + (struct jawt_DrawingSurface* ds); + /* + * Free the drawing surface info. + */ + void (JNICALL *FreeDrawingSurfaceInfo) + (JAWT_DrawingSurfaceInfo* dsi); + /* + * Unlock the drawing surface of the target component for native rendering. + */ + void (JNICALL *Unlock) + (struct jawt_DrawingSurface* ds); +} JAWT_DrawingSurface; + +/* + * JAWT + * Structure for containing native AWT functions. + */ +typedef struct jawt { + /* + * Version of this structure. This must always be set before + * calling JAWT_GetAWT() + */ + jint version; + /* + * Return a drawing surface from a target jobject. This value + * may be cached. + * Returns NULL if an error has occurred. + * Target must be a java.awt.Component (should be a Canvas + * or Window for native rendering). + * FreeDrawingSurface() must be called when finished with the + * returned JAWT_DrawingSurface. + */ + JAWT_DrawingSurface* (JNICALL *GetDrawingSurface) + (JNIEnv* env, jobject target); + /* + * Free the drawing surface allocated in GetDrawingSurface. + */ + void (JNICALL *FreeDrawingSurface) + (JAWT_DrawingSurface* ds); + /* + * Since 1.4 + * Locks the entire AWT for synchronization purposes + */ + void (JNICALL *Lock)(JNIEnv* env); + /* + * Since 1.4 + * Unlocks the entire AWT for synchronization purposes + */ + void (JNICALL *Unlock)(JNIEnv* env); + /* + * Since 1.4 + * Returns a reference to a java.awt.Component from a native + * platform handle. On Windows, this corresponds to an HWND; + * on Solaris and Linux, this is a Drawable. For other platforms, + * see the appropriate machine-dependent header file for a description. + * The reference returned by this function is a local + * reference that is only valid in this environment. + * This function returns a NULL reference if no component could be + * found with matching platform information. + */ + jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo); + +} JAWT; + +/* + * Get the AWT native structure. This function returns JNI_FALSE if + * an error occurs. + */ +_JNI_IMPORT_OR_EXPORT_ +jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt); + +#define JAWT_VERSION_1_3 0x00010003 +#define JAWT_VERSION_1_4 0x00010004 + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !_JAVASOFT_JAWT_H_ */ diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/jdk1.5.0_10/include/jdwpTransport.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/jdk1.5.0_10/include/jdwpTransport.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,237 @@ +/* + * @(#)jdwpTransport.h 1.7 03/12/19 + * + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + */ + +/* + * Java Debug Wire Protocol Transport Service Provider Interface. + */ + +#ifndef JDWPTRANSPORT_H +#define JDWPTRANSPORT_H + +#include "jni.h" + +enum { + JDWPTRANSPORT_VERSION_1_0 = 0x00010000 +}; + +#ifdef __cplusplus +extern "C" { +#endif + +struct jdwpTransportNativeInterface_; + +struct _jdwpTransportEnv; + +#ifdef __cplusplus +typedef _jdwpTransportEnv jdwpTransportEnv; +#else +typedef const struct jdwpTransportNativeInterface_ *jdwpTransportEnv; +#endif /* __cplusplus */ + +/* + * Errors. Universal errors with JVMTI/JVMDI equivalents keep the + * values the same. + */ +typedef enum { + JDWPTRANSPORT_ERROR_NONE = 0, + JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT = 103, + JDWPTRANSPORT_ERROR_OUT_OF_MEMORY = 110, + JDWPTRANSPORT_ERROR_INTERNAL = 113, + JDWPTRANSPORT_ERROR_ILLEGAL_STATE = 201, + JDWPTRANSPORT_ERROR_IO_ERROR = 202, + JDWPTRANSPORT_ERROR_TIMEOUT = 203, + JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE = 204 +} jdwpTransportError; + + +/* + * Structure to define capabilities + */ +typedef struct { + unsigned int can_timeout_attach :1; + unsigned int can_timeout_accept :1; + unsigned int can_timeout_handshake :1; + unsigned int reserved3 :1; + unsigned int reserved4 :1; + unsigned int reserved5 :1; + unsigned int reserved6 :1; + unsigned int reserved7 :1; + unsigned int reserved8 :1; + unsigned int reserved9 :1; + unsigned int reserved10 :1; + unsigned int reserved11 :1; + unsigned int reserved12 :1; + unsigned int reserved13 :1; + unsigned int reserved14 :1; + unsigned int reserved15 :1; +} JDWPTransportCapabilities; + + +/* + * Structures to define packet layout. + * + * See: http://java.sun.com/j2se/1.5/docs/guide/jpda/jdwp-spec.html + */ + +enum { + JDWPTRANSPORT_FLAGS_NONE = 0x0, + JDWPTRANSPORT_FLAGS_REPLY = 0x80 +}; + +typedef struct { + jint len; + jint id; + jbyte flags; + jbyte cmdSet; + jbyte cmd; + jbyte *data; +} jdwpCmdPacket; + +typedef struct { + jint len; + jint id; + jbyte flags; + jshort errorCode; + jbyte *data; +} jdwpReplyPacket; + +typedef struct { + union { + jdwpCmdPacket cmd; + jdwpReplyPacket reply; + } type; +} jdwpPacket; + +/* + * JDWP functions called by the transport. + */ +typedef struct jdwpTransportCallback { + void *(*alloc)(jint numBytes); /* Call this for all allocations */ + void (*free)(void *buffer); /* Call this for all deallocations */ +} jdwpTransportCallback; + +typedef jint (JNICALL *jdwpTransport_OnLoad_t)(JavaVM *jvm, + jdwpTransportCallback *callback, + jint version, + jdwpTransportEnv** env); + + + +/* Function Interface */ + +struct jdwpTransportNativeInterface_ { + /* 1 : RESERVED */ + void *reserved1; + + /* 2 : Get Capabilities */ + jdwpTransportError (JNICALL *GetCapabilities)(jdwpTransportEnv* env, + JDWPTransportCapabilities *capabilities_ptr); + + /* 3 : Attach */ + jdwpTransportError (JNICALL *Attach)(jdwpTransportEnv* env, + const char* address, + jlong attach_timeout, + jlong handshake_timeout); + + /* 4: StartListening */ + jdwpTransportError (JNICALL *StartListening)(jdwpTransportEnv* env, + const char* address, + char** actual_address); + + /* 5: StopListening */ + jdwpTransportError (JNICALL *StopListening)(jdwpTransportEnv* env); + + /* 6: Accept */ + jdwpTransportError (JNICALL *Accept)(jdwpTransportEnv* env, + jlong accept_timeout, + jlong handshake_timeout); + + /* 7: IsOpen */ + jboolean (JNICALL *IsOpen)(jdwpTransportEnv* env); + + /* 8: Close */ + jdwpTransportError (JNICALL *Close)(jdwpTransportEnv* env); + + /* 9: ReadPacket */ + jdwpTransportError (JNICALL *ReadPacket)(jdwpTransportEnv* env, + jdwpPacket *pkt); + + /* 10: Write Packet */ + jdwpTransportError (JNICALL *WritePacket)(jdwpTransportEnv* env, + const jdwpPacket* pkt); + + /* 11: GetLastError */ + jdwpTransportError (JNICALL *GetLastError)(jdwpTransportEnv* env, + char** error); + +}; + + +/* + * Use inlined functions so that C++ code can use syntax such as + * env->Attach("mymachine:5000", 10*1000, 0); + * + * rather than using C's :- + * + * (*env)->Attach(env, "mymachine:5000", 10*1000, 0); + */ +struct _jdwpTransportEnv { + const struct jdwpTransportNativeInterface_ *functions; +#ifdef __cplusplus + + jdwpTransportError GetCapabilities(JDWPTransportCapabilities *capabilities_ptr) { + return functions->GetCapabilities(this, capabilities_ptr); + } + + jdwpTransportError Attach(const char* address, jlong attach_timeout, + jlong handshake_timeout) { + return functions->Attach(this, address, attach_timeout, handshake_timeout); + } + + jdwpTransportError StartListening(const char* address, + char** actual_address) { + return functions->StartListening(this, address, actual_address); + } + + jdwpTransportError StopListening(void) { + return functions->StopListening(this); + } + + jdwpTransportError Accept(jlong accept_timeout, jlong handshake_timeout) { + return functions->Accept(this, accept_timeout, handshake_timeout); + } + + jboolean IsOpen(void) { + return functions->IsOpen(this); + } + + jdwpTransportError Close(void) { + return functions->Close(this); + } + + jdwpTransportError ReadPacket(jdwpPacket *pkt) { + return functions->ReadPacket(this, pkt); + } + + jdwpTransportError WritePacket(const jdwpPacket* pkt) { + return functions->WritePacket(this, pkt); + } + + jdwpTransportError GetLastError(char** error) { + return functions->GetLastError(this, error); + } + + +#endif /* __cplusplus */ +}; + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* JDWPTRANSPORT_H */ + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/jdk1.5.0_10/include/jni.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/jdk1.5.0_10/include/jni.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,1951 @@ +/* + * @(#)jni.h 1.56 03/12/19 + * + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + */ + +/* + * We used part of Netscape's Java Runtime Interface (JRI) as the starting + * point of our design and implementation. + */ + +/****************************************************************************** + * Java Runtime Interface + * Copyright (c) 1996 Netscape Communications Corporation. All rights reserved. + *****************************************************************************/ + +#ifndef _JAVASOFT_JNI_H_ +#define _JAVASOFT_JNI_H_ + +#include +#include + +/* jni_md.h contains the machine-dependent typedefs for jbyte, jint + and jlong */ + +#include "jni_md.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * JNI Types + */ + +#ifndef JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H + +typedef unsigned char jboolean; +typedef unsigned short jchar; +typedef short jshort; +typedef float jfloat; +typedef double jdouble; + +typedef jint jsize; + +#ifdef __cplusplus + +class _jobject {}; +class _jclass : public _jobject {}; +class _jthrowable : public _jobject {}; +class _jstring : public _jobject {}; +class _jarray : public _jobject {}; +class _jbooleanArray : public _jarray {}; +class _jbyteArray : public _jarray {}; +class _jcharArray : public _jarray {}; +class _jshortArray : public _jarray {}; +class _jintArray : public _jarray {}; +class _jlongArray : public _jarray {}; +class _jfloatArray : public _jarray {}; +class _jdoubleArray : public _jarray {}; +class _jobjectArray : public _jarray {}; + +typedef _jobject *jobject; +typedef _jclass *jclass; +typedef _jthrowable *jthrowable; +typedef _jstring *jstring; +typedef _jarray *jarray; +typedef _jbooleanArray *jbooleanArray; +typedef _jbyteArray *jbyteArray; +typedef _jcharArray *jcharArray; +typedef _jshortArray *jshortArray; +typedef _jintArray *jintArray; +typedef _jlongArray *jlongArray; +typedef _jfloatArray *jfloatArray; +typedef _jdoubleArray *jdoubleArray; +typedef _jobjectArray *jobjectArray; + +#else + +struct _jobject; + +typedef struct _jobject *jobject; +typedef jobject jclass; +typedef jobject jthrowable; +typedef jobject jstring; +typedef jobject jarray; +typedef jarray jbooleanArray; +typedef jarray jbyteArray; +typedef jarray jcharArray; +typedef jarray jshortArray; +typedef jarray jintArray; +typedef jarray jlongArray; +typedef jarray jfloatArray; +typedef jarray jdoubleArray; +typedef jarray jobjectArray; + +#endif + +typedef jobject jweak; + +typedef union jvalue { + jboolean z; + jbyte b; + jchar c; + jshort s; + jint i; + jlong j; + jfloat f; + jdouble d; + jobject l; +} jvalue; + +struct _jfieldID; +typedef struct _jfieldID *jfieldID; + +struct _jmethodID; +typedef struct _jmethodID *jmethodID; + +#endif /* JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H */ + +/* + * jboolean constants + */ + +#define JNI_FALSE 0 +#define JNI_TRUE 1 + +/* + * possible return values for JNI functions. + */ + +#define JNI_OK 0 /* success */ +#define JNI_ERR (-1) /* unknown error */ +#define JNI_EDETACHED (-2) /* thread detached from the VM */ +#define JNI_EVERSION (-3) /* JNI version error */ +#define JNI_ENOMEM (-4) /* not enough memory */ +#define JNI_EEXIST (-5) /* VM already created */ +#define JNI_EINVAL (-6) /* invalid arguments */ + +/* + * used in ReleaseScalarArrayElements + */ + +#define JNI_COMMIT 1 +#define JNI_ABORT 2 + +/* + * used in RegisterNatives to describe native method name, signature, + * and function pointer. + */ + +typedef struct { + char *name; + char *signature; + void *fnPtr; +} JNINativeMethod; + +/* + * JNI Native Method Interface. + */ + +struct JNINativeInterface_; + +struct JNIEnv_; + +#ifdef __cplusplus +typedef JNIEnv_ JNIEnv; +#else +typedef const struct JNINativeInterface_ *JNIEnv; +#endif + +/* + * JNI Invocation Interface. + */ + +struct JNIInvokeInterface_; + +struct JavaVM_; + +#ifdef __cplusplus +typedef JavaVM_ JavaVM; +#else +typedef const struct JNIInvokeInterface_ *JavaVM; +#endif + +struct JNINativeInterface_ { + void *reserved0; + void *reserved1; + void *reserved2; + + void *reserved3; + jint (JNICALL *GetVersion)(JNIEnv *env); + + jclass (JNICALL *DefineClass) + (JNIEnv *env, const char *name, jobject loader, const jbyte *buf, + jsize len); + jclass (JNICALL *FindClass) + (JNIEnv *env, const char *name); + + jmethodID (JNICALL *FromReflectedMethod) + (JNIEnv *env, jobject method); + jfieldID (JNICALL *FromReflectedField) + (JNIEnv *env, jobject field); + + jobject (JNICALL *ToReflectedMethod) + (JNIEnv *env, jclass cls, jmethodID methodID, jboolean isStatic); + + jclass (JNICALL *GetSuperclass) + (JNIEnv *env, jclass sub); + jboolean (JNICALL *IsAssignableFrom) + (JNIEnv *env, jclass sub, jclass sup); + + jobject (JNICALL *ToReflectedField) + (JNIEnv *env, jclass cls, jfieldID fieldID, jboolean isStatic); + + jint (JNICALL *Throw) + (JNIEnv *env, jthrowable obj); + jint (JNICALL *ThrowNew) + (JNIEnv *env, jclass clazz, const char *msg); + jthrowable (JNICALL *ExceptionOccurred) + (JNIEnv *env); + void (JNICALL *ExceptionDescribe) + (JNIEnv *env); + void (JNICALL *ExceptionClear) + (JNIEnv *env); + void (JNICALL *FatalError) + (JNIEnv *env, const char *msg); + + jint (JNICALL *PushLocalFrame) + (JNIEnv *env, jint capacity); + jobject (JNICALL *PopLocalFrame) + (JNIEnv *env, jobject result); + + jobject (JNICALL *NewGlobalRef) + (JNIEnv *env, jobject lobj); + void (JNICALL *DeleteGlobalRef) + (JNIEnv *env, jobject gref); + void (JNICALL *DeleteLocalRef) + (JNIEnv *env, jobject obj); + jboolean (JNICALL *IsSameObject) + (JNIEnv *env, jobject obj1, jobject obj2); + jobject (JNICALL *NewLocalRef) + (JNIEnv *env, jobject ref); + jint (JNICALL *EnsureLocalCapacity) + (JNIEnv *env, jint capacity); + + jobject (JNICALL *AllocObject) + (JNIEnv *env, jclass clazz); + jobject (JNICALL *NewObject) + (JNIEnv *env, jclass clazz, jmethodID methodID, ...); + jobject (JNICALL *NewObjectV) + (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); + jobject (JNICALL *NewObjectA) + (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); + + jclass (JNICALL *GetObjectClass) + (JNIEnv *env, jobject obj); + jboolean (JNICALL *IsInstanceOf) + (JNIEnv *env, jobject obj, jclass clazz); + + jmethodID (JNICALL *GetMethodID) + (JNIEnv *env, jclass clazz, const char *name, const char *sig); + + jobject (JNICALL *CallObjectMethod) + (JNIEnv *env, jobject obj, jmethodID methodID, ...); + jobject (JNICALL *CallObjectMethodV) + (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); + jobject (JNICALL *CallObjectMethodA) + (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args); + + jboolean (JNICALL *CallBooleanMethod) + (JNIEnv *env, jobject obj, jmethodID methodID, ...); + jboolean (JNICALL *CallBooleanMethodV) + (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); + jboolean (JNICALL *CallBooleanMethodA) + (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args); + + jbyte (JNICALL *CallByteMethod) + (JNIEnv *env, jobject obj, jmethodID methodID, ...); + jbyte (JNICALL *CallByteMethodV) + (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); + jbyte (JNICALL *CallByteMethodA) + (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); + + jchar (JNICALL *CallCharMethod) + (JNIEnv *env, jobject obj, jmethodID methodID, ...); + jchar (JNICALL *CallCharMethodV) + (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); + jchar (JNICALL *CallCharMethodA) + (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); + + jshort (JNICALL *CallShortMethod) + (JNIEnv *env, jobject obj, jmethodID methodID, ...); + jshort (JNICALL *CallShortMethodV) + (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); + jshort (JNICALL *CallShortMethodA) + (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); + + jint (JNICALL *CallIntMethod) + (JNIEnv *env, jobject obj, jmethodID methodID, ...); + jint (JNICALL *CallIntMethodV) + (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); + jint (JNICALL *CallIntMethodA) + (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); + + jlong (JNICALL *CallLongMethod) + (JNIEnv *env, jobject obj, jmethodID methodID, ...); + jlong (JNICALL *CallLongMethodV) + (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); + jlong (JNICALL *CallLongMethodA) + (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); + + jfloat (JNICALL *CallFloatMethod) + (JNIEnv *env, jobject obj, jmethodID methodID, ...); + jfloat (JNICALL *CallFloatMethodV) + (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); + jfloat (JNICALL *CallFloatMethodA) + (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); + + jdouble (JNICALL *CallDoubleMethod) + (JNIEnv *env, jobject obj, jmethodID methodID, ...); + jdouble (JNICALL *CallDoubleMethodV) + (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); + jdouble (JNICALL *CallDoubleMethodA) + (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args); + + void (JNICALL *CallVoidMethod) + (JNIEnv *env, jobject obj, jmethodID methodID, ...); + void (JNICALL *CallVoidMethodV) + (JNIEnv *env, jobject obj, jmethodID methodID, va_list args); + void (JNICALL *CallVoidMethodA) + (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args); + + jobject (JNICALL *CallNonvirtualObjectMethod) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); + jobject (JNICALL *CallNonvirtualObjectMethodV) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + va_list args); + jobject (JNICALL *CallNonvirtualObjectMethodA) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + const jvalue * args); + + jboolean (JNICALL *CallNonvirtualBooleanMethod) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); + jboolean (JNICALL *CallNonvirtualBooleanMethodV) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + va_list args); + jboolean (JNICALL *CallNonvirtualBooleanMethodA) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + const jvalue * args); + + jbyte (JNICALL *CallNonvirtualByteMethod) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); + jbyte (JNICALL *CallNonvirtualByteMethodV) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + va_list args); + jbyte (JNICALL *CallNonvirtualByteMethodA) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + const jvalue *args); + + jchar (JNICALL *CallNonvirtualCharMethod) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); + jchar (JNICALL *CallNonvirtualCharMethodV) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + va_list args); + jchar (JNICALL *CallNonvirtualCharMethodA) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + const jvalue *args); + + jshort (JNICALL *CallNonvirtualShortMethod) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); + jshort (JNICALL *CallNonvirtualShortMethodV) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + va_list args); + jshort (JNICALL *CallNonvirtualShortMethodA) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + const jvalue *args); + + jint (JNICALL *CallNonvirtualIntMethod) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); + jint (JNICALL *CallNonvirtualIntMethodV) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + va_list args); + jint (JNICALL *CallNonvirtualIntMethodA) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + const jvalue *args); + + jlong (JNICALL *CallNonvirtualLongMethod) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); + jlong (JNICALL *CallNonvirtualLongMethodV) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + va_list args); + jlong (JNICALL *CallNonvirtualLongMethodA) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + const jvalue *args); + + jfloat (JNICALL *CallNonvirtualFloatMethod) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); + jfloat (JNICALL *CallNonvirtualFloatMethodV) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + va_list args); + jfloat (JNICALL *CallNonvirtualFloatMethodA) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + const jvalue *args); + + jdouble (JNICALL *CallNonvirtualDoubleMethod) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); + jdouble (JNICALL *CallNonvirtualDoubleMethodV) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + va_list args); + jdouble (JNICALL *CallNonvirtualDoubleMethodA) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + const jvalue *args); + + void (JNICALL *CallNonvirtualVoidMethod) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...); + void (JNICALL *CallNonvirtualVoidMethodV) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + va_list args); + void (JNICALL *CallNonvirtualVoidMethodA) + (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, + const jvalue * args); + + jfieldID (JNICALL *GetFieldID) + (JNIEnv *env, jclass clazz, const char *name, const char *sig); + + jobject (JNICALL *GetObjectField) + (JNIEnv *env, jobject obj, jfieldID fieldID); + jboolean (JNICALL *GetBooleanField) + (JNIEnv *env, jobject obj, jfieldID fieldID); + jbyte (JNICALL *GetByteField) + (JNIEnv *env, jobject obj, jfieldID fieldID); + jchar (JNICALL *GetCharField) + (JNIEnv *env, jobject obj, jfieldID fieldID); + jshort (JNICALL *GetShortField) + (JNIEnv *env, jobject obj, jfieldID fieldID); + jint (JNICALL *GetIntField) + (JNIEnv *env, jobject obj, jfieldID fieldID); + jlong (JNICALL *GetLongField) + (JNIEnv *env, jobject obj, jfieldID fieldID); + jfloat (JNICALL *GetFloatField) + (JNIEnv *env, jobject obj, jfieldID fieldID); + jdouble (JNICALL *GetDoubleField) + (JNIEnv *env, jobject obj, jfieldID fieldID); + + void (JNICALL *SetObjectField) + (JNIEnv *env, jobject obj, jfieldID fieldID, jobject val); + void (JNICALL *SetBooleanField) + (JNIEnv *env, jobject obj, jfieldID fieldID, jboolean val); + void (JNICALL *SetByteField) + (JNIEnv *env, jobject obj, jfieldID fieldID, jbyte val); + void (JNICALL *SetCharField) + (JNIEnv *env, jobject obj, jfieldID fieldID, jchar val); + void (JNICALL *SetShortField) + (JNIEnv *env, jobject obj, jfieldID fieldID, jshort val); + void (JNICALL *SetIntField) + (JNIEnv *env, jobject obj, jfieldID fieldID, jint val); + void (JNICALL *SetLongField) + (JNIEnv *env, jobject obj, jfieldID fieldID, jlong val); + void (JNICALL *SetFloatField) + (JNIEnv *env, jobject obj, jfieldID fieldID, jfloat val); + void (JNICALL *SetDoubleField) + (JNIEnv *env, jobject obj, jfieldID fieldID, jdouble val); + + jmethodID (JNICALL *GetStaticMethodID) + (JNIEnv *env, jclass clazz, const char *name, const char *sig); + + jobject (JNICALL *CallStaticObjectMethod) + (JNIEnv *env, jclass clazz, jmethodID methodID, ...); + jobject (JNICALL *CallStaticObjectMethodV) + (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); + jobject (JNICALL *CallStaticObjectMethodA) + (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); + + jboolean (JNICALL *CallStaticBooleanMethod) + (JNIEnv *env, jclass clazz, jmethodID methodID, ...); + jboolean (JNICALL *CallStaticBooleanMethodV) + (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); + jboolean (JNICALL *CallStaticBooleanMethodA) + (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); + + jbyte (JNICALL *CallStaticByteMethod) + (JNIEnv *env, jclass clazz, jmethodID methodID, ...); + jbyte (JNICALL *CallStaticByteMethodV) + (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); + jbyte (JNICALL *CallStaticByteMethodA) + (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); + + jchar (JNICALL *CallStaticCharMethod) + (JNIEnv *env, jclass clazz, jmethodID methodID, ...); + jchar (JNICALL *CallStaticCharMethodV) + (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); + jchar (JNICALL *CallStaticCharMethodA) + (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); + + jshort (JNICALL *CallStaticShortMethod) + (JNIEnv *env, jclass clazz, jmethodID methodID, ...); + jshort (JNICALL *CallStaticShortMethodV) + (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); + jshort (JNICALL *CallStaticShortMethodA) + (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); + + jint (JNICALL *CallStaticIntMethod) + (JNIEnv *env, jclass clazz, jmethodID methodID, ...); + jint (JNICALL *CallStaticIntMethodV) + (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); + jint (JNICALL *CallStaticIntMethodA) + (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); + + jlong (JNICALL *CallStaticLongMethod) + (JNIEnv *env, jclass clazz, jmethodID methodID, ...); + jlong (JNICALL *CallStaticLongMethodV) + (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); + jlong (JNICALL *CallStaticLongMethodA) + (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); + + jfloat (JNICALL *CallStaticFloatMethod) + (JNIEnv *env, jclass clazz, jmethodID methodID, ...); + jfloat (JNICALL *CallStaticFloatMethodV) + (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); + jfloat (JNICALL *CallStaticFloatMethodA) + (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); + + jdouble (JNICALL *CallStaticDoubleMethod) + (JNIEnv *env, jclass clazz, jmethodID methodID, ...); + jdouble (JNICALL *CallStaticDoubleMethodV) + (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args); + jdouble (JNICALL *CallStaticDoubleMethodA) + (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args); + + void (JNICALL *CallStaticVoidMethod) + (JNIEnv *env, jclass cls, jmethodID methodID, ...); + void (JNICALL *CallStaticVoidMethodV) + (JNIEnv *env, jclass cls, jmethodID methodID, va_list args); + void (JNICALL *CallStaticVoidMethodA) + (JNIEnv *env, jclass cls, jmethodID methodID, const jvalue * args); + + jfieldID (JNICALL *GetStaticFieldID) + (JNIEnv *env, jclass clazz, const char *name, const char *sig); + jobject (JNICALL *GetStaticObjectField) + (JNIEnv *env, jclass clazz, jfieldID fieldID); + jboolean (JNICALL *GetStaticBooleanField) + (JNIEnv *env, jclass clazz, jfieldID fieldID); + jbyte (JNICALL *GetStaticByteField) + (JNIEnv *env, jclass clazz, jfieldID fieldID); + jchar (JNICALL *GetStaticCharField) + (JNIEnv *env, jclass clazz, jfieldID fieldID); + jshort (JNICALL *GetStaticShortField) + (JNIEnv *env, jclass clazz, jfieldID fieldID); + jint (JNICALL *GetStaticIntField) + (JNIEnv *env, jclass clazz, jfieldID fieldID); + jlong (JNICALL *GetStaticLongField) + (JNIEnv *env, jclass clazz, jfieldID fieldID); + jfloat (JNICALL *GetStaticFloatField) + (JNIEnv *env, jclass clazz, jfieldID fieldID); + jdouble (JNICALL *GetStaticDoubleField) + (JNIEnv *env, jclass clazz, jfieldID fieldID); + + void (JNICALL *SetStaticObjectField) + (JNIEnv *env, jclass clazz, jfieldID fieldID, jobject value); + void (JNICALL *SetStaticBooleanField) + (JNIEnv *env, jclass clazz, jfieldID fieldID, jboolean value); + void (JNICALL *SetStaticByteField) + (JNIEnv *env, jclass clazz, jfieldID fieldID, jbyte value); + void (JNICALL *SetStaticCharField) + (JNIEnv *env, jclass clazz, jfieldID fieldID, jchar value); + void (JNICALL *SetStaticShortField) + (JNIEnv *env, jclass clazz, jfieldID fieldID, jshort value); + void (JNICALL *SetStaticIntField) + (JNIEnv *env, jclass clazz, jfieldID fieldID, jint value); + void (JNICALL *SetStaticLongField) + (JNIEnv *env, jclass clazz, jfieldID fieldID, jlong value); + void (JNICALL *SetStaticFloatField) + (JNIEnv *env, jclass clazz, jfieldID fieldID, jfloat value); + void (JNICALL *SetStaticDoubleField) + (JNIEnv *env, jclass clazz, jfieldID fieldID, jdouble value); + + jstring (JNICALL *NewString) + (JNIEnv *env, const jchar *unicode, jsize len); + jsize (JNICALL *GetStringLength) + (JNIEnv *env, jstring str); + const jchar *(JNICALL *GetStringChars) + (JNIEnv *env, jstring str, jboolean *isCopy); + void (JNICALL *ReleaseStringChars) + (JNIEnv *env, jstring str, const jchar *chars); + + jstring (JNICALL *NewStringUTF) + (JNIEnv *env, const char *utf); + jsize (JNICALL *GetStringUTFLength) + (JNIEnv *env, jstring str); + const char* (JNICALL *GetStringUTFChars) + (JNIEnv *env, jstring str, jboolean *isCopy); + void (JNICALL *ReleaseStringUTFChars) + (JNIEnv *env, jstring str, const char* chars); + + + jsize (JNICALL *GetArrayLength) + (JNIEnv *env, jarray array); + + jobjectArray (JNICALL *NewObjectArray) + (JNIEnv *env, jsize len, jclass clazz, jobject init); + jobject (JNICALL *GetObjectArrayElement) + (JNIEnv *env, jobjectArray array, jsize index); + void (JNICALL *SetObjectArrayElement) + (JNIEnv *env, jobjectArray array, jsize index, jobject val); + + jbooleanArray (JNICALL *NewBooleanArray) + (JNIEnv *env, jsize len); + jbyteArray (JNICALL *NewByteArray) + (JNIEnv *env, jsize len); + jcharArray (JNICALL *NewCharArray) + (JNIEnv *env, jsize len); + jshortArray (JNICALL *NewShortArray) + (JNIEnv *env, jsize len); + jintArray (JNICALL *NewIntArray) + (JNIEnv *env, jsize len); + jlongArray (JNICALL *NewLongArray) + (JNIEnv *env, jsize len); + jfloatArray (JNICALL *NewFloatArray) + (JNIEnv *env, jsize len); + jdoubleArray (JNICALL *NewDoubleArray) + (JNIEnv *env, jsize len); + + jboolean * (JNICALL *GetBooleanArrayElements) + (JNIEnv *env, jbooleanArray array, jboolean *isCopy); + jbyte * (JNICALL *GetByteArrayElements) + (JNIEnv *env, jbyteArray array, jboolean *isCopy); + jchar * (JNICALL *GetCharArrayElements) + (JNIEnv *env, jcharArray array, jboolean *isCopy); + jshort * (JNICALL *GetShortArrayElements) + (JNIEnv *env, jshortArray array, jboolean *isCopy); + jint * (JNICALL *GetIntArrayElements) + (JNIEnv *env, jintArray array, jboolean *isCopy); + jlong * (JNICALL *GetLongArrayElements) + (JNIEnv *env, jlongArray array, jboolean *isCopy); + jfloat * (JNICALL *GetFloatArrayElements) + (JNIEnv *env, jfloatArray array, jboolean *isCopy); + jdouble * (JNICALL *GetDoubleArrayElements) + (JNIEnv *env, jdoubleArray array, jboolean *isCopy); + + void (JNICALL *ReleaseBooleanArrayElements) + (JNIEnv *env, jbooleanArray array, jboolean *elems, jint mode); + void (JNICALL *ReleaseByteArrayElements) + (JNIEnv *env, jbyteArray array, jbyte *elems, jint mode); + void (JNICALL *ReleaseCharArrayElements) + (JNIEnv *env, jcharArray array, jchar *elems, jint mode); + void (JNICALL *ReleaseShortArrayElements) + (JNIEnv *env, jshortArray array, jshort *elems, jint mode); + void (JNICALL *ReleaseIntArrayElements) + (JNIEnv *env, jintArray array, jint *elems, jint mode); + void (JNICALL *ReleaseLongArrayElements) + (JNIEnv *env, jlongArray array, jlong *elems, jint mode); + void (JNICALL *ReleaseFloatArrayElements) + (JNIEnv *env, jfloatArray array, jfloat *elems, jint mode); + void (JNICALL *ReleaseDoubleArrayElements) + (JNIEnv *env, jdoubleArray array, jdouble *elems, jint mode); + + void (JNICALL *GetBooleanArrayRegion) + (JNIEnv *env, jbooleanArray array, jsize start, jsize l, jboolean *buf); + void (JNICALL *GetByteArrayRegion) + (JNIEnv *env, jbyteArray array, jsize start, jsize len, jbyte *buf); + void (JNICALL *GetCharArrayRegion) + (JNIEnv *env, jcharArray array, jsize start, jsize len, jchar *buf); + void (JNICALL *GetShortArrayRegion) + (JNIEnv *env, jshortArray array, jsize start, jsize len, jshort *buf); + void (JNICALL *GetIntArrayRegion) + (JNIEnv *env, jintArray array, jsize start, jsize len, jint *buf); + void (JNICALL *GetLongArrayRegion) + (JNIEnv *env, jlongArray array, jsize start, jsize len, jlong *buf); + void (JNICALL *GetFloatArrayRegion) + (JNIEnv *env, jfloatArray array, jsize start, jsize len, jfloat *buf); + void (JNICALL *GetDoubleArrayRegion) + (JNIEnv *env, jdoubleArray array, jsize start, jsize len, jdouble *buf); + + void (JNICALL *SetBooleanArrayRegion) + (JNIEnv *env, jbooleanArray array, jsize start, jsize l, const jboolean *buf); + void (JNICALL *SetByteArrayRegion) + (JNIEnv *env, jbyteArray array, jsize start, jsize len, const jbyte *buf); + void (JNICALL *SetCharArrayRegion) + (JNIEnv *env, jcharArray array, jsize start, jsize len, const jchar *buf); + void (JNICALL *SetShortArrayRegion) + (JNIEnv *env, jshortArray array, jsize start, jsize len, const jshort *buf); + void (JNICALL *SetIntArrayRegion) + (JNIEnv *env, jintArray array, jsize start, jsize len, const jint *buf); + void (JNICALL *SetLongArrayRegion) + (JNIEnv *env, jlongArray array, jsize start, jsize len, const jlong *buf); + void (JNICALL *SetFloatArrayRegion) + (JNIEnv *env, jfloatArray array, jsize start, jsize len, const jfloat *buf); + void (JNICALL *SetDoubleArrayRegion) + (JNIEnv *env, jdoubleArray array, jsize start, jsize len, const jdouble *buf); + + jint (JNICALL *RegisterNatives) + (JNIEnv *env, jclass clazz, const JNINativeMethod *methods, + jint nMethods); + jint (JNICALL *UnregisterNatives) + (JNIEnv *env, jclass clazz); + + jint (JNICALL *MonitorEnter) + (JNIEnv *env, jobject obj); + jint (JNICALL *MonitorExit) + (JNIEnv *env, jobject obj); + + jint (JNICALL *GetJavaVM) + (JNIEnv *env, JavaVM **vm); + + void (JNICALL *GetStringRegion) + (JNIEnv *env, jstring str, jsize start, jsize len, jchar *buf); + void (JNICALL *GetStringUTFRegion) + (JNIEnv *env, jstring str, jsize start, jsize len, char *buf); + + void * (JNICALL *GetPrimitiveArrayCritical) + (JNIEnv *env, jarray array, jboolean *isCopy); + void (JNICALL *ReleasePrimitiveArrayCritical) + (JNIEnv *env, jarray array, void *carray, jint mode); + + const jchar * (JNICALL *GetStringCritical) + (JNIEnv *env, jstring string, jboolean *isCopy); + void (JNICALL *ReleaseStringCritical) + (JNIEnv *env, jstring string, const jchar *cstring); + + jweak (JNICALL *NewWeakGlobalRef) + (JNIEnv *env, jobject obj); + void (JNICALL *DeleteWeakGlobalRef) + (JNIEnv *env, jweak ref); + + jboolean (JNICALL *ExceptionCheck) + (JNIEnv *env); + + jobject (JNICALL *NewDirectByteBuffer) + (JNIEnv* env, void* address, jlong capacity); + void* (JNICALL *GetDirectBufferAddress) + (JNIEnv* env, jobject buf); + jlong (JNICALL *GetDirectBufferCapacity) + (JNIEnv* env, jobject buf); +}; + +/* + * We use inlined functions for C++ so that programmers can write: + * + * env->FindClass("java/lang/String") + * + * in C++ rather than: + * + * (*env)->FindClass(env, "java/lang/String") + * + * in C. + */ + +struct JNIEnv_ { + const struct JNINativeInterface_ *functions; +#ifdef __cplusplus + + jint GetVersion() { + return functions->GetVersion(this); + } + jclass DefineClass(const char *name, jobject loader, const jbyte *buf, + jsize len) { + return functions->DefineClass(this, name, loader, buf, len); + } + jclass FindClass(const char *name) { + return functions->FindClass(this, name); + } + jmethodID FromReflectedMethod(jobject method) { + return functions->FromReflectedMethod(this,method); + } + jfieldID FromReflectedField(jobject field) { + return functions->FromReflectedField(this,field); + } + + jobject ToReflectedMethod(jclass cls, jmethodID methodID, jboolean isStatic) { + return functions->ToReflectedMethod(this, cls, methodID, isStatic); + } + + jclass GetSuperclass(jclass sub) { + return functions->GetSuperclass(this, sub); + } + jboolean IsAssignableFrom(jclass sub, jclass sup) { + return functions->IsAssignableFrom(this, sub, sup); + } + + jobject ToReflectedField(jclass cls, jfieldID fieldID, jboolean isStatic) { + return functions->ToReflectedField(this,cls,fieldID,isStatic); + } + + jint Throw(jthrowable obj) { + return functions->Throw(this, obj); + } + jint ThrowNew(jclass clazz, const char *msg) { + return functions->ThrowNew(this, clazz, msg); + } + jthrowable ExceptionOccurred() { + return functions->ExceptionOccurred(this); + } + void ExceptionDescribe() { + functions->ExceptionDescribe(this); + } + void ExceptionClear() { + functions->ExceptionClear(this); + } + void FatalError(const char *msg) { + functions->FatalError(this, msg); + } + + jint PushLocalFrame(jint capacity) { + return functions->PushLocalFrame(this,capacity); + } + jobject PopLocalFrame(jobject result) { + return functions->PopLocalFrame(this,result); + } + + jobject NewGlobalRef(jobject lobj) { + return functions->NewGlobalRef(this,lobj); + } + void DeleteGlobalRef(jobject gref) { + functions->DeleteGlobalRef(this,gref); + } + void DeleteLocalRef(jobject obj) { + functions->DeleteLocalRef(this, obj); + } + + jboolean IsSameObject(jobject obj1, jobject obj2) { + return functions->IsSameObject(this,obj1,obj2); + } + + jobject NewLocalRef(jobject ref) { + return functions->NewLocalRef(this,ref); + } + jint EnsureLocalCapacity(jint capacity) { + return functions->EnsureLocalCapacity(this,capacity); + } + + jobject AllocObject(jclass clazz) { + return functions->AllocObject(this,clazz); + } + jobject NewObject(jclass clazz, jmethodID methodID, ...) { + va_list args; + jobject result; + va_start(args, methodID); + result = functions->NewObjectV(this,clazz,methodID,args); + va_end(args); + return result; + } + jobject NewObjectV(jclass clazz, jmethodID methodID, + va_list args) { + return functions->NewObjectV(this,clazz,methodID,args); + } + jobject NewObjectA(jclass clazz, jmethodID methodID, + const jvalue *args) { + return functions->NewObjectA(this,clazz,methodID,args); + } + + jclass GetObjectClass(jobject obj) { + return functions->GetObjectClass(this,obj); + } + jboolean IsInstanceOf(jobject obj, jclass clazz) { + return functions->IsInstanceOf(this,obj,clazz); + } + + jmethodID GetMethodID(jclass clazz, const char *name, + const char *sig) { + return functions->GetMethodID(this,clazz,name,sig); + } + + jobject CallObjectMethod(jobject obj, jmethodID methodID, ...) { + va_list args; + jobject result; + va_start(args,methodID); + result = functions->CallObjectMethodV(this,obj,methodID,args); + va_end(args); + return result; + } + jobject CallObjectMethodV(jobject obj, jmethodID methodID, + va_list args) { + return functions->CallObjectMethodV(this,obj,methodID,args); + } + jobject CallObjectMethodA(jobject obj, jmethodID methodID, + const jvalue * args) { + return functions->CallObjectMethodA(this,obj,methodID,args); + } + + jboolean CallBooleanMethod(jobject obj, + jmethodID methodID, ...) { + va_list args; + jboolean result; + va_start(args,methodID); + result = functions->CallBooleanMethodV(this,obj,methodID,args); + va_end(args); + return result; + } + jboolean CallBooleanMethodV(jobject obj, jmethodID methodID, + va_list args) { + return functions->CallBooleanMethodV(this,obj,methodID,args); + } + jboolean CallBooleanMethodA(jobject obj, jmethodID methodID, + const jvalue * args) { + return functions->CallBooleanMethodA(this,obj,methodID, args); + } + + jbyte CallByteMethod(jobject obj, jmethodID methodID, ...) { + va_list args; + jbyte result; + va_start(args,methodID); + result = functions->CallByteMethodV(this,obj,methodID,args); + va_end(args); + return result; + } + jbyte CallByteMethodV(jobject obj, jmethodID methodID, + va_list args) { + return functions->CallByteMethodV(this,obj,methodID,args); + } + jbyte CallByteMethodA(jobject obj, jmethodID methodID, + const jvalue * args) { + return functions->CallByteMethodA(this,obj,methodID,args); + } + + jchar CallCharMethod(jobject obj, jmethodID methodID, ...) { + va_list args; + jchar result; + va_start(args,methodID); + result = functions->CallCharMethodV(this,obj,methodID,args); + va_end(args); + return result; + } + jchar CallCharMethodV(jobject obj, jmethodID methodID, + va_list args) { + return functions->CallCharMethodV(this,obj,methodID,args); + } + jchar CallCharMethodA(jobject obj, jmethodID methodID, + const jvalue * args) { + return functions->CallCharMethodA(this,obj,methodID,args); + } + + jshort CallShortMethod(jobject obj, jmethodID methodID, ...) { + va_list args; + jshort result; + va_start(args,methodID); + result = functions->CallShortMethodV(this,obj,methodID,args); + va_end(args); + return result; + } + jshort CallShortMethodV(jobject obj, jmethodID methodID, + va_list args) { + return functions->CallShortMethodV(this,obj,methodID,args); + } + jshort CallShortMethodA(jobject obj, jmethodID methodID, + const jvalue * args) { + return functions->CallShortMethodA(this,obj,methodID,args); + } + + jint CallIntMethod(jobject obj, jmethodID methodID, ...) { + va_list args; + jint result; + va_start(args,methodID); + result = functions->CallIntMethodV(this,obj,methodID,args); + va_end(args); + return result; + } + jint CallIntMethodV(jobject obj, jmethodID methodID, + va_list args) { + return functions->CallIntMethodV(this,obj,methodID,args); + } + jint CallIntMethodA(jobject obj, jmethodID methodID, + const jvalue * args) { + return functions->CallIntMethodA(this,obj,methodID,args); + } + + jlong CallLongMethod(jobject obj, jmethodID methodID, ...) { + va_list args; + jlong result; + va_start(args,methodID); + result = functions->CallLongMethodV(this,obj,methodID,args); + va_end(args); + return result; + } + jlong CallLongMethodV(jobject obj, jmethodID methodID, + va_list args) { + return functions->CallLongMethodV(this,obj,methodID,args); + } + jlong CallLongMethodA(jobject obj, jmethodID methodID, + const jvalue * args) { + return functions->CallLongMethodA(this,obj,methodID,args); + } + + jfloat CallFloatMethod(jobject obj, jmethodID methodID, ...) { + va_list args; + jfloat result; + va_start(args,methodID); + result = functions->CallFloatMethodV(this,obj,methodID,args); + va_end(args); + return result; + } + jfloat CallFloatMethodV(jobject obj, jmethodID methodID, + va_list args) { + return functions->CallFloatMethodV(this,obj,methodID,args); + } + jfloat CallFloatMethodA(jobject obj, jmethodID methodID, + const jvalue * args) { + return functions->CallFloatMethodA(this,obj,methodID,args); + } + + jdouble CallDoubleMethod(jobject obj, jmethodID methodID, ...) { + va_list args; + jdouble result; + va_start(args,methodID); + result = functions->CallDoubleMethodV(this,obj,methodID,args); + va_end(args); + return result; + } + jdouble CallDoubleMethodV(jobject obj, jmethodID methodID, + va_list args) { + return functions->CallDoubleMethodV(this,obj,methodID,args); + } + jdouble CallDoubleMethodA(jobject obj, jmethodID methodID, + const jvalue * args) { + return functions->CallDoubleMethodA(this,obj,methodID,args); + } + + void CallVoidMethod(jobject obj, jmethodID methodID, ...) { + va_list args; + va_start(args,methodID); + functions->CallVoidMethodV(this,obj,methodID,args); + va_end(args); + } + void CallVoidMethodV(jobject obj, jmethodID methodID, + va_list args) { + functions->CallVoidMethodV(this,obj,methodID,args); + } + void CallVoidMethodA(jobject obj, jmethodID methodID, + const jvalue * args) { + functions->CallVoidMethodA(this,obj,methodID,args); + } + + jobject CallNonvirtualObjectMethod(jobject obj, jclass clazz, + jmethodID methodID, ...) { + va_list args; + jobject result; + va_start(args,methodID); + result = functions->CallNonvirtualObjectMethodV(this,obj,clazz, + methodID,args); + va_end(args); + return result; + } + jobject CallNonvirtualObjectMethodV(jobject obj, jclass clazz, + jmethodID methodID, va_list args) { + return functions->CallNonvirtualObjectMethodV(this,obj,clazz, + methodID,args); + } + jobject CallNonvirtualObjectMethodA(jobject obj, jclass clazz, + jmethodID methodID, const jvalue * args) { + return functions->CallNonvirtualObjectMethodA(this,obj,clazz, + methodID,args); + } + + jboolean CallNonvirtualBooleanMethod(jobject obj, jclass clazz, + jmethodID methodID, ...) { + va_list args; + jboolean result; + va_start(args,methodID); + result = functions->CallNonvirtualBooleanMethodV(this,obj,clazz, + methodID,args); + va_end(args); + return result; + } + jboolean CallNonvirtualBooleanMethodV(jobject obj, jclass clazz, + jmethodID methodID, va_list args) { + return functions->CallNonvirtualBooleanMethodV(this,obj,clazz, + methodID,args); + } + jboolean CallNonvirtualBooleanMethodA(jobject obj, jclass clazz, + jmethodID methodID, const jvalue * args) { + return functions->CallNonvirtualBooleanMethodA(this,obj,clazz, + methodID, args); + } + + jbyte CallNonvirtualByteMethod(jobject obj, jclass clazz, + jmethodID methodID, ...) { + va_list args; + jbyte result; + va_start(args,methodID); + result = functions->CallNonvirtualByteMethodV(this,obj,clazz, + methodID,args); + va_end(args); + return result; + } + jbyte CallNonvirtualByteMethodV(jobject obj, jclass clazz, + jmethodID methodID, va_list args) { + return functions->CallNonvirtualByteMethodV(this,obj,clazz, + methodID,args); + } + jbyte CallNonvirtualByteMethodA(jobject obj, jclass clazz, + jmethodID methodID, const jvalue * args) { + return functions->CallNonvirtualByteMethodA(this,obj,clazz, + methodID,args); + } + + jchar CallNonvirtualCharMethod(jobject obj, jclass clazz, + jmethodID methodID, ...) { + va_list args; + jchar result; + va_start(args,methodID); + result = functions->CallNonvirtualCharMethodV(this,obj,clazz, + methodID,args); + va_end(args); + return result; + } + jchar CallNonvirtualCharMethodV(jobject obj, jclass clazz, + jmethodID methodID, va_list args) { + return functions->CallNonvirtualCharMethodV(this,obj,clazz, + methodID,args); + } + jchar CallNonvirtualCharMethodA(jobject obj, jclass clazz, + jmethodID methodID, const jvalue * args) { + return functions->CallNonvirtualCharMethodA(this,obj,clazz, + methodID,args); + } + + jshort CallNonvirtualShortMethod(jobject obj, jclass clazz, + jmethodID methodID, ...) { + va_list args; + jshort result; + va_start(args,methodID); + result = functions->CallNonvirtualShortMethodV(this,obj,clazz, + methodID,args); + va_end(args); + return result; + } + jshort CallNonvirtualShortMethodV(jobject obj, jclass clazz, + jmethodID methodID, va_list args) { + return functions->CallNonvirtualShortMethodV(this,obj,clazz, + methodID,args); + } + jshort CallNonvirtualShortMethodA(jobject obj, jclass clazz, + jmethodID methodID, const jvalue * args) { + return functions->CallNonvirtualShortMethodA(this,obj,clazz, + methodID,args); + } + + jint CallNonvirtualIntMethod(jobject obj, jclass clazz, + jmethodID methodID, ...) { + va_list args; + jint result; + va_start(args,methodID); + result = functions->CallNonvirtualIntMethodV(this,obj,clazz, + methodID,args); + va_end(args); + return result; + } + jint CallNonvirtualIntMethodV(jobject obj, jclass clazz, + jmethodID methodID, va_list args) { + return functions->CallNonvirtualIntMethodV(this,obj,clazz, + methodID,args); + } + jint CallNonvirtualIntMethodA(jobject obj, jclass clazz, + jmethodID methodID, const jvalue * args) { + return functions->CallNonvirtualIntMethodA(this,obj,clazz, + methodID,args); + } + + jlong CallNonvirtualLongMethod(jobject obj, jclass clazz, + jmethodID methodID, ...) { + va_list args; + jlong result; + va_start(args,methodID); + result = functions->CallNonvirtualLongMethodV(this,obj,clazz, + methodID,args); + va_end(args); + return result; + } + jlong CallNonvirtualLongMethodV(jobject obj, jclass clazz, + jmethodID methodID, va_list args) { + return functions->CallNonvirtualLongMethodV(this,obj,clazz, + methodID,args); + } + jlong CallNonvirtualLongMethodA(jobject obj, jclass clazz, + jmethodID methodID, const jvalue * args) { + return functions->CallNonvirtualLongMethodA(this,obj,clazz, + methodID,args); + } + + jfloat CallNonvirtualFloatMethod(jobject obj, jclass clazz, + jmethodID methodID, ...) { + va_list args; + jfloat result; + va_start(args,methodID); + result = functions->CallNonvirtualFloatMethodV(this,obj,clazz, + methodID,args); + va_end(args); + return result; + } + jfloat CallNonvirtualFloatMethodV(jobject obj, jclass clazz, + jmethodID methodID, + va_list args) { + return functions->CallNonvirtualFloatMethodV(this,obj,clazz, + methodID,args); + } + jfloat CallNonvirtualFloatMethodA(jobject obj, jclass clazz, + jmethodID methodID, + const jvalue * args) { + return functions->CallNonvirtualFloatMethodA(this,obj,clazz, + methodID,args); + } + + jdouble CallNonvirtualDoubleMethod(jobject obj, jclass clazz, + jmethodID methodID, ...) { + va_list args; + jdouble result; + va_start(args,methodID); + result = functions->CallNonvirtualDoubleMethodV(this,obj,clazz, + methodID,args); + va_end(args); + return result; + } + jdouble CallNonvirtualDoubleMethodV(jobject obj, jclass clazz, + jmethodID methodID, + va_list args) { + return functions->CallNonvirtualDoubleMethodV(this,obj,clazz, + methodID,args); + } + jdouble CallNonvirtualDoubleMethodA(jobject obj, jclass clazz, + jmethodID methodID, + const jvalue * args) { + return functions->CallNonvirtualDoubleMethodA(this,obj,clazz, + methodID,args); + } + + void CallNonvirtualVoidMethod(jobject obj, jclass clazz, + jmethodID methodID, ...) { + va_list args; + va_start(args,methodID); + functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args); + va_end(args); + } + void CallNonvirtualVoidMethodV(jobject obj, jclass clazz, + jmethodID methodID, + va_list args) { + functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args); + } + void CallNonvirtualVoidMethodA(jobject obj, jclass clazz, + jmethodID methodID, + const jvalue * args) { + functions->CallNonvirtualVoidMethodA(this,obj,clazz,methodID,args); + } + + jfieldID GetFieldID(jclass clazz, const char *name, + const char *sig) { + return functions->GetFieldID(this,clazz,name,sig); + } + + jobject GetObjectField(jobject obj, jfieldID fieldID) { + return functions->GetObjectField(this,obj,fieldID); + } + jboolean GetBooleanField(jobject obj, jfieldID fieldID) { + return functions->GetBooleanField(this,obj,fieldID); + } + jbyte GetByteField(jobject obj, jfieldID fieldID) { + return functions->GetByteField(this,obj,fieldID); + } + jchar GetCharField(jobject obj, jfieldID fieldID) { + return functions->GetCharField(this,obj,fieldID); + } + jshort GetShortField(jobject obj, jfieldID fieldID) { + return functions->GetShortField(this,obj,fieldID); + } + jint GetIntField(jobject obj, jfieldID fieldID) { + return functions->GetIntField(this,obj,fieldID); + } + jlong GetLongField(jobject obj, jfieldID fieldID) { + return functions->GetLongField(this,obj,fieldID); + } + jfloat GetFloatField(jobject obj, jfieldID fieldID) { + return functions->GetFloatField(this,obj,fieldID); + } + jdouble GetDoubleField(jobject obj, jfieldID fieldID) { + return functions->GetDoubleField(this,obj,fieldID); + } + + void SetObjectField(jobject obj, jfieldID fieldID, jobject val) { + functions->SetObjectField(this,obj,fieldID,val); + } + void SetBooleanField(jobject obj, jfieldID fieldID, + jboolean val) { + functions->SetBooleanField(this,obj,fieldID,val); + } + void SetByteField(jobject obj, jfieldID fieldID, + jbyte val) { + functions->SetByteField(this,obj,fieldID,val); + } + void SetCharField(jobject obj, jfieldID fieldID, + jchar val) { + functions->SetCharField(this,obj,fieldID,val); + } + void SetShortField(jobject obj, jfieldID fieldID, + jshort val) { + functions->SetShortField(this,obj,fieldID,val); + } + void SetIntField(jobject obj, jfieldID fieldID, + jint val) { + functions->SetIntField(this,obj,fieldID,val); + } + void SetLongField(jobject obj, jfieldID fieldID, + jlong val) { + functions->SetLongField(this,obj,fieldID,val); + } + void SetFloatField(jobject obj, jfieldID fieldID, + jfloat val) { + functions->SetFloatField(this,obj,fieldID,val); + } + void SetDoubleField(jobject obj, jfieldID fieldID, + jdouble val) { + functions->SetDoubleField(this,obj,fieldID,val); + } + + jmethodID GetStaticMethodID(jclass clazz, const char *name, + const char *sig) { + return functions->GetStaticMethodID(this,clazz,name,sig); + } + + jobject CallStaticObjectMethod(jclass clazz, jmethodID methodID, + ...) { + va_list args; + jobject result; + va_start(args,methodID); + result = functions->CallStaticObjectMethodV(this,clazz,methodID,args); + va_end(args); + return result; + } + jobject CallStaticObjectMethodV(jclass clazz, jmethodID methodID, + va_list args) { + return functions->CallStaticObjectMethodV(this,clazz,methodID,args); + } + jobject CallStaticObjectMethodA(jclass clazz, jmethodID methodID, + const jvalue *args) { + return functions->CallStaticObjectMethodA(this,clazz,methodID,args); + } + + jboolean CallStaticBooleanMethod(jclass clazz, + jmethodID methodID, ...) { + va_list args; + jboolean result; + va_start(args,methodID); + result = functions->CallStaticBooleanMethodV(this,clazz,methodID,args); + va_end(args); + return result; + } + jboolean CallStaticBooleanMethodV(jclass clazz, + jmethodID methodID, va_list args) { + return functions->CallStaticBooleanMethodV(this,clazz,methodID,args); + } + jboolean CallStaticBooleanMethodA(jclass clazz, + jmethodID methodID, const jvalue *args) { + return functions->CallStaticBooleanMethodA(this,clazz,methodID,args); + } + + jbyte CallStaticByteMethod(jclass clazz, + jmethodID methodID, ...) { + va_list args; + jbyte result; + va_start(args,methodID); + result = functions->CallStaticByteMethodV(this,clazz,methodID,args); + va_end(args); + return result; + } + jbyte CallStaticByteMethodV(jclass clazz, + jmethodID methodID, va_list args) { + return functions->CallStaticByteMethodV(this,clazz,methodID,args); + } + jbyte CallStaticByteMethodA(jclass clazz, + jmethodID methodID, const jvalue *args) { + return functions->CallStaticByteMethodA(this,clazz,methodID,args); + } + + jchar CallStaticCharMethod(jclass clazz, + jmethodID methodID, ...) { + va_list args; + jchar result; + va_start(args,methodID); + result = functions->CallStaticCharMethodV(this,clazz,methodID,args); + va_end(args); + return result; + } + jchar CallStaticCharMethodV(jclass clazz, + jmethodID methodID, va_list args) { + return functions->CallStaticCharMethodV(this,clazz,methodID,args); + } + jchar CallStaticCharMethodA(jclass clazz, + jmethodID methodID, const jvalue *args) { + return functions->CallStaticCharMethodA(this,clazz,methodID,args); + } + + jshort CallStaticShortMethod(jclass clazz, + jmethodID methodID, ...) { + va_list args; + jshort result; + va_start(args,methodID); + result = functions->CallStaticShortMethodV(this,clazz,methodID,args); + va_end(args); + return result; + } + jshort CallStaticShortMethodV(jclass clazz, + jmethodID methodID, va_list args) { + return functions->CallStaticShortMethodV(this,clazz,methodID,args); + } + jshort CallStaticShortMethodA(jclass clazz, + jmethodID methodID, const jvalue *args) { + return functions->CallStaticShortMethodA(this,clazz,methodID,args); + } + + jint CallStaticIntMethod(jclass clazz, + jmethodID methodID, ...) { + va_list args; + jint result; + va_start(args,methodID); + result = functions->CallStaticIntMethodV(this,clazz,methodID,args); + va_end(args); + return result; + } + jint CallStaticIntMethodV(jclass clazz, + jmethodID methodID, va_list args) { + return functions->CallStaticIntMethodV(this,clazz,methodID,args); + } + jint CallStaticIntMethodA(jclass clazz, + jmethodID methodID, const jvalue *args) { + return functions->CallStaticIntMethodA(this,clazz,methodID,args); + } + + jlong CallStaticLongMethod(jclass clazz, + jmethodID methodID, ...) { + va_list args; + jlong result; + va_start(args,methodID); + result = functions->CallStaticLongMethodV(this,clazz,methodID,args); + va_end(args); + return result; + } + jlong CallStaticLongMethodV(jclass clazz, + jmethodID methodID, va_list args) { + return functions->CallStaticLongMethodV(this,clazz,methodID,args); + } + jlong CallStaticLongMethodA(jclass clazz, + jmethodID methodID, const jvalue *args) { + return functions->CallStaticLongMethodA(this,clazz,methodID,args); + } + + jfloat CallStaticFloatMethod(jclass clazz, + jmethodID methodID, ...) { + va_list args; + jfloat result; + va_start(args,methodID); + result = functions->CallStaticFloatMethodV(this,clazz,methodID,args); + va_end(args); + return result; + } + jfloat CallStaticFloatMethodV(jclass clazz, + jmethodID methodID, va_list args) { + return functions->CallStaticFloatMethodV(this,clazz,methodID,args); + } + jfloat CallStaticFloatMethodA(jclass clazz, + jmethodID methodID, const jvalue *args) { + return functions->CallStaticFloatMethodA(this,clazz,methodID,args); + } + + jdouble CallStaticDoubleMethod(jclass clazz, + jmethodID methodID, ...) { + va_list args; + jdouble result; + va_start(args,methodID); + result = functions->CallStaticDoubleMethodV(this,clazz,methodID,args); + va_end(args); + return result; + } + jdouble CallStaticDoubleMethodV(jclass clazz, + jmethodID methodID, va_list args) { + return functions->CallStaticDoubleMethodV(this,clazz,methodID,args); + } + jdouble CallStaticDoubleMethodA(jclass clazz, + jmethodID methodID, const jvalue *args) { + return functions->CallStaticDoubleMethodA(this,clazz,methodID,args); + } + + void CallStaticVoidMethod(jclass cls, jmethodID methodID, ...) { + va_list args; + va_start(args,methodID); + functions->CallStaticVoidMethodV(this,cls,methodID,args); + va_end(args); + } + void CallStaticVoidMethodV(jclass cls, jmethodID methodID, + va_list args) { + functions->CallStaticVoidMethodV(this,cls,methodID,args); + } + void CallStaticVoidMethodA(jclass cls, jmethodID methodID, + const jvalue * args) { + functions->CallStaticVoidMethodA(this,cls,methodID,args); + } + + jfieldID GetStaticFieldID(jclass clazz, const char *name, + const char *sig) { + return functions->GetStaticFieldID(this,clazz,name,sig); + } + jobject GetStaticObjectField(jclass clazz, jfieldID fieldID) { + return functions->GetStaticObjectField(this,clazz,fieldID); + } + jboolean GetStaticBooleanField(jclass clazz, jfieldID fieldID) { + return functions->GetStaticBooleanField(this,clazz,fieldID); + } + jbyte GetStaticByteField(jclass clazz, jfieldID fieldID) { + return functions->GetStaticByteField(this,clazz,fieldID); + } + jchar GetStaticCharField(jclass clazz, jfieldID fieldID) { + return functions->GetStaticCharField(this,clazz,fieldID); + } + jshort GetStaticShortField(jclass clazz, jfieldID fieldID) { + return functions->GetStaticShortField(this,clazz,fieldID); + } + jint GetStaticIntField(jclass clazz, jfieldID fieldID) { + return functions->GetStaticIntField(this,clazz,fieldID); + } + jlong GetStaticLongField(jclass clazz, jfieldID fieldID) { + return functions->GetStaticLongField(this,clazz,fieldID); + } + jfloat GetStaticFloatField(jclass clazz, jfieldID fieldID) { + return functions->GetStaticFloatField(this,clazz,fieldID); + } + jdouble GetStaticDoubleField(jclass clazz, jfieldID fieldID) { + return functions->GetStaticDoubleField(this,clazz,fieldID); + } + + void SetStaticObjectField(jclass clazz, jfieldID fieldID, + jobject value) { + functions->SetStaticObjectField(this,clazz,fieldID,value); + } + void SetStaticBooleanField(jclass clazz, jfieldID fieldID, + jboolean value) { + functions->SetStaticBooleanField(this,clazz,fieldID,value); + } + void SetStaticByteField(jclass clazz, jfieldID fieldID, + jbyte value) { + functions->SetStaticByteField(this,clazz,fieldID,value); + } + void SetStaticCharField(jclass clazz, jfieldID fieldID, + jchar value) { + functions->SetStaticCharField(this,clazz,fieldID,value); + } + void SetStaticShortField(jclass clazz, jfieldID fieldID, + jshort value) { + functions->SetStaticShortField(this,clazz,fieldID,value); + } + void SetStaticIntField(jclass clazz, jfieldID fieldID, + jint value) { + functions->SetStaticIntField(this,clazz,fieldID,value); + } + void SetStaticLongField(jclass clazz, jfieldID fieldID, + jlong value) { + functions->SetStaticLongField(this,clazz,fieldID,value); + } + void SetStaticFloatField(jclass clazz, jfieldID fieldID, + jfloat value) { + functions->SetStaticFloatField(this,clazz,fieldID,value); + } + void SetStaticDoubleField(jclass clazz, jfieldID fieldID, + jdouble value) { + functions->SetStaticDoubleField(this,clazz,fieldID,value); + } + + jstring NewString(const jchar *unicode, jsize len) { + return functions->NewString(this,unicode,len); + } + jsize GetStringLength(jstring str) { + return functions->GetStringLength(this,str); + } + const jchar *GetStringChars(jstring str, jboolean *isCopy) { + return functions->GetStringChars(this,str,isCopy); + } + void ReleaseStringChars(jstring str, const jchar *chars) { + functions->ReleaseStringChars(this,str,chars); + } + + jstring NewStringUTF(const char *utf) { + return functions->NewStringUTF(this,utf); + } + jsize GetStringUTFLength(jstring str) { + return functions->GetStringUTFLength(this,str); + } + const char* GetStringUTFChars(jstring str, jboolean *isCopy) { + return functions->GetStringUTFChars(this,str,isCopy); + } + void ReleaseStringUTFChars(jstring str, const char* chars) { + functions->ReleaseStringUTFChars(this,str,chars); + } + + jsize GetArrayLength(jarray array) { + return functions->GetArrayLength(this,array); + } + + jobjectArray NewObjectArray(jsize len, jclass clazz, + jobject init) { + return functions->NewObjectArray(this,len,clazz,init); + } + jobject GetObjectArrayElement(jobjectArray array, jsize index) { + return functions->GetObjectArrayElement(this,array,index); + } + void SetObjectArrayElement(jobjectArray array, jsize index, + jobject val) { + functions->SetObjectArrayElement(this,array,index,val); + } + + jbooleanArray NewBooleanArray(jsize len) { + return functions->NewBooleanArray(this,len); + } + jbyteArray NewByteArray(jsize len) { + return functions->NewByteArray(this,len); + } + jcharArray NewCharArray(jsize len) { + return functions->NewCharArray(this,len); + } + jshortArray NewShortArray(jsize len) { + return functions->NewShortArray(this,len); + } + jintArray NewIntArray(jsize len) { + return functions->NewIntArray(this,len); + } + jlongArray NewLongArray(jsize len) { + return functions->NewLongArray(this,len); + } + jfloatArray NewFloatArray(jsize len) { + return functions->NewFloatArray(this,len); + } + jdoubleArray NewDoubleArray(jsize len) { + return functions->NewDoubleArray(this,len); + } + + jboolean * GetBooleanArrayElements(jbooleanArray array, jboolean *isCopy) { + return functions->GetBooleanArrayElements(this,array,isCopy); + } + jbyte * GetByteArrayElements(jbyteArray array, jboolean *isCopy) { + return functions->GetByteArrayElements(this,array,isCopy); + } + jchar * GetCharArrayElements(jcharArray array, jboolean *isCopy) { + return functions->GetCharArrayElements(this,array,isCopy); + } + jshort * GetShortArrayElements(jshortArray array, jboolean *isCopy) { + return functions->GetShortArrayElements(this,array,isCopy); + } + jint * GetIntArrayElements(jintArray array, jboolean *isCopy) { + return functions->GetIntArrayElements(this,array,isCopy); + } + jlong * GetLongArrayElements(jlongArray array, jboolean *isCopy) { + return functions->GetLongArrayElements(this,array,isCopy); + } + jfloat * GetFloatArrayElements(jfloatArray array, jboolean *isCopy) { + return functions->GetFloatArrayElements(this,array,isCopy); + } + jdouble * GetDoubleArrayElements(jdoubleArray array, jboolean *isCopy) { + return functions->GetDoubleArrayElements(this,array,isCopy); + } + + void ReleaseBooleanArrayElements(jbooleanArray array, + jboolean *elems, + jint mode) { + functions->ReleaseBooleanArrayElements(this,array,elems,mode); + } + void ReleaseByteArrayElements(jbyteArray array, + jbyte *elems, + jint mode) { + functions->ReleaseByteArrayElements(this,array,elems,mode); + } + void ReleaseCharArrayElements(jcharArray array, + jchar *elems, + jint mode) { + functions->ReleaseCharArrayElements(this,array,elems,mode); + } + void ReleaseShortArrayElements(jshortArray array, + jshort *elems, + jint mode) { + functions->ReleaseShortArrayElements(this,array,elems,mode); + } + void ReleaseIntArrayElements(jintArray array, + jint *elems, + jint mode) { + functions->ReleaseIntArrayElements(this,array,elems,mode); + } + void ReleaseLongArrayElements(jlongArray array, + jlong *elems, + jint mode) { + functions->ReleaseLongArrayElements(this,array,elems,mode); + } + void ReleaseFloatArrayElements(jfloatArray array, + jfloat *elems, + jint mode) { + functions->ReleaseFloatArrayElements(this,array,elems,mode); + } + void ReleaseDoubleArrayElements(jdoubleArray array, + jdouble *elems, + jint mode) { + functions->ReleaseDoubleArrayElements(this,array,elems,mode); + } + + void GetBooleanArrayRegion(jbooleanArray array, + jsize start, jsize len, jboolean *buf) { + functions->GetBooleanArrayRegion(this,array,start,len,buf); + } + void GetByteArrayRegion(jbyteArray array, + jsize start, jsize len, jbyte *buf) { + functions->GetByteArrayRegion(this,array,start,len,buf); + } + void GetCharArrayRegion(jcharArray array, + jsize start, jsize len, jchar *buf) { + functions->GetCharArrayRegion(this,array,start,len,buf); + } + void GetShortArrayRegion(jshortArray array, + jsize start, jsize len, jshort *buf) { + functions->GetShortArrayRegion(this,array,start,len,buf); + } + void GetIntArrayRegion(jintArray array, + jsize start, jsize len, jint *buf) { + functions->GetIntArrayRegion(this,array,start,len,buf); + } + void GetLongArrayRegion(jlongArray array, + jsize start, jsize len, jlong *buf) { + functions->GetLongArrayRegion(this,array,start,len,buf); + } + void GetFloatArrayRegion(jfloatArray array, + jsize start, jsize len, jfloat *buf) { + functions->GetFloatArrayRegion(this,array,start,len,buf); + } + void GetDoubleArrayRegion(jdoubleArray array, + jsize start, jsize len, jdouble *buf) { + functions->GetDoubleArrayRegion(this,array,start,len,buf); + } + + void SetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len, + const jboolean *buf) { + functions->SetBooleanArrayRegion(this,array,start,len,buf); + } + void SetByteArrayRegion(jbyteArray array, jsize start, jsize len, + const jbyte *buf) { + functions->SetByteArrayRegion(this,array,start,len,buf); + } + void SetCharArrayRegion(jcharArray array, jsize start, jsize len, + const jchar *buf) { + functions->SetCharArrayRegion(this,array,start,len,buf); + } + void SetShortArrayRegion(jshortArray array, jsize start, jsize len, + const jshort *buf) { + functions->SetShortArrayRegion(this,array,start,len,buf); + } + void SetIntArrayRegion(jintArray array, jsize start, jsize len, + const jint *buf) { + functions->SetIntArrayRegion(this,array,start,len,buf); + } + void SetLongArrayRegion(jlongArray array, jsize start, jsize len, + const jlong *buf) { + functions->SetLongArrayRegion(this,array,start,len,buf); + } + void SetFloatArrayRegion(jfloatArray array, jsize start, jsize len, + const jfloat *buf) { + functions->SetFloatArrayRegion(this,array,start,len,buf); + } + void SetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len, + const jdouble *buf) { + functions->SetDoubleArrayRegion(this,array,start,len,buf); + } + + jint RegisterNatives(jclass clazz, const JNINativeMethod *methods, + jint nMethods) { + return functions->RegisterNatives(this,clazz,methods,nMethods); + } + jint UnregisterNatives(jclass clazz) { + return functions->UnregisterNatives(this,clazz); + } + + jint MonitorEnter(jobject obj) { + return functions->MonitorEnter(this,obj); + } + jint MonitorExit(jobject obj) { + return functions->MonitorExit(this,obj); + } + + jint GetJavaVM(JavaVM **vm) { + return functions->GetJavaVM(this,vm); + } + + void GetStringRegion(jstring str, jsize start, jsize len, jchar *buf) { + functions->GetStringRegion(this,str,start,len,buf); + } + void GetStringUTFRegion(jstring str, jsize start, jsize len, char *buf) { + functions->GetStringUTFRegion(this,str,start,len,buf); + } + + void * GetPrimitiveArrayCritical(jarray array, jboolean *isCopy) { + return functions->GetPrimitiveArrayCritical(this,array,isCopy); + } + void ReleasePrimitiveArrayCritical(jarray array, void *carray, jint mode) { + functions->ReleasePrimitiveArrayCritical(this,array,carray,mode); + } + + const jchar * GetStringCritical(jstring string, jboolean *isCopy) { + return functions->GetStringCritical(this,string,isCopy); + } + void ReleaseStringCritical(jstring string, const jchar *cstring) { + functions->ReleaseStringCritical(this,string,cstring); + } + + jweak NewWeakGlobalRef(jobject obj) { + return functions->NewWeakGlobalRef(this,obj); + } + void DeleteWeakGlobalRef(jweak ref) { + functions->DeleteWeakGlobalRef(this,ref); + } + + jboolean ExceptionCheck() { + return functions->ExceptionCheck(this); + } + + jobject NewDirectByteBuffer(void* address, jlong capacity) { + return functions->NewDirectByteBuffer(this, address, capacity); + } + void* GetDirectBufferAddress(jobject buf) { + return functions->GetDirectBufferAddress(this, buf); + } + jlong GetDirectBufferCapacity(jobject buf) { + return functions->GetDirectBufferCapacity(this, buf); + } + +#endif /* __cplusplus */ +}; + +typedef struct JavaVMOption { + char *optionString; + void *extraInfo; +} JavaVMOption; + +typedef struct JavaVMInitArgs { + jint version; + + jint nOptions; + JavaVMOption *options; + jboolean ignoreUnrecognized; +} JavaVMInitArgs; + +typedef struct JavaVMAttachArgs { + jint version; + + char *name; + jobject group; +} JavaVMAttachArgs; + +/* These structures will be VM-specific. */ + +typedef struct JDK1_1InitArgs { + jint version; + + char **properties; + jint checkSource; + jint nativeStackSize; + jint javaStackSize; + jint minHeapSize; + jint maxHeapSize; + jint verifyMode; + char *classpath; + + jint (JNICALL *vfprintf)(FILE *fp, const char *format, va_list args); + void (JNICALL *exit)(jint code); + void (JNICALL *abort)(void); + + jint enableClassGC; + jint enableVerboseGC; + jint disableAsyncGC; + jint verbose; + jboolean debugging; + jint debugPort; +} JDK1_1InitArgs; + +typedef struct JDK1_1AttachArgs { + void * __padding; /* C compilers don't allow empty structures. */ +} JDK1_1AttachArgs; + +#define JDK1_2 +#define JDK1_4 + +/* End VM-specific. */ + +struct JNIInvokeInterface_ { + void *reserved0; + void *reserved1; + void *reserved2; + + jint (JNICALL *DestroyJavaVM)(JavaVM *vm); + + jint (JNICALL *AttachCurrentThread)(JavaVM *vm, void **penv, void *args); + + jint (JNICALL *DetachCurrentThread)(JavaVM *vm); + + jint (JNICALL *GetEnv)(JavaVM *vm, void **penv, jint version); + + jint (JNICALL *AttachCurrentThreadAsDaemon)(JavaVM *vm, void **penv, void *args); +}; + +struct JavaVM_ { + const struct JNIInvokeInterface_ *functions; +#ifdef __cplusplus + + jint DestroyJavaVM() { + return functions->DestroyJavaVM(this); + } + jint AttachCurrentThread(void **penv, void *args) { + return functions->AttachCurrentThread(this, penv, args); + } + jint DetachCurrentThread() { + return functions->DetachCurrentThread(this); + } + + jint GetEnv(void **penv, jint version) { + return functions->GetEnv(this, penv, version); + } + jint AttachCurrentThreadAsDaemon(void **penv, void *args) { + return functions->AttachCurrentThreadAsDaemon(this, penv, args); + } +#endif +}; + +#ifdef _JNI_IMPLEMENTATION_ +#define _JNI_IMPORT_OR_EXPORT_ JNIEXPORT +#else +#define _JNI_IMPORT_OR_EXPORT_ JNIIMPORT +#endif +_JNI_IMPORT_OR_EXPORT_ jint JNICALL +JNI_GetDefaultJavaVMInitArgs(void *args); + +_JNI_IMPORT_OR_EXPORT_ jint JNICALL +JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *args); + +_JNI_IMPORT_OR_EXPORT_ jint JNICALL +JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *); + +/* Defined by native libraries. */ +JNIEXPORT jint JNICALL +JNI_OnLoad(JavaVM *vm, void *reserved); + +JNIEXPORT void JNICALL +JNI_OnUnload(JavaVM *vm, void *reserved); + +#define JNI_VERSION_1_1 0x00010001 +#define JNI_VERSION_1_2 0x00010002 +#define JNI_VERSION_1_4 0x00010004 + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* !_JAVASOFT_JNI_H_ */ diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/jdk1.5.0_10/include/jvmdi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/jdk1.5.0_10/include/jvmdi.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,1012 @@ +/* + * @(#)jvmdi.h 1.48 03/12/19 + * + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + */ + +/* + * Java Virtual Machine Debug Interface + * + * Defines debugging functionality that a VM should provide. + * + * Should not overlap functionality in jni.h + */ + +#ifndef _JAVASOFT_JVMDI_H_ +#define _JAVASOFT_JVMDI_H_ + +#include "jni.h" + +#define JVMDI_VERSION_1 0x20010000 +#define JVMDI_VERSION_1_1 0x20010001 +#define JVMDI_VERSION_1_2 0x20010002 +#define JVMDI_VERSION_1_3 0x20010003 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef jobject jthread; + +typedef jobject jthreadGroup; + +struct _jframeID; +typedef struct _jframeID *jframeID; + + /* specifies program location "pc" - often byte code index */ +typedef jlong jlocation; + + /* The jmethodID for methods that have been replaced */ + /* via RedefineClasses - used when the implementation */ + /* does not wish to retain replaced jmethodIDs */ +#define OBSOLETE_METHOD_ID ((jmethodID)(NULL)) + + /* + * Errors + */ + +typedef jint jvmdiError; + + /* no error */ +#define JVMDI_ERROR_NONE ((jvmdiError)0) + + /* + * Errors on thread operations + */ + + /* invalid thread */ +#define JVMDI_ERROR_INVALID_THREAD ((jvmdiError)10) + /* invalid thread group */ +#define JVMDI_ERROR_INVALID_THREAD_GROUP ((jvmdiError)11) + /* invalid thread priority */ +#define JVMDI_ERROR_INVALID_PRIORITY ((jvmdiError)12) + /* thread not suspended */ +#define JVMDI_ERROR_THREAD_NOT_SUSPENDED ((jvmdiError)13) + /* thread already suspended */ +#define JVMDI_ERROR_THREAD_SUSPENDED ((jvmdiError)14) + + /* + * Errors on object and class operations + */ + + /* invalid object (implementation not required to gracefully catch) */ +#define JVMDI_ERROR_INVALID_OBJECT ((jvmdiError)20) + /* invalid class (implementation not required to gracefully catch) */ +#define JVMDI_ERROR_INVALID_CLASS ((jvmdiError)21) + /* class not prepared */ +#define JVMDI_ERROR_CLASS_NOT_PREPARED ((jvmdiError)22) + /* invalid methodID (implementation not required to gracefully catch) */ +#define JVMDI_ERROR_INVALID_METHODID ((jvmdiError)23) + /* invalid location */ +#define JVMDI_ERROR_INVALID_LOCATION ((jvmdiError)24) + /* invalid fieldID (implementation not required to gracefully catch) */ +#define JVMDI_ERROR_INVALID_FIELDID ((jvmdiError)25) + + /* + * Errors on frame operations + */ + + /* invalid frameID (implementation not required to gracefully catch) */ +#define JVMDI_ERROR_INVALID_FRAMEID ((jvmdiError)30) + /* there are no more frames on the stack */ +#define JVMDI_ERROR_NO_MORE_FRAMES ((jvmdiError)31) + /* operation cannot be performed on this frame */ +#define JVMDI_ERROR_OPAQUE_FRAME ((jvmdiError)32) + /* operation can only be performed on current frame */ +#define JVMDI_ERROR_NOT_CURRENT_FRAME ((jvmdiError)33) + /* type mismatch (implementation not required to gracefully catch) */ +#define JVMDI_ERROR_TYPE_MISMATCH ((jvmdiError)34) + /* invalid slot */ +#define JVMDI_ERROR_INVALID_SLOT ((jvmdiError)35) + + /* + * Errors on set/clear/find operations + */ + + /* item already present */ +#define JVMDI_ERROR_DUPLICATE ((jvmdiError)40) + /* item not found */ +#define JVMDI_ERROR_NOT_FOUND ((jvmdiError)41) + + /* + * Errors on monitor operations + */ + + /* invalid monitor */ +#define JVMDI_ERROR_INVALID_MONITOR ((jvmdiError)50) + /* wait, notify, notify all tried without entering monitor */ +#define JVMDI_ERROR_NOT_MONITOR_OWNER ((jvmdiError)51) + /* waiting thread interrupted */ +#define JVMDI_ERROR_INTERRUPT ((jvmdiError)52) + + /* + * Class redefinition / operand stack errors + */ + + /* The equivalent of ClassFormatError */ +#define JVMDI_ERROR_INVALID_CLASS_FORMAT ((jvmdiError)60) + /* The equivalent of ClassCircularityError */ +#define JVMDI_ERROR_CIRCULAR_CLASS_DEFINITION ((jvmdiError)61) + /* The class bytes fail verification */ +#define JVMDI_ERROR_FAILS_VERIFICATION ((jvmdiError)62) + /* The new class version adds new methods */ + /* and can_add_method is false */ +#define JVMDI_ERROR_ADD_METHOD_NOT_IMPLEMENTED ((jvmdiError)63) + /* The new class version changes fields */ + /* and can_unrestrictedly_redefine_classes is false */ +#define JVMDI_ERROR_SCHEMA_CHANGE_NOT_IMPLEMENTED ((jvmdiError)64) + /* bci/operand stack/local var combination is not verifiably */ + /* type safe */ +#define JVMDI_ERROR_INVALID_TYPESTATE ((jvmdiError)65) + /* A direct superclass is different for the new class */ + /* version, or the set of directly implemented */ + /* interfaces is different */ + /* and can_unrestrictedly_redefine_classes is false */ +#define JVMDI_ERROR_HIERARCHY_CHANGE_NOT_IMPLEMENTED ((jvmdiError)66) + /* The new class version does not declare a method */ + /* declared in the old class version */ + /* and can_unrestrictedly_redefine_classes is false */ +#define JVMDI_ERROR_DELETE_METHOD_NOT_IMPLEMENTED ((jvmdiError)67) + /* A class file has a version number not supported */ + /* by this VM. */ +#define JVMDI_ERROR_UNSUPPORTED_VERSION ((jvmdiError)68) + /* The class name defined in the new class file is */ + /* different from the name in the old class object */ +#define JVMDI_ERROR_NAMES_DONT_MATCH ((jvmdiError)69) + /* The new class version has different modifiers and */ + /* can_unrestrictedly_redefine_classes is false */ +#define JVMDI_ERROR_CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED ((jvmdiError)70) + /* A method in the new class version has different modifiers */ + /* than its counterpart in the old class version */ + /* and can_unrestrictedly_redefine_classes is false */ +#define JVMDI_ERROR_METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED ((jvmdiError)71) + + /* + * Miscellaneous errors + */ + + /* Not yet implemented */ +#define JVMDI_ERROR_NOT_IMPLEMENTED ((jvmdiError)99) + /* null pointer */ +#define JVMDI_ERROR_NULL_POINTER ((jvmdiError)100) + /* information is absent */ +#define JVMDI_ERROR_ABSENT_INFORMATION ((jvmdiError)101) + /* invalid event type */ +#define JVMDI_ERROR_INVALID_EVENT_TYPE ((jvmdiError)102) + /* invalid argument */ +#define JVMDI_ERROR_ILLEGAL_ARGUMENT ((jvmdiError)103) + + /* + * Universal errors. These errors may be returned by + * any JVMDI function, not just the ones for which they are listed + * below. + */ + + /* no more memory available for allocation */ +#define JVMDI_ERROR_OUT_OF_MEMORY ((jvmdiError)110) + /* debugging has not been enabled in this VM */ +#define JVMDI_ERROR_ACCESS_DENIED ((jvmdiError)111) + /* VM is dead (implementation not required to gracefully catch) */ +#define JVMDI_ERROR_VM_DEAD ((jvmdiError)112) + /* internal error */ +#define JVMDI_ERROR_INTERNAL ((jvmdiError)113) + /* Thread calling JVMDI function not attached to VM */ +#define JVMDI_ERROR_UNATTACHED_THREAD ((jvmdiError)115) + + + /* + * Threads + */ + + /* Thread status is unknown */ +#define JVMDI_THREAD_STATUS_UNKNOWN ((jint)-1) + /* Thread is waiting to die */ +#define JVMDI_THREAD_STATUS_ZOMBIE ((jint)0) + /* Thread is runnable */ +#define JVMDI_THREAD_STATUS_RUNNING ((jint)1) + /* Thread is sleeping - Thread.sleep() or JVM_Sleep() was called */ +#define JVMDI_THREAD_STATUS_SLEEPING ((jint)2) + /* Thread is waiting on a java monitor */ +#define JVMDI_THREAD_STATUS_MONITOR ((jint)3) + /* Thread is waiting - Thread.wait() or JVM_MonitorWait() was called */ +#define JVMDI_THREAD_STATUS_WAIT ((jint)4) + + /* Thread is suspended - Thread.suspend(), JVM_Suspend() or + * JVMDI_Suspend was called */ +#define JVMDI_SUSPEND_STATUS_SUSPENDED ((jint)0x1) + /* Thread is at a breakpoint */ +#define JVMDI_SUSPEND_STATUS_BREAK ((jint)0x2) + + + /* Thread priority constants */ +#define JVMDI_THREAD_MIN_PRIORITY ((jint)1) +#define JVMDI_THREAD_NORM_PRIORITY ((jint)5) +#define JVMDI_THREAD_MAX_PRIORITY ((jint)10) + +typedef struct { + char *name; + jint priority; + jboolean is_daemon; + jthreadGroup thread_group; + jobject context_class_loader; +} JVMDI_thread_info; + +typedef struct { + jthreadGroup parent; + char *name; + jint max_priority; + jboolean is_daemon; +} JVMDI_thread_group_info; + +#define JVMDI_DISABLE ((jint) 0) +#define JVMDI_ENABLE ((jint) 1) + +/* + * Initial function for debug threads created through JVMDI + */ +typedef void (*JVMDI_StartFunction)(void *); + +/* + * Type for debug monitors created through JVMDI + */ +typedef void *JVMDI_RawMonitor; + +#define JVMDI_MONITOR_WAIT_FOREVER ((jlong)(-1)) + +/* + * Monitor information + */ +typedef struct { + jthread owner; + jint entry_count; + jint waiter_count; + jthread *waiters; +} JVMDI_monitor_info; + +typedef struct { + jint owned_monitor_count; + jobject *owned_monitors; +} JVMDI_owned_monitor_info; + + /* + * Events + */ + + /* kind = JVMDI_EVENT_SINGLE_STEP */ + typedef struct { + jthread thread; + jclass clazz; + jmethodID method; + jlocation location; + } JVMDI_single_step_event_data; + + /* kind = JVMDI_EVENT_BREAKPOINT */ + typedef struct { + jthread thread; + jclass clazz; + jmethodID method; + jlocation location; + } JVMDI_breakpoint_event_data; + + /* kind = JVMDI_EVENT_FIELD_ACCESS */ + typedef struct { + jthread thread; + jclass clazz; + jmethodID method; + jlocation location; + jclass field_clazz; + jobject object; + jfieldID field; + } JVMDI_field_access_event_data; + + /* kind = JVMDI_EVENT_FIELD_MODIFICATION */ + typedef struct { + jthread thread; + jclass clazz; + jmethodID method; + jlocation location; + jclass field_clazz; + jobject object; + jfieldID field; + char signature_type; + jvalue new_value; + } JVMDI_field_modification_event_data; + + /* kind = JVMDI_EVENT_FRAME_POP */ + /* kind = JVMDI_EVENT_METHOD_ENTRY */ + /* kind = JVMDI_EVENT_METHOD_EXIT */ + typedef struct { + jthread thread; + jclass clazz; + jmethodID method; + jframeID frame; + } JVMDI_frame_event_data; + + /* kind = JVMDI_EVENT_EXCEPTION */ + typedef struct { + jthread thread; + jclass clazz; + jmethodID method; + jlocation location; + jobject exception; + jclass catch_clazz; + jmethodID catch_method; + jlocation catch_location; + } JVMDI_exception_event_data; + + /* kind = JVMDI_EVENT_EXCEPTION_CATCH */ + typedef struct { + jthread thread; + jclass clazz; + jmethodID method; + jlocation location; + jobject exception; + } JVMDI_exception_catch_event_data; + + /* kind = JVMDI_EVENT_USER_DEFINED */ + typedef struct { + jobject object; + jint key; + } JVMDI_user_event_data; + + /* kind = JVMDI_EVENT_THREAD_END or */ + /* JVMDI_EVENT_THREAD_START */ + typedef struct { + jthread thread; + } JVMDI_thread_change_event_data; + + /* kind = JVMDI_EVENT_CLASS_LOAD, */ + /* JVMDI_EVENT_CLASS_UNLOAD, or */ + /* JVMDI_EVENT_CLASS_PREPARE */ + typedef struct { + jthread thread; + jclass clazz; + } JVMDI_class_event_data; + +/* This stucture passes information about the event. + * location is the index of the last instruction executed. + */ +typedef struct { + jint kind; /* the discriminant */ + + union { + /* kind = JVMDI_EVENT_SINGLE_STEP */ + JVMDI_single_step_event_data single_step; + + /* kind = JVMDI_EVENT_BREAKPOINT */ + JVMDI_breakpoint_event_data breakpoint; + + /* kind = JVMDI_EVENT_FRAME_POP */ + /* kind = JVMDI_EVENT_METHOD_ENTRY */ + /* kind = JVMDI_EVENT_METHOD_EXIT */ + JVMDI_frame_event_data frame; + + /* kind = JVMDI_EVENT_FIELD_ACCESS */ + JVMDI_field_access_event_data field_access; + + /* kind = JVMDI_EVENT_FIELD_MODIFICATION */ + JVMDI_field_modification_event_data field_modification; + + /* kind = JVMDI_EVENT_EXCEPTION */ + JVMDI_exception_event_data exception; + + /* kind = JVMDI_EVENT_EXCEPTION_CATCH */ + JVMDI_exception_catch_event_data exception_catch; + + /* kind = JVMDI_EVENT_USER_DEFINED */ + JVMDI_user_event_data user; + + /* kind = JVMDI_EVENT_THREAD_END or */ + /* JVMDI_EVENT_THREAD_START */ + JVMDI_thread_change_event_data thread_change; + + /* kind = JVMDI_EVENT_CLASS_LOAD, */ + /* JVMDI_EVENT_CLASS_UNLOAD, or */ + /* JVMDI_EVENT_CLASS_PREPARE */ + JVMDI_class_event_data class_event; + + /* kind = JVMDI_EVENT_VM_DEATH, JVMDI_EVENT_VM_INIT */ + /* no additional fields */ + } u; +} JVMDI_Event; + + /*** event kinds ***/ +#define JVMDI_EVENT_SINGLE_STEP ((jint)1) +#define JVMDI_EVENT_BREAKPOINT ((jint)2) +#define JVMDI_EVENT_FRAME_POP ((jint)3) +#define JVMDI_EVENT_EXCEPTION ((jint)4) +#define JVMDI_EVENT_USER_DEFINED ((jint)5) +#define JVMDI_EVENT_THREAD_START ((jint)6) +#define JVMDI_EVENT_THREAD_END ((jint)7) +#define JVMDI_EVENT_CLASS_PREPARE ((jint)8) +#define JVMDI_EVENT_CLASS_UNLOAD ((jint)9) +#define JVMDI_EVENT_CLASS_LOAD ((jint)10) +#define JVMDI_EVENT_FIELD_ACCESS ((jint)20) +#define JVMDI_EVENT_FIELD_MODIFICATION ((jint)21) +#define JVMDI_EVENT_EXCEPTION_CATCH ((jint)30) +#define JVMDI_EVENT_METHOD_ENTRY ((jint)40) +#define JVMDI_EVENT_METHOD_EXIT ((jint)41) +#define JVMDI_EVENT_VM_INIT ((jint)90) +#define JVMDI_EVENT_VM_DEATH ((jint)99) + +#define JVMDI_MAX_EVENT_TYPE_VAL ((jint)99) + + + +/* event handler hook */ +typedef void (*JVMDI_EventHook)(JNIEnv *env, JVMDI_Event *event); + +typedef jvmdiError (*JVMDI_AllocHook) (jlong size, jbyte** memPtr); +typedef jvmdiError (*JVMDI_DeallocHook) (jbyte* buffer); + +/* + * Class states used in JVMDI_GetClassStatus + */ +#define JVMDI_CLASS_STATUS_VERIFIED ((jint)0x01) +#define JVMDI_CLASS_STATUS_PREPARED ((jint)0x02) +#define JVMDI_CLASS_STATUS_INITIALIZED ((jint)0x04) + /* Error prevents initialization */ +#define JVMDI_CLASS_STATUS_ERROR ((jint)0x08) + +/* structure for returning line number information + */ +typedef struct { + jlocation start_location; + jint line_number; +} JVMDI_line_number_entry; + + +/* structure for returning local variable information + */ +typedef struct { + jlocation start_location; /* variable valid start_location */ + jint length; /* upto start_location+length */ + char *name; /* name in UTF8 */ + char *signature; /* type signature in UTF8 */ + jint slot; /* variable slot, see JVMDI_GetLocal*() */ +} JVMDI_local_variable_entry; + +/* structure for returning exception handler information + */ +typedef struct { + jlocation start_location; + jlocation end_location; + jlocation handler_location; + jclass exception; /* if null, all exceptions */ +} JVMDI_exception_handler_entry; + +#define JVMDI_OPERAND_TYPE_REFERENCE ((jint)1) +#define JVMDI_OPERAND_TYPE_INT ((jint)2) +#define JVMDI_OPERAND_TYPE_FLOAT ((jint)3) +#define JVMDI_OPERAND_TYPE_LONG0 ((jint)4) /* least sig. 32 bits */ +#define JVMDI_OPERAND_TYPE_LONG1 ((jint)5) /* most sig. 32 bits */ +#define JVMDI_OPERAND_TYPE_DOUBLE0 ((jint)6) /* least sig. 32 bits */ +#define JVMDI_OPERAND_TYPE_DOUBLE1 ((jint)7) /* most sig. 32 bits */ +#define JVMDI_OPERAND_TYPE_RETURN_ADDRESS ((jint)8) + +typedef struct { + jint word; /* 32 bit operand stack quantities */ + jint type; /* type encoding of the operand word */ + /* one of JVMDI_OPERAND_TYPE_* */ +} JVMDI_operand_stack_element; + +typedef struct { + jint instance_field_count; /* number of instance fields referencing obj */ + struct JVMDI_instance_field { + jobject instance; /* instance referencing obj */ + jfieldID field; /* field holding reference */ + } *instance_fields; /* instanceField_count of them */ + + jint static_field_count; /* number of static fields referencing obj */ + struct JVMDI_static_field { + jclass clazz; /* class referencing obj */ + jfieldID static_field; /* field holding reference */ + } *static_fields; /* static_field_count of them */ + + jint array_element_count; /* number of array elements referencing obj */ + struct JVMDI_array_element { + jobjectArray array; /* array referencing obj */ + jint index; /* index holding reference */ + } *array_elements; /* array_element_count of them */ + + jint frame_slot_count; /* number of frame slots referencing obj */ + struct JVMDI_frame_slot { + jthread thread; /* thread of the frame */ + jframeID frame; /* frame referencing obj */ + jint slot; /* slot holding reference */ + } *frame_slots; /* frame_slot_count of them */ +} JVMDI_object_reference_info; + +/* structure for defining a class +*/ +typedef struct { + jclass clazz; /* Class object for this class */ + jint class_byte_count; /* number of bytes defining class (below) */ + jbyte *class_bytes; /* bytes defining class (in JVM spec */ + /* Class File Format) */ +} JVMDI_class_definition; + + /* For backwards compatibility */ +#define can_change_schema can_unrestrictedly_redefine_classes + +typedef struct { + unsigned int can_watch_field_modification : 1; + unsigned int can_watch_field_access : 1; + unsigned int can_get_bytecodes : 1; + unsigned int can_get_synthetic_attribute : 1; + unsigned int can_get_owned_monitor_info : 1; + unsigned int can_get_current_contended_monitor : 1; + unsigned int can_get_monitor_info : 1; + unsigned int can_get_heap_info : 1; + unsigned int can_get_operand_stack : 1; + unsigned int can_set_operand_stack : 1; + unsigned int can_pop_frame : 1; + unsigned int can_get_class_definition : 1; + unsigned int can_redefine_classes : 1; + unsigned int can_add_method : 1; + unsigned int can_unrestrictedly_redefine_classes : 1; + unsigned int can_suspend_resume_thread_lists : 1; +} JVMDI_capabilities; + +typedef struct JVMDI_Interface_1_ { + jvmdiError (JNICALL *SetEventHook) + (JVMDI_EventHook hook); + jvmdiError (JNICALL *SetEventNotificationMode) + (jint mode, jint eventType, jthread thread, ...); + + jvmdiError (JNICALL *GetThreadStatus) + (jthread thread, + jint *threadStatusPtr, jint *suspendStatusPtr); + jvmdiError (JNICALL *GetAllThreads) + (jint *threadsCountPtr, jthread **threadsPtr); + jvmdiError (JNICALL *SuspendThread) + (jthread thread); + jvmdiError (JNICALL *ResumeThread) + (jthread thread); + jvmdiError (JNICALL *StopThread) + (jthread thread, jobject exception); + jvmdiError (JNICALL *InterruptThread) + (jthread thread); + jvmdiError (JNICALL *GetThreadInfo) + (jthread thread, JVMDI_thread_info *infoPtr); + jvmdiError (JNICALL *GetOwnedMonitorInfo) + (jthread thread, JVMDI_owned_monitor_info *infoPtr); + jvmdiError (JNICALL *GetCurrentContendedMonitor) + (jthread thread, jobject *monitor); + jvmdiError (JNICALL *RunDebugThread) + (jthread thread, JVMDI_StartFunction proc, void *arg, + int priority); + + jvmdiError (JNICALL *GetTopThreadGroups) + (jint *groupCountPtr, jthreadGroup **groupsPtr); + jvmdiError (JNICALL *GetThreadGroupInfo) + (jthreadGroup group, JVMDI_thread_group_info *infoPtr); + jvmdiError (JNICALL *GetThreadGroupChildren) + (jthreadGroup group, + jint *threadCountPtr, jthread **threadsPtr, + jint *groupCountPtr, jthreadGroup **groupsPtr); + + jvmdiError (JNICALL *GetFrameCount) + (jthread thread, jint *countPtr); + jvmdiError (JNICALL *GetCurrentFrame) + (jthread thread, jframeID *framePtr); + jvmdiError (JNICALL *GetCallerFrame) + (jframeID called, jframeID *framePtr); + jvmdiError (JNICALL *GetFrameLocation) + (jframeID frame, jclass *classPtr, jmethodID *methodPtr, + jlocation *locationPtr); + jvmdiError (JNICALL *NotifyFramePop) + (jframeID frame); + jvmdiError (JNICALL *GetLocalObject) + (jframeID frame, jint slot, jobject *valuePtr); + jvmdiError (JNICALL *GetLocalInt) + (jframeID frame, jint slot, jint *valuePtr); + jvmdiError (JNICALL *GetLocalLong) + (jframeID frame, jint slot, jlong *valuePtr); + jvmdiError (JNICALL *GetLocalFloat) + (jframeID frame, jint slot, jfloat *valuePtr); + jvmdiError (JNICALL *GetLocalDouble) + (jframeID frame, jint slot, jdouble *valuePtr); + jvmdiError (JNICALL *SetLocalObject) + (jframeID frame, jint slot, jobject value); + jvmdiError (JNICALL *SetLocalInt) + (jframeID frame, jint slot, jint value); + jvmdiError (JNICALL *SetLocalLong) + (jframeID frame, jint slot, jlong value); + jvmdiError (JNICALL *SetLocalFloat) + (jframeID frame, jint slot, jfloat value); + jvmdiError (JNICALL *SetLocalDouble) + (jframeID frame, jint slot, jdouble value); + + jvmdiError (JNICALL *CreateRawMonitor) + (char *name, JVMDI_RawMonitor *monitorPtr); + jvmdiError (JNICALL *DestroyRawMonitor) + (JVMDI_RawMonitor monitor); + jvmdiError (JNICALL *RawMonitorEnter) + (JVMDI_RawMonitor monitor); + jvmdiError (JNICALL *RawMonitorExit) + (JVMDI_RawMonitor monitor); + jvmdiError (JNICALL *RawMonitorWait) + (JVMDI_RawMonitor monitor, jlong millis); + jvmdiError (JNICALL *RawMonitorNotify) + (JVMDI_RawMonitor monitor); + jvmdiError (JNICALL *RawMonitorNotifyAll) + (JVMDI_RawMonitor monitor); + + jvmdiError (JNICALL *SetBreakpoint) + (jclass clazz, jmethodID method, jlocation location); + jvmdiError (JNICALL *ClearBreakpoint) + (jclass clazz, jmethodID method, jlocation location); + jvmdiError (JNICALL *ClearAllBreakpoints) + (); + + jvmdiError (JNICALL *SetFieldAccessWatch) + (jclass clazz, jfieldID field); + jvmdiError (JNICALL *ClearFieldAccessWatch) + (jclass clazz, jfieldID field); + jvmdiError (JNICALL *SetFieldModificationWatch) + (jclass clazz, jfieldID field); + jvmdiError (JNICALL *ClearFieldModificationWatch) + (jclass clazz, jfieldID field); + + jvmdiError (JNICALL *SetAllocationHooks) + (JVMDI_AllocHook ahook, JVMDI_DeallocHook dhook); + jvmdiError (JNICALL *Allocate) + (jlong size, jbyte** memPtr); + jvmdiError (JNICALL *Deallocate) + (jbyte* mem); + + jvmdiError (JNICALL *GetClassSignature) + (jclass clazz, char **sigPtr); + jvmdiError (JNICALL *GetClassStatus) + (jclass clazz, jint *statusPtr); + jvmdiError (JNICALL *GetSourceFileName) + (jclass clazz, char **sourceNamePtr); + jvmdiError (JNICALL *GetClassModifiers) + (jclass clazz, jint *modifiersPtr); + jvmdiError (JNICALL *GetClassMethods) + (jclass clazz, jint *methodCountPtr, jmethodID **methodsPtr); + jvmdiError (JNICALL *GetClassFields) + (jclass clazz, jint *fieldCountPtr, jfieldID **fieldsPtr); + jvmdiError (JNICALL *GetImplementedInterfaces) + (jclass clazz, jint *interfaceCountPtr, jclass **interfacesPtr); + jvmdiError (JNICALL *IsInterface) + (jclass clazz, jboolean *isInterfacePtr); + jvmdiError (JNICALL *IsArrayClass) + (jclass clazz, jboolean *isArrayClassPtr); + jvmdiError (JNICALL *GetClassLoader) + (jclass clazz, jobject *classloaderPtr); + + jvmdiError (JNICALL *GetObjectHashCode) + (jobject object, jint *hashCodePtr); + jvmdiError (JNICALL *GetMonitorInfo) + (jobject object, JVMDI_monitor_info *infoPtr); + + jvmdiError (JNICALL *GetFieldName) + (jclass clazz, jfieldID field, char **namePtr, char **signaturePtr); + jvmdiError (JNICALL *GetFieldDeclaringClass) + (jclass clazz, jfieldID field, jclass *declaringClassPtr); + jvmdiError (JNICALL *GetFieldModifiers) + (jclass clazz, jfieldID field, jint *modifiersPtr); + jvmdiError (JNICALL *IsFieldSynthetic) + (jclass clazz, jfieldID field, jboolean *isSyntheticPtr); + + jvmdiError (JNICALL *GetMethodName) + (jclass clazz, jmethodID method, + char **namePtr, char **signaturePtr); + jvmdiError (JNICALL *GetMethodDeclaringClass) + (jclass clazz, jmethodID method, jclass *declaringClassPtr); + jvmdiError (JNICALL *GetMethodModifiers) + (jclass clazz, jmethodID method, jint *modifiersPtr); + jvmdiError (JNICALL *GetMaxStack) + (jclass clazz, jmethodID method, jint *maxPtr); + jvmdiError (JNICALL *GetMaxLocals) + (jclass clazz, jmethodID method, jint *maxPtr); + jvmdiError (JNICALL *GetArgumentsSize) + (jclass clazz, jmethodID method, jint *sizePtr); + jvmdiError (JNICALL *GetLineNumberTable) + (jclass clazz, jmethodID method, + jint *entryCountPtr, JVMDI_line_number_entry **tablePtr); + jvmdiError (JNICALL *GetMethodLocation) + (jclass clazz, jmethodID method, + jlocation *startLocationPtr, jlocation *endLocationPtr); + jvmdiError (JNICALL *GetLocalVariableTable) + (jclass clazz, jmethodID method, + jint *entryCountPtr, JVMDI_local_variable_entry **tablePtr); + jvmdiError (JNICALL *GetExceptionHandlerTable) + (jclass clazz, jmethodID method, + jint *entryCountPtr, JVMDI_exception_handler_entry **tablePtr); + jvmdiError (JNICALL *GetThrownExceptions) + (jclass clazz, jmethodID method, + jint *exceptionCountPtr, jclass **exceptionsPtr); + jvmdiError (JNICALL *GetBytecodes) + (jclass clazz, jmethodID method, + jint *bytecodeCountPtr, jbyte **bytecodesPtr); + jvmdiError (JNICALL *IsMethodNative) + (jclass clazz, jmethodID method, jboolean *isNativePtr); + jvmdiError (JNICALL *IsMethodSynthetic) + (jclass clazz, jmethodID method, jboolean *isSyntheticPtr); + + jvmdiError (JNICALL *GetLoadedClasses) + (jint *classCountPtr, jclass **classesPtr); + jvmdiError (JNICALL *GetClassLoaderClasses) + (jobject initiatingLoader, jint *classesCountPtr, + jclass **classesPtr); + + jvmdiError (JNICALL *PopFrame) + (jthread thread); + jvmdiError (JNICALL *SetFrameLocation) + (jframeID frame, jlocation location); + jvmdiError (JNICALL *GetOperandStack) + (jframeID frame, jint *operandStackSizePtr, + JVMDI_operand_stack_element **operandStackPtr); + jvmdiError (JNICALL *SetOperandStack) + (jframeID frame, jint operandStackSize, + JVMDI_operand_stack_element *operandStack); + jvmdiError (JNICALL *AllInstances) + (jclass clazz, jint *instanceCountPtr, jobject **instancesPtr); + jvmdiError (JNICALL *References) + (jobject obj, JVMDI_object_reference_info *refs); + jvmdiError (JNICALL *GetClassDefinition) + (jclass clazz, JVMDI_class_definition *classDefPtr); + jvmdiError (JNICALL *RedefineClasses) + (jint classCount, JVMDI_class_definition *classDefs); + + jvmdiError (JNICALL *GetVersionNumber) + (jint *versionPtr); + jvmdiError (JNICALL *GetCapabilities) + (JVMDI_capabilities *capabilitiesPtr); + + jvmdiError (JNICALL *GetSourceDebugExtension) + (jclass clazz, char **sourceDebugExtension); + jvmdiError (JNICALL *IsMethodObsolete) + (jclass clazz, jmethodID method, jboolean *isObsoletePtr); + + jvmdiError (JNICALL *SuspendThreadList) + (jint reqCount, jthread *reqList, jvmdiError *results); + jvmdiError (JNICALL *ResumeThreadList) + (jint reqCount, jthread *reqList, jvmdiError *results); +} JVMDI_Interface_1; + +#ifndef NO_JVMDI_MACROS + +#define JVMDI_ERROR_DUPLICATE_BREAKPOINT JVMDI_ERROR_DUPLICATE +#define JVMDI_ERROR_NO_SUCH_BREAKPOINT JVMDI_ERROR_NOT_FOUND +#define JVMDI_ERROR_DUPLICATE_FRAME_POP JVMDI_ERROR_DUPLICATE + + +static JVMDI_Interface_1 *jvmdi_interface = NULL; +static JavaVM *j_vm; + +#ifdef __cplusplus +#define SetJVMDIfromJNIEnv(a_env) ( (jvmdi_interface == NULL)? \ + ((a_env)->GetJavaVM(&j_vm), \ + (j_vm)->GetEnv((void **)&jvmdi_interface, \ + JVMDI_VERSION_1)):0) +#else +#define SetJVMDIfromJNIEnv(a_env) ( (jvmdi_interface == NULL)? \ + ((*a_env)->GetJavaVM(a_env, &j_vm), \ + (*j_vm)->GetEnv(j_vm, (void **)&jvmdi_interface, \ + JVMDI_VERSION_1)):0) +#endif + +#define JVMDI_SetEventHook(a_env, a1) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->SetEventHook(a1) ) +#define JVMDI_GetThreadStatus(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetThreadStatus(a1, a2, a3) ) +#define JVMDI_GetAllThreads(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetAllThreads(a1, a2) ) +#define JVMDI_SuspendThread(a_env, a1) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->SuspendThread(a1) ) +#define JVMDI_ResumeThread(a_env, a1) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->ResumeThread(a1) ) +#define JVMDI_StopThread(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->StopThread(a1, a2) ) +#define JVMDI_InterruptThread(a_env, a1) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->InterruptThread(a1) ) +#define JVMDI_SetSingleStep(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->SetEventNotificationMode( \ + (a2) ? JVMDI_ENABLE : JVMDI_DISABLE, \ + JVMDI_EVENT_SINGLE_STEP, a1) ) +#define JVMDI_GetThreadInfo(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetThreadInfo(a1, a2) ) +#define JVMDI_RunDebugThread(a_env, a1, a2, a3, a4) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->RunDebugThread(a1, a2, a3, a4) ) +#define JVMDI_GetTopThreadGroups(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetTopThreadGroups(a1, a2) ) +#define JVMDI_GetThreadGroupInfo(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetThreadGroupInfo(a1, a2) ) +#define JVMDI_GetThreadGroupChildren(a_env, a1, a2, a3, a4, a5) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetThreadGroupChildren(a1, a2, a3, a4, a5) ) +#define JVMDI_GetCurrentFrame(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetCurrentFrame(a1, a2) ) +#define JVMDI_GetCallerFrame(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetCallerFrame(a1, a2) ) +#define JVMDI_GetFrameLocation(a_env, a1, a2, a3, a4) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetFrameLocation(a1, a2, a3, a4) ) +#define JVMDI_NotifyFramePop(a_env, a1) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->NotifyFramePop(a1) ) +#define JVMDI_GetLocalObject(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetLocalObject(a1, a2, a3) ) +#define JVMDI_GetLocalInt(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetLocalInt(a1, a2, a3) ) +#define JVMDI_GetLocalLong(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetLocalLong(a1, a2, a3) ) +#define JVMDI_GetLocalFloat(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetLocalFloat(a1, a2, a3) ) +#define JVMDI_GetLocalDouble(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetLocalDouble(a1, a2, a3) ) +#define JVMDI_SetLocalObject(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->SetLocalObject(a1, a2, a3) ) +#define JVMDI_SetLocalInt(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->SetLocalInt(a1, a2, a3) ) +#define JVMDI_SetLocalLong(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->SetLocalLong(a1, a2, a3) ) +#define JVMDI_SetLocalFloat(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->SetLocalFloat(a1, a2, a3) ) +#define JVMDI_SetLocalDouble(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->SetLocalDouble(a1, a2, a3) ) +#define JVMDI_CreateRawMonitor(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->CreateRawMonitor(a1, a2) ) +#define JVMDI_DestroyRawMonitor(a_env, a1) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->DestroyRawMonitor(a1) ) +#define JVMDI_RawMonitorEnter(a_env, a1) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->RawMonitorEnter(a1) ) +#define JVMDI_RawMonitorExit(a_env, a1) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->RawMonitorExit(a1) ) +#define JVMDI_RawMonitorWait(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->RawMonitorWait(a1, a2) ) +#define JVMDI_RawMonitorNotify(a_env, a1) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->RawMonitorNotify(a1) ) +#define JVMDI_RawMonitorNotifyAll(a_env, a1) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->RawMonitorNotifyAll(a1) ) +#define JVMDI_SetBreakpoint(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->SetBreakpoint(a1, a2, a3) ) +#define JVMDI_ClearBreakpoint(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->ClearBreakpoint(a1, a2, a3) ) +#define JVMDI_ClearAllBreakpoints(a_env) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->ClearAllBreakpoints() ) +#define JVMDI_SetAllocationHooks(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->SetAllocationHooks(a1, a2) ) +#define JVMDI_Allocate(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->Allocate(a1, a2) ) +#define JVMDI_Deallocate(a_env, a1) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->Deallocate(a1) ) +#define JVMDI_GetClassSignature(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetClassSignature(a1, a2) ) +#define JVMDI_GetClassStatus(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetClassStatus(a1, a2) ) +#define JVMDI_GetSourceFileName(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetSourceFileName(a1, a2) ) +#define JVMDI_GetClassModifiers(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetClassModifiers(a1, a2) ) +#define JVMDI_GetClassMethods(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetClassMethods(a1, a2, a3) ) +#define JVMDI_GetClassFields(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetClassFields(a1, a2, a3) ) +#define JVMDI_GetImplementedInterfaces(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetImplementedInterfaces(a1, a2, a3) ) +#define JVMDI_IsInterface(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->IsInterface(a1, a2) ) +#define JVMDI_IsArrayClass(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->IsArrayClass(a1, a2) ) +#define JVMDI_ClassLoader(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetClassLoader(a1, a2) ) +#define JVMDI_GetFieldName(a_env, a1, a2, a3, a4) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetFieldName(a1, a2, a3, a4) ) +#define JVMDI_GetFieldDeclaringClass(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetFieldDeclaringClass(a1, a2, a3) ) +#define JVMDI_GetFieldModifiers(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetFieldModifiers(a1, a2, a3) ) +#define JVMDI_GetMethodName(a_env, a1, a2, a3, a4) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetMethodName(a1, a2, a3, a4) ) +#define JVMDI_GetMethodDeclaringClass(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetMethodDeclaringClass(a1, a2, a3) ) +#define JVMDI_GetMethodModifiers(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetMethodModifiers(a1, a2, a3) ) +#define JVMDI_GetMaxStack(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetMaxStack(a1, a2, a3) ) +#define JVMDI_GetMaxLocals(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetMaxLocals(a1, a2, a3) ) +#define JVMDI_GetArgumentsSize(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetArgumentsSize(a1, a2, a3) ) +#define JVMDI_GetLineNumberTable(a_env, a1, a2, a3, a4) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetLineNumberTable(a1, a2, a3, a4) ) +#define JVMDI_GetMethodLocation(a_env, a1, a2, a3, a4) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetMethodLocation(a1, a2, a3, a4) ) +#define JVMDI_GetLocalVariableTable(a_env, a1, a2, a3, a4) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetLocalVariableTable(a1, a2, a3, a4) ) +#define JVMDI_GetExceptionHandlerTable(a_env, a1, a2, a3, a4) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetExceptionHandlerTable(a1, a2, a3, a4) ) +#define JVMDI_GetThrownExceptions(a_env, a1, a2, a3, a4) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetThrownExceptions(a1, a2, a3, a4) ) +#define JVMDI_GetBytecodes(a_env, a1, a2, a3, a4) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetBytecodes(a1, a2, a3, a4) ) +#define JVMDI_IsMethodNative(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->IsMethodNative(a1, a2, a3) ) +#define JVMDI_GetLoadedClasses(a_env, a1, a2) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetLoadedClasses(a1, a2) ) +#define JVMDI_GetClassLoaderClasses(a_env, a1, a2, a3) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetClassLoaderClasses(a1, a2, a3) ) +#define JVMDI_GetVersionNumber(a_env, a1) ( \ + SetJVMDIfromJNIEnv(a_env), \ + jvmdi_interface->GetVersionNumber(a1) ) + +#endif /* !NO_JVMDI_MACROS */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* !_JAVASOFT_JVMDI_H_ */ + + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/jdk1.5.0_10/include/jvmpi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/jdk1.5.0_10/include/jvmpi.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,642 @@ +/* + * @(#)jvmpi.h 1.28 03/12/19 + * + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + */ + +#ifndef _JAVASOFT_JVMPI_H_ +#define _JAVASOFT_JVMPI_H_ + +#include "jni.h" + +#define JVMPI_VERSION_1 ((jint)0x10000001) /* implied 0 for minor version */ +#define JVMPI_VERSION_1_1 ((jint)0x10000002) +#define JVMPI_VERSION_1_2 ((jint)0x10000003) + +#ifdef __cplusplus +extern "C" { +#endif + typedef void (*jvmpi_void_function_of_void)(void *); +#ifdef __cplusplus +} +#endif + +/**************************************************************** + * Profiler interface data structures. + ****************************************************************/ +/* identifier types. */ +struct _jobjectID; +typedef struct _jobjectID * jobjectID; /* type of object ids */ + +/* raw monitors */ +struct _JVMPI_RawMonitor; +typedef struct _JVMPI_RawMonitor * JVMPI_RawMonitor; + +/* call frame */ +typedef struct { + jint lineno; /* line number in the source file */ + jmethodID method_id; /* method executed in this frame */ +} JVMPI_CallFrame; + +/* call trace */ +typedef struct { + JNIEnv *env_id; /* Env where trace was recorded */ + jint num_frames; /* number of frames in this trace */ + JVMPI_CallFrame *frames; /* frames */ +} JVMPI_CallTrace; + +/* method */ +typedef struct { + char *method_name; /* name of method */ + char *method_signature; /* signature of method */ + jint start_lineno; /* -1 if native, abstract .. */ + jint end_lineno; /* -1 if native, abstract .. */ + jmethodID method_id; /* id assigned to this method */ +} JVMPI_Method; + +/* Field */ +typedef struct { + char *field_name; /* name of field */ + char *field_signature; /* signature of field */ +} JVMPI_Field; + +/* line number info for a compiled method */ +typedef struct { + jint offset; /* offset from beginning of method */ + jint lineno; /* lineno from beginning of src file */ +} JVMPI_Lineno; + +/* event */ +typedef struct { + jint event_type; /* event_type */ + JNIEnv *env_id; /* env where this event occured */ + + union { + struct { + const char *class_name; /* class name */ + char *source_name; /* name of source file */ + jint num_interfaces; /* number of interfaces implemented */ + jint num_methods; /* number of methods in the class */ + JVMPI_Method *methods; /* methods */ + jint num_static_fields; /* number of static fields */ + JVMPI_Field *statics; /* static fields */ + jint num_instance_fields; /* number of instance fields */ + JVMPI_Field *instances; /* instance fields */ + jobjectID class_id; /* id of the class object */ + } class_load; + + struct { + jobjectID class_id; /* id of the class object */ + } class_unload; + + struct { + unsigned char *class_data; /* content of class file */ + jint class_data_len; /* class file length */ + unsigned char *new_class_data; /* instrumented class file */ + jint new_class_data_len; /* new class file length */ + void * (*malloc_f)(unsigned int); /* memory allocation function */ + } class_load_hook; + + struct { + jint arena_id; + jobjectID class_id; /* id of object class */ + jint is_array; /* JVMPI_NORMAL_OBJECT, ... */ + jint size; /* size in number of bytes */ + jobjectID obj_id; /* id assigned to this object */ + } obj_alloc; + + struct { + jobjectID obj_id; /* id of the object */ + } obj_free; + + struct { + jint arena_id; /* cur arena id */ + jobjectID obj_id; /* cur object id */ + jint new_arena_id; /* new arena id */ + jobjectID new_obj_id; /* new object id */ + } obj_move; + + struct { + jint arena_id; /* id of arena */ + const char *arena_name; /* name of arena */ + } new_arena; + + struct { + jint arena_id; /* id of arena */ + } delete_arena; + + struct { + char *thread_name; /* name of thread */ + char *group_name; /* name of group */ + char *parent_name; /* name of parent */ + jobjectID thread_id; /* id of the thread object */ + JNIEnv *thread_env_id; + } thread_start; + + struct { + int dump_level; /* level of the heap dump info */ + char *begin; /* where all the root records begin, + please see the heap dump buffer + format described below */ + char *end; /* where the object records end. */ + jint num_traces; /* number of thread traces, + 0 if dump level = JVMPI_DUMP_LEVEL_0 */ + JVMPI_CallTrace *traces; /* thread traces collected during + heap dump */ + } heap_dump; + + struct { + jobjectID obj_id; /* object id */ + jobject ref_id; /* id assigned to the globalref */ + } jni_globalref_alloc; + + struct { + jobject ref_id; /* id of the global ref */ + } jni_globalref_free; + + struct { + jmethodID method_id; /* method */ + } method; + + struct { + jmethodID method_id; /* id of method */ + jobjectID obj_id; /* id of target object */ + } method_entry2; + + struct { + jmethodID method_id; /* id of compiled method */ + void *code_addr; /* code start addr. in memory */ + jint code_size; /* code size */ + jint lineno_table_size; /* size of lineno table */ + JVMPI_Lineno *lineno_table; /* lineno info */ + } compiled_method_load; + + struct { + jmethodID method_id; /* id of unloaded compiled method */ + } compiled_method_unload; + + struct { + jmethodID method_id; /* id of the method the instruction belongs to */ + jint offset; /* instruction offset in the method's bytecode */ + union { + struct { + jboolean is_true; /* whether true or false branch is taken */ + } if_info; + struct { + jint key; /* top stack value used as an index */ + jint low; /* min value of the index */ + jint hi; /* max value of the index */ + } tableswitch_info; + struct { + jint chosen_pair_index; /* actually chosen pair index (0-based) + * if chosen_pair_index == pairs_total then + * the 'default' branch is taken + */ + jint pairs_total; /* total number of lookupswitch pairs */ + } lookupswitch_info; + } u; + } instruction; + + struct { + char *begin; /* beginning of dump buffer, + see below for format */ + char *end; /* end of dump buffer */ + jint num_traces; /* number of traces */ + JVMPI_CallTrace *traces; /* traces of all threads */ + jint *threads_status; /* status of all threads */ + } monitor_dump; + + struct { + const char *name; /* name of raw monitor */ + JVMPI_RawMonitor id; /* id */ + } raw_monitor; + + struct { + jobjectID object; /* Java object */ + } monitor; + + struct { + jobjectID object; /* Java object */ + jlong timeout; /* timeout period */ + } monitor_wait; + + struct { + jlong used_objects; + jlong used_object_space; + jlong total_object_space; + } gc_info; + + struct { + jint data_len; + char *data; + } object_dump; + } u; +} JVMPI_Event; + +/* interface functions */ +typedef struct { + jint version; /* JVMPI version */ + + /* ------interface implemented by the profiler------ */ + + /** + * Function called by the JVM to notify an event. + */ + void (*NotifyEvent)(JVMPI_Event *event); + + /* ------interface implemented by the JVM------ */ + + /** + * Function called by the profiler to enable/disable/send notification + * for a particular event type. + * + * event_type - event_type + * arg - event specific arg + * + * return JVMPI_NOT_AVAILABLE, JVMPI_SUCCESS or JVMPI_FAIL + */ + jint (*EnableEvent)(jint event_type, void *arg); + jint (*DisableEvent)(jint event_type, void *arg); + jint (*RequestEvent)(jint event_type, void *arg); + + /** + * Function called by the profiler to get a stack + * trace from the JVM. + * + * trace - trace data structure to be filled + * depth - maximum depth of the trace. + */ + void (*GetCallTrace)(JVMPI_CallTrace *trace, jint depth); + + /** + * Function called by profiler when it wants to exit/stop. + */ + void (*ProfilerExit)(jint); + + /** + * Utility functions provided by the JVM. + */ + JVMPI_RawMonitor (*RawMonitorCreate)(char *lock_name); + void (*RawMonitorEnter)(JVMPI_RawMonitor lock_id); + void (*RawMonitorExit)(JVMPI_RawMonitor lock_id); + void (*RawMonitorWait)(JVMPI_RawMonitor lock_id, jlong ms); + void (*RawMonitorNotifyAll)(JVMPI_RawMonitor lock_id); + void (*RawMonitorDestroy)(JVMPI_RawMonitor lock_id); + + /** + * Function called by the profiler to get the current thread's CPU time. + * + * return time in nanoseconds; + */ + jlong (*GetCurrentThreadCpuTime)(void); + + void (*SuspendThread)(JNIEnv *env); + void (*ResumeThread)(JNIEnv *env); + jint (*GetThreadStatus)(JNIEnv *env); + jboolean (*ThreadHasRun)(JNIEnv *env); + + /* This function can be called safely only after JVMPI_EVENT_VM_INIT_DONE + notification by the JVM. */ + jint (*CreateSystemThread)(char *name, jint priority, void (*f)(void *)); + + /* thread local storage access functions to avoid locking in time + critical functions */ + void (*SetThreadLocalStorage)(JNIEnv *env_id, void *ptr); + void * (*GetThreadLocalStorage)(JNIEnv *env_id); + + /* control GC */ + void (*DisableGC)(void); + void (*EnableGC)(void); + void (*RunGC)(void); + + jobjectID (*GetThreadObject)(JNIEnv *env); + jobjectID (*GetMethodClass)(jmethodID mid); + + /* JNI <-> jobject conversions */ + jobject (*jobjectID2jobject)(jobjectID jid); + jobjectID (*jobject2jobjectID)(jobject jobj); + + void (*SuspendThreadList) + (jint reqCount, JNIEnv **reqList, jint *results); + void (*ResumeThreadList) + (jint reqCount, JNIEnv **reqList, jint *results); +} JVMPI_Interface; + +/* type of argument passed to RequestEvent for heap dumps */ +typedef struct { + jint heap_dump_level; +} JVMPI_HeapDumpArg; + +/********************************************************************** + * Constants and formats used in JVM Profiler Interface. + **********************************************************************/ +/* + * Event type constants. + */ +#define JVMPI_EVENT_METHOD_ENTRY ((jint)1) +#define JVMPI_EVENT_METHOD_ENTRY2 ((jint)2) +#define JVMPI_EVENT_METHOD_EXIT ((jint)3) + +#define JVMPI_EVENT_OBJECT_ALLOC ((jint)4) +#define JVMPI_EVENT_OBJECT_FREE ((jint)5) +#define JVMPI_EVENT_OBJECT_MOVE ((jint)6) + +#define JVMPI_EVENT_COMPILED_METHOD_LOAD ((jint)7) +#define JVMPI_EVENT_COMPILED_METHOD_UNLOAD ((jint)8) + +#define JVMPI_EVENT_INSTRUCTION_START ((jint)9) + +#define JVMPI_EVENT_THREAD_START ((jint)33) +#define JVMPI_EVENT_THREAD_END ((jint)34) + +#define JVMPI_EVENT_CLASS_LOAD_HOOK ((jint)35) + +#define JVMPI_EVENT_HEAP_DUMP ((jint)37) +#define JVMPI_EVENT_JNI_GLOBALREF_ALLOC ((jint)38) +#define JVMPI_EVENT_JNI_GLOBALREF_FREE ((jint)39) +#define JVMPI_EVENT_JNI_WEAK_GLOBALREF_ALLOC ((jint)40) +#define JVMPI_EVENT_JNI_WEAK_GLOBALREF_FREE ((jint)41) +#define JVMPI_EVENT_CLASS_LOAD ((jint)42) +#define JVMPI_EVENT_CLASS_UNLOAD ((jint)43) +#define JVMPI_EVENT_DATA_DUMP_REQUEST ((jint)44) +#define JVMPI_EVENT_DATA_RESET_REQUEST ((jint)45) + +#define JVMPI_EVENT_JVM_INIT_DONE ((jint)46) +#define JVMPI_EVENT_JVM_SHUT_DOWN ((jint)47) + +#define JVMPI_EVENT_ARENA_NEW ((jint)48) +#define JVMPI_EVENT_ARENA_DELETE ((jint)49) + +#define JVMPI_EVENT_OBJECT_DUMP ((jint)50) + +#define JVMPI_EVENT_RAW_MONITOR_CONTENDED_ENTER ((jint)51) +#define JVMPI_EVENT_RAW_MONITOR_CONTENDED_ENTERED ((jint)52) +#define JVMPI_EVENT_RAW_MONITOR_CONTENDED_EXIT ((jint)53) +#define JVMPI_EVENT_MONITOR_CONTENDED_ENTER ((jint)54) +#define JVMPI_EVENT_MONITOR_CONTENDED_ENTERED ((jint)55) +#define JVMPI_EVENT_MONITOR_CONTENDED_EXIT ((jint)56) +#define JVMPI_EVENT_MONITOR_WAIT ((jint)57) +#define JVMPI_EVENT_MONITOR_WAITED ((jint)58) +#define JVMPI_EVENT_MONITOR_DUMP ((jint)59) + +#define JVMPI_EVENT_GC_START ((jint)60) +#define JVMPI_EVENT_GC_FINISH ((jint)61) + +#define JVMPI_MAX_EVENT_TYPE_VAL ((jint)61) + +/* old definitions, to be removed */ +#define JVMPI_EVENT_LOAD_COMPILED_METHOD ((jint)7) +#define JVMPI_EVENT_UNLOAD_COMPILED_METHOD ((jint)8) +#define JVMPI_EVENT_NEW_ARENA ((jint)48) +#define JVMPI_EVENT_DELETE_ARENA ((jint)49) +#define JVMPI_EVENT_DUMP_DATA_REQUEST ((jint)44) +#define JVMPI_EVENT_RESET_DATA_REQUEST ((jint)45) +#define JVMPI_EVENT_OBJ_ALLOC ((jint)4) +#define JVMPI_EVENT_OBJ_FREE ((jint)5) +#define JVMPI_EVENT_OBJ_MOVE ((jint)6) + +#define JVMPI_REQUESTED_EVENT ((jint)0x10000000) + + + +/* + * enabling/disabling event notification. + */ +/* results */ +#define JVMPI_SUCCESS ((jint)0) +#define JVMPI_NOT_AVAILABLE ((jint)1) +#define JVMPI_FAIL ((jint)-1) + +/* + * Thread status + */ +enum { + JVMPI_THREAD_RUNNABLE = 1, + JVMPI_THREAD_MONITOR_WAIT, + JVMPI_THREAD_CONDVAR_WAIT +}; + +#define JVMPI_THREAD_SUSPENDED 0x8000 +#define JVMPI_THREAD_INTERRUPTED 0x4000 + +/* + * Thread priority + */ +#define JVMPI_MINIMUM_PRIORITY 1 +#define JVMPI_MAXIMUM_PRIORITY 10 +#define JVMPI_NORMAL_PRIORITY 5 + +/* + * Object type constants. + */ +#define JVMPI_NORMAL_OBJECT ((jint)0) +#define JVMPI_CLASS ((jint)2) +#define JVMPI_BOOLEAN ((jint)4) +#define JVMPI_CHAR ((jint)5) +#define JVMPI_FLOAT ((jint)6) +#define JVMPI_DOUBLE ((jint)7) +#define JVMPI_BYTE ((jint)8) +#define JVMPI_SHORT ((jint)9) +#define JVMPI_INT ((jint)10) +#define JVMPI_LONG ((jint)11) + +/* + * Monitor dump constants. + */ + +#define JVMPI_MONITOR_JAVA 0x01 +#define JVMPI_MONITOR_RAW 0x02 + +/* + * Heap dump constants. + */ +#define JVMPI_GC_ROOT_UNKNOWN 0xff +#define JVMPI_GC_ROOT_JNI_GLOBAL 0x01 +#define JVMPI_GC_ROOT_JNI_LOCAL 0x02 +#define JVMPI_GC_ROOT_JAVA_FRAME 0x03 +#define JVMPI_GC_ROOT_NATIVE_STACK 0x04 +#define JVMPI_GC_ROOT_STICKY_CLASS 0x05 +#define JVMPI_GC_ROOT_THREAD_BLOCK 0x06 +#define JVMPI_GC_ROOT_MONITOR_USED 0x07 +#define JVMPI_GC_ROOT_THREAD_OBJ 0x08 + +#define JVMPI_GC_CLASS_DUMP 0x20 +#define JVMPI_GC_INSTANCE_DUMP 0x21 +#define JVMPI_GC_OBJ_ARRAY_DUMP 0x22 +#define JVMPI_GC_PRIM_ARRAY_DUMP 0x23 + +/* + * Dump levels + */ +#define JVMPI_DUMP_LEVEL_0 ((jint)0) +#define JVMPI_DUMP_LEVEL_1 ((jint)1) +#define JVMPI_DUMP_LEVEL_2 ((jint)2) + +/* Types used in dumps - + * + * u1: 1 byte + * u2: 2 bytes + * u4: 4 bytes + * u8: 8 bytes + * + * ty: u1 where: + * JVMPI_CLASS: object + * JVMPI_BOOLEAN: boolean + * JVMPI_CHAR: char + * JVMPI_FLOAT: float + * JVMPI_DOUBLE: double + * JVMPI_BYTE: byte + * JVMPI_SHORT: short + * JVMPI_INT: int + * JVMPI_LONG: long + * + * vl: values, exact type depends on the type of the value: + * JVMPI_BOOLEAN & JVMPI_BYTE: u1 + * JVMPI_SHORT & JVMPI_CHAR: u2 + * JVMPI_INT & JVMPI_FLOAT: u4 + * JVMPI_LONG & JVMPI_DOUBLE: u8 + * JVMPI_CLASS: jobjectID + */ + +/* Format of the monitor dump buffer: + * + * u1 monitor type + * + * JVMPI_MONITOR_JAVA Java monitor + * + * jobjectID object + * JNIEnv * owner thread + * u4 entry count + * u4 # of threads waiting to enter + * [JNIEnv *]* threads waiting to enter + * u4 # of threads waiting to be notified + * [JNIEnv *]* threads waiting to be notified + * + * JVMPI_MONITOR_RAW raw monitor + * + * char * name + * JVMPI_RawMonitor raw monitor + * JNIEnv * owner thread + * u4 entry count + * u4 # of threads waiting to enter + * [JNIEnv *]* threads waiting to enter + * u4 # of threads waiting to be notified + * [JNIEnv *]* threads waiting to be notified + */ + +/* Format of the heap dump buffer depends on the dump level + * specified in the JVMPI_HeapDumpArg passed to RequestEvent as arg. + * The default is JVMPI_DUMP_LEVEL_2. + * + * JVMPI_DUMP_LEVEL_0: + * + * u1 object type (JVMPI_CLASS ...) + * jobjectID object + * + * JVMPI_DUMP_LEVEL_1 and JVMPI_DUMP_LEVEL_2 use the following format: + * In the case of JVMPI_DUMP_LEVEL_1 the values of primitive fields in object + * instance dumps , the values of primitive statics in class dumps and the + * values of primitive arrays are excluded. JVMPI_DUMP_LEVEL_2 includes the + * primitive values. + * + * u1 record type + * + * JVMPI_GC_ROOT_UNKNOWN unknown root + * + * jobjectID object + * + * JVMPI_GC_ROOT_JNI_GLOBAL JNI global ref root + * + * jobjectID object + * jobject JNI global reference + * + * JVMPI_GC_ROOT_JNI_LOCAL JNI local ref + * + * jobjectID object + * JNIEnv * thread + * u4 frame # in stack trace (-1 for empty) + * + * JVMPI_GC_ROOT_JAVA_FRAME Java stack frame + * + * jobjectID object + * JNIEnv * thread + * u4 frame # in stack trace (-1 for empty) + * + * JVMPI_GC_ROOT_NATIVE_STACK Native stack + * + * jobjectID object + * JNIEnv * thread + * + * JVMPI_GC_ROOT_STICKY_CLASS System class + * + * jobjectID class object + * + * JVMPI_GC_ROOT_THREAD_BLOCK Reference from thread block + * + * jobjectID thread object + * JNIEnv * thread + * + * JVMPI_GC_ROOT_MONITOR_USED Busy monitor + * + * jobjectID object + * + * JVMPI_GC_CLASS_DUMP dump of a class object + * + * jobjectID class + * jobjectID super + * jobjectID class loader + * jobjectID signers + * jobjectID protection domain + * jobjectID class name + * void * reserved + * + * u4 instance size (in bytes) + * + * [jobjectID]* interfaces + * + * u2 size of constant pool + * [u2, constant pool index, + * ty, type, + * vl]* value + * + * [vl]* static field values + * + * JVMPI_GC_INSTANCE_DUMP dump of a normal object + * + * jobjectID object + * jobjectID class + * u4 number of bytes that follow + * [vl]* instance field values (class, followed + * by super, super's super ...) + * + * JVMPI_GC_OBJ_ARRAY_DUMP dump of an object array + * + * jobjectID array object + * u4 number of elements + * jobjectID element class + * [jobjectID]* elements + * + * JVMPI_GC_PRIM_ARRAY_DUMP dump of a primitive array + * + * jobjectID array object + * u4 number of elements + * ty element type + * [vl]* elements + * + */ + +/* Format of the dump received in JVMPI_EVENT_OBJECT_DUMP: + * All the records have JVMPI_DUMP_LEVEL_2 information. + * + * u1 record type + * + * followed by a: + * + * JVMPI_GC_CLASS_DUMP, + * JVMPI_GC_INSTANCE_DUMP, + * JVMPI_GC_OBJ_ARRAY_DUMP, or + * JVMPI_GC_PRIM_ARRAY_DUMP record. + */ + +#endif /* !_JAVASOFT_JVMPI_H_ */ diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/jdk1.5.0_10/include/jvmti.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/jdk1.5.0_10/include/jvmti.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,2181 @@ +#ifdef USE_PRAGMA_IDENT_HDR +#pragma ident "@(#)jvmtiLib.xsl 1.32 04/06/01 20:19:53 JVM" +#endif +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + */ + + /* AUTOMATICALLY GENERATED FILE - DO NOT EDIT */ + + + /* Include file for the Java(tm) Virtual Machine Tool Interface */ + +#ifndef _JAVA_JVMTI_H_ +#define _JAVA_JVMTI_H_ + +#include "jni.h" + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + JVMTI_VERSION_1 = 0x30010000, + JVMTI_VERSION_1_0 = 0x30010000, + + JVMTI_VERSION = 0x30000000 + (1 * 0x10000) + (0 * 0x100) + 33 /* version: 1.0.33 */ +}; + +JNIEXPORT jint JNICALL +Agent_OnLoad(JavaVM *vm, char *options, void *reserved); + +JNIEXPORT void JNICALL +Agent_OnUnload(JavaVM *vm); + + /* Forward declaration of the environment */ + +struct _jvmtiEnv; + +struct jvmtiInterface_1_; + +#ifdef __cplusplus +typedef _jvmtiEnv jvmtiEnv; +#else +typedef const struct jvmtiInterface_1_ *jvmtiEnv; +#endif /* __cplusplus */ + +/* Derived Base Types */ + +typedef jobject jthread; +typedef jobject jthreadGroup; +typedef jlong jlocation; +struct _jrawMonitorID; +typedef struct _jrawMonitorID *jrawMonitorID; +typedef struct JNINativeInterface_ jniNativeInterface; + + /* Constants */ + + + /* Thread State Flags */ + +enum { + JVMTI_THREAD_STATE_ALIVE = 0x0001, + JVMTI_THREAD_STATE_TERMINATED = 0x0002, + JVMTI_THREAD_STATE_RUNNABLE = 0x0004, + JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400, + JVMTI_THREAD_STATE_WAITING = 0x0080, + JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010, + JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020, + JVMTI_THREAD_STATE_SLEEPING = 0x0040, + JVMTI_THREAD_STATE_IN_OBJECT_WAIT = 0x0100, + JVMTI_THREAD_STATE_PARKED = 0x0200, + JVMTI_THREAD_STATE_SUSPENDED = 0x100000, + JVMTI_THREAD_STATE_INTERRUPTED = 0x200000, + JVMTI_THREAD_STATE_IN_NATIVE = 0x400000, + JVMTI_THREAD_STATE_VENDOR_1 = 0x10000000, + JVMTI_THREAD_STATE_VENDOR_2 = 0x20000000, + JVMTI_THREAD_STATE_VENDOR_3 = 0x40000000 +}; + + /* java.lang.Thread.State Conversion Masks */ + +enum { + JVMTI_JAVA_LANG_THREAD_STATE_MASK = JVMTI_THREAD_STATE_TERMINATED | JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT, + JVMTI_JAVA_LANG_THREAD_STATE_NEW = 0, + JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED = JVMTI_THREAD_STATE_TERMINATED, + JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE, + JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER, + JVMTI_JAVA_LANG_THREAD_STATE_WAITING = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY, + JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +}; + + /* Thread Priority Constants */ + +enum { + JVMTI_THREAD_MIN_PRIORITY = 1, + JVMTI_THREAD_NORM_PRIORITY = 5, + JVMTI_THREAD_MAX_PRIORITY = 10 +}; + + /* Heap Object Filter Enumeration */ + +typedef enum { + JVMTI_HEAP_OBJECT_TAGGED = 1, + JVMTI_HEAP_OBJECT_UNTAGGED = 2, + JVMTI_HEAP_OBJECT_EITHER = 3 +} jvmtiHeapObjectFilter; + + /* Heap Root Kind Enumeration */ + +typedef enum { + JVMTI_HEAP_ROOT_JNI_GLOBAL = 1, + JVMTI_HEAP_ROOT_SYSTEM_CLASS = 2, + JVMTI_HEAP_ROOT_MONITOR = 3, + JVMTI_HEAP_ROOT_STACK_LOCAL = 4, + JVMTI_HEAP_ROOT_JNI_LOCAL = 5, + JVMTI_HEAP_ROOT_THREAD = 6, + JVMTI_HEAP_ROOT_OTHER = 7 +} jvmtiHeapRootKind; + + /* Object Reference Enumeration */ + +typedef enum { + JVMTI_REFERENCE_CLASS = 1, + JVMTI_REFERENCE_FIELD = 2, + JVMTI_REFERENCE_ARRAY_ELEMENT = 3, + JVMTI_REFERENCE_CLASS_LOADER = 4, + JVMTI_REFERENCE_SIGNERS = 5, + JVMTI_REFERENCE_PROTECTION_DOMAIN = 6, + JVMTI_REFERENCE_INTERFACE = 7, + JVMTI_REFERENCE_STATIC_FIELD = 8, + JVMTI_REFERENCE_CONSTANT_POOL = 9 +} jvmtiObjectReferenceKind; + + /* Iteration Control Enumeration */ + +typedef enum { + JVMTI_ITERATION_CONTINUE = 1, + JVMTI_ITERATION_IGNORE = 2, + JVMTI_ITERATION_ABORT = 0 +} jvmtiIterationControl; + + /* Class Status Flags */ + +enum { + JVMTI_CLASS_STATUS_VERIFIED = 1, + JVMTI_CLASS_STATUS_PREPARED = 2, + JVMTI_CLASS_STATUS_INITIALIZED = 4, + JVMTI_CLASS_STATUS_ERROR = 8, + JVMTI_CLASS_STATUS_ARRAY = 16, + JVMTI_CLASS_STATUS_PRIMITIVE = 32 +}; + + /* Event Enable/Disable */ + +typedef enum { + JVMTI_ENABLE = 1, + JVMTI_DISABLE = 0 +} jvmtiEventMode; + + /* Extension Function/Event Parameter Types */ + +typedef enum { + JVMTI_TYPE_JBYTE = 101, + JVMTI_TYPE_JCHAR = 102, + JVMTI_TYPE_JSHORT = 103, + JVMTI_TYPE_JINT = 104, + JVMTI_TYPE_JLONG = 105, + JVMTI_TYPE_JFLOAT = 106, + JVMTI_TYPE_JDOUBLE = 107, + JVMTI_TYPE_JBOOLEAN = 108, + JVMTI_TYPE_JOBJECT = 109, + JVMTI_TYPE_JTHREAD = 110, + JVMTI_TYPE_JCLASS = 111, + JVMTI_TYPE_JVALUE = 112, + JVMTI_TYPE_JFIELDID = 113, + JVMTI_TYPE_JMETHODID = 114, + JVMTI_TYPE_CCHAR = 115, + JVMTI_TYPE_CVOID = 116, + JVMTI_TYPE_JNIENV = 117 +} jvmtiParamTypes; + + /* Extension Function/Event Parameter Kinds */ + +typedef enum { + JVMTI_KIND_IN = 91, + JVMTI_KIND_IN_PTR = 92, + JVMTI_KIND_IN_BUF = 93, + JVMTI_KIND_ALLOC_BUF = 94, + JVMTI_KIND_ALLOC_ALLOC_BUF = 95, + JVMTI_KIND_OUT = 96, + JVMTI_KIND_OUT_BUF = 97 +} jvmtiParamKind; + + /* Timer Kinds */ + +typedef enum { + JVMTI_TIMER_USER_CPU = 30, + JVMTI_TIMER_TOTAL_CPU = 31, + JVMTI_TIMER_ELAPSED = 32 +} jvmtiTimerKind; + + /* Phases of execution */ + +typedef enum { + JVMTI_PHASE_ONLOAD = 1, + JVMTI_PHASE_PRIMORDIAL = 2, + JVMTI_PHASE_START = 6, + JVMTI_PHASE_LIVE = 4, + JVMTI_PHASE_DEAD = 8 +} jvmtiPhase; + + /* Version Interface Types */ + +enum { + JVMTI_VERSION_INTERFACE_JNI = 0x00000000, + JVMTI_VERSION_INTERFACE_JVMTI = 0x30000000 +}; + + /* Version Masks */ + +enum { + JVMTI_VERSION_MASK_INTERFACE_TYPE = 0x70000000, + JVMTI_VERSION_MASK_MAJOR = 0x0FFF0000, + JVMTI_VERSION_MASK_MINOR = 0x0000FF00, + JVMTI_VERSION_MASK_MICRO = 0x000000FF +}; + + /* Version Shifts */ + +enum { + JVMTI_VERSION_SHIFT_MAJOR = 16, + JVMTI_VERSION_SHIFT_MINOR = 8, + JVMTI_VERSION_SHIFT_MICRO = 0 +}; + + /* Verbose Flag Enumeration */ + +typedef enum { + JVMTI_VERBOSE_OTHER = 0, + JVMTI_VERBOSE_GC = 1, + JVMTI_VERBOSE_CLASS = 2, + JVMTI_VERBOSE_JNI = 4 +} jvmtiVerboseFlag; + + /* JLocation Format Enumeration */ + +typedef enum { + JVMTI_JLOCATION_JVMBCI = 1, + JVMTI_JLOCATION_MACHINEPC = 2, + JVMTI_JLOCATION_OTHER = 0 +} jvmtiJlocationFormat; + + /* Errors */ + +typedef enum { + JVMTI_ERROR_NONE = 0, + JVMTI_ERROR_INVALID_THREAD = 10, + JVMTI_ERROR_INVALID_THREAD_GROUP = 11, + JVMTI_ERROR_INVALID_PRIORITY = 12, + JVMTI_ERROR_THREAD_NOT_SUSPENDED = 13, + JVMTI_ERROR_THREAD_SUSPENDED = 14, + JVMTI_ERROR_THREAD_NOT_ALIVE = 15, + JVMTI_ERROR_INVALID_OBJECT = 20, + JVMTI_ERROR_INVALID_CLASS = 21, + JVMTI_ERROR_CLASS_NOT_PREPARED = 22, + JVMTI_ERROR_INVALID_METHODID = 23, + JVMTI_ERROR_INVALID_LOCATION = 24, + JVMTI_ERROR_INVALID_FIELDID = 25, + JVMTI_ERROR_NO_MORE_FRAMES = 31, + JVMTI_ERROR_OPAQUE_FRAME = 32, + JVMTI_ERROR_TYPE_MISMATCH = 34, + JVMTI_ERROR_INVALID_SLOT = 35, + JVMTI_ERROR_DUPLICATE = 40, + JVMTI_ERROR_NOT_FOUND = 41, + JVMTI_ERROR_INVALID_MONITOR = 50, + JVMTI_ERROR_NOT_MONITOR_OWNER = 51, + JVMTI_ERROR_INTERRUPT = 52, + JVMTI_ERROR_INVALID_CLASS_FORMAT = 60, + JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION = 61, + JVMTI_ERROR_FAILS_VERIFICATION = 62, + JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED = 63, + JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED = 64, + JVMTI_ERROR_INVALID_TYPESTATE = 65, + JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED = 66, + JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED = 67, + JVMTI_ERROR_UNSUPPORTED_VERSION = 68, + JVMTI_ERROR_NAMES_DONT_MATCH = 69, + JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED = 70, + JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED = 71, + JVMTI_ERROR_UNMODIFIABLE_CLASS = 79, + JVMTI_ERROR_NOT_AVAILABLE = 98, + JVMTI_ERROR_MUST_POSSESS_CAPABILITY = 99, + JVMTI_ERROR_NULL_POINTER = 100, + JVMTI_ERROR_ABSENT_INFORMATION = 101, + JVMTI_ERROR_INVALID_EVENT_TYPE = 102, + JVMTI_ERROR_ILLEGAL_ARGUMENT = 103, + JVMTI_ERROR_NATIVE_METHOD = 104, + JVMTI_ERROR_OUT_OF_MEMORY = 110, + JVMTI_ERROR_ACCESS_DENIED = 111, + JVMTI_ERROR_WRONG_PHASE = 112, + JVMTI_ERROR_INTERNAL = 113, + JVMTI_ERROR_UNATTACHED_THREAD = 115, + JVMTI_ERROR_INVALID_ENVIRONMENT = 116, + JVMTI_ERROR_MAX = 116 +} jvmtiError; + + /* Event IDs */ + +typedef enum { + JVMTI_MIN_EVENT_TYPE_VAL = 50, + JVMTI_EVENT_VM_INIT = 50, + JVMTI_EVENT_VM_DEATH = 51, + JVMTI_EVENT_THREAD_START = 52, + JVMTI_EVENT_THREAD_END = 53, + JVMTI_EVENT_CLASS_FILE_LOAD_HOOK = 54, + JVMTI_EVENT_CLASS_LOAD = 55, + JVMTI_EVENT_CLASS_PREPARE = 56, + JVMTI_EVENT_VM_START = 57, + JVMTI_EVENT_EXCEPTION = 58, + JVMTI_EVENT_EXCEPTION_CATCH = 59, + JVMTI_EVENT_SINGLE_STEP = 60, + JVMTI_EVENT_FRAME_POP = 61, + JVMTI_EVENT_BREAKPOINT = 62, + JVMTI_EVENT_FIELD_ACCESS = 63, + JVMTI_EVENT_FIELD_MODIFICATION = 64, + JVMTI_EVENT_METHOD_ENTRY = 65, + JVMTI_EVENT_METHOD_EXIT = 66, + JVMTI_EVENT_NATIVE_METHOD_BIND = 67, + JVMTI_EVENT_COMPILED_METHOD_LOAD = 68, + JVMTI_EVENT_COMPILED_METHOD_UNLOAD = 69, + JVMTI_EVENT_DYNAMIC_CODE_GENERATED = 70, + JVMTI_EVENT_DATA_DUMP_REQUEST = 71, + JVMTI_EVENT_MONITOR_WAIT = 73, + JVMTI_EVENT_MONITOR_WAITED = 74, + JVMTI_EVENT_MONITOR_CONTENDED_ENTER = 75, + JVMTI_EVENT_MONITOR_CONTENDED_ENTERED = 76, + JVMTI_EVENT_GARBAGE_COLLECTION_START = 81, + JVMTI_EVENT_GARBAGE_COLLECTION_FINISH = 82, + JVMTI_EVENT_OBJECT_FREE = 83, + JVMTI_EVENT_VM_OBJECT_ALLOC = 84, + JVMTI_MAX_EVENT_TYPE_VAL = 84 +} jvmtiEvent; + + + /* Function Types */ + +typedef void (JNICALL *jvmtiStartFunction) + (jvmtiEnv* jvmti_env, JNIEnv* jni_env, void* arg); + +typedef jvmtiIterationControl (JNICALL *jvmtiHeapObjectCallback) + (jlong class_tag, jlong size, jlong* tag_ptr, void* user_data); + +typedef jvmtiIterationControl (JNICALL *jvmtiHeapRootCallback) + (jvmtiHeapRootKind root_kind, jlong class_tag, jlong size, jlong* tag_ptr, void* user_data); + +typedef jvmtiIterationControl (JNICALL *jvmtiStackReferenceCallback) + (jvmtiHeapRootKind root_kind, jlong class_tag, jlong size, jlong* tag_ptr, jlong thread_tag, jint depth, jmethodID method, jint slot, void* user_data); + +typedef jvmtiIterationControl (JNICALL *jvmtiObjectReferenceCallback) + (jvmtiObjectReferenceKind reference_kind, jlong class_tag, jlong size, jlong* tag_ptr, jlong referrer_tag, jint referrer_index, void* user_data); + +typedef jvmtiError (JNICALL *jvmtiExtensionFunction) + (jvmtiEnv* jvmti_env, ...); + +typedef void (JNICALL *jvmtiExtensionEvent) + (jvmtiEnv* jvmti_env, ...); + + + /* Structure Types */ + +typedef struct { + char* name; + jint priority; + jboolean is_daemon; + jthreadGroup thread_group; + jobject context_class_loader; +} jvmtiThreadInfo; + +typedef struct { + jthreadGroup parent; + char* name; + jint max_priority; + jboolean is_daemon; +} jvmtiThreadGroupInfo; + +typedef struct { + jmethodID method; + jlocation location; +} jvmtiFrameInfo; + +typedef struct { + jthread thread; + jint state; + jvmtiFrameInfo* frame_buffer; + jint frame_count; +} jvmtiStackInfo; + +typedef struct { + jclass klass; + jint class_byte_count; + const unsigned char* class_bytes; +} jvmtiClassDefinition; + +typedef struct { + jthread owner; + jint entry_count; + jint waiter_count; + jthread* waiters; + jint notify_waiter_count; + jthread* notify_waiters; +} jvmtiMonitorUsage; + +typedef struct { + jlocation start_location; + jint line_number; +} jvmtiLineNumberEntry; + +typedef struct { + jlocation start_location; + jint length; + char* name; + char* signature; + char* generic_signature; + jint slot; +} jvmtiLocalVariableEntry; + +typedef struct { + char* name; + jvmtiParamKind kind; + jvmtiParamTypes base_type; + jboolean null_ok; +} jvmtiParamInfo; + +typedef struct { + jvmtiExtensionFunction func; + char* id; + char* short_description; + jint param_count; + jvmtiParamInfo* params; + jint error_count; + jvmtiError* errors; +} jvmtiExtensionFunctionInfo; + +typedef struct { + jint extension_event_index; + char* id; + char* short_description; + jint param_count; + jvmtiParamInfo* params; +} jvmtiExtensionEventInfo; + +typedef struct { + jlong max_value; + jboolean may_skip_forward; + jboolean may_skip_backward; + jvmtiTimerKind kind; + jlong reserved1; + jlong reserved2; +} jvmtiTimerInfo; + +typedef struct { + const void* start_address; + jlocation location; +} jvmtiAddrLocationMap; + +typedef struct { + unsigned int can_tag_objects : 1; + unsigned int can_generate_field_modification_events : 1; + unsigned int can_generate_field_access_events : 1; + unsigned int can_get_bytecodes : 1; + unsigned int can_get_synthetic_attribute : 1; + unsigned int can_get_owned_monitor_info : 1; + unsigned int can_get_current_contended_monitor : 1; + unsigned int can_get_monitor_info : 1; + unsigned int can_pop_frame : 1; + unsigned int can_redefine_classes : 1; + unsigned int can_signal_thread : 1; + unsigned int can_get_source_file_name : 1; + unsigned int can_get_line_numbers : 1; + unsigned int can_get_source_debug_extension : 1; + unsigned int can_access_local_variables : 1; + unsigned int can_maintain_original_method_order : 1; + unsigned int can_generate_single_step_events : 1; + unsigned int can_generate_exception_events : 1; + unsigned int can_generate_frame_pop_events : 1; + unsigned int can_generate_breakpoint_events : 1; + unsigned int can_suspend : 1; + unsigned int can_redefine_any_class : 1; + unsigned int can_get_current_thread_cpu_time : 1; + unsigned int can_get_thread_cpu_time : 1; + unsigned int can_generate_method_entry_events : 1; + unsigned int can_generate_method_exit_events : 1; + unsigned int can_generate_all_class_hook_events : 1; + unsigned int can_generate_compiled_method_load_events : 1; + unsigned int can_generate_monitor_events : 1; + unsigned int can_generate_vm_object_alloc_events : 1; + unsigned int can_generate_native_method_bind_events : 1; + unsigned int can_generate_garbage_collection_events : 1; + unsigned int can_generate_object_free_events : 1; + unsigned int : 15; + unsigned int : 16; + unsigned int : 16; + unsigned int : 16; + unsigned int : 16; + unsigned int : 16; +} jvmtiCapabilities; + + + /* Event Definitions */ + +typedef void (JNICALL *jvmtiEventReserved)(void); + + +typedef void (JNICALL *jvmtiEventBreakpoint) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread, + jmethodID method, + jlocation location); + +typedef void (JNICALL *jvmtiEventClassFileLoadHook) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jclass class_being_redefined, + jobject loader, + const char* name, + jobject protection_domain, + jint class_data_len, + const unsigned char* class_data, + jint* new_class_data_len, + unsigned char** new_class_data); + +typedef void (JNICALL *jvmtiEventClassLoad) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread, + jclass klass); + +typedef void (JNICALL *jvmtiEventClassPrepare) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread, + jclass klass); + +typedef void (JNICALL *jvmtiEventCompiledMethodLoad) + (jvmtiEnv *jvmti_env, + jmethodID method, + jint code_size, + const void* code_addr, + jint map_length, + const jvmtiAddrLocationMap* map, + const void* compile_info); + +typedef void (JNICALL *jvmtiEventCompiledMethodUnload) + (jvmtiEnv *jvmti_env, + jmethodID method, + const void* code_addr); + +typedef void (JNICALL *jvmtiEventDataDumpRequest) + (jvmtiEnv *jvmti_env); + +typedef void (JNICALL *jvmtiEventDynamicCodeGenerated) + (jvmtiEnv *jvmti_env, + const char* name, + const void* address, + jint length); + +typedef void (JNICALL *jvmtiEventException) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread, + jmethodID method, + jlocation location, + jobject exception, + jmethodID catch_method, + jlocation catch_location); + +typedef void (JNICALL *jvmtiEventExceptionCatch) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread, + jmethodID method, + jlocation location, + jobject exception); + +typedef void (JNICALL *jvmtiEventFieldAccess) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread, + jmethodID method, + jlocation location, + jclass field_klass, + jobject object, + jfieldID field); + +typedef void (JNICALL *jvmtiEventFieldModification) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread, + jmethodID method, + jlocation location, + jclass field_klass, + jobject object, + jfieldID field, + char signature_type, + jvalue new_value); + +typedef void (JNICALL *jvmtiEventFramePop) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread, + jmethodID method, + jboolean was_popped_by_exception); + +typedef void (JNICALL *jvmtiEventGarbageCollectionFinish) + (jvmtiEnv *jvmti_env); + +typedef void (JNICALL *jvmtiEventGarbageCollectionStart) + (jvmtiEnv *jvmti_env); + +typedef void (JNICALL *jvmtiEventMethodEntry) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread, + jmethodID method); + +typedef void (JNICALL *jvmtiEventMethodExit) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread, + jmethodID method, + jboolean was_popped_by_exception, + jvalue return_value); + +typedef void (JNICALL *jvmtiEventMonitorContendedEnter) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread, + jobject object); + +typedef void (JNICALL *jvmtiEventMonitorContendedEntered) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread, + jobject object); + +typedef void (JNICALL *jvmtiEventMonitorWait) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread, + jobject object, + jlong timeout); + +typedef void (JNICALL *jvmtiEventMonitorWaited) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread, + jobject object, + jboolean timed_out); + +typedef void (JNICALL *jvmtiEventNativeMethodBind) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread, + jmethodID method, + void* address, + void** new_address_ptr); + +typedef void (JNICALL *jvmtiEventObjectFree) + (jvmtiEnv *jvmti_env, + jlong tag); + +typedef void (JNICALL *jvmtiEventSingleStep) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread, + jmethodID method, + jlocation location); + +typedef void (JNICALL *jvmtiEventThreadEnd) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread); + +typedef void (JNICALL *jvmtiEventThreadStart) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread); + +typedef void (JNICALL *jvmtiEventVMDeath) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env); + +typedef void (JNICALL *jvmtiEventVMInit) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread); + +typedef void (JNICALL *jvmtiEventVMObjectAlloc) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env, + jthread thread, + jobject object, + jclass object_klass, + jlong size); + +typedef void (JNICALL *jvmtiEventVMStart) + (jvmtiEnv *jvmti_env, + JNIEnv* jni_env); + + /* Event Callback Structure */ + +typedef struct { + /* 50 : VM Initialization Event */ + jvmtiEventVMInit VMInit; + /* 51 : VM Death Event */ + jvmtiEventVMDeath VMDeath; + /* 52 : Thread Start */ + jvmtiEventThreadStart ThreadStart; + /* 53 : Thread End */ + jvmtiEventThreadEnd ThreadEnd; + /* 54 : Class File Load Hook */ + jvmtiEventClassFileLoadHook ClassFileLoadHook; + /* 55 : Class Load */ + jvmtiEventClassLoad ClassLoad; + /* 56 : Class Prepare */ + jvmtiEventClassPrepare ClassPrepare; + /* 57 : VM Start Event */ + jvmtiEventVMStart VMStart; + /* 58 : Exception */ + jvmtiEventException Exception; + /* 59 : Exception Catch */ + jvmtiEventExceptionCatch ExceptionCatch; + /* 60 : Single Step */ + jvmtiEventSingleStep SingleStep; + /* 61 : Frame Pop */ + jvmtiEventFramePop FramePop; + /* 62 : Breakpoint */ + jvmtiEventBreakpoint Breakpoint; + /* 63 : Field Access */ + jvmtiEventFieldAccess FieldAccess; + /* 64 : Field Modification */ + jvmtiEventFieldModification FieldModification; + /* 65 : Method Entry */ + jvmtiEventMethodEntry MethodEntry; + /* 66 : Method Exit */ + jvmtiEventMethodExit MethodExit; + /* 67 : Native Method Bind */ + jvmtiEventNativeMethodBind NativeMethodBind; + /* 68 : Compiled Method Load */ + jvmtiEventCompiledMethodLoad CompiledMethodLoad; + /* 69 : Compiled Method Unload */ + jvmtiEventCompiledMethodUnload CompiledMethodUnload; + /* 70 : Dynamic Code Generated */ + jvmtiEventDynamicCodeGenerated DynamicCodeGenerated; + /* 71 : Data Dump Request */ + jvmtiEventDataDumpRequest DataDumpRequest; + /* 72 */ + jvmtiEventReserved reserved72; + /* 73 : Monitor Wait */ + jvmtiEventMonitorWait MonitorWait; + /* 74 : Monitor Waited */ + jvmtiEventMonitorWaited MonitorWaited; + /* 75 : Monitor Contended Enter */ + jvmtiEventMonitorContendedEnter MonitorContendedEnter; + /* 76 : Monitor Contended Entered */ + jvmtiEventMonitorContendedEntered MonitorContendedEntered; + /* 77 */ + jvmtiEventReserved reserved77; + /* 78 */ + jvmtiEventReserved reserved78; + /* 79 */ + jvmtiEventReserved reserved79; + /* 80 */ + jvmtiEventReserved reserved80; + /* 81 : Garbage Collection Start */ + jvmtiEventGarbageCollectionStart GarbageCollectionStart; + /* 82 : Garbage Collection Finish */ + jvmtiEventGarbageCollectionFinish GarbageCollectionFinish; + /* 83 : Object Free */ + jvmtiEventObjectFree ObjectFree; + /* 84 : VM Object Allocation */ + jvmtiEventVMObjectAlloc VMObjectAlloc; +} jvmtiEventCallbacks; + + + /* Function Interface */ + +typedef struct jvmtiInterface_1_ { + + /* 1 : RESERVED */ + void *reserved1; + + /* 2 : Set Event Notification Mode */ + jvmtiError (JNICALL *SetEventNotificationMode) (jvmtiEnv* env, + jvmtiEventMode mode, + jvmtiEvent event_type, + jthread event_thread, + ...); + + /* 3 : RESERVED */ + void *reserved3; + + /* 4 : Get All Threads */ + jvmtiError (JNICALL *GetAllThreads) (jvmtiEnv* env, + jint* threads_count_ptr, + jthread** threads_ptr); + + /* 5 : Suspend Thread */ + jvmtiError (JNICALL *SuspendThread) (jvmtiEnv* env, + jthread thread); + + /* 6 : Resume Thread */ + jvmtiError (JNICALL *ResumeThread) (jvmtiEnv* env, + jthread thread); + + /* 7 : Stop Thread */ + jvmtiError (JNICALL *StopThread) (jvmtiEnv* env, + jthread thread, + jobject exception); + + /* 8 : Interrupt Thread */ + jvmtiError (JNICALL *InterruptThread) (jvmtiEnv* env, + jthread thread); + + /* 9 : Get Thread Info */ + jvmtiError (JNICALL *GetThreadInfo) (jvmtiEnv* env, + jthread thread, + jvmtiThreadInfo* info_ptr); + + /* 10 : Get Owned Monitor Info */ + jvmtiError (JNICALL *GetOwnedMonitorInfo) (jvmtiEnv* env, + jthread thread, + jint* owned_monitor_count_ptr, + jobject** owned_monitors_ptr); + + /* 11 : Get Current Contended Monitor */ + jvmtiError (JNICALL *GetCurrentContendedMonitor) (jvmtiEnv* env, + jthread thread, + jobject* monitor_ptr); + + /* 12 : Run Agent Thread */ + jvmtiError (JNICALL *RunAgentThread) (jvmtiEnv* env, + jthread thread, + jvmtiStartFunction proc, + const void* arg, + jint priority); + + /* 13 : Get Top Thread Groups */ + jvmtiError (JNICALL *GetTopThreadGroups) (jvmtiEnv* env, + jint* group_count_ptr, + jthreadGroup** groups_ptr); + + /* 14 : Get Thread Group Info */ + jvmtiError (JNICALL *GetThreadGroupInfo) (jvmtiEnv* env, + jthreadGroup group, + jvmtiThreadGroupInfo* info_ptr); + + /* 15 : Get Thread Group Children */ + jvmtiError (JNICALL *GetThreadGroupChildren) (jvmtiEnv* env, + jthreadGroup group, + jint* thread_count_ptr, + jthread** threads_ptr, + jint* group_count_ptr, + jthreadGroup** groups_ptr); + + /* 16 : Get Frame Count */ + jvmtiError (JNICALL *GetFrameCount) (jvmtiEnv* env, + jthread thread, + jint* count_ptr); + + /* 17 : Get Thread State */ + jvmtiError (JNICALL *GetThreadState) (jvmtiEnv* env, + jthread thread, + jint* thread_state_ptr); + + /* 18 : RESERVED */ + void *reserved18; + + /* 19 : Get Frame Location */ + jvmtiError (JNICALL *GetFrameLocation) (jvmtiEnv* env, + jthread thread, + jint depth, + jmethodID* method_ptr, + jlocation* location_ptr); + + /* 20 : Notify Frame Pop */ + jvmtiError (JNICALL *NotifyFramePop) (jvmtiEnv* env, + jthread thread, + jint depth); + + /* 21 : Get Local Variable - Object */ + jvmtiError (JNICALL *GetLocalObject) (jvmtiEnv* env, + jthread thread, + jint depth, + jint slot, + jobject* value_ptr); + + /* 22 : Get Local Variable - Int */ + jvmtiError (JNICALL *GetLocalInt) (jvmtiEnv* env, + jthread thread, + jint depth, + jint slot, + jint* value_ptr); + + /* 23 : Get Local Variable - Long */ + jvmtiError (JNICALL *GetLocalLong) (jvmtiEnv* env, + jthread thread, + jint depth, + jint slot, + jlong* value_ptr); + + /* 24 : Get Local Variable - Float */ + jvmtiError (JNICALL *GetLocalFloat) (jvmtiEnv* env, + jthread thread, + jint depth, + jint slot, + jfloat* value_ptr); + + /* 25 : Get Local Variable - Double */ + jvmtiError (JNICALL *GetLocalDouble) (jvmtiEnv* env, + jthread thread, + jint depth, + jint slot, + jdouble* value_ptr); + + /* 26 : Set Local Variable - Object */ + jvmtiError (JNICALL *SetLocalObject) (jvmtiEnv* env, + jthread thread, + jint depth, + jint slot, + jobject value); + + /* 27 : Set Local Variable - Int */ + jvmtiError (JNICALL *SetLocalInt) (jvmtiEnv* env, + jthread thread, + jint depth, + jint slot, + jint value); + + /* 28 : Set Local Variable - Long */ + jvmtiError (JNICALL *SetLocalLong) (jvmtiEnv* env, + jthread thread, + jint depth, + jint slot, + jlong value); + + /* 29 : Set Local Variable - Float */ + jvmtiError (JNICALL *SetLocalFloat) (jvmtiEnv* env, + jthread thread, + jint depth, + jint slot, + jfloat value); + + /* 30 : Set Local Variable - Double */ + jvmtiError (JNICALL *SetLocalDouble) (jvmtiEnv* env, + jthread thread, + jint depth, + jint slot, + jdouble value); + + /* 31 : Create Raw Monitor */ + jvmtiError (JNICALL *CreateRawMonitor) (jvmtiEnv* env, + const char* name, + jrawMonitorID* monitor_ptr); + + /* 32 : Destroy Raw Monitor */ + jvmtiError (JNICALL *DestroyRawMonitor) (jvmtiEnv* env, + jrawMonitorID monitor); + + /* 33 : Raw Monitor Enter */ + jvmtiError (JNICALL *RawMonitorEnter) (jvmtiEnv* env, + jrawMonitorID monitor); + + /* 34 : Raw Monitor Exit */ + jvmtiError (JNICALL *RawMonitorExit) (jvmtiEnv* env, + jrawMonitorID monitor); + + /* 35 : Raw Monitor Wait */ + jvmtiError (JNICALL *RawMonitorWait) (jvmtiEnv* env, + jrawMonitorID monitor, + jlong millis); + + /* 36 : Raw Monitor Notify */ + jvmtiError (JNICALL *RawMonitorNotify) (jvmtiEnv* env, + jrawMonitorID monitor); + + /* 37 : Raw Monitor Notify All */ + jvmtiError (JNICALL *RawMonitorNotifyAll) (jvmtiEnv* env, + jrawMonitorID monitor); + + /* 38 : Set Breakpoint */ + jvmtiError (JNICALL *SetBreakpoint) (jvmtiEnv* env, + jmethodID method, + jlocation location); + + /* 39 : Clear Breakpoint */ + jvmtiError (JNICALL *ClearBreakpoint) (jvmtiEnv* env, + jmethodID method, + jlocation location); + + /* 40 : RESERVED */ + void *reserved40; + + /* 41 : Set Field Access Watch */ + jvmtiError (JNICALL *SetFieldAccessWatch) (jvmtiEnv* env, + jclass klass, + jfieldID field); + + /* 42 : Clear Field Access Watch */ + jvmtiError (JNICALL *ClearFieldAccessWatch) (jvmtiEnv* env, + jclass klass, + jfieldID field); + + /* 43 : Set Field Modification Watch */ + jvmtiError (JNICALL *SetFieldModificationWatch) (jvmtiEnv* env, + jclass klass, + jfieldID field); + + /* 44 : Clear Field Modification Watch */ + jvmtiError (JNICALL *ClearFieldModificationWatch) (jvmtiEnv* env, + jclass klass, + jfieldID field); + + /* 45 : RESERVED */ + void *reserved45; + + /* 46 : Allocate */ + jvmtiError (JNICALL *Allocate) (jvmtiEnv* env, + jlong size, + unsigned char** mem_ptr); + + /* 47 : Deallocate */ + jvmtiError (JNICALL *Deallocate) (jvmtiEnv* env, + unsigned char* mem); + + /* 48 : Get Class Signature */ + jvmtiError (JNICALL *GetClassSignature) (jvmtiEnv* env, + jclass klass, + char** signature_ptr, + char** generic_ptr); + + /* 49 : Get Class Status */ + jvmtiError (JNICALL *GetClassStatus) (jvmtiEnv* env, + jclass klass, + jint* status_ptr); + + /* 50 : Get Source File Name */ + jvmtiError (JNICALL *GetSourceFileName) (jvmtiEnv* env, + jclass klass, + char** source_name_ptr); + + /* 51 : Get Class Modifiers */ + jvmtiError (JNICALL *GetClassModifiers) (jvmtiEnv* env, + jclass klass, + jint* modifiers_ptr); + + /* 52 : Get Class Methods */ + jvmtiError (JNICALL *GetClassMethods) (jvmtiEnv* env, + jclass klass, + jint* method_count_ptr, + jmethodID** methods_ptr); + + /* 53 : Get Class Fields */ + jvmtiError (JNICALL *GetClassFields) (jvmtiEnv* env, + jclass klass, + jint* field_count_ptr, + jfieldID** fields_ptr); + + /* 54 : Get Implemented Interfaces */ + jvmtiError (JNICALL *GetImplementedInterfaces) (jvmtiEnv* env, + jclass klass, + jint* interface_count_ptr, + jclass** interfaces_ptr); + + /* 55 : Is Interface */ + jvmtiError (JNICALL *IsInterface) (jvmtiEnv* env, + jclass klass, + jboolean* is_interface_ptr); + + /* 56 : Is Array Class */ + jvmtiError (JNICALL *IsArrayClass) (jvmtiEnv* env, + jclass klass, + jboolean* is_array_class_ptr); + + /* 57 : Get Class Loader */ + jvmtiError (JNICALL *GetClassLoader) (jvmtiEnv* env, + jclass klass, + jobject* classloader_ptr); + + /* 58 : Get Object Hash Code */ + jvmtiError (JNICALL *GetObjectHashCode) (jvmtiEnv* env, + jobject object, + jint* hash_code_ptr); + + /* 59 : Get Object Monitor Usage */ + jvmtiError (JNICALL *GetObjectMonitorUsage) (jvmtiEnv* env, + jobject object, + jvmtiMonitorUsage* info_ptr); + + /* 60 : Get Field Name (and Signature) */ + jvmtiError (JNICALL *GetFieldName) (jvmtiEnv* env, + jclass klass, + jfieldID field, + char** name_ptr, + char** signature_ptr, + char** generic_ptr); + + /* 61 : Get Field Declaring Class */ + jvmtiError (JNICALL *GetFieldDeclaringClass) (jvmtiEnv* env, + jclass klass, + jfieldID field, + jclass* declaring_class_ptr); + + /* 62 : Get Field Modifiers */ + jvmtiError (JNICALL *GetFieldModifiers) (jvmtiEnv* env, + jclass klass, + jfieldID field, + jint* modifiers_ptr); + + /* 63 : Is Field Synthetic */ + jvmtiError (JNICALL *IsFieldSynthetic) (jvmtiEnv* env, + jclass klass, + jfieldID field, + jboolean* is_synthetic_ptr); + + /* 64 : Get Method Name (and Signature) */ + jvmtiError (JNICALL *GetMethodName) (jvmtiEnv* env, + jmethodID method, + char** name_ptr, + char** signature_ptr, + char** generic_ptr); + + /* 65 : Get Method Declaring Class */ + jvmtiError (JNICALL *GetMethodDeclaringClass) (jvmtiEnv* env, + jmethodID method, + jclass* declaring_class_ptr); + + /* 66 : Get Method Modifiers */ + jvmtiError (JNICALL *GetMethodModifiers) (jvmtiEnv* env, + jmethodID method, + jint* modifiers_ptr); + + /* 67 : RESERVED */ + void *reserved67; + + /* 68 : Get Max Locals */ + jvmtiError (JNICALL *GetMaxLocals) (jvmtiEnv* env, + jmethodID method, + jint* max_ptr); + + /* 69 : Get Arguments Size */ + jvmtiError (JNICALL *GetArgumentsSize) (jvmtiEnv* env, + jmethodID method, + jint* size_ptr); + + /* 70 : Get Line Number Table */ + jvmtiError (JNICALL *GetLineNumberTable) (jvmtiEnv* env, + jmethodID method, + jint* entry_count_ptr, + jvmtiLineNumberEntry** table_ptr); + + /* 71 : Get Method Location */ + jvmtiError (JNICALL *GetMethodLocation) (jvmtiEnv* env, + jmethodID method, + jlocation* start_location_ptr, + jlocation* end_location_ptr); + + /* 72 : Get Local Variable Table */ + jvmtiError (JNICALL *GetLocalVariableTable) (jvmtiEnv* env, + jmethodID method, + jint* entry_count_ptr, + jvmtiLocalVariableEntry** table_ptr); + + /* 73 : RESERVED */ + void *reserved73; + + /* 74 : RESERVED */ + void *reserved74; + + /* 75 : Get Bytecodes */ + jvmtiError (JNICALL *GetBytecodes) (jvmtiEnv* env, + jmethodID method, + jint* bytecode_count_ptr, + unsigned char** bytecodes_ptr); + + /* 76 : Is Method Native */ + jvmtiError (JNICALL *IsMethodNative) (jvmtiEnv* env, + jmethodID method, + jboolean* is_native_ptr); + + /* 77 : Is Method Synthetic */ + jvmtiError (JNICALL *IsMethodSynthetic) (jvmtiEnv* env, + jmethodID method, + jboolean* is_synthetic_ptr); + + /* 78 : Get Loaded Classes */ + jvmtiError (JNICALL *GetLoadedClasses) (jvmtiEnv* env, + jint* class_count_ptr, + jclass** classes_ptr); + + /* 79 : Get Classloader Classes */ + jvmtiError (JNICALL *GetClassLoaderClasses) (jvmtiEnv* env, + jobject initiating_loader, + jint* class_count_ptr, + jclass** classes_ptr); + + /* 80 : Pop Frame */ + jvmtiError (JNICALL *PopFrame) (jvmtiEnv* env, + jthread thread); + + /* 81 : RESERVED */ + void *reserved81; + + /* 82 : RESERVED */ + void *reserved82; + + /* 83 : RESERVED */ + void *reserved83; + + /* 84 : RESERVED */ + void *reserved84; + + /* 85 : RESERVED */ + void *reserved85; + + /* 86 : RESERVED */ + void *reserved86; + + /* 87 : Redefine Classes */ + jvmtiError (JNICALL *RedefineClasses) (jvmtiEnv* env, + jint class_count, + const jvmtiClassDefinition* class_definitions); + + /* 88 : Get Version Number */ + jvmtiError (JNICALL *GetVersionNumber) (jvmtiEnv* env, + jint* version_ptr); + + /* 89 : Get Capabilities */ + jvmtiError (JNICALL *GetCapabilities) (jvmtiEnv* env, + jvmtiCapabilities* capabilities_ptr); + + /* 90 : Get Source Debug Extension */ + jvmtiError (JNICALL *GetSourceDebugExtension) (jvmtiEnv* env, + jclass klass, + char** source_debug_extension_ptr); + + /* 91 : Is Method Obsolete */ + jvmtiError (JNICALL *IsMethodObsolete) (jvmtiEnv* env, + jmethodID method, + jboolean* is_obsolete_ptr); + + /* 92 : Suspend Thread List */ + jvmtiError (JNICALL *SuspendThreadList) (jvmtiEnv* env, + jint request_count, + const jthread* request_list, + jvmtiError* results); + + /* 93 : Resume Thread List */ + jvmtiError (JNICALL *ResumeThreadList) (jvmtiEnv* env, + jint request_count, + const jthread* request_list, + jvmtiError* results); + + /* 94 : RESERVED */ + void *reserved94; + + /* 95 : RESERVED */ + void *reserved95; + + /* 96 : RESERVED */ + void *reserved96; + + /* 97 : RESERVED */ + void *reserved97; + + /* 98 : RESERVED */ + void *reserved98; + + /* 99 : RESERVED */ + void *reserved99; + + /* 100 : Get All Stack Traces */ + jvmtiError (JNICALL *GetAllStackTraces) (jvmtiEnv* env, + jint max_frame_count, + jvmtiStackInfo** stack_info_ptr, + jint* thread_count_ptr); + + /* 101 : Get Thread List Stack Traces */ + jvmtiError (JNICALL *GetThreadListStackTraces) (jvmtiEnv* env, + jint thread_count, + const jthread* thread_list, + jint max_frame_count, + jvmtiStackInfo** stack_info_ptr); + + /* 102 : Get Thread Local Storage */ + jvmtiError (JNICALL *GetThreadLocalStorage) (jvmtiEnv* env, + jthread thread, + void** data_ptr); + + /* 103 : Set Thread Local Storage */ + jvmtiError (JNICALL *SetThreadLocalStorage) (jvmtiEnv* env, + jthread thread, + const void* data); + + /* 104 : Get Stack Trace */ + jvmtiError (JNICALL *GetStackTrace) (jvmtiEnv* env, + jthread thread, + jint start_depth, + jint max_frame_count, + jvmtiFrameInfo* frame_buffer, + jint* count_ptr); + + /* 105 : RESERVED */ + void *reserved105; + + /* 106 : Get Tag */ + jvmtiError (JNICALL *GetTag) (jvmtiEnv* env, + jobject object, + jlong* tag_ptr); + + /* 107 : Set Tag */ + jvmtiError (JNICALL *SetTag) (jvmtiEnv* env, + jobject object, + jlong tag); + + /* 108 : Force Garbage Collection */ + jvmtiError (JNICALL *ForceGarbageCollection) (jvmtiEnv* env); + + /* 109 : Iterate Over Objects Reachable From Object */ + jvmtiError (JNICALL *IterateOverObjectsReachableFromObject) (jvmtiEnv* env, + jobject object, + jvmtiObjectReferenceCallback object_reference_callback, + void* user_data); + + /* 110 : Iterate Over Reachable Objects */ + jvmtiError (JNICALL *IterateOverReachableObjects) (jvmtiEnv* env, + jvmtiHeapRootCallback heap_root_callback, + jvmtiStackReferenceCallback stack_ref_callback, + jvmtiObjectReferenceCallback object_ref_callback, + void* user_data); + + /* 111 : Iterate Over Heap */ + jvmtiError (JNICALL *IterateOverHeap) (jvmtiEnv* env, + jvmtiHeapObjectFilter object_filter, + jvmtiHeapObjectCallback heap_object_callback, + void* user_data); + + /* 112 : Iterate Over Instances Of Class */ + jvmtiError (JNICALL *IterateOverInstancesOfClass) (jvmtiEnv* env, + jclass klass, + jvmtiHeapObjectFilter object_filter, + jvmtiHeapObjectCallback heap_object_callback, + void* user_data); + + /* 113 : RESERVED */ + void *reserved113; + + /* 114 : Get Objects With Tags */ + jvmtiError (JNICALL *GetObjectsWithTags) (jvmtiEnv* env, + jint tag_count, + const jlong* tags, + jint* count_ptr, + jobject** object_result_ptr, + jlong** tag_result_ptr); + + /* 115 : RESERVED */ + void *reserved115; + + /* 116 : RESERVED */ + void *reserved116; + + /* 117 : RESERVED */ + void *reserved117; + + /* 118 : RESERVED */ + void *reserved118; + + /* 119 : RESERVED */ + void *reserved119; + + /* 120 : Set JNI Function Table */ + jvmtiError (JNICALL *SetJNIFunctionTable) (jvmtiEnv* env, + const jniNativeInterface* function_table); + + /* 121 : Get JNI Function Table */ + jvmtiError (JNICALL *GetJNIFunctionTable) (jvmtiEnv* env, + jniNativeInterface** function_table); + + /* 122 : Set Event Callbacks */ + jvmtiError (JNICALL *SetEventCallbacks) (jvmtiEnv* env, + const jvmtiEventCallbacks* callbacks, + jint size_of_callbacks); + + /* 123 : Generate Events */ + jvmtiError (JNICALL *GenerateEvents) (jvmtiEnv* env, + jvmtiEvent event_type); + + /* 124 : Get Extension Functions */ + jvmtiError (JNICALL *GetExtensionFunctions) (jvmtiEnv* env, + jint* extension_count_ptr, + jvmtiExtensionFunctionInfo** extensions); + + /* 125 : Get Extension Events */ + jvmtiError (JNICALL *GetExtensionEvents) (jvmtiEnv* env, + jint* extension_count_ptr, + jvmtiExtensionEventInfo** extensions); + + /* 126 : Set Extension Event Callback */ + jvmtiError (JNICALL *SetExtensionEventCallback) (jvmtiEnv* env, + jint extension_event_index, + jvmtiExtensionEvent callback); + + /* 127 : Dispose Environment */ + jvmtiError (JNICALL *DisposeEnvironment) (jvmtiEnv* env); + + /* 128 : Get Error Name */ + jvmtiError (JNICALL *GetErrorName) (jvmtiEnv* env, + jvmtiError error, + char** name_ptr); + + /* 129 : Get JLocation Format */ + jvmtiError (JNICALL *GetJLocationFormat) (jvmtiEnv* env, + jvmtiJlocationFormat* format_ptr); + + /* 130 : Get System Properties */ + jvmtiError (JNICALL *GetSystemProperties) (jvmtiEnv* env, + jint* count_ptr, + char*** property_ptr); + + /* 131 : Get System Property */ + jvmtiError (JNICALL *GetSystemProperty) (jvmtiEnv* env, + const char* property, + char** value_ptr); + + /* 132 : Set System Property */ + jvmtiError (JNICALL *SetSystemProperty) (jvmtiEnv* env, + const char* property, + const char* value); + + /* 133 : Get Phase */ + jvmtiError (JNICALL *GetPhase) (jvmtiEnv* env, + jvmtiPhase* phase_ptr); + + /* 134 : Get Current Thread CPU Timer Information */ + jvmtiError (JNICALL *GetCurrentThreadCpuTimerInfo) (jvmtiEnv* env, + jvmtiTimerInfo* info_ptr); + + /* 135 : Get Current Thread CPU Time */ + jvmtiError (JNICALL *GetCurrentThreadCpuTime) (jvmtiEnv* env, + jlong* nanos_ptr); + + /* 136 : Get Thread CPU Timer Information */ + jvmtiError (JNICALL *GetThreadCpuTimerInfo) (jvmtiEnv* env, + jvmtiTimerInfo* info_ptr); + + /* 137 : Get Thread CPU Time */ + jvmtiError (JNICALL *GetThreadCpuTime) (jvmtiEnv* env, + jthread thread, + jlong* nanos_ptr); + + /* 138 : Get Timer Information */ + jvmtiError (JNICALL *GetTimerInfo) (jvmtiEnv* env, + jvmtiTimerInfo* info_ptr); + + /* 139 : Get Time */ + jvmtiError (JNICALL *GetTime) (jvmtiEnv* env, + jlong* nanos_ptr); + + /* 140 : Get Potential Capabilities */ + jvmtiError (JNICALL *GetPotentialCapabilities) (jvmtiEnv* env, + jvmtiCapabilities* capabilities_ptr); + + /* 141 : RESERVED */ + void *reserved141; + + /* 142 : Add Capabilities */ + jvmtiError (JNICALL *AddCapabilities) (jvmtiEnv* env, + const jvmtiCapabilities* capabilities_ptr); + + /* 143 : Relinquish Capabilities */ + jvmtiError (JNICALL *RelinquishCapabilities) (jvmtiEnv* env, + const jvmtiCapabilities* capabilities_ptr); + + /* 144 : Get Available Processors */ + jvmtiError (JNICALL *GetAvailableProcessors) (jvmtiEnv* env, + jint* processor_count_ptr); + + /* 145 : RESERVED */ + void *reserved145; + + /* 146 : RESERVED */ + void *reserved146; + + /* 147 : Get Environment Local Storage */ + jvmtiError (JNICALL *GetEnvironmentLocalStorage) (jvmtiEnv* env, + void** data_ptr); + + /* 148 : Set Environment Local Storage */ + jvmtiError (JNICALL *SetEnvironmentLocalStorage) (jvmtiEnv* env, + const void* data); + + /* 149 : Add To Bootstrap Class Loader Search */ + jvmtiError (JNICALL *AddToBootstrapClassLoaderSearch) (jvmtiEnv* env, + const char* segment); + + /* 150 : Set Verbose Flag */ + jvmtiError (JNICALL *SetVerboseFlag) (jvmtiEnv* env, + jvmtiVerboseFlag flag, + jboolean value); + + /* 151 : RESERVED */ + void *reserved151; + + /* 152 : RESERVED */ + void *reserved152; + + /* 153 : RESERVED */ + void *reserved153; + + /* 154 : Get Object Size */ + jvmtiError (JNICALL *GetObjectSize) (jvmtiEnv* env, + jobject object, + jlong* size_ptr); + +} jvmtiInterface_1; + +struct _jvmtiEnv { + const struct jvmtiInterface_1_ *functions; +#ifdef __cplusplus + + + jvmtiError Allocate(jlong size, + unsigned char** mem_ptr) { + return functions->Allocate(this, size, mem_ptr); + } + + jvmtiError Deallocate(unsigned char* mem) { + return functions->Deallocate(this, mem); + } + + jvmtiError GetThreadState(jthread thread, + jint* thread_state_ptr) { + return functions->GetThreadState(this, thread, thread_state_ptr); + } + + jvmtiError GetAllThreads(jint* threads_count_ptr, + jthread** threads_ptr) { + return functions->GetAllThreads(this, threads_count_ptr, threads_ptr); + } + + jvmtiError SuspendThread(jthread thread) { + return functions->SuspendThread(this, thread); + } + + jvmtiError SuspendThreadList(jint request_count, + const jthread* request_list, + jvmtiError* results) { + return functions->SuspendThreadList(this, request_count, request_list, results); + } + + jvmtiError ResumeThread(jthread thread) { + return functions->ResumeThread(this, thread); + } + + jvmtiError ResumeThreadList(jint request_count, + const jthread* request_list, + jvmtiError* results) { + return functions->ResumeThreadList(this, request_count, request_list, results); + } + + jvmtiError StopThread(jthread thread, + jobject exception) { + return functions->StopThread(this, thread, exception); + } + + jvmtiError InterruptThread(jthread thread) { + return functions->InterruptThread(this, thread); + } + + jvmtiError GetThreadInfo(jthread thread, + jvmtiThreadInfo* info_ptr) { + return functions->GetThreadInfo(this, thread, info_ptr); + } + + jvmtiError GetOwnedMonitorInfo(jthread thread, + jint* owned_monitor_count_ptr, + jobject** owned_monitors_ptr) { + return functions->GetOwnedMonitorInfo(this, thread, owned_monitor_count_ptr, owned_monitors_ptr); + } + + jvmtiError GetCurrentContendedMonitor(jthread thread, + jobject* monitor_ptr) { + return functions->GetCurrentContendedMonitor(this, thread, monitor_ptr); + } + + jvmtiError RunAgentThread(jthread thread, + jvmtiStartFunction proc, + const void* arg, + jint priority) { + return functions->RunAgentThread(this, thread, proc, arg, priority); + } + + jvmtiError SetThreadLocalStorage(jthread thread, + const void* data) { + return functions->SetThreadLocalStorage(this, thread, data); + } + + jvmtiError GetThreadLocalStorage(jthread thread, + void** data_ptr) { + return functions->GetThreadLocalStorage(this, thread, data_ptr); + } + + jvmtiError GetTopThreadGroups(jint* group_count_ptr, + jthreadGroup** groups_ptr) { + return functions->GetTopThreadGroups(this, group_count_ptr, groups_ptr); + } + + jvmtiError GetThreadGroupInfo(jthreadGroup group, + jvmtiThreadGroupInfo* info_ptr) { + return functions->GetThreadGroupInfo(this, group, info_ptr); + } + + jvmtiError GetThreadGroupChildren(jthreadGroup group, + jint* thread_count_ptr, + jthread** threads_ptr, + jint* group_count_ptr, + jthreadGroup** groups_ptr) { + return functions->GetThreadGroupChildren(this, group, thread_count_ptr, threads_ptr, group_count_ptr, groups_ptr); + } + + jvmtiError GetStackTrace(jthread thread, + jint start_depth, + jint max_frame_count, + jvmtiFrameInfo* frame_buffer, + jint* count_ptr) { + return functions->GetStackTrace(this, thread, start_depth, max_frame_count, frame_buffer, count_ptr); + } + + jvmtiError GetAllStackTraces(jint max_frame_count, + jvmtiStackInfo** stack_info_ptr, + jint* thread_count_ptr) { + return functions->GetAllStackTraces(this, max_frame_count, stack_info_ptr, thread_count_ptr); + } + + jvmtiError GetThreadListStackTraces(jint thread_count, + const jthread* thread_list, + jint max_frame_count, + jvmtiStackInfo** stack_info_ptr) { + return functions->GetThreadListStackTraces(this, thread_count, thread_list, max_frame_count, stack_info_ptr); + } + + jvmtiError GetFrameCount(jthread thread, + jint* count_ptr) { + return functions->GetFrameCount(this, thread, count_ptr); + } + + jvmtiError PopFrame(jthread thread) { + return functions->PopFrame(this, thread); + } + + jvmtiError GetFrameLocation(jthread thread, + jint depth, + jmethodID* method_ptr, + jlocation* location_ptr) { + return functions->GetFrameLocation(this, thread, depth, method_ptr, location_ptr); + } + + jvmtiError NotifyFramePop(jthread thread, + jint depth) { + return functions->NotifyFramePop(this, thread, depth); + } + + jvmtiError GetTag(jobject object, + jlong* tag_ptr) { + return functions->GetTag(this, object, tag_ptr); + } + + jvmtiError SetTag(jobject object, + jlong tag) { + return functions->SetTag(this, object, tag); + } + + jvmtiError ForceGarbageCollection() { + return functions->ForceGarbageCollection(this); + } + + jvmtiError IterateOverObjectsReachableFromObject(jobject object, + jvmtiObjectReferenceCallback object_reference_callback, + void* user_data) { + return functions->IterateOverObjectsReachableFromObject(this, object, object_reference_callback, user_data); + } + + jvmtiError IterateOverReachableObjects(jvmtiHeapRootCallback heap_root_callback, + jvmtiStackReferenceCallback stack_ref_callback, + jvmtiObjectReferenceCallback object_ref_callback, + void* user_data) { + return functions->IterateOverReachableObjects(this, heap_root_callback, stack_ref_callback, object_ref_callback, user_data); + } + + jvmtiError IterateOverHeap(jvmtiHeapObjectFilter object_filter, + jvmtiHeapObjectCallback heap_object_callback, + void* user_data) { + return functions->IterateOverHeap(this, object_filter, heap_object_callback, user_data); + } + + jvmtiError IterateOverInstancesOfClass(jclass klass, + jvmtiHeapObjectFilter object_filter, + jvmtiHeapObjectCallback heap_object_callback, + void* user_data) { + return functions->IterateOverInstancesOfClass(this, klass, object_filter, heap_object_callback, user_data); + } + + jvmtiError GetObjectsWithTags(jint tag_count, + const jlong* tags, + jint* count_ptr, + jobject** object_result_ptr, + jlong** tag_result_ptr) { + return functions->GetObjectsWithTags(this, tag_count, tags, count_ptr, object_result_ptr, tag_result_ptr); + } + + jvmtiError GetLocalObject(jthread thread, + jint depth, + jint slot, + jobject* value_ptr) { + return functions->GetLocalObject(this, thread, depth, slot, value_ptr); + } + + jvmtiError GetLocalInt(jthread thread, + jint depth, + jint slot, + jint* value_ptr) { + return functions->GetLocalInt(this, thread, depth, slot, value_ptr); + } + + jvmtiError GetLocalLong(jthread thread, + jint depth, + jint slot, + jlong* value_ptr) { + return functions->GetLocalLong(this, thread, depth, slot, value_ptr); + } + + jvmtiError GetLocalFloat(jthread thread, + jint depth, + jint slot, + jfloat* value_ptr) { + return functions->GetLocalFloat(this, thread, depth, slot, value_ptr); + } + + jvmtiError GetLocalDouble(jthread thread, + jint depth, + jint slot, + jdouble* value_ptr) { + return functions->GetLocalDouble(this, thread, depth, slot, value_ptr); + } + + jvmtiError SetLocalObject(jthread thread, + jint depth, + jint slot, + jobject value) { + return functions->SetLocalObject(this, thread, depth, slot, value); + } + + jvmtiError SetLocalInt(jthread thread, + jint depth, + jint slot, + jint value) { + return functions->SetLocalInt(this, thread, depth, slot, value); + } + + jvmtiError SetLocalLong(jthread thread, + jint depth, + jint slot, + jlong value) { + return functions->SetLocalLong(this, thread, depth, slot, value); + } + + jvmtiError SetLocalFloat(jthread thread, + jint depth, + jint slot, + jfloat value) { + return functions->SetLocalFloat(this, thread, depth, slot, value); + } + + jvmtiError SetLocalDouble(jthread thread, + jint depth, + jint slot, + jdouble value) { + return functions->SetLocalDouble(this, thread, depth, slot, value); + } + + jvmtiError SetBreakpoint(jmethodID method, + jlocation location) { + return functions->SetBreakpoint(this, method, location); + } + + jvmtiError ClearBreakpoint(jmethodID method, + jlocation location) { + return functions->ClearBreakpoint(this, method, location); + } + + jvmtiError SetFieldAccessWatch(jclass klass, + jfieldID field) { + return functions->SetFieldAccessWatch(this, klass, field); + } + + jvmtiError ClearFieldAccessWatch(jclass klass, + jfieldID field) { + return functions->ClearFieldAccessWatch(this, klass, field); + } + + jvmtiError SetFieldModificationWatch(jclass klass, + jfieldID field) { + return functions->SetFieldModificationWatch(this, klass, field); + } + + jvmtiError ClearFieldModificationWatch(jclass klass, + jfieldID field) { + return functions->ClearFieldModificationWatch(this, klass, field); + } + + jvmtiError GetLoadedClasses(jint* class_count_ptr, + jclass** classes_ptr) { + return functions->GetLoadedClasses(this, class_count_ptr, classes_ptr); + } + + jvmtiError GetClassLoaderClasses(jobject initiating_loader, + jint* class_count_ptr, + jclass** classes_ptr) { + return functions->GetClassLoaderClasses(this, initiating_loader, class_count_ptr, classes_ptr); + } + + jvmtiError GetClassSignature(jclass klass, + char** signature_ptr, + char** generic_ptr) { + return functions->GetClassSignature(this, klass, signature_ptr, generic_ptr); + } + + jvmtiError GetClassStatus(jclass klass, + jint* status_ptr) { + return functions->GetClassStatus(this, klass, status_ptr); + } + + jvmtiError GetSourceFileName(jclass klass, + char** source_name_ptr) { + return functions->GetSourceFileName(this, klass, source_name_ptr); + } + + jvmtiError GetClassModifiers(jclass klass, + jint* modifiers_ptr) { + return functions->GetClassModifiers(this, klass, modifiers_ptr); + } + + jvmtiError GetClassMethods(jclass klass, + jint* method_count_ptr, + jmethodID** methods_ptr) { + return functions->GetClassMethods(this, klass, method_count_ptr, methods_ptr); + } + + jvmtiError GetClassFields(jclass klass, + jint* field_count_ptr, + jfieldID** fields_ptr) { + return functions->GetClassFields(this, klass, field_count_ptr, fields_ptr); + } + + jvmtiError GetImplementedInterfaces(jclass klass, + jint* interface_count_ptr, + jclass** interfaces_ptr) { + return functions->GetImplementedInterfaces(this, klass, interface_count_ptr, interfaces_ptr); + } + + jvmtiError IsInterface(jclass klass, + jboolean* is_interface_ptr) { + return functions->IsInterface(this, klass, is_interface_ptr); + } + + jvmtiError IsArrayClass(jclass klass, + jboolean* is_array_class_ptr) { + return functions->IsArrayClass(this, klass, is_array_class_ptr); + } + + jvmtiError GetClassLoader(jclass klass, + jobject* classloader_ptr) { + return functions->GetClassLoader(this, klass, classloader_ptr); + } + + jvmtiError GetSourceDebugExtension(jclass klass, + char** source_debug_extension_ptr) { + return functions->GetSourceDebugExtension(this, klass, source_debug_extension_ptr); + } + + jvmtiError RedefineClasses(jint class_count, + const jvmtiClassDefinition* class_definitions) { + return functions->RedefineClasses(this, class_count, class_definitions); + } + + jvmtiError GetObjectSize(jobject object, + jlong* size_ptr) { + return functions->GetObjectSize(this, object, size_ptr); + } + + jvmtiError GetObjectHashCode(jobject object, + jint* hash_code_ptr) { + return functions->GetObjectHashCode(this, object, hash_code_ptr); + } + + jvmtiError GetObjectMonitorUsage(jobject object, + jvmtiMonitorUsage* info_ptr) { + return functions->GetObjectMonitorUsage(this, object, info_ptr); + } + + jvmtiError GetFieldName(jclass klass, + jfieldID field, + char** name_ptr, + char** signature_ptr, + char** generic_ptr) { + return functions->GetFieldName(this, klass, field, name_ptr, signature_ptr, generic_ptr); + } + + jvmtiError GetFieldDeclaringClass(jclass klass, + jfieldID field, + jclass* declaring_class_ptr) { + return functions->GetFieldDeclaringClass(this, klass, field, declaring_class_ptr); + } + + jvmtiError GetFieldModifiers(jclass klass, + jfieldID field, + jint* modifiers_ptr) { + return functions->GetFieldModifiers(this, klass, field, modifiers_ptr); + } + + jvmtiError IsFieldSynthetic(jclass klass, + jfieldID field, + jboolean* is_synthetic_ptr) { + return functions->IsFieldSynthetic(this, klass, field, is_synthetic_ptr); + } + + jvmtiError GetMethodName(jmethodID method, + char** name_ptr, + char** signature_ptr, + char** generic_ptr) { + return functions->GetMethodName(this, method, name_ptr, signature_ptr, generic_ptr); + } + + jvmtiError GetMethodDeclaringClass(jmethodID method, + jclass* declaring_class_ptr) { + return functions->GetMethodDeclaringClass(this, method, declaring_class_ptr); + } + + jvmtiError GetMethodModifiers(jmethodID method, + jint* modifiers_ptr) { + return functions->GetMethodModifiers(this, method, modifiers_ptr); + } + + jvmtiError GetMaxLocals(jmethodID method, + jint* max_ptr) { + return functions->GetMaxLocals(this, method, max_ptr); + } + + jvmtiError GetArgumentsSize(jmethodID method, + jint* size_ptr) { + return functions->GetArgumentsSize(this, method, size_ptr); + } + + jvmtiError GetLineNumberTable(jmethodID method, + jint* entry_count_ptr, + jvmtiLineNumberEntry** table_ptr) { + return functions->GetLineNumberTable(this, method, entry_count_ptr, table_ptr); + } + + jvmtiError GetMethodLocation(jmethodID method, + jlocation* start_location_ptr, + jlocation* end_location_ptr) { + return functions->GetMethodLocation(this, method, start_location_ptr, end_location_ptr); + } + + jvmtiError GetLocalVariableTable(jmethodID method, + jint* entry_count_ptr, + jvmtiLocalVariableEntry** table_ptr) { + return functions->GetLocalVariableTable(this, method, entry_count_ptr, table_ptr); + } + + jvmtiError GetBytecodes(jmethodID method, + jint* bytecode_count_ptr, + unsigned char** bytecodes_ptr) { + return functions->GetBytecodes(this, method, bytecode_count_ptr, bytecodes_ptr); + } + + jvmtiError IsMethodNative(jmethodID method, + jboolean* is_native_ptr) { + return functions->IsMethodNative(this, method, is_native_ptr); + } + + jvmtiError IsMethodSynthetic(jmethodID method, + jboolean* is_synthetic_ptr) { + return functions->IsMethodSynthetic(this, method, is_synthetic_ptr); + } + + jvmtiError IsMethodObsolete(jmethodID method, + jboolean* is_obsolete_ptr) { + return functions->IsMethodObsolete(this, method, is_obsolete_ptr); + } + + jvmtiError CreateRawMonitor(const char* name, + jrawMonitorID* monitor_ptr) { + return functions->CreateRawMonitor(this, name, monitor_ptr); + } + + jvmtiError DestroyRawMonitor(jrawMonitorID monitor) { + return functions->DestroyRawMonitor(this, monitor); + } + + jvmtiError RawMonitorEnter(jrawMonitorID monitor) { + return functions->RawMonitorEnter(this, monitor); + } + + jvmtiError RawMonitorExit(jrawMonitorID monitor) { + return functions->RawMonitorExit(this, monitor); + } + + jvmtiError RawMonitorWait(jrawMonitorID monitor, + jlong millis) { + return functions->RawMonitorWait(this, monitor, millis); + } + + jvmtiError RawMonitorNotify(jrawMonitorID monitor) { + return functions->RawMonitorNotify(this, monitor); + } + + jvmtiError RawMonitorNotifyAll(jrawMonitorID monitor) { + return functions->RawMonitorNotifyAll(this, monitor); + } + + jvmtiError SetJNIFunctionTable(const jniNativeInterface* function_table) { + return functions->SetJNIFunctionTable(this, function_table); + } + + jvmtiError GetJNIFunctionTable(jniNativeInterface** function_table) { + return functions->GetJNIFunctionTable(this, function_table); + } + + jvmtiError SetEventCallbacks(const jvmtiEventCallbacks* callbacks, + jint size_of_callbacks) { + return functions->SetEventCallbacks(this, callbacks, size_of_callbacks); + } + + jvmtiError SetEventNotificationMode(jvmtiEventMode mode, + jvmtiEvent event_type, + jthread event_thread, + ...) { + return functions->SetEventNotificationMode(this, mode, event_type, event_thread); + } + + jvmtiError GenerateEvents(jvmtiEvent event_type) { + return functions->GenerateEvents(this, event_type); + } + + jvmtiError GetExtensionFunctions(jint* extension_count_ptr, + jvmtiExtensionFunctionInfo** extensions) { + return functions->GetExtensionFunctions(this, extension_count_ptr, extensions); + } + + jvmtiError GetExtensionEvents(jint* extension_count_ptr, + jvmtiExtensionEventInfo** extensions) { + return functions->GetExtensionEvents(this, extension_count_ptr, extensions); + } + + jvmtiError SetExtensionEventCallback(jint extension_event_index, + jvmtiExtensionEvent callback) { + return functions->SetExtensionEventCallback(this, extension_event_index, callback); + } + + jvmtiError GetPotentialCapabilities(jvmtiCapabilities* capabilities_ptr) { + return functions->GetPotentialCapabilities(this, capabilities_ptr); + } + + jvmtiError AddCapabilities(const jvmtiCapabilities* capabilities_ptr) { + return functions->AddCapabilities(this, capabilities_ptr); + } + + jvmtiError RelinquishCapabilities(const jvmtiCapabilities* capabilities_ptr) { + return functions->RelinquishCapabilities(this, capabilities_ptr); + } + + jvmtiError GetCapabilities(jvmtiCapabilities* capabilities_ptr) { + return functions->GetCapabilities(this, capabilities_ptr); + } + + jvmtiError GetCurrentThreadCpuTimerInfo(jvmtiTimerInfo* info_ptr) { + return functions->GetCurrentThreadCpuTimerInfo(this, info_ptr); + } + + jvmtiError GetCurrentThreadCpuTime(jlong* nanos_ptr) { + return functions->GetCurrentThreadCpuTime(this, nanos_ptr); + } + + jvmtiError GetThreadCpuTimerInfo(jvmtiTimerInfo* info_ptr) { + return functions->GetThreadCpuTimerInfo(this, info_ptr); + } + + jvmtiError GetThreadCpuTime(jthread thread, + jlong* nanos_ptr) { + return functions->GetThreadCpuTime(this, thread, nanos_ptr); + } + + jvmtiError GetTimerInfo(jvmtiTimerInfo* info_ptr) { + return functions->GetTimerInfo(this, info_ptr); + } + + jvmtiError GetTime(jlong* nanos_ptr) { + return functions->GetTime(this, nanos_ptr); + } + + jvmtiError GetAvailableProcessors(jint* processor_count_ptr) { + return functions->GetAvailableProcessors(this, processor_count_ptr); + } + + jvmtiError AddToBootstrapClassLoaderSearch(const char* segment) { + return functions->AddToBootstrapClassLoaderSearch(this, segment); + } + + jvmtiError GetSystemProperties(jint* count_ptr, + char*** property_ptr) { + return functions->GetSystemProperties(this, count_ptr, property_ptr); + } + + jvmtiError GetSystemProperty(const char* property, + char** value_ptr) { + return functions->GetSystemProperty(this, property, value_ptr); + } + + jvmtiError SetSystemProperty(const char* property, + const char* value) { + return functions->SetSystemProperty(this, property, value); + } + + jvmtiError GetPhase(jvmtiPhase* phase_ptr) { + return functions->GetPhase(this, phase_ptr); + } + + jvmtiError DisposeEnvironment() { + return functions->DisposeEnvironment(this); + } + + jvmtiError SetEnvironmentLocalStorage(const void* data) { + return functions->SetEnvironmentLocalStorage(this, data); + } + + jvmtiError GetEnvironmentLocalStorage(void** data_ptr) { + return functions->GetEnvironmentLocalStorage(this, data_ptr); + } + + jvmtiError GetVersionNumber(jint* version_ptr) { + return functions->GetVersionNumber(this, version_ptr); + } + + jvmtiError GetErrorName(jvmtiError error, + char** name_ptr) { + return functions->GetErrorName(this, error, name_ptr); + } + + jvmtiError SetVerboseFlag(jvmtiVerboseFlag flag, + jboolean value) { + return functions->SetVerboseFlag(this, flag, value); + } + + jvmtiError GetJLocationFormat(jvmtiJlocationFormat* format_ptr) { + return functions->GetJLocationFormat(this, format_ptr); + } + +#endif /* __cplusplus */ +}; + + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* !_JAVA_JVMTI_H_ */ + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/jdk1.5.0_10/include/win32/jawt_md.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/jdk1.5.0_10/include/win32/jawt_md.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,41 @@ +/* + * @(#)jawt_md.h 1.7 03/12/19 + * + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + */ + +#ifndef _JAVASOFT_JAWT_MD_H_ +#define _JAVASOFT_JAWT_MD_H_ + +#include +#include "jawt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Win32-specific declarations for AWT native interface. + * See notes in jawt.h for an example of use. + */ +typedef struct jawt_Win32DrawingSurfaceInfo { + /* Native window, DDB, or DIB handle */ + union { + HWND hwnd; + HBITMAP hbitmap; + void* pbits; + }; + /* + * This HDC should always be used instead of the HDC returned from + * BeginPaint() or any calls to GetDC(). + */ + HDC hdc; + HPALETTE hpalette; +} JAWT_Win32DrawingSurfaceInfo; + +#ifdef __cplusplus +} +#endif + +#endif /* !_JAVASOFT_JAWT_MD_H_ */ diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/jdk1.5.0_10/include/win32/jni_md.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/jdk1.5.0_10/include/win32/jni_md.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,19 @@ +/* + * @(#)jni_md.h 1.14 03/12/19 + * + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + */ + +#ifndef _JAVASOFT_JNI_MD_H_ +#define _JAVASOFT_JNI_MD_H_ + +#define JNIEXPORT __declspec(dllexport) +#define JNIIMPORT __declspec(dllimport) +#define JNICALL __stdcall + +typedef long jint; +typedef __int64 jlong; +typedef signed char jbyte; + +#endif /* !_JAVASOFT_JNI_MD_H_ */ diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/resource.aps Binary file connectivity/com.nokia.tcf/native/TCFNative/TCFClient/resource.aps has changed diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/resource.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/resource.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by resource.rc +// +#define IDS_VERSION 1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFClient/resource.rc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/resource.rc Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,120 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 2,0,0,0 + PRODUCTVERSION 2,0,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Nokia\0" + VALUE "FileDescription", "Target Communication Framework Client\0" + VALUE "FileVersion", "2, 0, 0, 0\0" + VALUE "InternalName", "TCFClient\0" + VALUE "LegalCopyright", "Copyright © 2008\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "TCFClient.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Nokia TCFClient\0" + VALUE "ProductVersion", "2, 0, 0, 0\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_VERSION "2.0.0.0" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/ReadMe.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/ReadMe.txt Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,37 @@ +======================================================================== + DYNAMIC LINK LIBRARY : TCFCommSerial +======================================================================== + + +AppWizard has created this TCFCommSerial DLL for you. + +This file contains a summary of what you will find in each of the files that +make up your TCFCommSerial application. + +TCFCommSerial.dsp + This file (the project file) contains information at the project level and + is used to build a single project or subproject. Other users can share the + project (.dsp) file, but they should export the makefiles locally. + +TCFCommSerial.cpp + This is the main DLL source file. + +TCFCommSerial.h + This file contains your DLL exports. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named TCFCommSerial.pch and a precompiled types file named StdAfx.obj. + + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + + +///////////////////////////////////////////////////////////////////////////// diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/RealSerialComm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/RealSerialComm.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,886 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// RealSerialComm.cpp: implementation of the CRealSerialComm class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "RealSerialComm.h" +//#include "pn_const.h" +//#include "OSTConstants.h" +#include "Connection.h" + +#ifdef _DEBUG +static char sLogMsg[3000]; +#endif +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// +#ifdef _DEBUG +#define LogErrorText(err) { if (err > 0) GetErrorText(err); } +#define LogErrorText2(err) { if (err > 0) GetErrorText2(err); } +#else +#define LogErrorText(err) {} +#define LogErrorText2(err) {} +#endif + +#ifdef _DEBUG +#define DUMPCOMSTAT(x) DumpComStat(x) +#define DUMPCOMSTATP(x) DumpComStatP(x) +#else +#define DUMPCOMSTAT(x) +#define DUMPCOMSTATP(x) +#endif + +CRealSerialComm::CRealSerialComm() +{ +#ifdef _DEBUG + if (gDoLogging) + { + FILE* f = fopen("c:\\tcf\\rscommlog.txt", "at"); + fprintf(f, "CRealSerialComm::CRealSerialComm() (default constructor)\n"); + fclose(f); + } +#endif + m_hSerial = INVALID_HANDLE_VALUE; + m_serialPortName[0] = 0; + m_pBuffer = NULL; + m_ProcDebugLog = NULL; + +} +CRealSerialComm::CRealSerialComm(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol) +{ +#ifdef _DEBUG + if (gDoLogging) + { + FILE* f = fopen("c:\\tcf\\rscommlog.txt", "at"); + fprintf(f, "connectSettings=%x connectionId=%d, protocol=%x\n", connectSettings, connectionId, protocol); + fclose(f); + } +#endif + m_hSerial = INVALID_HANDLE_VALUE; + m_serialPortName[0] = 0; + m_pBuffer = NULL; + + m_connId = connectionId; + m_Protocol = protocol; + + m_ConnectSettings = new ConnectData(); + memcpy(m_ConnectSettings, connectSettings, sizeof(ConnectData)); + +#if (defined(LOG_COMM) || defined(LOG_PROCCOMM)) && defined(_DEBUG) + if (gDoLogging) + { + m_CommDebugLog = new TCDebugLog("TCF_Comm", connectionId, 2000L); + m_ProcDebugLog = new TCDebugLog("TCF_CommP", connectionId, 2000L); + } +#endif +} +CRealSerialComm::~CRealSerialComm() +{ +#ifdef _DEBUG + if (gDoLogging) + { + FILE* f = fopen("c:\\tcf\\rscommlog.txt", "at"); + fprintf(f, "CRealSerialComm::~CRealSerialComm()\n"); + fclose(f); + } +#endif + if (m_hSerial != INVALID_HANDLE_VALUE) + ::CloseHandle(m_hSerial); + + if (m_pBuffer) + delete[] m_pBuffer; + +} + +long CRealSerialComm::OpenPort() +{ + COMMLOGOPEN(); + COMMLOGS("CRealSerialComm::OpenPort\n"); + + long err = TCAPI_ERR_NONE; + + char* comPort = m_ConnectSettings->realSerialSettings.comPort; + DWORD baudRate = m_ConnectSettings->realSerialSettings.baudRate; + DWORD dataBits = m_ConnectSettings->realSerialSettings.dataBits; + eParity parity = m_ConnectSettings->realSerialSettings.parity; + eStopBits stopBits = m_ConnectSettings->realSerialSettings.stopBits; + eFlowControl flow = m_ConnectSettings->realSerialSettings.flowControl; + + COMMLOGA2("CRealSerialComm::OpenPort comPort=%s baudRate=%d\n", comPort, baudRate); + COMMLOGA2("CRealSerialComm::OpenPort dataBits=%d parity=%d\n", dataBits, parity); + COMMLOGA2("CRealSerialComm::OpenPort stopBits=%d flow=%d\n", stopBits, flow); + + // fill in DCB + m_dcb.DCBlength = sizeof(DCB); + m_dcb.BaudRate = baudRate; + m_dcb.ByteSize = dataBits; + + // parity + switch(parity) + { + default: + case eParityNone: + m_dcb.fParity = FALSE; + m_dcb.Parity = NOPARITY; + break; + case eParityEven: + m_dcb.fParity = TRUE; + m_dcb.Parity = EVENPARITY; + break; + case eParityOdd: + m_dcb.fParity = TRUE; + m_dcb.Parity = ODDPARITY; + break; + } + + // stop bits + switch(stopBits) + { + default: + case eStopBits1: + m_dcb.StopBits = ONESTOPBIT; + break; + case eStopBits15: + m_dcb.StopBits = ONE5STOPBITS; + break; + case eStopBits2: + m_dcb.StopBits = TWOSTOPBITS; + break; + } + + // flow control + switch(flow) + { + default: + case eFlowControlNone: + m_dcb.fRtsControl = RTS_CONTROL_DISABLE; + m_dcb.fOutxCtsFlow = FALSE; + m_dcb.fInX = m_dcb.fOutX = FALSE; + break; + case eFlowControlHW: + m_dcb.fRtsControl = RTS_CONTROL_HANDSHAKE; + m_dcb.fOutxCtsFlow = TRUE; + m_dcb.fInX = m_dcb.fOutX = FALSE; + break; + case eFlowControlSW: + m_dcb.fRtsControl = RTS_CONTROL_DISABLE; + m_dcb.fOutxCtsFlow = FALSE; + m_dcb.fInX = m_dcb.fOutX = TRUE; + m_dcb.XonChar = '\021'; // Ctrl-Q; + m_dcb.XoffChar = '\023'; // Ctrl-S; + m_dcb.XonLim = 100; + m_dcb.XoffLim = 100; + break; + } + + // other things in DCB + m_dcb.fDtrControl = DTR_CONTROL_ENABLE; + m_dcb.fDsrSensitivity = FALSE; + m_dcb.fBinary = TRUE; + m_dcb.fNull = FALSE; + m_dcb.fAbortOnError = TRUE; // reads & writes will terminate with errors if one occurs + + // translate serial port + char p[20]; char* pp = p; + strncpy(p, comPort, 20); + int len = (int)strlen(p); + for (int i = 0; i < len; i++) + { + p[i] = toupper(p[i]); + } + if (strncmp(p, "COM", 3) == 0) + { + pp+=3; + } + int val = atoi((const char*)pp); + if (val == INT_MIN || val == INT_MAX) + { + err = TCAPI_ERR_INVALID_MEDIA_DATA; + } + else + { + // must translate for CreatFile + _snprintf(m_serialPortName, MAX_COMPORT_SIZE, "\\\\.\\COM%d", val); + } + + + if (err == TCAPI_ERR_NONE) + { + m_hSerial = CreateFile(m_serialPortName, + GENERIC_READ|GENERIC_WRITE, // dwDesiredAccess = read & write + 0, // dwSharedMode = 0 ==> device not shared + NULL, // lpSecurityAttributes = NULL ==> not inheritable + OPEN_EXISTING, // dwCreationDisposition ==> required for devices + 0, // dwFlagsAndAttributes ==> no special flags or attributes (not overlapped) + NULL ); // hTemplateFile = NULL ==> required for devices + + if (m_hSerial != INVALID_HANDLE_VALUE) + { + // TODO: this is really not needed as we're not doing overlapped IO + // and we're not creating an event nor waiting on that event + if (!SetCommMask(m_hSerial, EV_RXCHAR)) + { + ::CloseHandle(m_hSerial); + m_hSerial = INVALID_HANDLE_VALUE; + m_lastCommError = GetLastError(); + err = TCAPI_ERR_WHILE_CONFIGURING_MEDIA; + } + else + { + // no error from SetCommMask + if (!SetupComm(m_hSerial,MAX_MESSAGE_LENGTH,MAX_SERIAL_MESSAGE_BUFFER_LENGTH)) + { + CloseHandle(m_hSerial); + m_hSerial = INVALID_HANDLE_VALUE; + m_lastCommError = GetLastError(); + err = TCAPI_ERR_WHILE_CONFIGURING_MEDIA; + } + else + { + // no error from SetupComm + // Get rid of any junk that might be sitting there. + PurgeComm( m_hSerial, PURGE_TXABORT | PURGE_RXABORT | + PURGE_TXCLEAR | PURGE_RXCLEAR ); + + // Using these settings, the ReadFile command will return immediately + // rather than waiting for a timeout. + COMMTIMEOUTS lclCommTimeOuts; + + lclCommTimeOuts.ReadIntervalTimeout = MAXDWORD; // we don't care about time between chars + lclCommTimeOuts.ReadTotalTimeoutMultiplier = 100; + lclCommTimeOuts.ReadTotalTimeoutConstant = 0; + lclCommTimeOuts.WriteTotalTimeoutMultiplier = 100; + lclCommTimeOuts.WriteTotalTimeoutConstant = 0; + + if (!SetCommTimeouts( m_hSerial, &lclCommTimeOuts )) + { + CloseHandle(m_hSerial); + m_hSerial = INVALID_HANDLE_VALUE; + m_lastCommError = GetLastError(); + err = TCAPI_ERR_WHILE_CONFIGURING_MEDIA; + } + else + { + // no error from SetCommTimeouts + err = SetDCB(); + if (err != TCAPI_ERR_NONE) + { + CloseHandle(m_hSerial); + m_hSerial = INVALID_HANDLE_VALUE; + } + else + { + // no error from SetDCB + err = TCAPI_ERR_NONE; + m_numberBytes = 0; + m_lastCommError = 0; + m_isConnected = true; + m_pBuffer = new BYTE[MAX_SERIAL_MESSAGE_BUFFER_LENGTH]; + } + } + } + } + } + else + { + // error from CreateFile + // couldn't open serial port + m_lastCommError = GetLastError(); + err = TCAPI_ERR_WHILE_CONFIGURING_MEDIA; + } + } + + COMMLOGA2("CRealSerialComm::OpenPort err=%d osError=%d\n", err, m_lastCommError); + LogErrorText(m_lastCommError); +// if (m_lastCommError > 0) +// LogErrorText(m_lastCommError); + COMMLOGCLOSE(); + return err; +} + +long CRealSerialComm::SetDCB() +{ + // assumes serial port is open + long err = TCAPI_ERR_NONE; + if (m_hSerial == INVALID_HANDLE_VALUE) + return err; + + // setup DCB + DCB lcldcb; + lcldcb.DCBlength = sizeof(DCB); + + if (!GetCommState( m_hSerial, &lcldcb )) + { + m_lastCommError = GetLastError(); + err = TCAPI_ERR_WHILE_CONFIGURING_MEDIA; + } + +// LogDCB(pInfo); + // copy only the ones that Connect() set initially + lcldcb.BaudRate = m_dcb.BaudRate; + lcldcb.ByteSize = m_dcb.ByteSize; + lcldcb.Parity = m_dcb.Parity; + lcldcb.StopBits = m_dcb.StopBits; + lcldcb.fRtsControl = m_dcb.fRtsControl; + lcldcb.fOutxCtsFlow = m_dcb.fOutxCtsFlow; + lcldcb.fDtrControl = m_dcb.fDtrControl; + lcldcb.fDsrSensitivity = m_dcb.fDsrSensitivity; + lcldcb.fInX = m_dcb.fInX; + lcldcb.fOutX = m_dcb.fOutX; + lcldcb.XonChar = m_dcb.XonChar; + lcldcb.XoffChar = m_dcb.XoffChar; + lcldcb.XonLim = m_dcb.XonLim; + lcldcb.XoffLim = m_dcb.XoffLim; + lcldcb.fBinary = m_dcb.fBinary; + lcldcb.fParity = m_dcb.fParity; + lcldcb.fNull = m_dcb.fNull; + lcldcb.fAbortOnError = m_dcb.fAbortOnError; + + // DCB has been changed + // If setting the port went well then we are connected properly! + if (!SetCommState( m_hSerial, &lcldcb)) + { + m_lastCommError = GetLastError(); + err = TCAPI_ERR_WHILE_CONFIGURING_MEDIA; + } + + return err; +} + +long CRealSerialComm::ClosePort() +{ + COMMLOGOPEN(); + COMMLOGS("CRealSerialComm::ClosePort\n"); + + long err = TCAPI_ERR_NONE; + + if (!IsConnected()) + { + + err = TCAPI_ERR_MEDIA_NOT_OPEN; + } + else if (m_hSerial != INVALID_HANDLE_VALUE) + { + // disable event notification + SetCommMask( m_hSerial, 0 ); + + // drop DTR + EscapeCommFunction( m_hSerial, CLRDTR ); + + // purge any outstanding reads/writes and close device handle + PurgeComm( m_hSerial, + PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR ); + + CloseHandle( m_hSerial ); + m_hSerial = INVALID_HANDLE_VALUE; + + if (m_pBuffer) + { + delete[] m_pBuffer; + m_pBuffer = NULL; + } + m_isConnected = false; + } + + COMMLOGCLOSE(); + return err; +} + +void CRealSerialComm::DeleteMsg(DWORD inMsgLength) +{ + if (!IsConnected()) + return; + // inMsgLength includes header + // delete from beginning of buffer + if (inMsgLength == 0) + return; + if (m_numberBytes > 0 && m_numberBytes >= inMsgLength) + { + size_t moveLen = m_numberBytes - inMsgLength; + if (moveLen > 0) + memcpy(&m_pBuffer[0], &m_pBuffer[inMsgLength], moveLen); + m_numberBytes -= inMsgLength; + } +} + +long CRealSerialComm::SendDataToPort(DWORD inSize, const void *inData) +{ + + long err = TCAPI_ERR_NONE; + DWORD lclNumBytes=0; + COMMLOGOPEN(); + COMMLOGS("CRealSerialComm::SendDataToPort\n"); + COMMLOGCLOSE(); + if (!IsConnected()) + { + + COMMLOGOPEN(); + COMMLOGS("CRealSerialComm::SendDataToPort notConnected\n"); + COMMLOGCLOSE(); + return TCAPI_ERR_MEDIA_NOT_OPEN; + } + + if (WriteFile(m_hSerial, inData, inSize, &lclNumBytes, NULL)) + { + // we were successful, but did we send all data? (i.e., a timeout occurred) + // we are not doing overlapped I/O so if not all data went, then we timed out + // and there was some kind of error + if (lclNumBytes != inSize) + { + COMMLOGOPEN(); + COMMLOGA3("CRealSerialComm::SendDataToPort WriteFile not all bytes sent: lclNumBytes=%d inSize=%d err=%d\n", lclNumBytes, inSize, GetLastError()); + COMMLOGCLOSE(); + + COMSTAT lclComStat; + DWORD lclErrorFlags = 0; + if (!ClearCommError(m_hSerial, &lclErrorFlags, &lclComStat)) + { + // clear comm error returned error (this doesn't normally happen if the handle is valid and port is still open) + m_lastCommError = GetLastError(); + err = TCAPI_ERR_COMM_ERROR; + COMMLOGOPEN(); + COMMLOGA1("CRealSerialComm::SendDataToPort ClearCommError failed=%d\n", m_lastCommError); + COMMLOGCLOSE(); + } + else + { + // clear comm error returned OK + // check error flags + if (lclErrorFlags) + { + // there really was an error + m_lastCommError = lclErrorFlags; + err = TCAPI_ERR_COMM_ERROR; + COMMLOGOPEN(); + COMMLOGA1("CRealSerialComm::SendDataToPort ClearCommError succeeded lclErrorFlags=%d\n", m_lastCommError); + COMMLOGCLOSE(); + } + else + { + // No OS error returned, but WriteFile failed to write out all bytes + // therefore, since we are not doing overlapped I/O, this is an error. + err = TCAPI_ERR_COMM_ERROR; + COMMLOGOPEN(); + COMMLOGS("CRealSerialComm::SendDataToPort ClearCommError succeeded lclErrorFlags=0\n"); + COMMLOGCLOSE(); +// DUMPCOMSTAT(&lclComStat); + } + } + } + else + { + // we sent all the data we requested + err = TCAPI_ERR_NONE; +#ifdef _DEBUG + COMMLOGOPEN(); + COMMLOGS("CRealSerialComm::SendDataToPort WriteFile successful\n"); + BYTE* ptr = (BYTE*)inData; + long numBytes = (inSize > 20) ? 20 : inSize; + char msg[200]; + sprintf(msg, "CRealSerialComm::SendDataToPort = "); + for (int i = 0; i < numBytes; i++) + { + sprintf(msg, "%s %02.2x", msg, ptr[i]); + } + sprintf(msg, "%s\n", msg); + COMMLOGS(msg); + COMMLOGCLOSE(); +#endif + } + } + else + { + // write failed + m_lastCommError = GetLastError(); + err = TCAPI_ERR_COMM_ERROR; + COMMLOGOPEN(); + COMMLOGA1("CRealSerialComm::SendDataToPort WriteFile failed = %d\n", m_lastCommError); + COMMLOGCLOSE(); + } + + return err; +} +long CRealSerialComm::PollPort(DWORD &outSize) +{ + long err = TCAPI_ERR_NONE; + outSize = 0; + + COMSTAT lclComStat; + DWORD lclErrorFlags=0; + + if (!IsConnected()) + return TCAPI_ERR_MEDIA_NOT_OPEN; + +// Sleep(1); + if (!ClearCommError( m_hSerial, &lclErrorFlags, &lclComStat )) + { + m_lastCommError = GetLastError(); + err = TCAPI_ERR_COMM_ERROR; + + PROCLOGOPEN(); + PROCLOGA1("CRealSerialComm::PollPort ClearCommError failed=%d\n", m_lastCommError); +// if (m_lastCommError > 0) + LogErrorText2(m_lastCommError); + PROCLOGCLOSE(); + } + else + { + // ClearCommError succeeded + if (lclErrorFlags) + { + m_lastCommError = lclErrorFlags; + err = TCAPI_ERR_COMM_ERROR; + PROCLOGOPEN(); + PROCLOGA1("CRealSerialComm::PollPort ClearCommError succeeded but lclErrorFlags=%d\n", m_lastCommError); + PROCLOGCLOSE(); + } + else + { +// DUMPCOMSTATP(&lclComStat); +// PROCLOGOPEN(); +// PROCLOGA1("CRealSerialComm::PollPort ClearCommError succeeded cbInQue=%d\n", lclComStat.cbInQue); +// PROCLOGCLOSE(); + m_lastCommError = 0; + } + outSize = lclComStat.cbInQue; + } + + return err; +} +#ifdef _DEBUG +void CRealSerialComm::DumpComStat(COMSTAT* stat) +{ + COMMLOGOPEN(); + COMMLOGA3(" comstat fCtsHold =%d fDsrHold =%d fRlsdHold=%d\n", stat->fCtsHold, stat->fDsrHold, stat->fRlsdHold); + COMMLOGA3(" comstat fXoffHold=%d fXoffSent=%d fEof =%d\n", stat->fXoffHold, stat->fXoffSent, stat->fEof); + COMMLOGA3(" comstat fTxim =%d cbInQue =%d cbOutQue =%d\n", stat->fTxim, stat->cbInQue, stat->cbOutQue); + COMMLOGCLOSE(); +} +void CRealSerialComm::DumpComStatP(COMSTAT* stat) +{ + PROCLOGOPEN(); + PROCLOGA3(" comstat fCtsHold =%d fDsrHold =%d fRlsdHold=%d\n", stat->fCtsHold, stat->fDsrHold, stat->fRlsdHold); + PROCLOGA3(" comstat fXoffHold=%d fXoffSent=%d fEof =%d\n", stat->fXoffHold, stat->fXoffSent, stat->fEof); + PROCLOGA3(" comstat fTxim =%d cbInQue =%d cbOutQue =%d\n", stat->fTxim, stat->cbInQue, stat->cbOutQue); + PROCLOGCLOSE(); +} +#endif +long CRealSerialComm::ReadPort(DWORD inSize, void *outData, DWORD &outSize) +{ + long err = TCAPI_ERR_NONE; + outSize = 0; + + COMSTAT lclComStat; + DWORD lclErrorFlags=0; + DWORD lclLength; + if (!IsConnected()) + return TCAPI_ERR_MEDIA_NOT_OPEN; + + // clear out any errors in the channel and get the length of the buffer + if (!ClearCommError( m_hSerial, &lclErrorFlags, &lclComStat )) + { + // ClearCommError failed + m_lastCommError = GetLastError(); + err = TCAPI_ERR_COMM_ERROR; + PROCLOGOPEN(); + PROCLOGA1("CRealSerialComm::ReadPort ClearCommError failed=%d\n", m_lastCommError); + PROCLOGCLOSE(); + } + else + { + if (lclErrorFlags) + { + m_lastCommError = lclErrorFlags; + err = TCAPI_ERR_COMM_ERROR; + PROCLOGOPEN(); + PROCLOGA1("CRealSerialComm::ReadPort ClearCommError succeeded but lclErrorFlags=%d\n", m_lastCommError); + PROCLOGCLOSE(); + } + else + { + m_lastCommError = 0; + + lclLength = min( inSize, lclComStat.cbInQue ); + + if (lclLength > 0) + { + // Read lclLength number of bytes into outData. + if (!ReadFile(m_hSerial,outData,lclLength,&outSize,NULL)) + { + m_lastCommError = GetLastError(); + err = TCAPI_ERR_COMM_ERROR; + PROCLOGOPEN(); + PROCLOGA1("CRealSerialComm::ReadPort ReadFile failed = %d\n", m_lastCommError); + PROCLOGCLOSE(); + } + else + { + // ReadFile returned successful, check to see all our bytes came in + // If a timeout happened - we may not get all the data + if (lclLength != outSize) + { + lclErrorFlags = 0; + if (!ClearCommError( m_hSerial, &lclErrorFlags, &lclComStat )) + { + // ClearCommError failed + m_lastCommError = GetLastError(); + err = TCAPI_ERR_COMM_ERROR; + PROCLOGOPEN(); + PROCLOGA1("CRealSerialComm::ReadPort ClearCommError failed=%d\n", m_lastCommError); + PROCLOGCLOSE(); + } + else + { + // ClearCommError succeeded + if (lclErrorFlags) + { + // there really was an error + m_lastCommError = lclErrorFlags; + err = TCAPI_ERR_COMM_ERROR; + PROCLOGOPEN(); + PROCLOGA1("CRealSerialComm::ReadPort ReadFile succeeded-not all data read lclErrorFlags=%d\n", m_lastCommError); + PROCLOGCLOSE(); + } + else + { + // Since we are not doing overlapped I/O + // and our timeout values say to timeout, we should read all the bytes + // that the last Poll told us, if not this is an error + err = TCAPI_ERR_COMM_ERROR; + PROCLOGOPEN(); + PROCLOGS("CRealSerialComm::ReadPort ReadFile succeeded-not all data read lclErrorFlags=0\n"); + PROCLOGCLOSE(); + } + } + } + else + { + // all data read + m_lastCommError = 0; + PROCLOGOPEN(); + PROCLOGS("CRealSerialComm::ReadPort ReadFile successful\n"); + PROCLOGCLOSE(); + } + } + } + } + } + + return err; +} + +long CRealSerialComm::ProcessBuffer(CConnection* pConn, CRegistry* pRegistry, long& numberProcessed) +{ + PROCLOGOPEN(); + PROCLOGS("CRealSerialComm::ProcessBuffer\n"); + PROCLOGCLOSE(); + + long err = TCAPI_ERR_NONE; + long routingErr = TCAPI_ERR_NONE; + + if (!IsConnected()) + return TCAPI_ERR_MEDIA_NOT_OPEN; + + if (!m_Protocol) + return TCAPI_ERR_UNKNOWN_MEDIA_TYPE; + + DWORD protocolHeaderLength = m_Protocol->GetHeaderLength(); + + // fill buffer + if (m_numberBytes < MAX_SERIAL_MESSAGE_BUFFER_LENGTH) + { + DWORD outLen = 0; + err = PollPort(outLen); + if (err == TCAPI_ERR_NONE && outLen > 0) + { + if (outLen > (MAX_SERIAL_MESSAGE_BUFFER_LENGTH - m_numberBytes)) + outLen = MAX_SERIAL_MESSAGE_BUFFER_LENGTH - m_numberBytes; + BYTE *ptr = &m_pBuffer[m_numberBytes]; + err = ReadPort(outLen, ptr, outLen); + if (err == TCAPI_ERR_NONE && outLen > 0) + { + m_numberBytes += outLen; + } + } + } + // now process buffer but only for complete messages + if (err == TCAPI_ERR_NONE) + { + if (m_numberBytes >= protocolHeaderLength) + { + BYTE* ptr = m_pBuffer; + long bytesRemaining = m_numberBytes; + long usedLen = 0; + bool done = false; + + while (!done) + { + DWORD fullMessageLength = bytesRemaining; + DWORD rawLength = 0; + BYTE* fullMessage = ptr; + BYTE* rawMessage = ptr; + BYTE msgId = 0; + if (m_Protocol->DecodeMessage(fullMessage, fullMessageLength, msgId, rawMessage, rawLength)) + { + err = PreProcessMessage(msgId, fullMessageLength, fullMessage); + if (err != TCAPI_ERR_NONE) + { + // notify all clients right now + pConn->NotifyClientsCommError(err, false, 0); + err = TCAPI_ERR_NONE; + } +#ifdef _DEBUG + int reallen = fullMessageLength; + if (reallen > 50) reallen = 50; + char msg[6]; + msg[0] = '\0'; + + sLogMsg[0] = '\0'; + if (reallen > 0) + { + sLogMsg[0] = '\0'; + for (int i = 0; i < reallen; i++) + { + sprintf(msg, "%02.2x ", ptr[i]); + strcat(sLogMsg, msg); + } + } +#endif + PROCLOGOPEN(); + PROCLOGA5("CRealSerialComm::ProcessBuffer - RouteMesssage pRegistry = %x id=%x len=%d len=%d\n msg=%s\n", pRegistry, msgId, fullMessageLength, rawLength, sLogMsg); + PROCLOGCLOSE(); + + err = pRegistry->RouteMessage(msgId, fullMessage, fullMessageLength, rawMessage, rawLength); + if (err != TCAPI_ERR_NONE) routingErr = err; // saved for future + + numberProcessed++; + usedLen += fullMessageLength; + bytesRemaining -= fullMessageLength; + ptr += fullMessageLength; + if (bytesRemaining < protocolHeaderLength) + done = true; + } + else + { + done = true; + } + } + DeleteMsg(usedLen); + } + } +// PROCLOGOPEN(); +// PROCLOGA1("CRealSerialComm::ProcessBuffer err = %d\n", err); +// PROCLOGCLOSE(); + if (routingErr == TCAPI_ERR_NONE) + return err; + else + return routingErr; +} +bool CRealSerialComm::IsConnectionEqual(ConnectData* pConn) +{ + bool equal = false; + + // forms accepted: + // "comNN", "NN" + char* ptr1 = m_ConnectSettings->realSerialSettings.comPort; + char* ptr2 = pConn->realSerialSettings.comPort; + bool digit1found = false; + while(!digit1found && *ptr1 != NULL) + { + if (*ptr1 >= '0' && *ptr1 <= '9') + { + digit1found = true; + break; + } + ptr1++; + } + bool digit2found = false; + while(!digit2found && *ptr2 != NULL) + { + if (*ptr2 >= '0' && *ptr2 <= '9') + { + digit2found = true; + break; + } + ptr2++; + } + if (digit1found && digit2found) + { + if (strcmp(ptr1, ptr2) == 0) + equal = true; + } + return equal; +} + +#ifdef _DEBUG +DWORD CRealSerialComm::GetErrorText(DWORD inError) +{ + LPVOID lpMsgBuf; + + if (inError == 0) return inError; + + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + inError, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &lpMsgBuf, + 0, + NULL ); + + COMMLOGA1(" -- GetErrorText=%s", lpMsgBuf); + // Free the buffer. + LocalFree( lpMsgBuf ); + + return inError; +} +DWORD CRealSerialComm::GetErrorText2(DWORD inError) +{ + LPVOID lpMsgBuf; + + if (inError == 0) return inError; + + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + inError, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &lpMsgBuf, + 0, + NULL ); + + PROCLOGA1(" -- GetErrorText=%s", lpMsgBuf); + // Free the buffer. + LocalFree( lpMsgBuf ); + + return inError; +} + +void CRealSerialComm::DumpBuffer(BYTE* ptr, long length) +{ + char msg[256] = {0}; + if (length > 50) length = 50; + for (int i = 0; i < length; i++) + { + sprintf(msg, "%s%02.2X ", msg, ptr[i]); + } + sprintf(msg, "%s\n", msg); + PROCLOGS(msg); +} +#endif diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/RealSerialComm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/RealSerialComm.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// RealSerialComm.h: interface for the CRealSerialComm class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_REALSERIALCOMM_H__B20F73BE_260A_4A99_B7F5_E4F7C42FE05F__INCLUDED_) +#define AFX_REALSERIALCOMM_H__B20F73BE_260A_4A99_B7F5_E4F7C42FE05F__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "BaseCom.h" +#define MAX_MESSAGE_LENGTH (64*1024L) +#define MAX_SERIAL_MESSAGE_BUFFER_LENGTH (2*MAX_MESSAGE_LENGTH) + +class CRealSerialComm : public CBaseCom +{ +public: + CRealSerialComm(); + CRealSerialComm(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol); + virtual ~CRealSerialComm(); + + virtual long OpenPort(); + long ClosePort(); + long SendDataToPort(DWORD inSize, const void* inData); + long PollPort(DWORD& outSize); + long ReadPort(DWORD inSize, void* outData, DWORD& outSize); + long ProcessBuffer(CConnection* pConn, CRegistry* pRegistry, long& numberProcessed); + void DeleteMsg(DWORD inMsgLength); + bool GetVersion(char* outVersion) { return false; } // don't have enough information for this + bool HasVersion() { return false; } // can we have a version? + virtual long PreProcessMessage(int inMsgType, DWORD inMsgLength, BYTE* inMessage) { return TCAPI_ERR_NONE; } + virtual long PreProcessMessage(BYTE msgId, DWORD inMsgLength, BYTE* inMessage) { return TCAPI_ERR_NONE; } + virtual bool IsConnectionEqual(ConnectData* pConn); + +#ifdef _DEBUG + DWORD GetErrorText(DWORD inError); + DWORD GetErrorText2(DWORD inError); + void DumpComStat(COMSTAT* stat); + void DumpComStatP(COMSTAT* stat); + void DumpBuffer(BYTE* ptr, long length); +#endif + +private: + long SetDCB(); + HANDLE m_hSerial; + DCB m_dcb; + char m_serialPortName[MAX_COMPORT_SIZE]; + +}; + +#endif // !defined(AFX_REALSERIALCOMM_H__B20F73BE_260A_4A99_B7F5_E4F7C42FE05F__INCLUDED_) diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/StdAfx.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/StdAfx.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// stdafx.cpp : source file that includes just the standard includes +// TCFCommSerial.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/StdAfx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/StdAfx.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__825E7B19_F712_4246_8188_8E96B42EEB40__INCLUDED_) +#define AFX_STDAFX_H__825E7B19_F712_4246_8188_8E96B42EEB40__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +// Insert your headers here +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#include +#include + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__825E7B19_F712_4246_8188_8E96B42EEB40__INCLUDED_) diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/TCFCommSerial.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/TCFCommSerial.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// TCFCommSerial.cpp : Defines the entry point for the DLL application. +// + +#include "stdafx.h" +#include +#include "TCFCommSerial.h" +#include "RealSerialComm.h" + +static const char* pCommType="serial"; +static CBaseCom* pCommClass=NULL; +#ifdef _DEBUG +BOOL gDoLogging = FALSE; +#endif + +BOOL APIENTRY DllMain( HANDLE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + { +#ifdef _DEBUG + struct _stat buf; + char* dirname = "c:\\tcf"; + int result = _stat(dirname, &buf); + if (result == 0) // exists + { + gDoLogging = TRUE; + } + else + { + gDoLogging = FALSE; + } +#endif + } + break; + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + +// register this connection type +TCFCOMMSERIAL_API const char* RegisterComm() +{ + return pCommType; +} + +// create this connection type +TCFCOMMSERIAL_API CBaseCom* CreateComm(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol) +{ + pCommClass = new CRealSerialComm(connectSettings, connectionId, protocol); + + return pCommClass; +} + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/TCFCommSerial.dep --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/TCFCommSerial.dep Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,66 @@ +# Microsoft Developer Studio Generated Dependency File, included by TCFCommSerial.mak + +..\TCFServer\BaseCom.cpp : \ + "..\Common\Headers\ErrorMonitorData.h"\ + "..\Common\Headers\InputStream.h"\ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\ServerClient.h"\ + "..\Common\Headers\shareddata.h"\ + "..\Common\Headers\TCConstants.h"\ + "..\Common\Headers\TCDebugLog.h"\ + "..\Common\Headers\TCErrorConstants.h"\ + "..\TCFServer\BaseCom.h"\ + "..\TCFServer\Client.h"\ + "..\TCFServer\MessageFile.h"\ + "..\TCFServer\Registry.h"\ + + +..\Common\Source\mutex.cpp : \ + "..\Common\Headers\mutex.h"\ + + +.\RealSerialComm.cpp : \ + "..\Common\Headers\ErrorMonitorData.h"\ + "..\Common\Headers\InputStream.h"\ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\OSTConstants.h"\ + "..\Common\Headers\pn_const.h"\ + "..\Common\Headers\ServerClient.h"\ + "..\Common\Headers\shareddata.h"\ + "..\Common\Headers\TCConstants.h"\ + "..\Common\Headers\TCDebugLog.h"\ + "..\Common\Headers\TCErrorConstants.h"\ + "..\TCFServer\BaseCom.h"\ + "..\TCFServer\Client.h"\ + "..\TCFServer\Connection.h"\ + "..\TCFServer\MessageFile.h"\ + "..\TCFServer\Registry.h"\ + ".\RealSerialComm.h"\ + + +.\StdAfx.cpp : \ + "..\..\..\..\..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ + ".\StdAfx.h"\ + + +..\Common\Source\TCDebugLog.cpp : \ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\TCDebugLog.h"\ + + +.\TCFCommSerial.cpp : \ + "..\Common\Headers\ErrorMonitorData.h"\ + "..\Common\Headers\InputStream.h"\ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\ServerClient.h"\ + "..\Common\Headers\shareddata.h"\ + "..\Common\Headers\TCConstants.h"\ + "..\Common\Headers\TCDebugLog.h"\ + "..\Common\Headers\TCErrorConstants.h"\ + "..\TCFServer\BaseCom.h"\ + "..\TCFServer\Client.h"\ + "..\TCFServer\MessageFile.h"\ + "..\TCFServer\Registry.h"\ + ".\RealSerialComm.h"\ + ".\TCFCommSerial.h"\ + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/TCFCommSerial.dsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/TCFCommSerial.dsp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,154 @@ +# Microsoft Developer Studio Project File - Name="TCFCommSerial" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=TCFCommSerial - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "TCFCommSerial.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "TCFCommSerial.mak" CFG="TCFCommSerial - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "TCFCommSerial - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "TCFCommSerial - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TCFCommSerial - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMSERIAL_EXPORTS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMSERIAL_EXPORTS" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /map /machine:I386 +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +PostBuild_Cmds=copyBinaries Release +# End Special Build Tool + +!ELSEIF "$(CFG)" == "TCFCommSerial - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMSERIAL_EXPORTS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMSERIAL_EXPORTS" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /map /debug /machine:I386 /pdbtype:sept +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +PostBuild_Cmds=copyBinaries Debug +# End Special Build Tool + +!ENDIF + +# Begin Target + +# Name "TCFCommSerial - Win32 Release" +# Name "TCFCommSerial - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\TCFServer\BaseCom.cpp +# End Source File +# Begin Source File + +SOURCE=..\Common\Source\mutex.cpp +# End Source File +# Begin Source File + +SOURCE=.\RealSerialComm.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=..\Common\Source\TCDebugLog.cpp +# End Source File +# Begin Source File + +SOURCE=.\TCFCommSerial.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\RealSerialComm.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\TCFCommSerial.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/TCFCommSerial.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/TCFCommSerial.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "BaseCom.h" +// The following ifdef block is the standard way of creating macros which make exporting +// from a DLL simpler. All files within this DLL are compiled with the TCFCOMMSERIAL_EXPORTS +// symbol defined on the command line. this symbol should not be defined on any project +// that uses this DLL. This way any other project whose source files include this file see +// TCFCOMMSERIAL_API functions as being imported from a DLL, wheras this DLL sees symbols +// defined with this macro as being exported. +#ifdef TCFCOMMSERIAL_EXPORTS +#define TCFCOMMSERIAL_API __declspec(dllexport) +#else +#define TCFCOMMSERIAL_API __declspec(dllimport) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +TCFCOMMSERIAL_API const char* RegisterComm(); +TCFCOMMSERIAL_API CBaseCom* CreateComm(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol); + +#ifdef __cplusplus +} +#endif diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/TCFCommSerial.mak --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/TCFCommSerial.mak Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,258 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on TCFCommSerial.dsp +!IF "$(CFG)" == "" +CFG=TCFCommSerial - Win32 Debug +!MESSAGE No configuration specified. Defaulting to TCFCommSerial - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "TCFCommSerial - Win32 Release" && "$(CFG)" != "TCFCommSerial - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "TCFCommSerial.mak" CFG="TCFCommSerial - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "TCFCommSerial - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "TCFCommSerial - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TCFCommSerial - Win32 Release" + +OUTDIR=.\Release +INTDIR=.\Release +# Begin Custom Macros +OutDir=.\Release +# End Custom Macros + +ALL : "$(OUTDIR)\TCFCommSerial.dll" + + +CLEAN : + -@erase "$(INTDIR)\BaseCom.obj" + -@erase "$(INTDIR)\mutex.obj" + -@erase "$(INTDIR)\RealSerialComm.obj" + -@erase "$(INTDIR)\StdAfx.obj" + -@erase "$(INTDIR)\TCDebugLog.obj" + -@erase "$(INTDIR)\TCFCommSerial.obj" + -@erase "$(INTDIR)\TCFCommSerial.pch" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\TCFCommSerial.dll" + -@erase "$(OUTDIR)\TCFCommSerial.exp" + -@erase "$(OUTDIR)\TCFCommSerial.lib" + -@erase "$(OUTDIR)\TCFCommSerial.map" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMSERIAL_EXPORTS" /Fp"$(INTDIR)\TCFCommSerial.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\TCFCommSerial.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /pdb:"$(OUTDIR)\TCFCommSerial.pdb" /map:"$(INTDIR)\TCFCommSerial.map" /machine:I386 /out:"$(OUTDIR)\TCFCommSerial.dll" /implib:"$(OUTDIR)\TCFCommSerial.lib" +LINK32_OBJS= \ + "$(INTDIR)\BaseCom.obj" \ + "$(INTDIR)\mutex.obj" \ + "$(INTDIR)\RealSerialComm.obj" \ + "$(INTDIR)\StdAfx.obj" \ + "$(INTDIR)\TCDebugLog.obj" \ + "$(INTDIR)\TCFCommSerial.obj" + +"$(OUTDIR)\TCFCommSerial.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep + +ALL : $(DS_POSTBUILD_DEP) + +# Begin Custom Macros +OutDir=.\Release +# End Custom Macros + +$(DS_POSTBUILD_DEP) : "$(OUTDIR)\TCFCommSerial.dll" + copyBinaries Release + echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)" + +!ELSEIF "$(CFG)" == "TCFCommSerial - Win32 Debug" + +OUTDIR=.\Debug +INTDIR=.\Debug +# Begin Custom Macros +OutDir=.\Debug +# End Custom Macros + +ALL : "$(OUTDIR)\TCFCommSerial.dll" + + +CLEAN : + -@erase "$(INTDIR)\BaseCom.obj" + -@erase "$(INTDIR)\mutex.obj" + -@erase "$(INTDIR)\RealSerialComm.obj" + -@erase "$(INTDIR)\StdAfx.obj" + -@erase "$(INTDIR)\TCDebugLog.obj" + -@erase "$(INTDIR)\TCFCommSerial.obj" + -@erase "$(INTDIR)\TCFCommSerial.pch" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\TCFCommSerial.dll" + -@erase "$(OUTDIR)\TCFCommSerial.exp" + -@erase "$(OUTDIR)\TCFCommSerial.ilk" + -@erase "$(OUTDIR)\TCFCommSerial.lib" + -@erase "$(OUTDIR)\TCFCommSerial.map" + -@erase "$(OUTDIR)\TCFCommSerial.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMSERIAL_EXPORTS" /Fp"$(INTDIR)\TCFCommSerial.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\TCFCommSerial.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\TCFCommSerial.pdb" /map:"$(INTDIR)\TCFCommSerial.map" /debug /machine:I386 /out:"$(OUTDIR)\TCFCommSerial.dll" /implib:"$(OUTDIR)\TCFCommSerial.lib" /pdbtype:sept +LINK32_OBJS= \ + "$(INTDIR)\BaseCom.obj" \ + "$(INTDIR)\mutex.obj" \ + "$(INTDIR)\RealSerialComm.obj" \ + "$(INTDIR)\StdAfx.obj" \ + "$(INTDIR)\TCDebugLog.obj" \ + "$(INTDIR)\TCFCommSerial.obj" + +"$(OUTDIR)\TCFCommSerial.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep + +ALL : $(DS_POSTBUILD_DEP) + +# Begin Custom Macros +OutDir=.\Debug +# End Custom Macros + +$(DS_POSTBUILD_DEP) : "$(OUTDIR)\TCFCommSerial.dll" + copyBinaries Debug + echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)" + +!ENDIF + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("TCFCommSerial.dep") +!INCLUDE "TCFCommSerial.dep" +!ELSE +!MESSAGE Warning: cannot find "TCFCommSerial.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "TCFCommSerial - Win32 Release" || "$(CFG)" == "TCFCommSerial - Win32 Debug" +SOURCE=..\TCFServer\BaseCom.cpp + +"$(INTDIR)\BaseCom.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommSerial.pch" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\Common\Source\mutex.cpp + +"$(INTDIR)\mutex.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommSerial.pch" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=.\RealSerialComm.cpp + +"$(INTDIR)\RealSerialComm.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommSerial.pch" + + +SOURCE=.\StdAfx.cpp + +!IF "$(CFG)" == "TCFCommSerial - Win32 Release" + +CPP_SWITCHES=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMSERIAL_EXPORTS" /Fp"$(INTDIR)\TCFCommSerial.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\StdAfx.obj" "$(INTDIR)\TCFCommSerial.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "TCFCommSerial - Win32 Debug" + +CPP_SWITCHES=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMSERIAL_EXPORTS" /Fp"$(INTDIR)\TCFCommSerial.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\StdAfx.obj" "$(INTDIR)\TCFCommSerial.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=..\Common\Source\TCDebugLog.cpp + +"$(INTDIR)\TCDebugLog.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommSerial.pch" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=.\TCFCommSerial.cpp + +"$(INTDIR)\TCFCommSerial.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommSerial.pch" + + + +!ENDIF + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/TCFCommSerial.plg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/TCFCommSerial.plg Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,48 @@ + + +
+

Build Log

+

+--------------------Configuration: TCFCommSerial - Win32 Debug-------------------- +

+

Command Lines

+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP23D7.tmp" with contents +[ +/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMSERIAL_EXPORTS" /Fp"Debug/TCFCommSerial.pch" /Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf.legacy\native\TCFNative\TCFCommSerial\RealSerialComm.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP23D7.tmp" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP23D8.tmp" with contents +[ +kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:"Debug/TCFCommSerial.pdb" /map:"Debug/TCFCommSerial.map" /debug /machine:I386 /out:"Debug/TCFCommSerial.dll" /implib:"Debug/TCFCommSerial.lib" /pdbtype:sept +.\Debug\BaseCom.obj +.\Debug\mutex.obj +.\Debug\RealSerialComm.obj +.\Debug\StdAfx.obj +.\Debug\TCDebugLog.obj +.\Debug\TCFCommSerial.obj +] +Creating command line "link.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP23D8.tmp" +

Output Window

+Compiling... +RealSerialComm.cpp +Linking... +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP23D9.bat" with contents +[ +@echo off +copyBinaries Debug +] +Creating command line "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP23D9.bat" +copy libs +Copy binaries to ..\..\..\os\win32\x86 + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + + + +

Results

+TCFCommSerial.dll - 0 error(s), 0 warning(s) +
+ + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/copyBinaries.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/copyBinaries.cmd Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,5 @@ +echo off +echo Copy binaries to ..\..\..\os\win32\x86 +copy /V %1\TCFCommSerial.dll ..\..\..\os\win32\x86 +copy /V %1\TCFCommSerial.lib ..\..\..\os\win32\x86 +copy /V %1\TCFCommSerial.map ..\..\..\os\win32\x86 diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/ReadMe.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/ReadMe.txt Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,37 @@ +======================================================================== + DYNAMIC LINK LIBRARY : TCFCommTCP +======================================================================== + + +AppWizard has created this TCFCommTCP DLL for you. + +This file contains a summary of what you will find in each of the files that +make up your TCFCommTCP application. + +TCFCommTCP.dsp + This file (the project file) contains information at the project level and + is used to build a single project or subproject. Other users can share the + project (.dsp) file, but they should export the makefiles locally. + +TCFCommTCP.cpp + This is the main DLL source file. + +TCFCommTCP.h + This file contains your DLL exports. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named TCFCommTCP.pch and a precompiled types file named StdAfx.obj. + + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + + +///////////////////////////////////////////////////////////////////////////// diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/StdAfx.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/StdAfx.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// stdafx.cpp : source file that includes just the standard includes +// TCFCommTCP.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/StdAfx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/StdAfx.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__7DD6E468_1B83_4416_82F1_1E86303443AD__INCLUDED_) +#define AFX_STDAFX_H__7DD6E468_1B83_4416_82F1_1E86303443AD__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +// Insert your headers here +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#include +#include + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__7DD6E468_1B83_4416_82F1_1E86303443AD__INCLUDED_) diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TCFCommTCP.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TCFCommTCP.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// TCFCommTCP.cpp : Defines the entry point for the DLL application. +// + +#include "stdafx.h" +#include +#include "TCFCommTCP.h" +#include "TcpComm.h" + +static const char* pCommType="tcp"; +static CBaseCom* pCommClass=NULL; +#ifdef _DEBUG +BOOL gDoLogging = FALSE; +#endif + +BOOL APIENTRY DllMain( HANDLE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + { +#ifdef _DEBUG + struct _stat buf; + char* dirname = "c:\\tcf"; + int result = _stat(dirname, &buf); + if (result == 0) // exists + { + gDoLogging = TRUE; + } + else + { + gDoLogging = FALSE; + } +#endif + } + break; + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + +// register this connection type +TCFCOMMTCP_API const char* RegisterComm() +{ + return pCommType; +} + +// create this connection type +TCFCOMMTCP_API CBaseCom* CreateComm(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol) +{ + pCommClass = new CTcpComm(connectSettings, connectionId, protocol); + + return pCommClass; +} + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TCFCommTCP.dep --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TCFCommTCP.dep Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,66 @@ +# Microsoft Developer Studio Generated Dependency File, included by TCFCommTCP.mak + +..\TCFServer\BaseCom.cpp : \ + "..\Common\Headers\ErrorMonitorData.h"\ + "..\Common\Headers\InputStream.h"\ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\ServerClient.h"\ + "..\Common\Headers\shareddata.h"\ + "..\Common\Headers\TCConstants.h"\ + "..\Common\Headers\TCDebugLog.h"\ + "..\Common\Headers\TCErrorConstants.h"\ + "..\TCFServer\BaseCom.h"\ + "..\TCFServer\Client.h"\ + "..\TCFServer\MessageFile.h"\ + "..\TCFServer\Registry.h"\ + + +..\Common\Source\mutex.cpp : \ + "..\Common\Headers\mutex.h"\ + + +.\StdAfx.cpp : \ + "..\..\..\..\..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ + ".\StdAfx.h"\ + + +..\Common\Source\TCDebugLog.cpp : \ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\TCDebugLog.h"\ + + +.\TCFCommTCP.cpp : \ + "..\Common\Headers\ErrorMonitorData.h"\ + "..\Common\Headers\InputStream.h"\ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\ServerClient.h"\ + "..\Common\Headers\shareddata.h"\ + "..\Common\Headers\TCConstants.h"\ + "..\Common\Headers\TCDebugLog.h"\ + "..\Common\Headers\TCErrorConstants.h"\ + "..\TCFServer\BaseCom.h"\ + "..\TCFServer\Client.h"\ + "..\TCFServer\MessageFile.h"\ + "..\TCFServer\Registry.h"\ + ".\TCFCommTCP.h"\ + ".\TcpComm.h"\ + + +.\TcpComm.cpp : \ + "..\Common\Headers\ErrorMonitorData.h"\ + "..\Common\Headers\InputStream.h"\ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\OSTConstants.h"\ + "..\Common\Headers\pn_const.h"\ + "..\Common\Headers\ServerClient.h"\ + "..\Common\Headers\shareddata.h"\ + "..\Common\Headers\TCConstants.h"\ + "..\Common\Headers\TCDebugLog.h"\ + "..\Common\Headers\TCErrorConstants.h"\ + "..\TCFServer\BaseCom.h"\ + "..\TCFServer\Client.h"\ + "..\TCFServer\Connection.h"\ + "..\TCFServer\MessageFile.h"\ + "..\TCFServer\Registry.h"\ + ".\TcpComm.h"\ + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TCFCommTCP.dsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TCFCommTCP.dsp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,154 @@ +# Microsoft Developer Studio Project File - Name="TCFCommTCP" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=TCFCommTCP - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "TCFCommTCP.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "TCFCommTCP.mak" CFG="TCFCommTCP - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "TCFCommTCP - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "TCFCommTCP - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TCFCommTCP - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMTCP_EXPORTS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMTCP_EXPORTS" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib shlwapi.lib /nologo /dll /map /machine:I386 +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +PostBuild_Cmds=copybinaries Release +# End Special Build Tool + +!ELSEIF "$(CFG)" == "TCFCommTCP - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMTCP_EXPORTS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMTCP_EXPORTS" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib shlwapi.lib /nologo /dll /map /debug /machine:I386 /pdbtype:sept +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +PostBuild_Cmds=copybinaries Debug +# End Special Build Tool + +!ENDIF + +# Begin Target + +# Name "TCFCommTCP - Win32 Release" +# Name "TCFCommTCP - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\TCFServer\BaseCom.cpp +# End Source File +# Begin Source File + +SOURCE=..\Common\Source\mutex.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=..\Common\Source\TCDebugLog.cpp +# End Source File +# Begin Source File + +SOURCE=.\TCFCommTCP.cpp +# End Source File +# Begin Source File + +SOURCE=.\TcpComm.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\TCFCommTCP.h +# End Source File +# Begin Source File + +SOURCE=.\TcpComm.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TCFCommTCP.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TCFCommTCP.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "BaseCom.h" +// The following ifdef block is the standard way of creating macros which make exporting +// from a DLL simpler. All files within this DLL are compiled with the TCFCOMMTCP_EXPORTS +// symbol defined on the command line. this symbol should not be defined on any project +// that uses this DLL. This way any other project whose source files include this file see +// TCFCOMMTCP_API functions as being imported from a DLL, wheras this DLL sees symbols +// defined with this macro as being exported. +#ifdef TCFCOMMTCP_EXPORTS +#define TCFCOMMTCP_API __declspec(dllexport) +#else +#define TCFCOMMTCP_API __declspec(dllimport) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +TCFCOMMTCP_API const char* RegisterComm(); +TCFCOMMTCP_API CBaseCom* CreateComm(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol); + +#ifdef __cplusplus +} +#endif diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TCFCommTCP.mak --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TCFCommTCP.mak Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,334 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on TCFCommTCP.dsp +!IF "$(CFG)" == "" +CFG=TCFCommTCP - Win32 Debug +!MESSAGE No configuration specified. Defaulting to TCFCommTCP - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "TCFCommTCP - Win32 Release" && "$(CFG)" != "TCFCommTCP - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "TCFCommTCP.mak" CFG="TCFCommTCP - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "TCFCommTCP - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "TCFCommTCP - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TCFCommTCP - Win32 Release" + +OUTDIR=.\Release +INTDIR=.\Release +# Begin Custom Macros +OutDir=.\Release +# End Custom Macros + +ALL : "$(OUTDIR)\TCFCommTCP.dll" + + +CLEAN : + -@erase "$(INTDIR)\BaseCom.obj" + -@erase "$(INTDIR)\mutex.obj" + -@erase "$(INTDIR)\StdAfx.obj" + -@erase "$(INTDIR)\TCDebugLog.obj" + -@erase "$(INTDIR)\TCFCommTCP.obj" + -@erase "$(INTDIR)\TCFCommTCP.pch" + -@erase "$(INTDIR)\TcpComm.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\TCFCommTCP.dll" + -@erase "$(OUTDIR)\TCFCommTCP.exp" + -@erase "$(OUTDIR)\TCFCommTCP.lib" + -@erase "$(OUTDIR)\TCFCommTCP.map" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMTCP_EXPORTS" /Fp"$(INTDIR)\TCFCommTCP.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\TCFCommTCP.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib shlwapi.lib /nologo /dll /incremental:no /pdb:"$(OUTDIR)\TCFCommTCP.pdb" /map:"$(INTDIR)\TCFCommTCP.map" /machine:I386 /out:"$(OUTDIR)\TCFCommTCP.dll" /implib:"$(OUTDIR)\TCFCommTCP.lib" +LINK32_OBJS= \ + "$(INTDIR)\BaseCom.obj" \ + "$(INTDIR)\mutex.obj" \ + "$(INTDIR)\StdAfx.obj" \ + "$(INTDIR)\TCDebugLog.obj" \ + "$(INTDIR)\TCFCommTCP.obj" \ + "$(INTDIR)\TcpComm.obj" + +"$(OUTDIR)\TCFCommTCP.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep + +ALL : $(DS_POSTBUILD_DEP) + +# Begin Custom Macros +OutDir=.\Release +# End Custom Macros + +$(DS_POSTBUILD_DEP) : "$(OUTDIR)\TCFCommTCP.dll" + copybinaries Release + echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)" + +!ELSEIF "$(CFG)" == "TCFCommTCP - Win32 Debug" + +OUTDIR=.\Debug +INTDIR=.\Debug +# Begin Custom Macros +OutDir=.\Debug +# End Custom Macros + +ALL : "$(OUTDIR)\TCFCommTCP.dll" "$(OUTDIR)\TCFCommTCP.bsc" + + +CLEAN : + -@erase "$(INTDIR)\BaseCom.obj" + -@erase "$(INTDIR)\BaseCom.sbr" + -@erase "$(INTDIR)\mutex.obj" + -@erase "$(INTDIR)\mutex.sbr" + -@erase "$(INTDIR)\StdAfx.obj" + -@erase "$(INTDIR)\StdAfx.sbr" + -@erase "$(INTDIR)\TCDebugLog.obj" + -@erase "$(INTDIR)\TCDebugLog.sbr" + -@erase "$(INTDIR)\TCFCommTCP.obj" + -@erase "$(INTDIR)\TCFCommTCP.pch" + -@erase "$(INTDIR)\TCFCommTCP.sbr" + -@erase "$(INTDIR)\TcpComm.obj" + -@erase "$(INTDIR)\TcpComm.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\TCFCommTCP.bsc" + -@erase "$(OUTDIR)\TCFCommTCP.dll" + -@erase "$(OUTDIR)\TCFCommTCP.exp" + -@erase "$(OUTDIR)\TCFCommTCP.ilk" + -@erase "$(OUTDIR)\TCFCommTCP.lib" + -@erase "$(OUTDIR)\TCFCommTCP.map" + -@erase "$(OUTDIR)\TCFCommTCP.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMTCP_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\TCFCommTCP.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\TCFCommTCP.bsc" +BSC32_SBRS= \ + "$(INTDIR)\BaseCom.sbr" \ + "$(INTDIR)\mutex.sbr" \ + "$(INTDIR)\StdAfx.sbr" \ + "$(INTDIR)\TCDebugLog.sbr" \ + "$(INTDIR)\TCFCommTCP.sbr" \ + "$(INTDIR)\TcpComm.sbr" + +"$(OUTDIR)\TCFCommTCP.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib shlwapi.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\TCFCommTCP.pdb" /map:"$(INTDIR)\TCFCommTCP.map" /debug /machine:I386 /out:"$(OUTDIR)\TCFCommTCP.dll" /implib:"$(OUTDIR)\TCFCommTCP.lib" /pdbtype:sept +LINK32_OBJS= \ + "$(INTDIR)\BaseCom.obj" \ + "$(INTDIR)\mutex.obj" \ + "$(INTDIR)\StdAfx.obj" \ + "$(INTDIR)\TCDebugLog.obj" \ + "$(INTDIR)\TCFCommTCP.obj" \ + "$(INTDIR)\TcpComm.obj" + +"$(OUTDIR)\TCFCommTCP.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep + +ALL : $(DS_POSTBUILD_DEP) + +# Begin Custom Macros +OutDir=.\Debug +# End Custom Macros + +$(DS_POSTBUILD_DEP) : "$(OUTDIR)\TCFCommTCP.dll" "$(OUTDIR)\TCFCommTCP.bsc" + copybinaries Debug + echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)" + +!ENDIF + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("TCFCommTCP.dep") +!INCLUDE "TCFCommTCP.dep" +!ELSE +!MESSAGE Warning: cannot find "TCFCommTCP.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "TCFCommTCP - Win32 Release" || "$(CFG)" == "TCFCommTCP - Win32 Debug" +SOURCE=..\TCFServer\BaseCom.cpp + +!IF "$(CFG)" == "TCFCommTCP - Win32 Release" + + +"$(INTDIR)\BaseCom.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommTCP.pch" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "TCFCommTCP - Win32 Debug" + + +"$(INTDIR)\BaseCom.obj" "$(INTDIR)\BaseCom.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommTCP.pch" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=..\Common\Source\mutex.cpp + +!IF "$(CFG)" == "TCFCommTCP - Win32 Release" + + +"$(INTDIR)\mutex.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommTCP.pch" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "TCFCommTCP - Win32 Debug" + + +"$(INTDIR)\mutex.obj" "$(INTDIR)\mutex.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommTCP.pch" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=.\StdAfx.cpp + +!IF "$(CFG)" == "TCFCommTCP - Win32 Release" + +CPP_SWITCHES=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMTCP_EXPORTS" /Fp"$(INTDIR)\TCFCommTCP.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\StdAfx.obj" "$(INTDIR)\TCFCommTCP.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "TCFCommTCP - Win32 Debug" + +CPP_SWITCHES=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMTCP_EXPORTS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\TCFCommTCP.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\StdAfx.obj" "$(INTDIR)\StdAfx.sbr" "$(INTDIR)\TCFCommTCP.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=..\Common\Source\TCDebugLog.cpp + +!IF "$(CFG)" == "TCFCommTCP - Win32 Release" + + +"$(INTDIR)\TCDebugLog.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommTCP.pch" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "TCFCommTCP - Win32 Debug" + + +"$(INTDIR)\TCDebugLog.obj" "$(INTDIR)\TCDebugLog.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommTCP.pch" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +SOURCE=.\TCFCommTCP.cpp + +!IF "$(CFG)" == "TCFCommTCP - Win32 Release" + + +"$(INTDIR)\TCFCommTCP.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommTCP.pch" + + +!ELSEIF "$(CFG)" == "TCFCommTCP - Win32 Debug" + + +"$(INTDIR)\TCFCommTCP.obj" "$(INTDIR)\TCFCommTCP.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommTCP.pch" + + +!ENDIF + +SOURCE=.\TcpComm.cpp + +!IF "$(CFG)" == "TCFCommTCP - Win32 Release" + + +"$(INTDIR)\TcpComm.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommTCP.pch" + + +!ELSEIF "$(CFG)" == "TCFCommTCP - Win32 Debug" + + +"$(INTDIR)\TcpComm.obj" "$(INTDIR)\TcpComm.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommTCP.pch" + + +!ENDIF + + +!ENDIF + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TCFCommTCP.plg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TCFCommTCP.plg Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,16 @@ + + +
+

Build Log

+

+--------------------Configuration: TCFCommTCP - Win32 Debug-------------------- +

+

Command Lines

+ + + +

Results

+TCFCommTCP.dll - 0 error(s), 0 warning(s) +
+ + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TcpComm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TcpComm.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,666 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// TcpComm.cpp: implementation of the CTcpComm class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "TcpComm.h" +//#include "pn_const.h" +//#include "OSTConstants.h" +#include "Connection.h" + +#ifdef _DEBUG +static char sTcpLogMsg[3000]; +#endif +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// +CTcpComm::CTcpComm() +{ +#ifdef _DEBUG + if (gDoLogging) + { + FILE* f = fopen("c:\\tcf\\tcpcommlog.txt", "at"); + fprintf(f, "CTcpComm::CTcpComm() (default constructor)\n"); + fclose(f); + } +#endif + m_socket = INVALID_SOCKET; + m_timeOut.tv_sec = TIMEOUT_SEC(DEFAULT_SOCKET_TIMEOUT); + m_timeOut.tv_usec = TIMEOUT_USEC(DEFAULT_SOCKET_TIMEOUT); + + m_hSocketEvent = WSA_INVALID_EVENT; +} + +CTcpComm::CTcpComm(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol) +{ +#ifdef _DEBUG + if (gDoLogging) + { + FILE* f = fopen("c:\\tcf\\tcpcommlog.txt", "at"); + fprintf(f, "connectSettings=%x connectionId=%d, protocol=%x\n", connectSettings, connectionId, protocol); + fclose(f); + } +#endif + m_connId = connectionId; + m_Protocol = protocol; + + m_ConnectSettings = new ConnectData(); + memcpy(m_ConnectSettings, connectSettings, sizeof(ConnectData)); + +#if (defined(LOG_COMM) || defined(LOG_PROCCOMM)) && defined(_DEBUG) + if (gDoLogging) + { + m_CommDebugLog = new TCDebugLog("TCF_Comm", connectionId, 2000L); + m_ProcDebugLog = new TCDebugLog("TCF_CommP", connectionId, 2000L); + } +#endif + m_socket = INVALID_SOCKET; + m_timeOut.tv_sec = TIMEOUT_SEC(DEFAULT_SOCKET_TIMEOUT); + m_timeOut.tv_usec = TIMEOUT_USEC(DEFAULT_SOCKET_TIMEOUT); + + m_hSocketEvent = WSA_INVALID_EVENT; +} +CTcpComm::~CTcpComm() +{ +#ifdef _DEBUG + if (gDoLogging) + { + FILE* f = fopen("c:\\tcf\\tcpcommlog.txt", "at"); + fprintf(f, "CTcpComm::~CTcpComm()\n"); + fclose(f); + } +#endif + if (IsConnected()) + { + shutdown(m_socket, SD_BOTH); + closesocket(m_socket); + WSACleanup(); + } + if (m_pBuffer) + delete[] m_pBuffer; + + if (m_hSocketEvent != WSA_INVALID_EVENT) + WSACloseEvent(m_hSocketEvent); + +} + +//#define USE_EVENTS +; +long CTcpComm::OpenPort() +{ + COMMLOGOPEN(); + COMMLOGS("CTcpComm::OpenPort\n"); + + long err = TCAPI_ERR_NONE; + char* ipAddress = m_ConnectSettings->tcpSettings.ipAddress; + char* ipPort = m_ConnectSettings->tcpSettings.ipPort; + // set this to set socket to non-blocking + // DWORD nonblock = 1; // non-blocking + DWORD nonblock = 0; // blocking + + COMMLOGA2("CTcpComm::OpenPort ipAddress=%s ipPort=%s\n", ipAddress, ipPort); + + WSADATA wsaData; + int wsaErr = WSAStartup(MAKEWORD(2,2), &wsaData); + if (wsaErr != 0) + { + err = TCAPI_ERR_WHILE_CONFIGURING_MEDIA; +// err = -1; + } + else + { + m_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + if (m_socket == INVALID_SOCKET) + { + m_lastCommError = WSAGetLastError(); + WSACleanup(); + err = TCAPI_ERR_WHILE_CONFIGURING_MEDIA; + } + else + { + if (ioctlsocket(m_socket, FIONBIO, &nonblock) == SOCKET_ERROR) + { + m_lastCommError = WSAGetLastError(); + closesocket(m_socket); + m_socket = INVALID_SOCKET; + WSACleanup(); + err = TCAPI_ERR_WHILE_CONFIGURING_MEDIA; + } + else + { + int i = SO_MAX_MSG_SIZE; + // set socket options + BOOL keepAlive = TRUE; + setsockopt(m_socket, SOL_SOCKET, SO_KEEPALIVE, (const char*)&keepAlive, sizeof(BOOL)); + int sockRecvSize = MAX_TCP_MESSAGE_BUFFER_LENGTH;//(256*1024L); + setsockopt(m_socket, SOL_SOCKET, SO_RCVBUF, (const char*)&sockRecvSize, sizeof(int)); + int sockSendSize = (64*1024L); + setsockopt(m_socket, SOL_SOCKET, SO_SNDBUF, (const char*)&sockSendSize, sizeof(int)); + WSAGetLastError(); // ignore error for now + int gotsockRecvSize, optLen=sizeof(int); + getsockopt(m_socket, SOL_SOCKET, SO_RCVBUF, (char*)&gotsockRecvSize, &optLen); + WSAGetLastError(); // ignore error for now + // connect + WORD wPort = atoi(ipPort); + m_clientService.sin_family = AF_INET; + m_clientService.sin_addr.S_un.S_addr = inet_addr(ipAddress); + m_clientService.sin_port = htons(wPort); + if (connect(m_socket, (SOCKADDR*)&m_clientService, sizeof(m_clientService)) == SOCKET_ERROR) + { + int wsaErr = WSAGetLastError(); + // socket is non-blocking + if (wsaErr != WSAEWOULDBLOCK) + { + m_lastCommError = wsaErr; + + closesocket(m_socket); + m_socket = INVALID_SOCKET; + WSACleanup(); + err = TCAPI_ERR_WHILE_CONFIGURING_MEDIA; + } + else // WSAEWOULDBLOCK error returned + { + // WSAEWOULDBLOCK use select now + fd_set readfds, writefds, exceptfds; + FD_ZERO(&readfds); + FD_ZERO(&writefds); + FD_ZERO(&exceptfds); + FD_SET(m_socket, &readfds); + FD_SET(m_socket, &writefds); + FD_SET(m_socket, &exceptfds); + + int selRes = 0; + while(1) + { + selRes = select(0, &readfds, &writefds, &exceptfds, &m_timeOut); + if (selRes == SOCKET_ERROR) + { + wsaErr = WSAGetLastError(); + if (wsaErr != WSAEWOULDBLOCK) + { + // real error + m_lastCommError = wsaErr; + shutdown(m_socket, SD_BOTH); + closesocket(m_socket); + m_socket = INVALID_SOCKET; + WSACleanup(); + err = TCAPI_ERR_WHILE_CONFIGURING_MEDIA; + } + // else do another select + } + else if (selRes > 0)// select OK + { + m_lastCommError = 0; + m_isConnected = true; + break; // done + } + else + { + // timed out + m_lastCommError = WSAGetLastError(); + shutdown(m_socket, SD_BOTH); + closesocket(m_socket); + m_socket = INVALID_SOCKET; + WSACleanup(); + err = TCAPI_ERR_WHILE_CONFIGURING_MEDIA; + } + } + } + } + else // connect return OK + { + m_lastCommError = 0; + m_isConnected = true; + } + } + } + } + if (err == TCAPI_ERR_NONE) + { + // we are connected + m_numberBytes = 0; + m_pBuffer = new BYTE[MAX_TCP_MESSAGE_BUFFER_LENGTH]; + +#ifdef USE_EVENTS + // create an event for the socket closing + m_hSocketEvent = WSACreateEvent(); + ::WSAEventSelect(m_socket, m_hSocketEvent, FD_CLOSE); + // above call sets socket to non-blocking + // cannot reset to blocking after using WSAEventSelect + // thus this ioctlsocket call will fail + ioctlsocket(m_socket, FIONBIO, &nonblock); +#endif + } + + COMMLOGCLOSE(); + return err; +} + +long CTcpComm::ClosePort() +{ + COMMLOGOPEN(); + COMMLOGS("CTcpComm::ClosePort\n"); + + long err = TCAPI_ERR_NONE; + + if (!IsConnected()) + { + err = TCAPI_ERR_MEDIA_NOT_OPEN; + } + else + { + shutdown(m_socket, SD_BOTH); + closesocket(m_socket); + m_socket = INVALID_SOCKET; + WSACleanup(); + + delete[] m_pBuffer; + m_pBuffer = NULL; + + if (m_hSocketEvent != WSA_INVALID_EVENT) + { + WSACloseEvent(m_hSocketEvent); + m_hSocketEvent = WSA_INVALID_EVENT; + } + } + + COMMLOGCLOSE(); + return err; +} + +long CTcpComm::PollPort(DWORD &outSize) +{ + long err = TCAPI_ERR_NONE; + DWORD numBytes = 0; + outSize = 0; + + if (!IsConnected()) + return TCAPI_ERR_MEDIA_NOT_OPEN; + +#ifdef USE_EVENTS + int ret = ::WSAWaitForMultipleEvents(1, &m_hSocketEvent, FALSE, 0, FALSE); + if (ret == WSA_WAIT_EVENT_0) + { + ::WSAResetEvent(m_hSocketEvent); + err = TCAPI_ERR_COMM_ERROR; + m_lastCommError = WSAESHUTDOWN; + return err; + } +#endif + int sockErr = 0; int optLen = sizeof(int); + int getErr = getsockopt(m_socket, SOL_SOCKET, SO_ERROR, (char*)&sockErr, &optLen); + if (getErr == 0) + { + if (sockErr) + { + err = TCAPI_ERR_COMM_ERROR; + m_lastCommError = sockErr; + return err; + } + } + + fd_set readfds, writefds, exceptfds; + FD_ZERO(&readfds); + FD_ZERO(&writefds); + FD_ZERO(&exceptfds); + FD_SET(m_socket, &readfds); + FD_SET(m_socket, &writefds); + FD_SET(m_socket, &exceptfds); + + bool portReady = false; + { + TIMEVAL pollTimeout = {0,0}; // just poll the status + int selErr = select(0, &readfds, 0, 0, &pollTimeout); + if (selErr > 0) + { + if (FD_ISSET(m_socket, &readfds)) + { + m_lastCommError = 0; + portReady = true; + } + } + else if (selErr == SOCKET_ERROR) + { + m_lastCommError = WSAGetLastError(); + err = TCAPI_ERR_COMM_ERROR; + } + } + + if (portReady) + { + // read was signaled as ready + int recvRet = recv(m_socket, (char*)&m_pPeekBuffer, sizeof(m_pPeekBuffer), MSG_PEEK); + if (recvRet > 0) + { + if (ioctlsocket(m_socket, FIONREAD, &numBytes) == 0) + { + m_lastCommError = 0; + outSize = numBytes; + } + else // SOCKET_ERROR + { + m_lastCommError = WSAGetLastError(); + err = TCAPI_ERR_COMM_ERROR; + } + } + else if (recvRet == 0) + { + // read was signalled as ready but recv=0 signals that remote shutdown + m_lastCommError = WSAESHUTDOWN; + err = TCAPI_ERR_COMM_ERROR; + } + else + { + // SOCKET_ERROR: error on recv other than a shutdown + m_lastCommError = WSAGetLastError(); + err = TCAPI_ERR_COMM_ERROR; + } + } + return err; +} + +long CTcpComm::ReadPort(DWORD inSize, void *outData, DWORD &outSize) +{ + long err = TCAPI_ERR_NONE; + DWORD numBytes = 0; + outSize = 0; + + if (!IsConnected()) + return TCAPI_ERR_MEDIA_NOT_OPEN; + + if (ioctlsocket(m_socket, FIONREAD, &numBytes) == 0) + { + if (numBytes > inSize) + numBytes = inSize; + int res = recv(m_socket, (char*)outData, numBytes, 0); + if (res == SOCKET_ERROR) + { + long commErr = WSAGetLastError(); + if ((DWORD)commErr != m_lastCommError) + { + m_lastCommError = commErr; + } + err = TCAPI_ERR_COMM_ERROR; + } + else if (res == 0) + { + // recv=0 --> connection closed + m_lastCommError = WSAESHUTDOWN; + err = TCAPI_ERR_COMM_ERROR; + } + else + { + m_lastCommError = 0; + outSize = numBytes; + } + } + else + { + // SOCKET_ERROR on ioctlsocket + m_lastCommError = WSAGetLastError(); + err = TCAPI_ERR_COMM_ERROR; + } + return err; +} +long CTcpComm::ProcessBuffer(CConnection* pConn, CRegistry* pRegistry, long& numberProcessed) +{ + + long err = TCAPI_ERR_NONE; + long routingErr = TCAPI_ERR_NONE; + + if (!IsConnected()) + return TCAPI_ERR_MEDIA_NOT_OPEN; + + if (!m_Protocol) + return TCAPI_ERR_UNKNOWN_MEDIA_TYPE; + + DWORD protocolHeaderLength = m_Protocol->GetHeaderLength(); + + // fill buffer + if (m_numberBytes < MAX_TCP_MESSAGE_BUFFER_LENGTH) + { + DWORD outLen = MAX_TCP_MESSAGE_BUFFER_LENGTH - m_numberBytes; + BYTE* ptr = &m_pBuffer[m_numberBytes]; + err = ReadPort(outLen, ptr, outLen); + if (err == TCAPI_ERR_NONE && outLen > 0) + { + m_numberBytes += outLen; + } + } + + // now process buffer but only for complete messages + if (err == TCAPI_ERR_NONE) + { + if (m_numberBytes >= protocolHeaderLength) + { + BYTE* ptr = m_pBuffer; + long bytesRemaining = m_numberBytes; + long usedLen = 0; + bool done = false; + + while (!done) + { + DWORD fullMessageLength = bytesRemaining; + DWORD rawLength = 0; + BYTE* fullMessage = ptr; + BYTE* rawMessage = ptr; + BYTE msgId = 0; + if (m_Protocol->DecodeMessage(fullMessage, fullMessageLength, msgId, rawMessage, rawLength)) + { + err = PreProcessMessage(msgId, fullMessageLength, fullMessage); + if (err != TCAPI_ERR_NONE) + { + PROCLOGOPEN(); + PROCLOGA1("CTcpComm::ProcessBuffer Notify err = %x\n", err); + PROCLOGCLOSE(); + // notify all clients right now + pConn->NotifyClientsCommError(err, false, 0); + err = TCAPI_ERR_NONE; + } +#ifdef _DEBUG + int reallen = fullMessageLength; + if (reallen > 50) reallen = 50; + char msg[6]; + msg[0] = '\0'; + + sTcpLogMsg[0] = '\0'; + if (reallen > 0) + { + sTcpLogMsg[0] = '\0'; + for (int i = 0; i < reallen; i++) + { + sprintf(msg, "%02.2x ", ptr[i]); + strcat(sTcpLogMsg, msg); + } + } +#endif + PROCLOGOPEN(); + PROCLOGA5("CTcpComm::ProcessBuffer - RouteMesssage pRegistry = %x id=%x len=%d len=%d\n msg=%s\n", pRegistry, msgId, fullMessageLength, rawLength, sTcpLogMsg); + PROCLOGCLOSE(); + + err = pRegistry->RouteMessage(msgId, fullMessage, fullMessageLength, rawMessage, rawLength); + if (err != TCAPI_ERR_NONE) routingErr = err; // saved for future + + numberProcessed++; + usedLen += fullMessageLength; + bytesRemaining -= fullMessageLength; + ptr += fullMessageLength; + if (bytesRemaining < protocolHeaderLength) + done = true; + } + else + { + done = true; + } + } + DeleteMsg(usedLen); + } + } + + if (routingErr == TCAPI_ERR_NONE) + return err; + else + return routingErr; +} + + +long CTcpComm::SendDataToPort(DWORD inSize, const void* inData) +{ + COMMLOGOPEN(); + COMMLOGS("CTcpComm::SendDataToPort\n"); + + long err = TCAPI_ERR_NONE; + + if (!IsConnected()) + { + COMMLOGCLOSE(); + return TCAPI_ERR_MEDIA_NOT_OPEN; + } + +#ifdef USE_EVENTS + int ret = ::WSAWaitForMultipleEvents(1, &m_hSocketEvent, FALSE, 0, FALSE); + if (ret == WSA_WAIT_EVENT_0) + { + ::WSAResetEvent(m_hSocketEvent); + err = TCAPI_ERR_COMM_ERROR; + m_lastCommError = WSAESHUTDOWN; + COMMLOGCLOSE(); + return err; + } +#endif + int sockErr = 0; int optLen = sizeof(int); + int getErr = getsockopt(m_socket, SOL_SOCKET, SO_ERROR, (char*)&sockErr, &optLen); + if (getErr == 0) + { + if (sockErr) + { + err = TCAPI_ERR_COMM_ERROR; + m_lastCommError = sockErr; + COMMLOGCLOSE(); + return err; + } + } + + fd_set readfds, writefds, exceptfds; + FD_ZERO(&readfds); + FD_ZERO(&writefds); + FD_ZERO(&exceptfds); + FD_SET(m_socket, &readfds); + FD_SET(m_socket, &writefds); + FD_SET(m_socket, &exceptfds); + + COMMLOGS("CTcpComm::SendDataToPort select\n"); + bool portReady = false; + { + int selErr = select(0, &readfds, &writefds, &exceptfds, &m_timeOut); + if (selErr > 0) + { + if (FD_ISSET(m_socket, &writefds)) + { + m_lastCommError = 0; + portReady = true; + } + } + else if (selErr == SOCKET_ERROR) + { + m_lastCommError = WSAGetLastError(); + err = TCAPI_ERR_COMM_ERROR; + } + else if (selErr == 0) // timeout + { + m_lastCommError = WSAGetLastError(); + err = TCAPI_ERR_COMM_ERROR; + } + } + COMMLOGA1("CTcpComm::SendDataToPort portReady=%d\n", portReady); + if (portReady) + { + COMMLOGS("CTcpComm::SendDataToPort send start\n"); + // loop until all bytes are sent + DWORD bytesRemaining = inSize; + DWORD nSent = 0; + char* unsent = (char*)inData; + while (bytesRemaining) + { + nSent = send(m_socket, unsent, bytesRemaining, 0); + if (nSent == SOCKET_ERROR) + { + int wsaErr = WSAGetLastError(); + // ignore "would block" errors + if (wsaErr != WSAEWOULDBLOCK) + { + // TODO: error handling + m_lastCommError = wsaErr; + err = TCAPI_ERR_COMM_ERROR; + break; + } + } + else + { + m_lastCommError = 0; + unsent += nSent; + bytesRemaining -= nSent; + } + } // end while + COMMLOGS("CTcpComm::SendDataToPort send done\n"); +#ifdef _DEBUG + BYTE* ptr = (BYTE*)inData; + long numBytes = (inSize > 20) ? 20 : inSize; + char msg[200]; + sprintf(msg, "CTcpComm::SendDataToPort data = "); + for (int i = 0; i < numBytes; i++) + { + sprintf(msg, "%s %02.2x", msg, ptr[i]); + } + sprintf(msg, "%s\n", msg); + COMMLOGS(msg); +#endif + } + + COMMLOGCLOSE(); + return err; +} + +void CTcpComm::DeleteMsg(DWORD inMsgLength) +{ + // inMsgLength includes header + // delete from beginning of buffer + if (inMsgLength == 0) + return; + if (m_numberBytes > 0 && m_numberBytes >= inMsgLength) + { + size_t moveLen = m_numberBytes - inMsgLength; + if (moveLen > 0) + memcpy(&m_pBuffer[0], &m_pBuffer[inMsgLength], moveLen); + m_numberBytes -= inMsgLength; + } +} +bool CTcpComm::IsConnectionEqual(ConnectData* pConn) +{ + if ((strcmp(pConn->tcpSettings.ipAddress, m_ConnectSettings->tcpSettings.ipAddress) == 0) && + (strcmp(pConn->tcpSettings.ipPort, m_ConnectSettings->tcpSettings.ipPort) == 0)) + { + return true; + } + else + { + return false; + } +} + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TcpComm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TcpComm.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// TcpComm.h: interface for the CTcpComm class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_TCPCOMM_H__69657421_6D37_497A_A377_12E71365EDAB__INCLUDED_) +#define AFX_TCPCOMM_H__69657421_6D37_497A_A377_12E71365EDAB__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "BaseCom.h" +#include + +#define MAX_MESSAGE_LENGTH (64*1024L) +#define MAX_TCP_MESSAGE_BUFFER_LENGTH (8*MAX_MESSAGE_LENGTH) + +#define DEFAULT_SOCKET_TIMEOUT (2000000L) // 2 seconds +#define TIMEOUT_SEC(x) (x/1000000L) +#define TIMEOUT_USEC(x) (x%1000000L) + +class CTcpComm : public CBaseCom +{ +public: + CTcpComm(); + CTcpComm(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol); + virtual ~CTcpComm(); + + virtual long OpenPort(); + long ClosePort(); + long SendDataToPort(DWORD inSize, const void* inData); + long PollPort(DWORD& outSize); + long ReadPort(DWORD inSize, void* outData, DWORD& outSize); + long ProcessBuffer(CConnection* pConn, CRegistry* pRegistry, long& numberProcessed); +// long ProcessBuffer(NOTIFYCLIENTSCOMMERROR pNotify, ROUTEMESSAGE pRouteMessage, long& numberProcessed); +// long ProcessBuffer(long& numberProcessed); + void DeleteMsg(DWORD inMsgLength); + bool GetVersion(char* outVersion) { return false; } // don't have enough information for this + bool HasVersion() { return false; } // can we have a version? + virtual long PreProcessMessage(int inMsgType, DWORD inMsgLength, BYTE* inMessage) { return TCAPI_ERR_NONE; } + virtual long PreProcessMessage(BYTE msgId, DWORD inMsgLength, BYTE* inMessage) { return TCAPI_ERR_NONE; } + bool IsConnectionEqual(ConnectData* pConn); + +private: + SOCKET m_socket; + sockaddr_in m_clientService; + TIMEVAL m_timeOut; + WSAEVENT m_hSocketEvent; + DWORD m_pPeekBuffer; + +}; + +#endif // !defined(AFX_TCPCOMM_H__69657421_6D37_497A_A377_12E71365EDAB__INCLUDED_) diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/copyBinaries.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/copyBinaries.cmd Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,5 @@ +echo off +echo Copy binaries to ..\..\..\os\win32\x86 +copy /V %1\TCFCommTCP.dll ..\..\..\os\win32\x86 +copy /V %1\TCFCommTCP.lib ..\..\..\os\win32\x86 +copy /V %1\TCFCommTCP.map ..\..\..\os\win32\x86 diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/ReadMe.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/ReadMe.txt Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,37 @@ +======================================================================== + DYNAMIC LINK LIBRARY : TCFCommVirtualSerial +======================================================================== + + +AppWizard has created this TCFCommVirtualSerial DLL for you. + +This file contains a summary of what you will find in each of the files that +make up your TCFCommVirtualSerial application. + +TCFCommVirtualSerial.dsp + This file (the project file) contains information at the project level and + is used to build a single project or subproject. Other users can share the + project (.dsp) file, but they should export the makefiles locally. + +TCFCommVirtualSerial.cpp + This is the main DLL source file. + +TCFCommVirtualSerial.h + This file contains your DLL exports. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named TCFCommVirtualSerial.pch and a precompiled types file named StdAfx.obj. + + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + + +///////////////////////////////////////////////////////////////////////////// diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/StdAfx.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/StdAfx.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// stdafx.cpp : source file that includes just the standard includes +// TCFCommVirtualSerial.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/StdAfx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/StdAfx.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__9F3786A5_6D42_4ECE_BA9A_9BAE7093845F__INCLUDED_) +#define AFX_STDAFX_H__9F3786A5_6D42_4ECE_BA9A_9BAE7093845F__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +// Insert your headers here +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#include +#include + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__9F3786A5_6D42_4ECE_BA9A_9BAE7093845F__INCLUDED_) diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/TCFCommVirtualSerial.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/TCFCommVirtualSerial.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// TCFCommVirtualSerial.cpp : Defines the entry point for the DLL application. +// + +#include "stdafx.h" +#include +#include "TCFCommVirtualSerial.h" +#include "VirtualSerialComm.h" + +static const char* pCommType="virtualserial"; +static CBaseCom* pCommClass=NULL; +#ifdef _DEBUG +BOOL gDoLogging = FALSE; +#endif + +BOOL APIENTRY DllMain( HANDLE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + { +#ifdef _DEBUG + struct _stat buf; + char* dirname = "c:\\tcf"; + int result = _stat(dirname, &buf); + if (result == 0) // exists + { + gDoLogging = TRUE; + } + else + { + gDoLogging = FALSE; + } +#endif + } + break; + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + +// register this connection type +TCFCOMMVIRTUALSERIAL_API const char* RegisterComm() +{ + return pCommType; +} + +// create this connection type +TCFCOMMVIRTUALSERIAL_API CBaseCom* CreateComm(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol) +{ + pCommClass = new VirtualSerialComm(connectSettings, connectionId, protocol); + + return pCommClass; +} diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/TCFCommVirtualSerial.dep --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/TCFCommVirtualSerial.dep Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,84 @@ +# Microsoft Developer Studio Generated Dependency File, included by TCFCommVirtualSerial.mak + +..\TCFServer\BaseCom.cpp : \ + "..\Common\Headers\ErrorMonitorData.h"\ + "..\Common\Headers\InputStream.h"\ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\ServerClient.h"\ + "..\Common\Headers\shareddata.h"\ + "..\Common\Headers\TCConstants.h"\ + "..\Common\Headers\TCDebugLog.h"\ + "..\Common\Headers\TCErrorConstants.h"\ + "..\TCFServer\BaseCom.h"\ + "..\TCFServer\Client.h"\ + "..\TCFServer\MessageFile.h"\ + "..\TCFServer\Registry.h"\ + + +..\Common\Source\mutex.cpp : \ + "..\Common\Headers\mutex.h"\ + + +..\TCFCommSerial\RealSerialComm.cpp : \ + "..\Common\Headers\ErrorMonitorData.h"\ + "..\Common\Headers\InputStream.h"\ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\OSTConstants.h"\ + "..\Common\Headers\pn_const.h"\ + "..\Common\Headers\ServerClient.h"\ + "..\Common\Headers\shareddata.h"\ + "..\Common\Headers\TCConstants.h"\ + "..\Common\Headers\TCDebugLog.h"\ + "..\Common\Headers\TCErrorConstants.h"\ + "..\TCFCommSerial\RealSerialComm.h"\ + "..\TCFServer\BaseCom.h"\ + "..\TCFServer\Client.h"\ + "..\TCFServer\Connection.h"\ + "..\TCFServer\MessageFile.h"\ + "..\TCFServer\Registry.h"\ + + +.\StdAfx.cpp : \ + "..\..\..\..\..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ + ".\StdAfx.h"\ + + +..\Common\Source\TCDebugLog.cpp : \ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\TCDebugLog.h"\ + + +.\TCFCommVirtualSerial.cpp : \ + "..\Common\Headers\ErrorMonitorData.h"\ + "..\Common\Headers\InputStream.h"\ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\ServerClient.h"\ + "..\Common\Headers\shareddata.h"\ + "..\Common\Headers\TCConstants.h"\ + "..\Common\Headers\TCDebugLog.h"\ + "..\Common\Headers\TCErrorConstants.h"\ + "..\TCFCommSerial\RealSerialComm.h"\ + "..\TCFServer\BaseCom.h"\ + "..\TCFServer\Client.h"\ + "..\TCFServer\MessageFile.h"\ + "..\TCFServer\Registry.h"\ + ".\TCFCommVirtualSerial.h"\ + ".\VirtualSerialComm.h"\ + + +.\VirtualSerialComm.cpp : \ + "..\Common\Headers\ErrorMonitorData.h"\ + "..\Common\Headers\InputStream.h"\ + "..\Common\Headers\mutex.h"\ + "..\Common\Headers\ServerClient.h"\ + "..\Common\Headers\shareddata.h"\ + "..\Common\Headers\TCConstants.h"\ + "..\Common\Headers\TCDebugLog.h"\ + "..\Common\Headers\TCErrorConstants.h"\ + "..\TCFCommSerial\RealSerialComm.h"\ + "..\TCFServer\BaseCom.h"\ + "..\TCFServer\Client.h"\ + "..\TCFServer\MessageFile.h"\ + "..\TCFServer\Registry.h"\ + ".\VirtualSerialComm.h"\ + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/TCFCommVirtualSerial.dsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/TCFCommVirtualSerial.dsp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,162 @@ +# Microsoft Developer Studio Project File - Name="TCFCommVirtualSerial" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=TCFCommVirtualSerial - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "TCFCommVirtualSerial.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "TCFCommVirtualSerial.mak" CFG="TCFCommVirtualSerial - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "TCFCommVirtualSerial - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "TCFCommVirtualSerial - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TCFCommVirtualSerial - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMVIRTUALSERIAL_EXPORTS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFCommSerial" /I "..\Common\Headers" /I "..\TCFServer" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMVIRTUALSERIAL_EXPORTS" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /map /machine:I386 +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +PostBuild_Cmds=copyBinaries Release +# End Special Build Tool + +!ELSEIF "$(CFG)" == "TCFCommVirtualSerial - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMVIRTUALSERIAL_EXPORTS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\TCFCommSerial" /I "..\Common\Headers" /I "..\TCFServer" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMVIRTUALSERIAL_EXPORTS" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /map /debug /machine:I386 /pdbtype:sept +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +PostBuild_Cmds=copyBinaries Debug +# End Special Build Tool + +!ENDIF + +# Begin Target + +# Name "TCFCommVirtualSerial - Win32 Release" +# Name "TCFCommVirtualSerial - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\TCFServer\BaseCom.cpp +# End Source File +# Begin Source File + +SOURCE=..\Common\Source\mutex.cpp +# End Source File +# Begin Source File + +SOURCE=..\TCFCommSerial\RealSerialComm.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=..\Common\Source\TCDebugLog.cpp +# End Source File +# Begin Source File + +SOURCE=.\TCFCommVirtualSerial.cpp +# End Source File +# Begin Source File + +SOURCE=.\VirtualSerialComm.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\TCFCommSerial\RealSerialComm.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\TCFCommVirtualSerial.h +# End Source File +# Begin Source File + +SOURCE=.\VirtualSerialComm.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/TCFCommVirtualSerial.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/TCFCommVirtualSerial.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "BaseCom.h" +// The following ifdef block is the standard way of creating macros which make exporting +// from a DLL simpler. All files within this DLL are compiled with the TCFCOMMVIRTUALSERIAL_EXPORTS +// symbol defined on the command line. this symbol should not be defined on any project +// that uses this DLL. This way any other project whose source files include this file see +// TCFCOMMVIRTUALSERIAL_API functions as being imported from a DLL, wheras this DLL sees symbols +// defined with this macro as being exported. +#ifdef TCFCOMMVIRTUALSERIAL_EXPORTS +#define TCFCOMMVIRTUALSERIAL_API __declspec(dllexport) +#else +#define TCFCOMMVIRTUALSERIAL_API __declspec(dllimport) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +TCFCOMMVIRTUALSERIAL_API const char* RegisterComm(); +TCFCOMMVIRTUALSERIAL_API CBaseCom* CreateComm(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol); + +#ifdef __cplusplus +} +#endif diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/TCFCommVirtualSerial.mak --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/TCFCommVirtualSerial.mak Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,268 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on TCFCommVirtualSerial.dsp +!IF "$(CFG)" == "" +CFG=TCFCommVirtualSerial - Win32 Debug +!MESSAGE No configuration specified. Defaulting to TCFCommVirtualSerial - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "TCFCommVirtualSerial - Win32 Release" && "$(CFG)" != "TCFCommVirtualSerial - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "TCFCommVirtualSerial.mak" CFG="TCFCommVirtualSerial - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "TCFCommVirtualSerial - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "TCFCommVirtualSerial - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TCFCommVirtualSerial - Win32 Release" + +OUTDIR=.\Release +INTDIR=.\Release +# Begin Custom Macros +OutDir=.\Release +# End Custom Macros + +ALL : "$(OUTDIR)\TCFCommVirtualSerial.dll" + + +CLEAN : + -@erase "$(INTDIR)\BaseCom.obj" + -@erase "$(INTDIR)\mutex.obj" + -@erase "$(INTDIR)\RealSerialComm.obj" + -@erase "$(INTDIR)\StdAfx.obj" + -@erase "$(INTDIR)\TCDebugLog.obj" + -@erase "$(INTDIR)\TCFCommVirtualSerial.obj" + -@erase "$(INTDIR)\TCFCommVirtualSerial.pch" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\VirtualSerialComm.obj" + -@erase "$(OUTDIR)\TCFCommVirtualSerial.dll" + -@erase "$(OUTDIR)\TCFCommVirtualSerial.exp" + -@erase "$(OUTDIR)\TCFCommVirtualSerial.lib" + -@erase "$(OUTDIR)\TCFCommVirtualSerial.map" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFCommSerial" /I "..\Common\Headers" /I "..\TCFServer" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMVIRTUALSERIAL_EXPORTS" /Fp"$(INTDIR)\TCFCommVirtualSerial.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\TCFCommVirtualSerial.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /pdb:"$(OUTDIR)\TCFCommVirtualSerial.pdb" /map:"$(INTDIR)\TCFCommVirtualSerial.map" /machine:I386 /out:"$(OUTDIR)\TCFCommVirtualSerial.dll" /implib:"$(OUTDIR)\TCFCommVirtualSerial.lib" +LINK32_OBJS= \ + "$(INTDIR)\BaseCom.obj" \ + "$(INTDIR)\mutex.obj" \ + "$(INTDIR)\RealSerialComm.obj" \ + "$(INTDIR)\StdAfx.obj" \ + "$(INTDIR)\TCDebugLog.obj" \ + "$(INTDIR)\TCFCommVirtualSerial.obj" \ + "$(INTDIR)\VirtualSerialComm.obj" + +"$(OUTDIR)\TCFCommVirtualSerial.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep + +ALL : $(DS_POSTBUILD_DEP) + +# Begin Custom Macros +OutDir=.\Release +# End Custom Macros + +$(DS_POSTBUILD_DEP) : "$(OUTDIR)\TCFCommVirtualSerial.dll" + copyBinaries Release + echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)" + +!ELSEIF "$(CFG)" == "TCFCommVirtualSerial - Win32 Debug" + +OUTDIR=.\Debug +INTDIR=.\Debug +# Begin Custom Macros +OutDir=.\Debug +# End Custom Macros + +ALL : "$(OUTDIR)\TCFCommVirtualSerial.dll" + + +CLEAN : + -@erase "$(INTDIR)\BaseCom.obj" + -@erase "$(INTDIR)\mutex.obj" + -@erase "$(INTDIR)\RealSerialComm.obj" + -@erase "$(INTDIR)\StdAfx.obj" + -@erase "$(INTDIR)\TCDebugLog.obj" + -@erase "$(INTDIR)\TCFCommVirtualSerial.obj" + -@erase "$(INTDIR)\TCFCommVirtualSerial.pch" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(INTDIR)\VirtualSerialComm.obj" + -@erase "$(OUTDIR)\TCFCommVirtualSerial.dll" + -@erase "$(OUTDIR)\TCFCommVirtualSerial.exp" + -@erase "$(OUTDIR)\TCFCommVirtualSerial.ilk" + -@erase "$(OUTDIR)\TCFCommVirtualSerial.lib" + -@erase "$(OUTDIR)\TCFCommVirtualSerial.map" + -@erase "$(OUTDIR)\TCFCommVirtualSerial.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\TCFCommSerial" /I "..\Common\Headers" /I "..\TCFServer" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMVIRTUALSERIAL_EXPORTS" /Fp"$(INTDIR)\TCFCommVirtualSerial.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\TCFCommVirtualSerial.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\TCFCommVirtualSerial.pdb" /map:"$(INTDIR)\TCFCommVirtualSerial.map" /debug /machine:I386 /out:"$(OUTDIR)\TCFCommVirtualSerial.dll" /implib:"$(OUTDIR)\TCFCommVirtualSerial.lib" /pdbtype:sept +LINK32_OBJS= \ + "$(INTDIR)\BaseCom.obj" \ + "$(INTDIR)\mutex.obj" \ + "$(INTDIR)\RealSerialComm.obj" \ + "$(INTDIR)\StdAfx.obj" \ + "$(INTDIR)\TCDebugLog.obj" \ + "$(INTDIR)\TCFCommVirtualSerial.obj" \ + "$(INTDIR)\VirtualSerialComm.obj" + +"$(OUTDIR)\TCFCommVirtualSerial.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep + +ALL : $(DS_POSTBUILD_DEP) + +# Begin Custom Macros +OutDir=.\Debug +# End Custom Macros + +$(DS_POSTBUILD_DEP) : "$(OUTDIR)\TCFCommVirtualSerial.dll" + copyBinaries Debug + echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)" + +!ENDIF + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("TCFCommVirtualSerial.dep") +!INCLUDE "TCFCommVirtualSerial.dep" +!ELSE +!MESSAGE Warning: cannot find "TCFCommVirtualSerial.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "TCFCommVirtualSerial - Win32 Release" || "$(CFG)" == "TCFCommVirtualSerial - Win32 Debug" +SOURCE=..\TCFServer\BaseCom.cpp + +"$(INTDIR)\BaseCom.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommVirtualSerial.pch" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\Common\Source\mutex.cpp + +"$(INTDIR)\mutex.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommVirtualSerial.pch" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=..\TCFCommSerial\RealSerialComm.cpp + +"$(INTDIR)\RealSerialComm.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommVirtualSerial.pch" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=.\StdAfx.cpp + +!IF "$(CFG)" == "TCFCommVirtualSerial - Win32 Release" + +CPP_SWITCHES=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFCommSerial" /I "..\Common\Headers" /I "..\TCFServer" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMVIRTUALSERIAL_EXPORTS" /Fp"$(INTDIR)\TCFCommVirtualSerial.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\StdAfx.obj" "$(INTDIR)\TCFCommVirtualSerial.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "TCFCommVirtualSerial - Win32 Debug" + +CPP_SWITCHES=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\TCFCommSerial" /I "..\Common\Headers" /I "..\TCFServer" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMVIRTUALSERIAL_EXPORTS" /Fp"$(INTDIR)\TCFCommVirtualSerial.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\StdAfx.obj" "$(INTDIR)\TCFCommVirtualSerial.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=..\Common\Source\TCDebugLog.cpp + +"$(INTDIR)\TCDebugLog.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommVirtualSerial.pch" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=.\TCFCommVirtualSerial.cpp + +"$(INTDIR)\TCFCommVirtualSerial.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommVirtualSerial.pch" + + +SOURCE=.\VirtualSerialComm.cpp + +"$(INTDIR)\VirtualSerialComm.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFCommVirtualSerial.pch" + + + +!ENDIF + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/TCFCommVirtualSerial.plg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/TCFCommVirtualSerial.plg Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,49 @@ + + +
+

Build Log

+

+--------------------Configuration: TCFCommVirtualSerial - Win32 Debug-------------------- +

+

Command Lines

+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP23DA.tmp" with contents +[ +/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\TCFCommSerial" /I "..\Common\Headers" /I "..\TCFServer" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMVIRTUALSERIAL_EXPORTS" /Fp"Debug/TCFCommVirtualSerial.pch" /Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf.legacy\native\TCFNative\TCFCommSerial\RealSerialComm.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP23DA.tmp" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP23DB.tmp" with contents +[ +kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:"Debug/TCFCommVirtualSerial.pdb" /map:"Debug/TCFCommVirtualSerial.map" /debug /machine:I386 /out:"Debug/TCFCommVirtualSerial.dll" /implib:"Debug/TCFCommVirtualSerial.lib" /pdbtype:sept +.\Debug\BaseCom.obj +.\Debug\mutex.obj +.\Debug\RealSerialComm.obj +.\Debug\StdAfx.obj +.\Debug\TCDebugLog.obj +.\Debug\TCFCommVirtualSerial.obj +.\Debug\VirtualSerialComm.obj +] +Creating command line "link.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP23DB.tmp" +

Output Window

+Compiling... +RealSerialComm.cpp +Linking... +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP23DC.bat" with contents +[ +@echo off +copyBinaries Debug +] +Creating command line "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP23DC.bat" +copy libs +Copy binaries to ..\..\..\os\win32\x86 + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + + + +

Results

+TCFCommVirtualSerial.dll - 0 error(s), 0 warning(s) +
+ + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/VirtualSerialComm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/VirtualSerialComm.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// VirtualSerialComm1.cpp: implementation of the VirtualSerialComm class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "VirtualSerialComm.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +VirtualSerialComm::VirtualSerialComm() +{ +#ifdef _DEBUG + if (gDoLogging) + { + FILE* f = fopen("c:\\tcf\\vscommlog.txt", "at"); + fprintf(f, "VirtualSerialComm::VirtualSerialComm() (default constructor)\n"); + fclose(f); + } +#endif +} +VirtualSerialComm::VirtualSerialComm(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol) +{ +#ifdef _DEBUG + if (gDoLogging) + { + FILE* f = fopen("c:\\tcf\\vscommlog.txt", "at"); + fprintf(f, "connectSettings=%x connectionId=%d, protocol=%x\n", connectSettings, connectionId, protocol); + fprintf(f, "connectSettings->comPort=%s\n", connectSettings->virtualSerialSettings.comPort); + fclose(f); + } +#endif + m_connId = connectionId; + m_Protocol = protocol; + + m_ConnectSettings = new ConnectData(); + memcpy(m_ConnectSettings, connectSettings, sizeof(ConnectData)); + +#if (defined(LOG_COMM) || defined(LOG_PROCCOMM)) && defined(_DEBUG) + if (gDoLogging) + { + m_CommDebugLog = new TCDebugLog("TCF_Comm", connectionId, 2000L); + m_ProcDebugLog = new TCDebugLog("TCF_CommP", connectionId, 2000L); + } +#endif + pRealSerialConnectData pR = &m_ConnectSettings->realSerialSettings; + pVirtualSerialConnectData pV = &m_ConnectSettings->virtualSerialSettings; + + // copy com port to real settings + strcpy(pR->comPort, pV->comPort); + + // fill in real setting defaults + pR->baudRate = 115200; + pR->dataBits = 8; + pR->flowControl = eFlowControlNone; + pR->parity = eParityNone; + pR->stopBits = eStopBits1; +} + +VirtualSerialComm::~VirtualSerialComm() +{ +#ifdef _DEBUG + if (gDoLogging) + { + FILE* f = fopen("c:\\tcf\\vscommlog.txt", "at"); + fprintf(f, "VirtualSerialComm::~VirtualSerialComm()\n"); + fclose(f); + } +#endif +} +bool VirtualSerialComm::IsConnectionEqual(ConnectData* pConn) +{ + bool equal = false; + + // forms accepted: + // "comNN", "NN" + char* ptr1 = m_ConnectSettings->virtualSerialSettings.comPort; + char* ptr2 = pConn->virtualSerialSettings.comPort; + bool digit1found = false; + while(!digit1found && *ptr1 != NULL) + { + if (*ptr1 >= '0' && *ptr1 <= '9') + { + digit1found = true; + break; + } + ptr1++; + } + bool digit2found = false; + while(!digit2found && *ptr2 != NULL) + { + if (*ptr2 >= '0' && *ptr2 <= '9') + { + digit2found = true; + break; + } + ptr2++; + } + if (digit1found && digit2found) + { + if (strcmp(ptr1, ptr2) == 0) + equal = true; + } + return equal; +} + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/VirtualSerialComm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/VirtualSerialComm.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// VirtualSerialComm1.h: interface for the VirtualSerialComm class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_VIRTUALSERIALCOMM1_H__C5549E09_44AA_4DD2_9DD0_56054DCA0C20__INCLUDED_) +#define AFX_VIRTUALSERIALCOMM1_H__C5549E09_44AA_4DD2_9DD0_56054DCA0C20__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "RealSerialComm.h" + +class VirtualSerialComm : public CRealSerialComm +{ +public: + VirtualSerialComm(); + VirtualSerialComm(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol); + virtual ~VirtualSerialComm(); + + virtual bool IsConnectionEqual(ConnectData* pConn); +}; + +#endif // !defined(AFX_VIRTUALSERIALCOMM1_H__C5549E09_44AA_4DD2_9DD0_56054DCA0C20__INCLUDED_) diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/copyBinaries.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommVirtualSerial/copyBinaries.cmd Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,5 @@ +echo off +echo Copy binaries to ..\..\..\os\win32\x86 +copy /V %1\TCFCommVirtualSerial.dll ..\..\..\os\win32\x86 +copy /V %1\TCFCommVirtualSerial.lib ..\..\..\os\win32\x86 +copy /V %1\TCFCommVirtualSerial.map ..\..\..\os\win32\x86 diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFNative.dsw --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFNative.dsw Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,89 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "TCFClient"=.\TCFClient\TCFClient.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "TCFCommSerial"=.\TCFCommSerial\TCFCommSerial.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "TCFCommTCP"=.\TCFCommTCP\TCFCommTCP.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "TCFCommVirtualSerial"=.\TCFCommVirtualSerial\TCFCommVirtualSerial.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "TCFProtOST"=.\TCFProtOST\TCFProtOST.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "TCFServer"=.\TCFServer\TCFServer.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFNative.ncb Binary file connectivity/com.nokia.tcf/native/TCFNative/TCFNative.ncb has changed diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFNative.opt Binary file connectivity/com.nokia.tcf/native/TCFNative/TCFNative.opt has changed diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/OSTProtocol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/OSTProtocol.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// OSTProtocol.cpp: implementation of the COSTProtocol class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "OSTProtocol.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +COSTProtocol::COSTProtocol() +{ + +} + +COSTProtocol::~COSTProtocol() +{ + +} +BOOL COSTProtocol::DecodeMessage(BYTE* fullMessage, DWORD& fullMessageLength, BYTE& msgId, BYTE*& rawMessage, DWORD& rawLength) +{ + BOOL found = FALSE; + + WORD msgLen = MAKEWORD(fullMessage[OST_LEN_BYTE_1+1], fullMessage[OST_LEN_BYTE_1]); + if (fullMessageLength >= (WORD)(msgLen + OST_HDR_LEN_1)) + { + msgId = fullMessage[OST_PROT_BYTE_1]; + rawMessage = &fullMessage[OST_MSG_BYTE_1]; + rawLength = msgLen; + fullMessageLength = msgLen+OST_HDR_LEN_1; + found = TRUE; + } + + return found; +} + +DWORD COSTProtocol::EncodeMessage(BYTE* rawMessage, DWORD rawLength, BYTE protocolVersion, BYTE msgId, BYTE* fullMessage, DWORD maxFullLength) +{ + DWORD outLength = 0; + + fullMessage[OST_VER_BYTE_1] = protocolVersion; + fullMessage[OST_PROT_BYTE_1] = msgId; + fullMessage[OST_LEN_BYTE_1] = (BYTE)((rawLength >> 8) & 0xff); + fullMessage[OST_LEN_BYTE_1+1] = (BYTE)(rawLength & 0xff); + if (rawLength > 0) + { + memcpy(&fullMessage[OST_MSG_BYTE_1], rawMessage, rawLength); + } + outLength = rawLength + OST_HDR_LEN_1; + + return outLength; + +} diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/OSTProtocol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/OSTProtocol.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// OSTProtocol.h: interface for the COSTProtocol class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_OSTPROTOCOL_H__6A8FE0C0_A365_4649_8665_EFCCA002A707__INCLUDED_) +#define AFX_OSTPROTOCOL_H__6A8FE0C0_A365_4649_8665_EFCCA002A707__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "BaseProtocol.h" +// Version 1 offsets +#define OST_HDR_LEN_1 4 // header length +#define OST_VER_BYTE_1 0 // byte that contains the version +#define OST_PROT_BYTE_1 1 // protocol byte +#define OST_LEN_BYTE_1 2 // first byte of length (bytes 2-3) +#define OST_MSG_BYTE_1 4 // start of message bytes + +// Protocol constants +#define OST_PROT_OST_SYSTEM (0x00) // OST System messages +#define OST_PROT_OST_ACTIVATION (0x01) // OST Activation messages +#define OST_PROT_OST_ASCII (0x02) // OST ASCII messages +#define OST_PROT_OST_SIMPLE (0x03) // OST Simple messages +#define OST_PROT_OST_EXTENSIBLE (0x04) // OST Extensible messages +#define OST_PROT_OST_SYMBIAN (0x05) // OST Symbian messages +#define OST_PROT_TRK (0x90) // OST TRK messages +#define OST_PROT_TC (0x91) // OST TraceCore messages + +class COSTProtocol : public CBaseProtocol +{ +public: + COSTProtocol(); + virtual ~COSTProtocol(); + + BOOL DecodeMessage(BYTE* fullMessage, DWORD& fullLength, BYTE& msgId, BYTE*& rawMessage, DWORD& rawLength); + DWORD EncodeMessage(BYTE* rawMessage, DWORD rawLength, BYTE protocolVersion, BYTE msgId, BYTE* fullMessage, DWORD maxFullLength); + DWORD GetHeaderLength() { return OST_HDR_LEN_1; } +}; + +#endif // !defined(AFX_OSTPROTOCOL_H__6A8FE0C0_A365_4649_8665_EFCCA002A707__INCLUDED_) diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/ReadMe.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/ReadMe.txt Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,37 @@ +======================================================================== + DYNAMIC LINK LIBRARY : TCFProtOST +======================================================================== + + +AppWizard has created this TCFProtOST DLL for you. + +This file contains a summary of what you will find in each of the files that +make up your TCFProtOST application. + +TCFProtOST.dsp + This file (the project file) contains information at the project level and + is used to build a single project or subproject. Other users can share the + project (.dsp) file, but they should export the makefiles locally. + +TCFProtOST.cpp + This is the main DLL source file. + +TCFProtOST.h + This file contains your DLL exports. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named TCFProtOST.pch and a precompiled types file named StdAfx.obj. + + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + + +///////////////////////////////////////////////////////////////////////////// diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/StdAfx.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/StdAfx.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// stdafx.cpp : source file that includes just the standard includes +// TCFProtOST.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/StdAfx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/StdAfx.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__FEC75CA3_A547_455E_AD43_CD2A8594423F__INCLUDED_) +#define AFX_STDAFX_H__FEC75CA3_A547_455E_AD43_CD2A8594423F__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +// Insert your headers here +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#include +#include + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__FEC75CA3_A547_455E_AD43_CD2A8594423F__INCLUDED_) diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/TCFProtOST.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/TCFProtOST.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// TCFProtOST.cpp : Defines the entry point for the DLL application. +// + +#include "stdafx.h" +#include "TCFProtOST.h" +#include "OSTProtocol.h" + +static const char* pProtocol="ost"; +static COSTProtocol* pProtocolClass=NULL; + +BOOL APIENTRY DllMain( HANDLE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + +TCFPROTOST_API const char* RegisterProtocol() +{ + return pProtocol; +} + +TCFPROTOST_API CBaseProtocol* CreateProtocol() +{ + pProtocolClass = new COSTProtocol(); + return pProtocolClass; +} diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/TCFProtOST.dep --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/TCFProtOST.dep Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,21 @@ +# Microsoft Developer Studio Generated Dependency File, included by TCFProtOST.mak + +..\TCFServer\BaseProtocol.cpp : \ + "..\TCFServer\BaseProtocol.h"\ + + +.\OSTProtocol.cpp : \ + "..\TCFServer\BaseProtocol.h"\ + ".\OSTProtocol.h"\ + + +.\StdAfx.cpp : \ + "..\..\..\..\..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ + ".\StdAfx.h"\ + + +.\TCFProtOST.cpp : \ + "..\TCFServer\BaseProtocol.h"\ + ".\OSTProtocol.h"\ + ".\TCFProtOST.h"\ + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/TCFProtOST.dsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/TCFProtOST.dsp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,146 @@ +# Microsoft Developer Studio Project File - Name="TCFProtOST" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=TCFProtOST - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "TCFProtOST.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "TCFProtOST.mak" CFG="TCFProtOST - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "TCFProtOST - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "TCFProtOST - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TCFProtOST - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFPROTOST_EXPORTS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFPROTOST_EXPORTS" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /map /machine:I386 +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +PostBuild_Cmds=copyBinaries Release +# End Special Build Tool + +!ELSEIF "$(CFG)" == "TCFProtOST - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFPROTOST_EXPORTS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\TCFServer" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFPROTOST_EXPORTS" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /map /debug /machine:I386 /pdbtype:sept +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +PostBuild_Cmds=copyBinaries Debug +# End Special Build Tool + +!ENDIF + +# Begin Target + +# Name "TCFProtOST - Win32 Release" +# Name "TCFProtOST - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\TCFServer\BaseProtocol.cpp +# End Source File +# Begin Source File + +SOURCE=.\OSTProtocol.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\TCFProtOST.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\OSTProtocol.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\TCFProtOST.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/TCFProtOST.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/TCFProtOST.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "BaseProtocol.h" +// The following ifdef block is the standard way of creating macros which make exporting +// from a DLL simpler. All files within this DLL are compiled with the TCFPROTOST_EXPORTS +// symbol defined on the command line. this symbol should not be defined on any project +// that uses this DLL. This way any other project whose source files include this file see +// TCFPROTOST_API functions as being imported from a DLL, wheras this DLL sees symbols +// defined with this macro as being exported. +#ifdef TCFPROTOST_EXPORTS +#define TCFPROTOST_API __declspec(dllexport) +#else +#define TCFPROTOST_API __declspec(dllimport) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +TCFPROTOST_API const char* RegisterProtocol(); +TCFPROTOST_API CBaseProtocol* CreateProtocol(); + +#ifdef __cplusplus +} +#endif + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/TCFProtOST.mak --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/TCFProtOST.mak Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,238 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on TCFProtOST.dsp +!IF "$(CFG)" == "" +CFG=TCFProtOST - Win32 Debug +!MESSAGE No configuration specified. Defaulting to TCFProtOST - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "TCFProtOST - Win32 Release" && "$(CFG)" != "TCFProtOST - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "TCFProtOST.mak" CFG="TCFProtOST - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "TCFProtOST - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "TCFProtOST - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TCFProtOST - Win32 Release" + +OUTDIR=.\Release +INTDIR=.\Release +# Begin Custom Macros +OutDir=.\Release +# End Custom Macros + +ALL : "$(OUTDIR)\TCFProtOST.dll" + + +CLEAN : + -@erase "$(INTDIR)\BaseProtocol.obj" + -@erase "$(INTDIR)\OSTProtocol.obj" + -@erase "$(INTDIR)\StdAfx.obj" + -@erase "$(INTDIR)\TCFProtOST.obj" + -@erase "$(INTDIR)\TCFProtOST.pch" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\TCFProtOST.dll" + -@erase "$(OUTDIR)\TCFProtOST.exp" + -@erase "$(OUTDIR)\TCFProtOST.lib" + -@erase "$(OUTDIR)\TCFProtOST.map" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFPROTOST_EXPORTS" /Fp"$(INTDIR)\TCFProtOST.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\TCFProtOST.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /pdb:"$(OUTDIR)\TCFProtOST.pdb" /map:"$(INTDIR)\TCFProtOST.map" /machine:I386 /out:"$(OUTDIR)\TCFProtOST.dll" /implib:"$(OUTDIR)\TCFProtOST.lib" +LINK32_OBJS= \ + "$(INTDIR)\BaseProtocol.obj" \ + "$(INTDIR)\OSTProtocol.obj" \ + "$(INTDIR)\StdAfx.obj" \ + "$(INTDIR)\TCFProtOST.obj" + +"$(OUTDIR)\TCFProtOST.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep + +ALL : $(DS_POSTBUILD_DEP) + +# Begin Custom Macros +OutDir=.\Release +# End Custom Macros + +$(DS_POSTBUILD_DEP) : "$(OUTDIR)\TCFProtOST.dll" + copyBinaries Release + echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)" + +!ELSEIF "$(CFG)" == "TCFProtOST - Win32 Debug" + +OUTDIR=.\Debug +INTDIR=.\Debug +# Begin Custom Macros +OutDir=.\Debug +# End Custom Macros + +ALL : "$(OUTDIR)\TCFProtOST.dll" + + +CLEAN : + -@erase "$(INTDIR)\BaseProtocol.obj" + -@erase "$(INTDIR)\OSTProtocol.obj" + -@erase "$(INTDIR)\StdAfx.obj" + -@erase "$(INTDIR)\TCFProtOST.obj" + -@erase "$(INTDIR)\TCFProtOST.pch" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\TCFProtOST.dll" + -@erase "$(OUTDIR)\TCFProtOST.exp" + -@erase "$(OUTDIR)\TCFProtOST.ilk" + -@erase "$(OUTDIR)\TCFProtOST.lib" + -@erase "$(OUTDIR)\TCFProtOST.map" + -@erase "$(OUTDIR)\TCFProtOST.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\TCFServer" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFPROTOST_EXPORTS" /Fp"$(INTDIR)\TCFProtOST.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\TCFProtOST.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\TCFProtOST.pdb" /map:"$(INTDIR)\TCFProtOST.map" /debug /machine:I386 /out:"$(OUTDIR)\TCFProtOST.dll" /implib:"$(OUTDIR)\TCFProtOST.lib" /pdbtype:sept +LINK32_OBJS= \ + "$(INTDIR)\BaseProtocol.obj" \ + "$(INTDIR)\OSTProtocol.obj" \ + "$(INTDIR)\StdAfx.obj" \ + "$(INTDIR)\TCFProtOST.obj" + +"$(OUTDIR)\TCFProtOST.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +SOURCE="$(InputPath)" +PostBuild_Desc=copy libs +DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep + +ALL : $(DS_POSTBUILD_DEP) + +# Begin Custom Macros +OutDir=.\Debug +# End Custom Macros + +$(DS_POSTBUILD_DEP) : "$(OUTDIR)\TCFProtOST.dll" + copyBinaries Debug + echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)" + +!ENDIF + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("TCFProtOST.dep") +!INCLUDE "TCFProtOST.dep" +!ELSE +!MESSAGE Warning: cannot find "TCFProtOST.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "TCFProtOST - Win32 Release" || "$(CFG)" == "TCFProtOST - Win32 Debug" +SOURCE=..\TCFServer\BaseProtocol.cpp + +"$(INTDIR)\BaseProtocol.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFProtOST.pch" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=.\OSTProtocol.cpp + +"$(INTDIR)\OSTProtocol.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFProtOST.pch" + + +SOURCE=.\StdAfx.cpp + +!IF "$(CFG)" == "TCFProtOST - Win32 Release" + +CPP_SWITCHES=/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFPROTOST_EXPORTS" /Fp"$(INTDIR)\TCFProtOST.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\StdAfx.obj" "$(INTDIR)\TCFProtOST.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "TCFProtOST - Win32 Debug" + +CPP_SWITCHES=/nologo /Zp2 /MTd /W3 /Gm /GX /ZI /Od /I "..\TCFServer" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFPROTOST_EXPORTS" /Fp"$(INTDIR)\TCFProtOST.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\StdAfx.obj" "$(INTDIR)\TCFProtOST.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\TCFProtOST.cpp + +"$(INTDIR)\TCFProtOST.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\TCFProtOST.pch" + + + +!ENDIF + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/TCFProtOST.plg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/TCFProtOST.plg Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,409 @@ + + +
+

Build Log

+

+--------------------Configuration: TCFClient - Win32 Release-------------------- +

+

Command Lines

+Creating command line "rc.exe /l 0x409 /fo"Release/resource.res" /d "NDEBUG" "C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFClient\resource.rc"" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28AE.tmp" with contents +[ +/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Fp"Release/TCFClient.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFClient\ClientManager.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\ErrorMonitorData.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\InputStream.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\mutex.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\ServerClient.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\shareddata.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFClient\TCAPIConnectionJni.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\TCDebugLog.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFClient\TCFClient.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFClient\TCFCppApi.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28AE.tmp" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28AF.tmp" with contents +[ +/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Fp"Release/TCFClient.pch" /Yc"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFClient\StdAfx.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28AF.tmp" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28B0.tmp" with contents +[ +kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib shlwapi.lib /nologo /dll /incremental:no /pdb:"Release/TCFClient.pdb" /map:"Release/TCFClient.map" /machine:I386 /out:"Release/TCFClient.dll" /implib:"Release/TCFClient.lib" +.\Release\ClientManager.obj +.\Release\ErrorMonitorData.obj +.\Release\InputStream.obj +.\Release\mutex.obj +.\Release\ServerClient.obj +.\Release\shareddata.obj +.\Release\StdAfx.obj +.\Release\TCAPIConnectionJni.obj +.\Release\TCDebugLog.obj +.\Release\TCFClient.obj +.\Release\TCFCppApi.obj +.\Release\resource.res +] +Creating command line "link.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28B0.tmp" +

Output Window

+Compiling resources... +Compiling... +StdAfx.cpp +Compiling... +ClientManager.cpp +ErrorMonitorData.cpp +InputStream.cpp +mutex.cpp +ServerClient.cpp +shareddata.cpp +TCAPIConnectionJni.cpp +TCDebugLog.cpp +TCFClient.cpp +TCFCppApi.cpp +Generating Code... +Linking... + Creating library Release/TCFClient.lib and object Release/TCFClient.exp +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28B4.bat" with contents +[ +@echo off +copybinaries Release +] +Creating command line "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28B4.bat" +copy libs +Copy binaries to ..\..\..\os\win32\x86 + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + + + +

Results

+TCFClient.dll - 0 error(s), 0 warning(s) +

+--------------------Configuration: TCFCommSerial - Win32 Release-------------------- +

+

Command Lines

+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28B5.tmp" with contents +[ +/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMSERIAL_EXPORTS" /Fp"Release/TCFCommSerial.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFServer\BaseCom.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\mutex.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFCommSerial\RealSerialComm.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\TCDebugLog.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFCommSerial\TCFCommSerial.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28B5.tmp" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28B6.tmp" with contents +[ +/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMSERIAL_EXPORTS" /Fp"Release/TCFCommSerial.pch" /Yc"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFCommSerial\StdAfx.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28B6.tmp" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28B7.tmp" with contents +[ +kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /pdb:"Release/TCFCommSerial.pdb" /map:"Release/TCFCommSerial.map" /machine:I386 /out:"Release/TCFCommSerial.dll" /implib:"Release/TCFCommSerial.lib" +.\Release\BaseCom.obj +.\Release\mutex.obj +.\Release\RealSerialComm.obj +.\Release\StdAfx.obj +.\Release\TCDebugLog.obj +.\Release\TCFCommSerial.obj +] +Creating command line "link.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28B7.tmp" +

Output Window

+Compiling... +StdAfx.cpp +Compiling... +BaseCom.cpp +mutex.cpp +RealSerialComm.cpp +TCDebugLog.cpp +TCFCommSerial.cpp +Generating Code... +Linking... + Creating library Release/TCFCommSerial.lib and object Release/TCFCommSerial.exp +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28BB.bat" with contents +[ +@echo off +copyBinaries Release +] +Creating command line "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28BB.bat" +copy libs +Copy binaries to ..\..\..\os\win32\x86 + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + + + +

Results

+TCFCommSerial.dll - 0 error(s), 0 warning(s) +

+--------------------Configuration: TCFCommTCP - Win32 Release-------------------- +

+

Command Lines

+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28BC.tmp" with contents +[ +/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMTCP_EXPORTS" /Fp"Release/TCFCommTCP.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFServer\BaseCom.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\mutex.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\TCDebugLog.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFCommTCP\TCFCommTCP.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFCommTCP\TcpComm.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28BC.tmp" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28BD.tmp" with contents +[ +/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMTCP_EXPORTS" /Fp"Release/TCFCommTCP.pch" /Yc"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFCommTCP\StdAfx.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28BD.tmp" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28BE.tmp" with contents +[ +kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib shlwapi.lib /nologo /dll /incremental:no /pdb:"Release/TCFCommTCP.pdb" /map:"Release/TCFCommTCP.map" /machine:I386 /out:"Release/TCFCommTCP.dll" /implib:"Release/TCFCommTCP.lib" +.\Release\BaseCom.obj +.\Release\mutex.obj +.\Release\StdAfx.obj +.\Release\TCDebugLog.obj +.\Release\TCFCommTCP.obj +.\Release\TcpComm.obj +] +Creating command line "link.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28BE.tmp" +

Output Window

+Compiling... +StdAfx.cpp +Compiling... +BaseCom.cpp +mutex.cpp +TCDebugLog.cpp +TCFCommTCP.cpp +TcpComm.cpp +Generating Code... +Linking... + Creating library Release/TCFCommTCP.lib and object Release/TCFCommTCP.exp +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28C2.bat" with contents +[ +@echo off +copybinaries Release +] +Creating command line "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28C2.bat" +copy libs +Copy binaries to ..\..\..\os\win32\x86 + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + + + +

Results

+TCFCommTCP.dll - 0 error(s), 0 warning(s) +

+--------------------Configuration: TCFCommVirtualSerial - Win32 Release-------------------- +

+

Command Lines

+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28C3.tmp" with contents +[ +/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFCommSerial" /I "..\Common\Headers" /I "..\TCFServer" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMVIRTUALSERIAL_EXPORTS" /Fp"Release/TCFCommVirtualSerial.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFServer\BaseCom.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\mutex.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFCommSerial\RealSerialComm.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\TCDebugLog.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFCommVirtualSerial\TCFCommVirtualSerial.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFCommVirtualSerial\VirtualSerialComm.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28C3.tmp" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28C4.tmp" with contents +[ +/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFCommSerial" /I "..\Common\Headers" /I "..\TCFServer" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMVIRTUALSERIAL_EXPORTS" /Fp"Release/TCFCommVirtualSerial.pch" /Yc"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFCommVirtualSerial\StdAfx.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28C4.tmp" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28C5.tmp" with contents +[ +kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /pdb:"Release/TCFCommVirtualSerial.pdb" /map:"Release/TCFCommVirtualSerial.map" /machine:I386 /out:"Release/TCFCommVirtualSerial.dll" /implib:"Release/TCFCommVirtualSerial.lib" +.\Release\BaseCom.obj +.\Release\mutex.obj +.\Release\RealSerialComm.obj +.\Release\StdAfx.obj +.\Release\TCDebugLog.obj +.\Release\TCFCommVirtualSerial.obj +.\Release\VirtualSerialComm.obj +] +Creating command line "link.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28C5.tmp" +

Output Window

+Compiling... +StdAfx.cpp +Compiling... +BaseCom.cpp +mutex.cpp +RealSerialComm.cpp +TCDebugLog.cpp +TCFCommVirtualSerial.cpp +VirtualSerialComm.cpp +Generating Code... +Linking... + Creating library Release/TCFCommVirtualSerial.lib and object Release/TCFCommVirtualSerial.exp +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28C9.bat" with contents +[ +@echo off +copyBinaries Release +] +Creating command line "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28C9.bat" +copy libs +Copy binaries to ..\..\..\os\win32\x86 + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + + + +

Results

+TCFCommVirtualSerial.dll - 0 error(s), 0 warning(s) +

+--------------------Configuration: TCFProtOST - Win32 Release-------------------- +

+

Command Lines

+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28CA.tmp" with contents +[ +/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFPROTOST_EXPORTS" /Fp"Release/TCFProtOST.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFServer\BaseProtocol.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFProtOST\OSTProtocol.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFProtOST\TCFProtOST.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28CA.tmp" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28CB.tmp" with contents +[ +/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFPROTOST_EXPORTS" /Fp"Release/TCFProtOST.pch" /Yc"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFProtOST\StdAfx.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28CB.tmp" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28CC.tmp" with contents +[ +kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /pdb:"Release/TCFProtOST.pdb" /map:"Release/TCFProtOST.map" /machine:I386 /out:"Release/TCFProtOST.dll" /implib:"Release/TCFProtOST.lib" +.\Release\BaseProtocol.obj +.\Release\OSTProtocol.obj +.\Release\StdAfx.obj +.\Release\TCFProtOST.obj +] +Creating command line "link.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28CC.tmp" +

Output Window

+Compiling... +StdAfx.cpp +Compiling... +BaseProtocol.cpp +OSTProtocol.cpp +TCFProtOST.cpp +Generating Code... +Linking... + Creating library Release/TCFProtOST.lib and object Release/TCFProtOST.exp +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28D0.bat" with contents +[ +@echo off +copyBinaries Release +] +Creating command line "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28D0.bat" +copy libs +Copy binaries to ..\..\..\os\win32\x86 + 1 file(s) copied. + 1 file(s) copied. + 1 file(s) copied. + + + +

Results

+TCFProtOST.dll - 0 error(s), 0 warning(s) +

+--------------------Configuration: TCFServer - Win32 Release-------------------- +

+

Command Lines

+Creating command line "rc.exe /l 0x409 /fo"Release/resource.res" /d "NDEBUG" "C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFServer\resource.rc"" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28D1.tmp" with contents +[ +/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I "..\Common\Source" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"Release/TCFServer.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFServer\Client.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFServer\CommRegistryItem.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFServer\Connection.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFServer\ConnectionImpl.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\ErrorMonitorData.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\InputStream.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFServer\MessageFile.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\mutex.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFServer\ProtocolRegistryItem.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFServer\Registry.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFServer\RegistryImpl.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\ServerClient.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFServer\ServerManager.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\shareddata.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\Common\Source\TCDebugLog.cpp" +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFServer\TCFServer.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28D1.tmp" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28D2.tmp" with contents +[ +/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I "..\Common\Source" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"Release/TCFServer.pch" /Yc"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\Symbian\Carbide\devspace_203_0316\com.nokia.tcf\native\TCFNative\TCFServer\StdAfx.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28D2.tmp" +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28D3.tmp" with contents +[ +kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib shlwapi.lib /nologo /subsystem:console /incremental:no /pdb:"Release/TCFServer.pdb" /machine:I386 /out:"Release/TCFServer.exe" +.\Release\Client.obj +.\Release\CommRegistryItem.obj +.\Release\Connection.obj +.\Release\ConnectionImpl.obj +.\Release\ErrorMonitorData.obj +.\Release\InputStream.obj +.\Release\MessageFile.obj +.\Release\mutex.obj +.\Release\ProtocolRegistryItem.obj +.\Release\Registry.obj +.\Release\RegistryImpl.obj +.\Release\ServerClient.obj +.\Release\ServerManager.obj +.\Release\shareddata.obj +.\Release\StdAfx.obj +.\Release\TCDebugLog.obj +.\Release\TCFServer.obj +.\Release\resource.res +] +Creating command line "link.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28D3.tmp" +

Output Window

+Compiling resources... +Compiling... +StdAfx.cpp +Compiling... +Client.cpp +CommRegistryItem.cpp +Connection.cpp +ConnectionImpl.cpp +ErrorMonitorData.cpp +InputStream.cpp +MessageFile.cpp +mutex.cpp +ProtocolRegistryItem.cpp +Registry.cpp +RegistryImpl.cpp +ServerClient.cpp +ServerManager.cpp +shareddata.cpp +TCDebugLog.cpp +TCFServer.cpp +Generating Code... +Linking... +Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28D5.bat" with contents +[ +@echo off +copybinaries Release +] +Creating command line "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP28D5.bat" +copy binary +Copy binaries to ..\..\..\os\win32\x86 + 1 file(s) copied. + + + +

Results

+TCFServer.exe - 0 error(s), 0 warning(s) +
+ + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/copyBinaries.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFProtOST/copyBinaries.cmd Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,5 @@ +echo off +echo Copy binaries to ..\..\..\os\win32\x86 +copy /V %1\TCFProtOST.dll ..\..\..\os\win32\x86 +copy /V %1\TCFProtOST.lib ..\..\..\os\win32\x86 +copy /V %1\TCFProtOST.map ..\..\..\os\win32\x86 diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFServer/BaseCom.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/BaseCom.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "stdafx.h" +#include "BaseCom.h" + +CBaseCom::CBaseCom() +{ +#ifdef _DEBUG + if (gDoLogging) + { + FILE* f = fopen("c:\\tcf\\basecommlog.txt", "at"); + fprintf(f, "CBaseCom::CBaseCom() (default constructor)\n"); + fclose(f); + } +#endif + m_isConnected = false; + m_pBuffer = NULL; + m_numberBytes = 0; + m_ConnectSettings = NULL; + m_lastCommError = 0; + m_CommDebugLog = NULL; + m_ProcDebugLog = NULL; + m_connId = -1; + m_Protocol = NULL; +} + +CBaseCom::CBaseCom(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol) +{ +#ifdef _DEBUG + if (gDoLogging) + { + FILE* f = fopen("c:\\tcf\\basecommlog.txt", "at"); + fprintf(f, "connectSettings=%x connectionId=%d, protocol=%x\n", connectSettings, connectionId, protocol); + fclose(f); + } +#endif + m_isConnected = false; + m_pBuffer = NULL; + m_numberBytes = 0; + m_ConnectSettings = NULL; + m_lastCommError = 0; + m_CommDebugLog = NULL; + m_ProcDebugLog = NULL; + + m_connId = connectionId; + m_Protocol = protocol; + + m_ConnectSettings = new ConnectData(); + memcpy(m_ConnectSettings, connectSettings, sizeof(ConnectData)); + +#if (defined(LOG_COMM) || defined(LOG_PROCCOMM)) && defined(_DEBUG) + if (gDoLogging) + { + m_CommDebugLog = new TCDebugLog("TCF_Comm", connectionId, 2000L); + m_ProcDebugLog = new TCDebugLog("TCF_CommP", connectionId, 2000L); + } +#endif +} + +CBaseCom::~CBaseCom() +{ +#ifdef _DEBUG + if (gDoLogging) + { + FILE* f = fopen("c:\\tcf\\basecommlog.txt", "at"); + fprintf(f, "CBaseCom::~CBaseCom()\n"); + fclose(f); + } +#endif + if (m_pBuffer) + delete[] m_pBuffer; + + if (m_ConnectSettings) + delete m_ConnectSettings; + + if (m_CommDebugLog) + delete m_CommDebugLog; + + if (m_ProcDebugLog) + delete m_ProcDebugLog; +} diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFServer/BaseCom.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/BaseCom.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __BASECOM_H__ +#define __BASECOM_H__ +#include "Registry.h" +#include "ServerClient.h" +#include "TCConstants.h" +#include "TCErrorConstants.h" +#include "BaseProtocol.h" +#include "TCDebugLog.h" +#include + +#ifdef _DEBUG +extern BOOL gDoLogging; +#endif + +#define LOG_COMM +#if defined(LOG_COMM) && defined(_DEBUG) + +#define COMMLOGOPEN() if (gDoLogging) { if (m_CommDebugLog) m_CommDebugLog->WaitForAccess(); } +#define COMMLOGS(s) if (gDoLogging) { sprintf(m_CommDebugLogMsg,"%s", s); if (m_CommDebugLog) m_CommDebugLog->log(m_CommDebugLogMsg); } +#define COMMLOGA1(s, a1) if (gDoLogging) { sprintf(m_CommDebugLogMsg, s, a1); if (m_CommDebugLog) m_CommDebugLog->log(m_CommDebugLogMsg); } +#define COMMLOGA2(s, a1, a2) if (gDoLogging) { sprintf(m_CommDebugLogMsg, s, a1, a2); if (m_CommDebugLog) m_CommDebugLog->log(m_CommDebugLogMsg); } +#define COMMLOGA3(s, a1, a2, a3) if (gDoLogging) { sprintf(m_CommDebugLogMsg, s, a1, a2, a3); if (m_CommDebugLog) m_CommDebugLog->log(m_CommDebugLogMsg); } +#define COMMLOGA4(s, a1, a2, a3, a4) if (gDoLogging) { sprintf(m_CommDebugLogMsg, s, a1, a2, a3, a4); if (m_CommDebugLog) m_CommDebugLog->log(m_CommDebugLogMsg); } +#define COMMLOGCLOSE() if (gDoLogging) { if (m_CommDebugLog) m_CommDebugLog->ReleaseAccess(); } +#else +#define COMMLOGOPEN() +#define COMMLOGS(s) +#define COMMLOGA1(s, a1) +#define COMMLOGA2(s, a1, a2) +#define COMMLOGA3(s, a1, a2, a3) +#define COMMLOGA4(s, a1, a2, a3, a4) +#define COMMLOGCLOSE() +#endif + +#define LOG_PROCCOMM +#if defined(LOG_PROCCOMM) && defined(_DEBUG) +#define PROCLOGOPEN() if (gDoLogging) { m_ProcDebugLog->WaitForAccess(); } +#define PROCLOGS(s) if (gDoLogging) { sprintf(m_ProcDebugLogMsg,"%s", s); m_ProcDebugLog->log(m_ProcDebugLogMsg); } +#define PROCLOGA1(s, a1) if (gDoLogging) { sprintf(m_ProcDebugLogMsg, s, a1); m_ProcDebugLog->log(m_ProcDebugLogMsg); } +#define PROCLOGA2(s, a1, a2) if (gDoLogging) { sprintf(m_ProcDebugLogMsg, s, a1, a2); m_ProcDebugLog->log(m_ProcDebugLogMsg); } +#define PROCLOGA3(s, a1, a2, a3) if (gDoLogging) { sprintf(m_ProcDebugLogMsg, s, a1, a2, a3); m_ProcDebugLog->log(m_ProcDebugLogMsg); } +#define PROCLOGA4(s, a1, a2, a3, a4) if (gDoLogging) { sprintf(m_ProcDebugLogMsg, s, a1, a2, a3, a4); m_ProcDebugLog->log(m_ProcDebugLogMsg); } +#define PROCLOGA5(s, a1, a2, a3, a4, a5) if (gDoLogging) { sprintf(m_ProcDebugLogMsg, s, a1, a2, a3, a4, a5); m_ProcDebugLog->log(m_ProcDebugLogMsg); } +#define PROCLOGCLOSE() if (gDoLogging) { m_ProcDebugLog->ReleaseAccess(); } +#else +#define PROCLOGOPEN() +#define PROCLOGS(s) +#define PROCLOGA1(s, a1) +#define PROCLOGA2(s, a1, a2) +#define PROCLOGA3(s, a1, a2, a3) +#define PROCLOGA4(s, a1, a2, a3, a4) +#define PROCLOGA5(s, a1, a2, a3, a4, a5) +#define PROCLOGCLOSE() +#endif + +class CConnection; +class CBaseProtocol; + +class CBaseCom +{ +public: + CBaseCom(); + CBaseCom(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol); + virtual ~CBaseCom(); + +// void SetConnectSettings(ConnectData* connectSettings); +// void SetProtocol(CBaseProtocol* protocol) { m_Protocol = protocol; } +// void SetConnectionId(DWORD id); + + virtual long OpenPort()=0; + virtual long ClosePort()=0; + virtual long SendDataToPort(DWORD inSize, const void* inData)=0; + virtual long PollPort(DWORD& outSize)=0; + virtual long ReadPort(DWORD inSize, void* outData, DWORD& outSize)=0; + virtual long ProcessBuffer(CConnection* pConn, CRegistry* pRegistry, long& numberProcessed)=0; + virtual void DeleteMsg(DWORD inMsgLength)=0; + virtual bool IsConnected() { return m_isConnected; } + virtual bool GetVersion(char* outVersion)=0; // get version of whatever we're connected to + virtual bool HasVersion()=0; // does this connection have a version? + virtual long PreProcessMessage(int inMsgType, DWORD inMsgLength, BYTE* inMessage)=0; + virtual long PreProcessMessage(BYTE msgId, DWORD inMsgLength, BYTE* inMessage)=0; + virtual bool IsConnectionEqual(ConnectData* pConn)=0; + + BYTE* m_pBuffer; + DWORD m_numberBytes; + bool m_isConnected; + DWORD m_connId; + + ConnectData* m_ConnectSettings; // from connection + CBaseProtocol* m_Protocol; // used for this connection + + // for Open/Close/Send thread + char m_CommDebugLogMsg[2000]; + TCDebugLog* m_CommDebugLog; + + // for Poll/Read/Process/PreProcess thread + char m_ProcDebugLogMsg[2000]; + TCDebugLog* m_ProcDebugLog; + + DWORD m_lastCommError; +}; + +typedef const char* (*COMMREGISTER)(void); +typedef CBaseCom* (*COMMCREATE)(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol); + +#define COMMREGISTER_FNNAME "RegisterComm" +#define COMMCREATE_FNNAME "CreateComm" + +#define COMMDLL_BASENAME "TCFComm" + +#endif __BASECOM_H__ diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFServer/BaseProtocol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/BaseProtocol.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// BaseProtocol.cpp: implementation of the CBaseProtocol class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "BaseProtocol.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CBaseProtocol::CBaseProtocol() +{ + +} + +CBaseProtocol::~CBaseProtocol() +{ + +} + +DWORD CBaseProtocol::GetHeaderLength() +{ + return 0; +} + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFServer/BaseProtocol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/BaseProtocol.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// BaseProtocol.h: interface for the CBaseProtocol class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_BASEPROTOCOL_H__EABB80B6_353C_45AE_8976_AE0C0D93AC84__INCLUDED_) +#define AFX_BASEPROTOCOL_H__EABB80B6_353C_45AE_8976_AE0C0D93AC84__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class CBaseProtocol +{ +public: + CBaseProtocol(); + virtual ~CBaseProtocol(); + + // used to decode a message into header/message parts + virtual BOOL DecodeMessage(BYTE* fullMessage, DWORD& fullLength, BYTE& msgId, BYTE*& rawMessage, DWORD& rawLength)=0; + + // used to encode a raw message (prefixes any protocol headers) + virtual DWORD EncodeMessage(BYTE* rawMessage, DWORD rawLength, BYTE protocolVersion, BYTE msgId, BYTE* fullMessage, DWORD maxFullLength)=0; + + // used to query how many bytes the header is so the caller can allocate enough memory + virtual DWORD GetHeaderLength()=0; + +}; + +typedef const char* (*PROTOCOLREGISTER)(void); +typedef CBaseProtocol* (*PROTOCOLCREATE)(void); + +#define PROTOCOLREGISTER_FNNAME "RegisterProtocol" +#define PROTOCOLCREATE_FNNAME "CreateProtocol" + +#define PROTOCOLDLL_BASENAME "TCFProt" + +#endif // !defined(AFX_BASEPROTOCOL_H__EABB80B6_353C_45AE_8976_AE0C0D93AC84__INCLUDED_) diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFServer/Client.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/Client.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// Client.cpp: implementation of the CClient class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Client.h" +#include "ServerManager.h" + +extern CServerManager* gManager; +#ifdef _DEBUG +extern BOOL gDoLogging; +#endif + +//#define LOG_CLIENT +#if defined(LOG_CLIENT) && defined(_DEBUG) +extern char TCDebugMsg[]; +#define TCDEBUGOPEN() if (gDoLogging) { gManager->m_DebugLog->WaitForAccess(); } +#define TCDEBUGLOGS(s) if (gDoLogging) { sprintf(TCDebugMsg,"%s", s); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGLOGA1(s, a1) if (gDoLogging) { sprintf(TCDebugMsg, s, a1); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGLOGA2(s, a1, a2) if (gDoLogging) { sprintf(TCDebugMsg, s, a1, a2); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGLOGA3(s, a1, a2, a3) if (gDoLogging) { sprintf(TCDebugMsg, s, a1, a2, a3); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGCLOSE() if (gDoLogging) { gManager->m_DebugLog->ReleaseAccess(); } +#else +#define TCDEBUGOPEN() +#define TCDEBUGLOGS(s) +#define TCDEBUGLOGA1(s, a1) +#define TCDEBUGLOGA2(s, a1, a2) +#define TCDEBUGLOGA3(s, a1, a2, a3) +#define TCDEBUGCLOSE() +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CClient::CClient() +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CClient::CClient\n"); + + m_InputStream = NULL; + m_MessageFile = NULL; + m_ErrorMonitor = NULL; + m_Connection = NULL; + m_Status = eStopped; + m_ClientId = -1; + m_Options.ostVersion = 1; + m_Options.unWrapFormat = DEFAULT_UNWRAP_OPTION; + m_MessageDestination = eDestinationInputStream; // default - changed later + + TCDEBUGCLOSE(); +} + +CClient::CClient(CConnection* connection, ClientOptions& options, DWORD clientId) +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CClient::CClient\n"); + + m_Connection = connection; + m_Options.ostVersion = options.ostVersion; + m_Options.unWrapFormat = options.unWrapFormat; + m_ClientId = clientId; + m_Status = eStopped; + + m_ErrorMonitor = new CErrorMonitor(m_ClientId); + m_ErrorMonitor->CreateData(); + m_InputStream = NULL; // created on open instead + m_MessageFile = NULL; + m_MessageDestination = eDestinationInputStream; // default - changed later + + + TCDEBUGCLOSE(); +} +CClient::~CClient() +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CClient::~CClient\n"); + + if (m_ErrorMonitor) + delete m_ErrorMonitor; + + if (m_InputStream) + delete m_InputStream; + + if (m_MessageFile) + delete m_MessageFile; + + TCDEBUGCLOSE(); +} +BOOL CClient::OpenStream(DestinationOptions* streamOptions) +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CClient::OpenStream\n"); + + BOOL done = TRUE; + + if (m_InputStream == NULL) + { + m_InputStream = new CInputStream(streamOptions->destinationFile, streamOptions->streamSize, streamOptions->overFlowToFile, m_ClientId); + m_InputStream->CreateStream(); + } + + TCDEBUGCLOSE(); + return done; +} + +BOOL CClient::CloseStream() +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CClient::CloseStream\n"); + + BOOL done = TRUE; + + if (m_InputStream) + { + delete m_InputStream; + m_InputStream = NULL; + } + + TCDEBUGCLOSE(); + return done; +} +BOOL CClient::OpenMessageFile(DestinationOptions *messageFileOptions) +{ + BOOL done = TRUE; + if (m_MessageFile == NULL) + { + m_MessageFile = new CMessageFile(messageFileOptions->destinationFile, m_ClientId); + m_MessageFile->Open(); + } + + return done; +} +BOOL CClient::CloseMessageFile() +{ + BOOL done = TRUE; + + if (m_MessageFile) + { + delete m_MessageFile; + m_MessageFile = NULL; + } + + return done; +} +BOOL CClient::ClearMessageFile() +{ + BOOL done = TRUE; + + if (m_MessageFile) + { + m_MessageFile->ClearFile(); + } + + return done; +} + diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFServer/Client.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/Client.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// Client.h: interface for the CClient class. +// +// one of these per client +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_CLIENT_H__6BC8ADEC_683A_4924_ABD0_28B449E927C6__INCLUDED_) +#define AFX_CLIENT_H__6BC8ADEC_683A_4924_ABD0_28B449E927C6__INCLUDED_ + +#include "ServerClient.h" +#include "InputStream.h" +#include "MessageFile.h" +#include "ErrorMonitorData.h" +#include "TCConstants.h" + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class CConnection; + +class CClient +{ +public: + CClient(); + CClient(CConnection* connection, ClientOptions& options, DWORD clientId); + virtual ~CClient(); + + void Start() { m_Status = eStarted; } + void Stop() { m_Status = eStopped; } + + BOOL IsStarted() { return (m_Status == eStarted); } + DWORD GetClientId() { return m_ClientId; } + CConnection* GetConnection() { return m_Connection; } + BOOL OpenStream(DestinationOptions* streamOptions); + BOOL CloseStream(); + BOOL IsStreamOpen() { return (m_InputStream != NULL); } + CInputStream* GetInputStream() { return m_InputStream; } + + BOOL OpenMessageFile(DestinationOptions* messageFileOptions); + BOOL CloseMessageFile(); + BOOL ClearMessageFile(); + BOOL IsMessageFileOpen() { return (m_MessageFile != NULL); } + CMessageFile* GetMessageFile() { return m_MessageFile; } + + eMessageDestination m_MessageDestination; + CMessageFile* m_MessageFile; + CInputStream* m_InputStream; + CErrorMonitor* m_ErrorMonitor; + CConnection* m_Connection; + ClientOptions m_Options; + eClientStatus m_Status; + DWORD m_ClientId; +}; + +#endif // !defined(AFX_CLIENT_H__6BC8ADEC_683A_4924_ABD0_28B449E927C6__INCLUDED_) diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFServer/CommRegistryItem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/CommRegistryItem.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// CommRegistryItem.cpp: implementation of the CCommRegistryItem class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "CommRegistryItem.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CCommRegistryItem::CCommRegistryItem() +{ + +} + +CCommRegistryItem::~CCommRegistryItem() +{ + +} diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFServer/CommRegistryItem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/CommRegistryItem.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// CommRegistryItem.h: interface for the CCommRegistryItem class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_COMMREGISTRYITEM_H__3100D179_F754_4A4C_910D_7EB827E8DEA0__INCLUDED_) +#define AFX_COMMREGISTRYITEM_H__3100D179_F754_4A4C_910D_7EB827E8DEA0__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ServerClient.h" +#include "BaseCom.h" + +#define MAX_DLLPATHNAME (2048) + +class CCommRegistryItem +{ +public: + CCommRegistryItem(); + virtual ~CCommRegistryItem(); + + char m_CommType[MAX_CONNECTION_TYPE]; + char m_CommLibrary[MAX_DLLPATHNAME]; +}; + +#endif // !defined(AFX_COMMREGISTRYITEM_H__3100D179_F754_4A4C_910D_7EB827E8DEA0__INCLUDED_) diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFServer/Connection.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/Connection.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// Connection.cpp: implementation of the CConnection class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Connection.h" +#include "ServerManager.h" + +#ifdef _DEBUG +extern BOOL gDoLogging; +#define TCDEBUGOPEN() if (gDoLogging) { this->m_DebugLog->WaitForAccess(); } +#define TCDEBUGLOGS(s) if (gDoLogging) { sprintf(this->m_DebugLogMsg,"%s", s); this->m_DebugLog->log(this->m_DebugLogMsg); } +#define TCDEBUGLOGA1(s, a1) if (gDoLogging) { sprintf(this->m_DebugLogMsg, s, a1); this->m_DebugLog->log(this->m_DebugLogMsg); } +#define TCDEBUGLOGA2(s, a1, a2) if (gDoLogging) { sprintf(this->m_DebugLogMsg, s, a1, a2); this->m_DebugLog->log(this->m_DebugLogMsg); } +#define TCDEBUGLOGA3(s, a1, a2, a3) if (gDoLogging) { sprintf(this->m_DebugLogMsg, s, a1, a2, a3); this->m_DebugLog->log(this->m_DebugLogMsg); } +#define TCDEBUGCLOSE() if (gDoLogging) { this->m_DebugLog->ReleaseAccess(); } +#else +#define TCDEBUGOPEN() +#define TCDEBUGLOGS(s) +#define TCDEBUGLOGA1(s, a1) +#define TCDEBUGLOGA2(s, a1, a2) +#define TCDEBUGLOGA3(s, a1, a2, a3) +#define TCDEBUGCLOSE() +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// +CConnection::CConnection() +{ +} + +CConnection::CConnection(ConnectData conData, DWORD connectionId) +{ +} + +CConnection::~CConnection() +{ +} diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFServer/Connection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/Connection.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// Connection.h: interface for the CConnection class. +// Implemented by CConnectionImpl +// +// one of these per connection +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_CONNECTION_H__C7E97807_97B0_4BF7_AEC7_FA246A751509__INCLUDED_) +#define AFX_CONNECTION_H__C7E97807_97B0_4BF7_AEC7_FA246A751509__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ServerClient.h" +#include "TCErrorConstants.h" +#include "Client.h" +#include "Registry.h" +#include "BaseCom.h" +#include +#include + +// basename is suffixed with connection ID to make it unique per CConnection +#define MESSAGEPROCESSOR_EXITEVENT_BASENAME "TCFServerMessageProcessorExittedEvent" +#define MESSAGEPROCESSOR_STOPEVENT_BASENAME "TCFServerMessageProcessorStoppedEvent" +#define MESSAGEPROCESSOR_STARTEVENT_BASENAME "TCFServerMessageProcessorStartedEvent" +#define MESSAGEPROCESSOR_EVENTWAIT_TIMEOUT 60000L + +typedef std::vector ClientList; + +// m_MessageProcessorState states +#define MP_NONE (0) +#define MP_EXIT (1) +#define MP_START (2) +#define MP_PAUSE (3) +#define MP_PROCESSING (4) + + +#define FLUSH_TIME (100) // 100 ms +class CConnection +{ +public: + CConnection(); + CConnection(ConnectData conData, DWORD connectionId); + virtual ~CConnection(); + + virtual BOOL IsEqual(CConnection* connection)=0; + virtual BOOL IsEqual(pConnectData pConData)=0; + virtual long GetConnectionId() { return m_ConnectionID; } + virtual BOOL ExitProcessing()=0; // exit processing thread + virtual long DoDisconnect()=0; + virtual void NotifyClientsCommError(long tcfError, bool passOsError=false, DWORD osError=0)=0; + long m_ConnectionID; // id for this connection + + ConnectData* m_ConnectSettings; // connection settings +}; + +#endif // !defined(AFX_CONNECTION_H__C7E97807_97B0_4BF7_AEC7_FA246A751509__INCLUDED_) diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFServer/ConnectionImpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/ConnectionImpl.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,907 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// ConnectionImpl.cpp: implementation of the CConnectionImpl class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ConnectionImpl.h" +#include "RegistryImpl.h" +#include "ServerManager.h" + +#ifdef _DEBUG +extern BOOL gDoLogging; +#endif + +#define LOG_CONNECTION +#if defined(LOG_CONNECTION) && defined(_DEBUG) +#define TCDEBUGOPEN() if (gDoLogging) { this->m_DebugLog->WaitForAccess(); } +#define TCDEBUGLOGS(s) if (gDoLogging) { sprintf(this->m_DebugLogMsg,"%s", s); this->m_DebugLog->log(this->m_DebugLogMsg); } +#define TCDEBUGLOGA1(s, a1) if (gDoLogging) { sprintf(this->m_DebugLogMsg, s, a1); this->m_DebugLog->log(this->m_DebugLogMsg); } +#define TCDEBUGLOGA2(s, a1, a2) if (gDoLogging) { sprintf(this->m_DebugLogMsg, s, a1, a2); this->m_DebugLog->log(this->m_DebugLogMsg); } +#define TCDEBUGLOGA3(s, a1, a2, a3) if (gDoLogging) { sprintf(this->m_DebugLogMsg, s, a1, a2, a3); this->m_DebugLog->log(this->m_DebugLogMsg); } +#define TCDEBUGLOGA4(s, a1, a2, a3, a4) if (gDoLogging) { sprintf(this->m_DebugLogMsg, s, a1, a2, a3, a4); this->m_DebugLog->log(this->m_DebugLogMsg); } +#define TCDEBUGCLOSE() if (gDoLogging) { this->m_DebugLog->ReleaseAccess(); } +#else +#define TCDEBUGOPEN() +#define TCDEBUGLOGS(s) +#define TCDEBUGLOGA1(s, a1) +#define TCDEBUGLOGA2(s, a1, a2) +#define TCDEBUGLOGA3(s, a1, a2, a3) +#define TCDEBUGLOGA4(s, a1, a2, a3, a4) +#define TCDEBUGCLOSE() +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CConnectionImpl::CConnectionImpl() +{ + m_ConnectSettings = NULL; + m_ClientList = NULL; + m_Status = eDisconnected; + m_Registry = NULL; + m_ConnectionID = 0; + m_OsError = 0; + m_BaseComm = NULL; + m_BaseProtocol = NULL; + m_BaseCommHandle = NULL; + m_BaseProtocolHandle = NULL; + + // message processing thread flags and handles + m_MessageProcessorState = MP_NONE; + m_ExitMessageProcessor = false; + m_PauseMessageProcessing = false; + m_StartMessageProcessing = false; + m_hMessageProcessorExittedEvent = NULL; + m_hMessageProcessorStoppedEvent = NULL; + m_hMessageProcessorStartedEvent = NULL; + m_hMessageProcessorThread = NULL; + m_dwMessageProcessorThreadId = 0; + + m_NextRetryTime = m_RetryTimeoutTime = 0; + + m_NextFlushFileTime = 0; +} + +CConnectionImpl::CConnectionImpl(ConnectData conData, DWORD connectionId) +{ +#ifdef _DEBUG + if (gDoLogging) + { + m_DebugLog = new TCDebugLog("TCF_ConnectionLog", connectionId); + m_DebugLog2 = new TCDebugLog("TCF_ProcessorLog", connectionId); + } + else + { + m_DebugLog = NULL; + m_DebugLog2 = NULL; + } +#else + m_DebugLog = NULL; + m_DebugLog2 = NULL; +#endif + + TCDEBUGOPEN(); + TCDEBUGLOGA1("CConnectionImpl::CConnectionImpl id = %d\n", connectionId); + + m_ConnectSettings = new ConnectData(); + + memcpy(m_ConnectSettings, &conData, sizeof(ConnectData)); + + m_ClientList = new ClientList(); + m_ClientList->clear(); + m_Status = eDisconnected; + m_Registry = new CRegistryImpl(connectionId); + m_ConnectionID = connectionId; + m_BaseComm = NULL; + m_BaseProtocol = NULL; + m_BaseCommHandle = NULL; + m_BaseProtocolHandle = NULL; + + // message processing thread flags and handles + m_MessageProcessorState = MP_NONE; + m_ExitMessageProcessor = false; + m_PauseMessageProcessing = false; + m_StartMessageProcessing = false; + + // create named events + char eventName[100]; + + sprintf(eventName, "%s%d", MESSAGEPROCESSOR_EXITEVENT_BASENAME, connectionId); + m_hMessageProcessorExittedEvent = ::CreateEvent(NULL, FALSE, FALSE, eventName); + + sprintf(eventName, "%s%d", MESSAGEPROCESSOR_STOPEVENT_BASENAME, connectionId); + m_hMessageProcessorStoppedEvent = ::CreateEvent(NULL, FALSE, FALSE, eventName); + + sprintf(eventName, "%s%d", MESSAGEPROCESSOR_STARTEVENT_BASENAME, connectionId); + m_hMessageProcessorStartedEvent = ::CreateEvent(NULL, FALSE, FALSE, eventName); + + m_hMessageProcessorThread = NULL; + m_dwMessageProcessorThreadId = 0; + + m_NextRetryTime = m_RetryTimeoutTime = 0; + + m_NextFlushFileTime = 0; + m_OsError = 0; + + TCDEBUGCLOSE(); +} +CConnectionImpl::~CConnectionImpl() +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::~CConnectionImpl\n"); + + // terminate the message processor thread if running + + if (m_hMessageProcessorThread != NULL) + { + BOOL t = ::TerminateThread(m_hMessageProcessorThread, 0); + ::CloseHandle(m_hMessageProcessorThread); + } + + if (m_hMessageProcessorExittedEvent != NULL) + { + ::CloseHandle(m_hMessageProcessorExittedEvent); + } + + if (m_hMessageProcessorStoppedEvent != NULL) + { + ::CloseHandle(m_hMessageProcessorStoppedEvent); + } + + if (m_ConnectSettings) + delete m_ConnectSettings; + + + if (m_ClientList) + { + m_ClientList->clear(); + delete m_ClientList; + } + + if (m_Registry) + { + delete m_Registry; + } + + if (m_BaseComm) + { + delete m_BaseComm; + } + + if (m_BaseCommHandle) + { + ::FreeLibrary(m_BaseCommHandle); + } + if (m_BaseProtocol) + { + delete m_BaseProtocol; + } + + if (m_BaseProtocolHandle) + { + ::FreeLibrary(m_BaseProtocolHandle); + } + + TCDEBUGCLOSE(); + if (m_DebugLog) + delete m_DebugLog; + if (m_DebugLog2) + delete m_DebugLog2; + +} + +BOOL CConnectionImpl::IsEqual(CConnection* connection) +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::IsEqual\n"); + + BOOL equal = FALSE; + + if (strcmp(m_ConnectSettings->connectType, connection->m_ConnectSettings->connectType) == 0) + { + if (m_BaseComm) + { + if (m_BaseComm->IsConnectionEqual(connection->m_ConnectSettings)) + { + equal = TRUE; + } + } + else + { + equal = TRUE; + } + } + + TCDEBUGCLOSE(); + return equal; +} + +BOOL CConnectionImpl::IsEqual(pConnectData pConData) +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::IsEqual\n"); + + BOOL equal = FALSE; + + if (strcmp(m_ConnectSettings->connectType, pConData->connectType) == 0) + { + if (m_BaseComm) + { + if (m_BaseComm->IsConnectionEqual(pConData)) + { + equal = TRUE; + } + } + else + { + equal = TRUE; + } + } + TCDEBUGCLOSE(); + return equal; +} + +long CConnectionImpl::DoConnect() +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::DoConnect\n"); + + long ret = TCAPI_ERR_NONE; + + if (m_BaseComm && m_BaseProtocol) + { + ret = m_BaseComm->OpenPort(); + if (ret != TCAPI_ERR_NONE) + { + m_OsError = m_BaseComm->m_lastCommError; + TCDEBUGLOGA1(" m_BaseComm->OpenPort = %d\n", ret); + } + } + else + { + ret = TCAPI_ERR_UNKNOWN_MEDIA_TYPE; + } + + if (ret == TCAPI_ERR_NONE) + { + m_Status = eConnected; + + TCDEBUGCLOSE(); + + StartProcessing(); + } + else + { +// if (m_BaseComm != NULL) +// { +// delete m_BaseComm; +// m_BaseComm = NULL; +// } + TCDEBUGCLOSE(); + } + return ret; +} + +long CConnectionImpl::DoDisconnect() +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::DoDisconnect\n"); + + long ret = TCAPI_ERR_NONE; + if (IsConnected()) + { + ret = m_BaseComm->ClosePort(); +// delete m_BaseComm; +// m_BaseComm = NULL; + } + m_Status = eDisconnected; + + TCDEBUGCLOSE(); + return ret; +} + +BOOL CConnectionImpl::AddClient(CClient* client) +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::AddClient\n"); + + BOOL ok = TRUE; + + m_ClientList->push_back(client); + + TCDEBUGCLOSE(); + return ok; +} + +long CConnectionImpl::DoSendMessage(long encodeOption, BYTE protocolVersion, BOOL useMsgId, BYTE msgId, DWORD msgLength, BYTE* pMsg) +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::DoSendMessage\n"); + + long err = TCAPI_ERR_NONE; + if (IsRetryInProgress()) + { + err = TCAPI_ERR_COMM_RETRY_IN_PROGRESS; + } + else if (IsRetryTimedOut()) + { + err = TCAPI_ERR_COMM_TIMEOUT; + } + else if (m_Status == eConnected) + { + BYTE* encodedMessage = new BYTE[msgLength + 40]; // add enough for header (msgLength may be 0) + // if msgLength == 0, then encodeOption SHOULD be ENCODE_FORMAT since com expects to send something! + if (encodeOption == ENCODE_FORMAT) + { +#ifdef _DEBUG + char msg[200]; msg[0] = '\0'; + int len = (msgLength > 30) ? 30 : msgLength; + for (int i = 0; i < len; i ++) + { + sprintf(msg, "%s%02.2x ", msg, pMsg[i]); + } + sprintf(msg, "%s\n", msg); + TCDEBUGLOGS(msg); +#endif + // msgLength maybe 0 and pMsg maybe NULL (we're not sending a raw message, just a protocol header) + msgLength = m_BaseProtocol->EncodeMessage(pMsg, msgLength, protocolVersion, msgId, encodedMessage, msgLength+40); +#ifdef _DEBUG + msg[0] = '\0'; + len = (msgLength > 30) ? 30 : msgLength; + for (i = 0; i < len; i ++) + { + sprintf(msg, "%s%02.2x ", msg, encodedMessage[i]); + } + sprintf(msg, "%s\n", msg); + TCDEBUGLOGS(msg); +#endif + err = m_BaseComm->SendDataToPort(msgLength, encodedMessage); + } + else + { +#ifdef _DEBUG + char msg[200]; msg[0] = '\0'; + int len = (msgLength > 30) ? 30 : msgLength; + for (int i = 0; i < len; i ++) + { + sprintf(msg, "%s%02.2x ", msg, pMsg[i]); + } + sprintf(msg, "%s\n", msg); + TCDEBUGLOGS(msg); +#endif + // msgLength != 0 and pMsg != NULL + err = m_BaseComm->SendDataToPort(msgLength, pMsg); + } + delete[] encodedMessage; + + TCDEBUGLOGS("CConnectionImpl::DoSendMessage done\n"); + if (err == TCAPI_ERR_COMM_ERROR) + { + EnterRetryPeriod(err, true, m_BaseComm->m_lastCommError); + m_OsError = m_BaseComm->m_lastCommError; + } + } + else + { + err = TCAPI_ERR_MEDIA_NOT_OPEN; + } + + TCDEBUGLOGA1("CConnectionImpl::DoSendMessage err = %d\n", err); + TCDEBUGCLOSE(); + return err; +} + +long CConnectionImpl::DoRetryProcessing() +{ + long err = TCAPI_ERR_NONE; + + // if not connected + // return no error + if (m_BaseComm == NULL /*|| m_BaseComm->IsConnected() == false*/) + return TCAPI_ERR_MEDIA_NOT_OPEN; + + // if retry not in progress && retry not timed out + // return no error + if (!IsRetryInProgress() && !IsRetryTimedOut()) + return TCAPI_ERR_NONE; + +// TCDEBUGOPEN(); +// TCDEBUGLOGS("CConnectionImpl::DoRetryProcessing\n"); +// TCDEBUGCLOSE(); + // if retry timeout flag already set + // return timeout error + if (IsRetryTimedOut()) + return TCAPI_ERR_COMM_TIMEOUT; + + // get current time + time_t ctime; + time(&ctime); + // if retry timeout period has expired + if (ctime >= m_RetryTimeoutTime) + { + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::DoRetryProcessing retry timeout\n"); + TCDEBUGCLOSE(); + // send timeout error to all clients + NotifyClientsCommError(TCAPI_ERR_COMM_TIMEOUT); + // close comm port + m_BaseComm->ClosePort(); + // set retry timeout flag + SetRetryTimedOut(); + // return retry timeout error + err = TCAPI_ERR_COMM_TIMEOUT; + } + // else if retry time has passed + else if (ctime >= m_NextRetryTime) + { + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::DoRetryProcessing retry time\n"); + TCDEBUGCLOSE(); + // close comm port + // reopen comm port + m_BaseComm->ClosePort(); + int openErr = m_BaseComm->OpenPort(); + // if comm error + if (openErr != TCAPI_ERR_NONE) + { + // set next retry time + // return comm error + m_NextRetryTime = ctime + m_ConnectSettings->retryInterval; + err = TCAPI_ERR_COMM_RETRY_IN_PROGRESS; + m_OsError = m_BaseComm->m_lastCommError; + } + else + { + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::DoRetryProcessing reconnected\n"); + TCDEBUGCLOSE(); + // send reconnect warning to all clients + NotifyClientsCommError(TCAPI_INFO_COMM_RECONNECTED); + // set connected + SetConnected(); + err = TCAPI_ERR_NONE; + } + } + else // still in retry + { + err = TCAPI_ERR_COMM_RETRY_IN_PROGRESS; + } + + +// TCDEBUGOPEN(); +// TCDEBUGLOGA1("CConnectionImpl::DoRetryProcessing err = %d\n", err); +// TCDEBUGCLOSE(); + return err; +} +long CConnectionImpl::EnterRetryPeriod(long commErr, bool passOsErr, DWORD osErr) +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::EnterRetryPeriod\n"); + TCDEBUGCLOSE(); + + long err = TCAPI_ERR_NONE; + + // set next retry time + time_t ctime; + time(&ctime); + m_NextRetryTime = ctime + m_ConnectSettings->retryInterval; + // set retry timeout time + m_RetryTimeoutTime = ctime + m_ConnectSettings->retryTimeout; + // send comm error to all clients + NotifyClientsCommError(commErr, passOsErr, osErr); + // set retry in progress flag + SetRetryInProgress(); + + return err; +} + +BOOL CConnectionImpl::RemoveClient(CClient* client) +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::RemoveClient\n"); + + BOOL found = FALSE; + + if (m_ClientList->size() != 0) + { + ClientList::iterator iter; + for (iter = m_ClientList->begin(); iter != m_ClientList->end(); iter++) + { + if ((*iter)->GetClientId() == client->GetClientId()) + { + m_ClientList->erase(iter); + found = TRUE; + break; + } + } + } + + TCDEBUGCLOSE(); + return found; +} + +BOOL CConnectionImpl::ExitProcessing() +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::ExitProcessing\n"); + + // exit the messageprocessing thread + if (m_hMessageProcessorThread != NULL) + { + m_MessageProcessorState = MP_EXIT; + + m_StartMessageProcessing = false; + m_PauseMessageProcessing = true; + m_ExitMessageProcessor = true; + DWORD waitStatus = ::WaitForSingleObject(m_hMessageProcessorExittedEvent, MESSAGEPROCESSOR_EVENTWAIT_TIMEOUT); + TCDEBUGLOGA1("CConnectionImpl::ExitProcessing waitStatus=%x\n", waitStatus); + ::CloseHandle(m_hMessageProcessorThread); + m_hMessageProcessorThread = NULL; + } + + TCDEBUGCLOSE(); + return TRUE; +} + +BOOL CConnectionImpl::StartProcessing() +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::StartProcessing\n"); + + // starts processing thread + if (m_hMessageProcessorThread == NULL) + { + m_MessageProcessorState = MP_PAUSE; + + m_ExitMessageProcessor = false; + m_StartMessageProcessing = false; + m_PauseMessageProcessing = false; + // TODO: create thread + m_hMessageProcessorThread = ::CreateThread( + NULL, + 0, + (LPTHREAD_START_ROUTINE) MessageProcessor, + this, + 0, + &m_dwMessageProcessorThreadId); + } + + TCDEBUGCLOSE(); + return PauseProcessing();//RestartProcessing(); +} + +BOOL CConnectionImpl::PauseProcessing() +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::PauseProcessing\n"); + + // tells the processing thread to pause + if (m_hMessageProcessorThread != NULL) + { + m_MessageProcessorState = MP_PAUSE; + + m_ExitMessageProcessor = false; + m_StartMessageProcessing = false; + m_PauseMessageProcessing = true; + DWORD waitStatus = ::WaitForSingleObject(m_hMessageProcessorStoppedEvent, MESSAGEPROCESSOR_EVENTWAIT_TIMEOUT); + TCDEBUGLOGA1("CConnectionImpl::PauseProcessing waitStatus=%x\n", waitStatus); + } + + TCDEBUGCLOSE(); + return TRUE; +} + +BOOL CConnectionImpl::RestartProcessing() +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::RestartProcessing\n"); + + // tell the processing thread to restart + if (m_hMessageProcessorThread != NULL) + { + m_MessageProcessorState = MP_START; + + m_ExitMessageProcessor = false; + m_StartMessageProcessing = true; + m_PauseMessageProcessing = false; + DWORD waitStatus = ::WaitForSingleObject(m_hMessageProcessorStartedEvent, MESSAGEPROCESSOR_EVENTWAIT_TIMEOUT); + TCDEBUGLOGA1("CConnectionImpl::RestartProcessing waitStatus=%x\n", waitStatus); + } + + TCDEBUGCLOSE(); + return TRUE; +} + +BOOL CConnectionImpl::RemoveClientFromRegistry(CClient* client) +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::RemoveClientFromRegistry\n"); + TCDEBUGCLOSE(); + + return m_Registry->RemoveClient(client); +} + +BOOL CConnectionImpl::AddClientToRegistry(CClient* client, long numberIds, BYTE* ids) +{ + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::AddClientToRegistry\n"); + TCDEBUGCLOSE(); + + return m_Registry->AddClient(client, numberIds, ids); +} + +void CConnectionImpl::NotifyClientsCommError(long tcfError, bool passOsError, DWORD osError) +{ +// TCDEBUGOPEN(); +// TCDEBUGLOGS("CConnectionImpl::NotifyClientsCommError\n"); +// TCDEBUGCLOSE(); + + if (m_ClientList->size() != 0) + { + ClientList::iterator iter; + for (iter = m_ClientList->begin(); iter != m_ClientList->end(); iter++) + { + CErrorMonitor* errorMonitor = (*iter)->m_ErrorMonitor; + errorMonitor->PutError(tcfError, passOsError, osError); + } + } +} +BOOL CConnectionImpl::HasVersion() +{ + BOOL found = FALSE; + + if (m_BaseComm && m_BaseComm->HasVersion()) + found = TRUE; + + return found; +} +void CConnectionImpl::GetVersion(char* version) +{ + if (HasVersion()) { + m_BaseComm->GetVersion(version); + } +} + +void CConnectionImpl::UnLockAllDestinations() +{ + if (m_ClientList->size() != 0) + { + ClientList::iterator iter; + for (iter = m_ClientList->begin(); iter != m_ClientList->end(); iter++) + { + CInputStream* inputStream = (*iter)->m_InputStream; + CMessageFile* file = (*iter)->m_MessageFile; + if (inputStream != NULL) + { + inputStream->UnLockStream(); + } + else if (file != NULL) + { + file->UnLockMessageFile(); + } + } + } +} + +#define LOG_MPROCESSOR +#if defined(LOG_MPROCESSOR) && defined(_DEBUG) +#define MPLOGOPEN() if (gDoLogging) { pThis->m_DebugLog2->WaitForAccess(); } +#define MPLOGS(s) if (gDoLogging) { sprintf(pThis->m_DebugLogMsg2,"%s", s); pThis->m_DebugLog2->log(pThis->m_DebugLogMsg2); } +#define MPLOGA1(s, a1) if (gDoLogging) { sprintf(pThis->m_DebugLogMsg2, s, a1); pThis->m_DebugLog2->log(pThis->m_DebugLogMsg2); } +#define MPLOGA2(s, a1, a2) if (gDoLogging) { sprintf(pThis->m_DebugLogMsg2, s, a1, a2); pThis->m_DebugLog2->log(pThis->m_DebugLogMsg2); } +#define MPLOGA3(s, a1, a2, a3) if (gDoLogging) { sprintf(pThis->m_DebugLogMsg2, s, a1, a2, a3); pThis->m_DebugLog2->log(pThis->m_DebugLogMsg2); } +#define MPLOGCLOSE() if (gDoLogging) { pThis->m_DebugLog2->ReleaseAccess(); } +#else +#define MPLOGOPEN() +#define MPLOGS(s) +#define MPLOGA1(s, a1) +#define MPLOGA2(s, a1, a2) +#define MPLOGA3(s, a1, a2, a3) +#define MPLOGCLOSE() +#endif + +DWORD WINAPI CConnectionImpl::MessageProcessor(LPVOID lpParam) +{ + CConnectionImpl* pThis = (CConnectionImpl*)lpParam; + + MPLOGOPEN(); + MPLOGS("MessageProcessor start thread\n"); + + bool processing = false; + long err = TCAPI_ERR_NONE; + DWORD pollSize = 0; + + while (pThis->m_MessageProcessorState != MP_EXIT) + { + if (pThis->m_MessageProcessorState == MP_PAUSE) + { + MPLOGS("MessageProcessor pause\n"); + + processing = false; + pThis->m_PauseMessageProcessing = false; + pThis->m_MessageProcessorState = MP_NONE; + BOOL ok = ::SetEvent(pThis->m_hMessageProcessorStoppedEvent); + } + + if (pThis->IsRetryInProgress()) + err = pThis->DoRetryProcessing(); + else if (pThis->IsRetryTimedOut()) + err = TCAPI_ERR_COMM_TIMEOUT; + + if (processing && err == TCAPI_ERR_NONE) + { + if (pThis->m_BaseComm && pThis->m_BaseComm->IsConnected()) + { + err = pThis->m_BaseComm->PollPort(pollSize); + MPLOGA2("MessageProcessor PollPort = %d pollsize = %d\n", err, pollSize); + if (err != TCAPI_ERR_NONE) + { + MPLOGA2("MessageProcessor err = %d osError = %d\n", err, pThis->m_BaseComm->m_lastCommError); + pThis->EnterRetryPeriod(err, true, pThis->m_BaseComm->m_lastCommError); + } + else + { + if (pollSize == 0) + { + Sleep(1); + } + else + { + long numberProcessed = 0; +// MPLOGA1("MessageProcessor ProcessBuffer pRegistry = %x\n", pThis->m_Registry); + err = pThis->m_BaseComm->ProcessBuffer(pThis, pThis->m_Registry, numberProcessed); + + MPLOGA2("MessageProcessor ProcessBuffer err = %d number = %d\n", err, numberProcessed); + + if (err == TCAPI_ERR_COMM_ERROR) + { + // for this error we have os error, but we probably caught this in PollPort already + pThis->EnterRetryPeriod(err, true, pThis->m_BaseComm->m_lastCommError); + } + else if (err != TCAPI_ERR_NONE) + { + // all clients already notified in ProcessBuffer + err = TCAPI_ERR_NONE; + } + pThis->UnLockAllDestinations(); // unlock all input streams, if they became locked during AddMessage() +// Sleep(1); + } + } +// MPLOGS("MessageProcessor FlushAllClientMessageFiles\n"); + pThis->FlushAllClientMessageFiles(); + } + else + { + // basecom not connected + Sleep(1); + } + } + else + { + // processing is not being done + Sleep(1); + } + if (pThis->m_MessageProcessorState == MP_START) + { + MPLOGS("MessageProcessor start\n"); + + processing = true; + pThis->m_StartMessageProcessing = false; + pThis->m_MessageProcessorState = MP_PROCESSING; + BOOL ok = ::SetEvent(pThis->m_hMessageProcessorStartedEvent); + } + } + // signal we're stopping + pThis->m_ExitMessageProcessor = false; + pThis->m_MessageProcessorState = MP_NONE; + ::SetEvent(pThis->m_hMessageProcessorExittedEvent); + + MPLOGS("MessageProcessor exit thread\n"); + MPLOGCLOSE(); + + return 0; +} + +void CConnectionImpl::FlushAllClientMessageFiles() +{ + DWORD cTick = GetTickCount(); + +// MPLOGA2("CConnectionImpl::FlushAllClientMessageFiles cTick=%d m_NextFlushFileTime=%d\n", cTick, m_NextFlushFileTime); + + if (cTick > m_NextFlushFileTime) + { +// MPLOGS("CConnectionImpl::FlushAllClientMessageFiles flush timeout\n"); + if (m_ClientList->size() != 0) + { + ClientList::iterator iter; + for (iter = m_ClientList->begin(); iter != m_ClientList->end(); iter++) + { + CMessageFile* file = (*iter)->m_MessageFile; + if (file != NULL) + { +// MPLOGS("CConnectionImpl::FlushAllClientMessageFiles flush client\n"); + file->FlushFile(); + } + } + } + m_NextFlushFileTime = GetTickCount() + FLUSH_TIME; + } +} + +BOOL CConnectionImpl::CreateCommProtocols(const char* commPath, const char* protPath) +{ + BOOL loaded = FALSE; + + TCDEBUGOPEN(); + TCDEBUGLOGS("CConnectionImpl::CreateCommProtocols\n"); + + TCDEBUGLOGA2(" commPath=%s protPath=%s\n", commPath, protPath); + + m_BaseCommHandle = ::LoadLibrary(commPath); + m_BaseProtocolHandle = ::LoadLibrary(protPath); + if (m_BaseCommHandle == NULL || m_BaseProtocolHandle == NULL) + { + TCDEBUGLOGA2(" error loading library, m_BaseCommHandle=%x m_BaseProtocolHandle=%x\n", m_BaseCommHandle, m_BaseProtocolHandle); + if (m_BaseCommHandle) ::FreeLibrary(m_BaseCommHandle); m_BaseCommHandle = NULL; + if (m_BaseProtocolHandle) ::FreeLibrary(m_BaseProtocolHandle); m_BaseProtocolHandle = NULL; + + } + else + { + COMMCREATE lpCommFn = (COMMCREATE)::GetProcAddress(m_BaseCommHandle, COMMCREATE_FNNAME); + PROTOCOLCREATE lpProtFn = (PROTOCOLCREATE)::GetProcAddress(m_BaseProtocolHandle, PROTOCOLCREATE_FNNAME); + if (lpCommFn == NULL || lpProtFn == NULL) + { + TCDEBUGLOGA2(" error finding function, lpCommFn=%x lpProtFn=%x\n", lpCommFn, lpProtFn); + if (m_BaseCommHandle) ::FreeLibrary(m_BaseCommHandle); m_BaseCommHandle = NULL; + if (m_BaseProtocolHandle) ::FreeLibrary(m_BaseProtocolHandle); m_BaseProtocolHandle = NULL; + } + else + { + m_BaseProtocol = lpProtFn(); + if (m_BaseProtocol == NULL) + { + TCDEBUGLOGA1(" error creating protocol, m_BaseProtocol=%x\n", m_BaseProtocol); + if (m_BaseCommHandle) ::FreeLibrary(m_BaseCommHandle); m_BaseCommHandle = NULL; + if (m_BaseProtocolHandle) ::FreeLibrary(m_BaseProtocolHandle); m_BaseProtocolHandle = NULL; + } + else + { + m_BaseComm = lpCommFn(m_ConnectSettings, m_ConnectionID, m_BaseProtocol); + if (m_BaseComm == NULL) + { + TCDEBUGLOGA1(" error creating comm, m_BaseComm=%x\n", m_BaseComm); + if (m_BaseProtocol) delete m_BaseProtocol; m_BaseProtocol = NULL; + + if (m_BaseCommHandle) ::FreeLibrary(m_BaseCommHandle); m_BaseCommHandle = NULL; + if (m_BaseProtocolHandle) ::FreeLibrary(m_BaseProtocolHandle); m_BaseProtocolHandle = NULL; + } + else + { + loaded = TRUE; + TCDEBUGLOGA4(" created class, m_BaseComm=%x m_BaseProtocol=%x m_BaseCommHandle=%x m_BaseProtocolHandle=%x\n", m_BaseComm, m_BaseProtocol, m_BaseCommHandle, m_BaseProtocolHandle); + } + } + } + } + + TCDEBUGCLOSE(); + return loaded; +} diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFServer/ConnectionImpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/ConnectionImpl.h Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// ConnectionImpl.h: interface for the CConnectionImpl class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_CONNECTIONIMPL_H__1D0D5B50_3DDD_49B8_834B_5996D9CC0124__INCLUDED_) +#define AFX_CONNECTIONIMPL_H__1D0D5B50_3DDD_49B8_834B_5996D9CC0124__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "Connection.h" + +class CConnectionImpl : public CConnection +{ +public: + CConnectionImpl(); + CConnectionImpl(ConnectData conData, DWORD connectionId); + virtual ~CConnectionImpl(); + + BOOL IsEqual(CConnection* connection); + BOOL IsEqual(pConnectData pConData); + + BOOL AddClient(CClient* client); // add a client to this connection + BOOL RemoveClient(CClient* client); // remove a client from this connection + BOOL AddClientToRegistry(CClient* client, long numberIds, BYTE* ids); + BOOL RemoveClientFromRegistry(CClient* client); // remove a client from this registry + BOOL StartClient(CClient* client){ return TRUE; } // start processing for a specified client + BOOL StopClient(CClient* client){ return TRUE; } // stop processing for a specified client + long DoConnect(); + long DoDisconnect(); + long DoSendMessage(long encodeOption, BYTE protocolVersion, BOOL useMsgId, BYTE msgId, DWORD msgLength, BYTE* msg); + long DoRetryProcessing(); + long EnterRetryPeriod(long err, bool passOsErr, DWORD osErr); + + BOOL PauseProcessing(); // pause processing thread (not exit) + BOOL RestartProcessing(); // restart processing after a pause + BOOL StartProcessing(); // start processing thread + BOOL ExitProcessing(); // exit processing thread + BOOL IsProcessingPaused() { return (m_MessageProcessorState == MP_PAUSE); } + BOOL IsProcessingStarted() { return (m_MessageProcessorState == MP_START); } + BOOL IsProcessingContinuing() { return (m_MessageProcessorState == MP_PROCESSING); } + + long GetConnectionId() { return m_ConnectionID; } + + // m_Status operations + BOOL IsConnected() { return ((m_Status == eConnected) || (m_Status == eRetryInProgress)); } + BOOL IsDisconnected() { return (m_Status == eDisconnected); } + BOOL IsRetryInProgress() { return (m_Status== eRetryInProgress); } + BOOL IsRetryTimedOut() { return (m_Status == eRetryTimedOut); } + void SetConnected() { m_Status = eConnected; } + void SetDisconnected() { m_Status = eDisconnected; } + void SetRetryInProgress() { m_Status = eRetryInProgress; } + void SetRetryTimedOut() { m_Status = eRetryTimedOut; } + void NotifyClientsCommError(long tcfError, bool passOsError=false, DWORD osError=0); + BOOL CreateCommProtocols(const char* commLibraryPath, const char* protocolLibraryPath); + BOOL HasVersion(); + void GetVersion(char* outVersion); + + long GetNumberClients() { return m_ClientList->size(); } + + void UnLockAllDestinations(); + void FlushAllClientMessageFiles(); + + ConnectData* m_ConnectSettings; // connection settings + ClientList* m_ClientList; // this connection only + eConnectionStatus m_Status; // this connection status + CRegistry* m_Registry; // registry for this connection + long m_ConnectionID; // id for this connection + + CBaseCom* m_BaseComm; // communication port handler + HINSTANCE m_BaseCommHandle; + CBaseProtocol* m_BaseProtocol; // protocol for port + HINSTANCE m_BaseProtocolHandle; + + unsigned long m_OsError; // error from OS if applicable + + + char m_DebugLogMsg[2000]; + TCDebugLog* m_DebugLog; + char m_DebugLogMsg2[2000]; + TCDebugLog* m_DebugLog2; + + // MessageProcessor thread + static DWORD WINAPI MessageProcessor(LPVOID lpParam); + + int m_MessageProcessorState; + bool m_ExitMessageProcessor; // flag to tell MessageProcessor thread to exit + bool m_PauseMessageProcessing; // flag to tell MessageProcessor thread to stop all message processing (temporarily) + bool m_StartMessageProcessing; // flag to tell MessageProcessor thread to start message processing + HANDLE m_hMessageProcessorExittedEvent; // event to tell main thread that MessageProcessor thread has exitted + HANDLE m_hMessageProcessorStoppedEvent; // event to tell main thread that MessageProcessor thread has stopped processing + HANDLE m_hMessageProcessorStartedEvent; // event to tell main thread that MessageProcessor thread has started processing + + HANDLE m_hMessageProcessorThread; // handle to MessageProcessor thread + DWORD m_dwMessageProcessorThreadId; // ID for " " + + // com errors and retry stuff + time_t m_NextRetryTime; + time_t m_RetryTimeoutTime; + + // client flush times + DWORD m_NextFlushFileTime; + +}; + +#endif // !defined(AFX_CONNECTIONIMPL_H__1D0D5B50_3DDD_49B8_834B_5996D9CC0124__INCLUDED_) diff -r c892c53c664e -r 9d2210c8eed2 connectivity/com.nokia.tcf/native/TCFNative/TCFServer/MessageFile.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/MessageFile.cpp Mon Apr 06 15:18:48 2009 -0500 @@ -0,0 +1,276 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// MessageFile.cpp: implementation of the CMessageFile class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ServerClient.h" +#include "MessageFile.h" +#include "ServerManager.h" +#include "TCErrorConstants.h" +#include +#include + +//#define USE_TEXT_FILE +#ifdef USE_TEXT_FILE +#define WRITE_MODE "w+t" +#define APPEND_MODE "a+t" +#else +#define WRITE_MODE "w+b" +#define APPEND_MODE "a+b" +#endif + +#define FLUSH_FREQ 2000 // # messages to write between flushing (if buffered) +#ifdef _DEBUG +extern BOOL gDoLogging; +#endif + +//#define LOG_MESSAGEFILE +#if defined(LOG_MESSAGEFILE) && defined(_DEBUG) +extern CServerManager* gManager; +#define TCDEBUGOPEN() if (gDoLogging) { gManager->m_DebugLog->WaitForAccess(); } +#define TCDEBUGLOGS(s) if (gDoLogging) { sprintf(TCDebugMsg,"%s", s); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGLOGA1(s, a1) if (gDoLogging) { sprintf(TCDebugMsg, s, a1); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGLOGA2(s, a1, a2) if (gDoLogging) { sprintf(TCDebugMsg, s, a1, a2); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGLOGA3(s, a1, a2, a3) if (gDoLogging) { sprintf(TCDebugMsg, s, a1, a2, a3); gManager->m_DebugLog->log(TCDebugMsg); } +#define TCDEBUGCLOSE() if (gDoLogging) { gManager->m_DebugLog->ReleaseAccess(); } +#else +#define TCDEBUGOPEN() +#define TCDEBUGLOGS(s) +#define TCDEBUGLOGA1(s, a1) +#define TCDEBUGLOGA2(s, a1, a2) +#define TCDEBUGLOGA3(s, a1, a2, a3) +#define TCDEBUGCLOSE() +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CMessageFile::CMessageFile(CHAR* pFilePath, long inClientID) +{ + m_ClientID = inClientID; + m_FileLocked = FALSE; + strncpy(m_FilePath, pFilePath, MAX_FILEPATH); + + char toString[30]; + sprintf(toString, "%s%04.4d", MESSAGEFILE_MUTEX_BASENAME, m_ClientID); + + m_Mutex.Open(toString, MESSAGEFILE_MUTEX_TIMEOUT); + m_hFile = NULL; + m_numWritten = 0; + m_numWrittenSinceLastFlush = 0; + m_Open = FALSE; + +#ifdef LOG_FILE_PERFORMANCE + perfFileName="c:\\tcf\\serverfileperf.txt"; + fpLog = NULL; + numLogged=0; +#endif + OPENFILEPERF(); +} + +CMessageFile::~CMessageFile() +{ + CLOSEFILEPERF(); + Close(); + m_Mutex.Close(); + +} + +long CMessageFile::AddMessage(DWORD inLength, BYTE* inMessage) +{ + long err = TCAPI_ERR_NONE; + + BOOL gotIt = WaitForAccess(); // will lock on first access only + size_t lenWritten = 0; + +#ifdef USE_TEXT_FILE + lenWritten = inLength; + int textStart = 20; + if (inMessage[9] == 0x5a) textStart = 64; + for (int i = 0; i < textStart; i++) + fprintf(m_hFile, "%02.2X ", inMessage[i]); + + for (i = textStart; i < (int)inLength; i++) + { + if (isprint(inMessage[i])) + fprintf(m_hFile, "%c", inMessage[i]); + else + fprintf(m_hFile, "%02.2X ", inMessage[i]); + } + fprintf(m_hFile,"\n"); +#else + lenWritten = fwrite(inMessage, 1, inLength, m_hFile); +#endif + if (lenWritten < inLength) + { + err = TCAPI_ERR_WRITING_FILE; + } + else + { + m_numWrittenSinceLastFlush++; + m_numWritten++; + if ((m_numWrittenSinceLastFlush % FLUSH_FREQ) == 0) + { + FlushFile(TRUE); + } + } + LOGFILEPERF("AddMessage\n"); + + // no ReleaseAccess this is done by Connection when all bytes processed in buffer and + // calls all clients unlock method + + return err; +} + +long CMessageFile::Open() +{ + TCDEBUGOPEN(); + long err = TCAPI_ERR_NONE; + + TCDEBUGLOGS("CMessageFile::Open\n"); + WaitForAccess(); + + if (m_hFile) + fclose(m_hFile); + + m_hFile = _fsopen(m_FilePath, APPEND_MODE, _SH_DENYNO); + + if (m_hFile == NULL) + { + err = TCAPI_ERR_FILE_DOES_NOT_EXIST; + } + else + m_Open = TRUE; + + + ReleaseAccess(); + + TCDEBUGCLOSE(); + return err; +} + +long CMessageFile::Close() +{ + TCDEBUGOPEN(); + long err = TCAPI_ERR_NONE; + + TCDEBUGLOGA1("CMessageFile::Close numWritten=%d\n", m_numWritten); + WaitForAccess(); + + if (m_hFile) + { + fclose(m_hFile); + m_hFile = NULL; + } + + ReleaseAccess(); + + TCDEBUGCLOSE(); + return err; +} + +long CMessageFile::ClearFile() +{ + TCDEBUGOPEN(); + long err = TCAPI_ERR_NONE; + + TCDEBUGLOGA2("CMessageFile::ClearFile m_hFile=%x numWritten=%d\n", m_hFile, m_numWritten); + WaitForAccess(); + + if (m_hFile) + { + fclose(m_hFile); + m_hFile = NULL; + m_Open = FALSE; + } + m_numWritten = 0; + m_numWrittenSinceLastFlush = 0; + + m_hFile = _fsopen(m_FilePath, WRITE_MODE, _SH_DENYNO); + + if (m_hFile == NULL) + { + err = TCAPI_ERR_FILE_DOES_NOT_EXIST; + } + else + m_Open = TRUE; + + LOGFILEPERF("ClearFile\n"); + + TCDEBUGLOGA1("CMessageFile::ClearFile m_hFile=%x\n", m_hFile); + ReleaseAccess(); + + TCDEBUGCLOSE(); + return err; +} +void CMessageFile::FlushFile(BOOL numberTimeOut) +{ + if (m_hFile && m_numWrittenSinceLastFlush > 0) + { + fflush(m_hFile); + m_numWrittenSinceLastFlush = 0; + if (numberTimeOut) + LOGFILEPERF("FlushFile \n"); + else + LOGFILEPERF("FlushFile