author | fturovic <frank.turovich@nokia.com> |
Tue, 29 Jun 2010 14:04:33 -0500 | |
changeset 1554 | f83f6a37088e |
parent 506 | 44dbbc3220b8 |
permissions | -rw-r--r-- |
60 | 1 |
/* |
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: |
|
15 |
* |
|
16 |
*/ |
|
17 |
// TcpComm.h: interface for the CTcpComm class. |
|
18 |
// |
|
19 |
////////////////////////////////////////////////////////////////////// |
|
20 |
||
21 |
#if !defined(AFX_TCPCOMM_H__69657421_6D37_497A_A377_12E71365EDAB__INCLUDED_) |
|
22 |
#define AFX_TCPCOMM_H__69657421_6D37_497A_A377_12E71365EDAB__INCLUDED_ |
|
23 |
||
24 |
#if _MSC_VER > 1000 |
|
25 |
#pragma once |
|
26 |
#endif // _MSC_VER > 1000 |
|
27 |
||
28 |
#include "BaseCom.h" |
|
29 |
#include <winsock2.h> |
|
30 |
||
31 |
#define MAX_MESSAGE_LENGTH (64*1024L) |
|
32 |
#define MAX_TCP_MESSAGE_BUFFER_LENGTH (8*MAX_MESSAGE_LENGTH) |
|
33 |
||
34 |
#define DEFAULT_SOCKET_TIMEOUT (2000000L) // 2 seconds |
|
35 |
#define TIMEOUT_SEC(x) (x/1000000L) |
|
36 |
#define TIMEOUT_USEC(x) (x%1000000L) |
|
37 |
||
38 |
class CTcpComm : public CBaseCom |
|
39 |
{ |
|
40 |
public: |
|
41 |
CTcpComm(); |
|
42 |
CTcpComm(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol); |
|
43 |
virtual ~CTcpComm(); |
|
44 |
||
45 |
virtual long OpenPort(); |
|
46 |
long ClosePort(); |
|
47 |
long SendDataToPort(DWORD inSize, const void* inData); |
|
48 |
long PollPort(DWORD& outSize); |
|
49 |
long ReadPort(DWORD inSize, void* outData, DWORD& outSize); |
|
50 |
long ProcessBuffer(CConnection* pConn, CRegistry* pRegistry, long& numberProcessed); |
|
51 |
// long ProcessBuffer(NOTIFYCLIENTSCOMMERROR pNotify, ROUTEMESSAGE pRouteMessage, long& numberProcessed); |
|
52 |
// long ProcessBuffer(long& numberProcessed); |
|
53 |
void DeleteMsg(DWORD inMsgLength); |
|
54 |
bool GetVersion(char* outVersion) { return false; } // don't have enough information for this |
|
55 |
bool HasVersion() { return false; } // can we have a version? |
|
56 |
virtual long PreProcessMessage(int inMsgType, DWORD inMsgLength, BYTE* inMessage) { return TCAPI_ERR_NONE; } |
|
57 |
virtual long PreProcessMessage(BYTE msgId, DWORD inMsgLength, BYTE* inMessage) { return TCAPI_ERR_NONE; } |
|
58 |
bool IsConnectionEqual(ConnectData* pConn); |
|
366 | 59 |
int WSAInit(); |
60 |
void WSAClose(); |
|
61 |
||
60 | 62 |
|
63 |
private: |
|
64 |
SOCKET m_socket; |
|
65 |
sockaddr_in m_clientService; |
|
66 |
TIMEVAL m_timeOut; |
|
67 |
WSAEVENT m_hSocketEvent; |
|
68 |
DWORD m_pPeekBuffer; |
|
366 | 69 |
char sTcpLogMsg[3000]; |
506
44dbbc3220b8
add different logging to send & recieve messages so we can see the messages better in debug version
Chad Peckham <chad.peckham@nokia.com>
parents:
366
diff
changeset
|
70 |
char sTcpLogMsgSend[3000]; |
60 | 71 |
}; |
72 |
||
73 |
#endif // !defined(AFX_TCPCOMM_H__69657421_6D37_497A_A377_12E71365EDAB__INCLUDED_) |