14 #ifndef tcpMsgSocket_H_
15 #define tcpMsgSocket_H_
21 #include <vlutil/vlInetTcpSocket.h>
48 size_t recvBufferSize = 20000,
int maxQueuedMsgs = -1);
53 std::shared_ptr<DtMsgHeaderReader> hdrReader,
54 size_t recvBuffSize = 20000,
int maxQueuedMsgs = -1);
67 virtual void openServerSocket( MAKRti::DtU16 localPort,
68 MAKRti::DtU32 flags = theDefaultSockOpts, MAKRti::DtInetDevice* hostIf =
NULL,
69 MAKRti::DtInetUtils::DtInetAddrFamily family = MAKRti::DtInetUtils::DtInetAddrFamily_IPv4 );
83 virtual void openClientSocket(
const MAKRti::DtInetEndpoint& dest,
84 MAKRti::DtU32 flags = theDefaultSockOpts, MAKRti::DtU16 localPort = 0,
85 MAKRti::DtInetDevice* hostIf =
NULL);
87 virtual MAKRti::DtInetTcpSocket* reconnect();
88 virtual void replaceSocket(DtUniquePtr<MAKRti::DtInetTcpSocket> newSock);
92 virtual int sendMessage(caddr_t msg,
size_t msgSize,
bool deleteAfterSend,
93 const MAKRti::DtInetAddr& destAddr = MAKRti::DtInetAddr::inaddrAny(),
int port = 0);
112 virtual unsigned bundleSize()
const;
121 virtual unsigned compressionLevel()
const;
124 virtual bool testConnectionStatus();
128 virtual void setMaxQueuedMessages(
int size);
132 virtual int maxQueuedMessages()
const;
136 virtual bool getQueueStatus(
int& percentFull)
const;
139 virtual void setTcpNoDelay(
bool enable);
142 virtual void setNonBlocking(
bool nonBlocking);
145 virtual const MAKRti::DtInetEndpoint& destination()
const;
148 virtual MAKRti::DtU32 maxMsgSize()
const;
151 MAKRti::DtInetTcpSocket* inetTcpSocket();
154 bool isConnected()
const {
return mySocket.get() && mySocket->state() == MAKRti::DtInetSockState_CONNECTED; }
157 bool isConnectionInProgress()
const {
return mySocket.get() && mySocket->state() == MAKRti::DtInetSockState_INPROGRESS; }
159 MAKRti::DtString getErrorString()
const;
161 virtual bool isClient()
const;
166 virtual int sendData(caddr_t msg,
size_t msgSize,
bool deleteAfterSend);
170 virtual bool flushQueue();
173 virtual bool queueMessage(caddr_t msg,
size_t msgSize);
176 virtual void resizeTestPacket();
232 return static_cast<MAKRti::DtInetTcpSocket*
>(
mySocket.get());
~DtQueuedMsg()
Definition: tcpMsgSocket.h:29
bool isConnectionInProgress() const
Returns true if the socket is in the process of connecting.
Definition: tcpMsgSocket.h:157
size_t myBytesNeededForSize
The number of bytes needed to read the size from the message header.
Definition: tcpMsgSocket.h:217
std::list< DtQueuedMsg > myMsgQueue
The queue of unsent messages.
Definition: tcpMsgSocket.h:194
virtual void enableCompression(MAKRti::DtU8 compressionLevel)=0
Enables message compression and sets the compression level.
DtUniquePtr< MAKRti::DtInetDevice > myClientHostIf
Definition: tcpMsgSocket.h:225
This file contains the declaration of the DtMsgCompressor class.
virtual int recvMessage(caddr_t *buffptr)=0
Gets the next message from the incoming data.
size_t myNumBytesToWaitFor
The number of bytes we are waiting for to complete the message.
Definition: tcpMsgSocket.h:185
MAKRti::DtU32 myClientFlags
Definition: tcpMsgSocket.h:223
DtMsgBundler myMsgBundler
Bundler for outgoing messages.
Definition: tcpMsgSocket.h:197
MAKRti::DtInetTcpSocket * inetTcpSocket()
Returns a pointer to the MAKRti::DtInetTcpSocket.
Definition: tcpMsgSocket.h:230
DtQueuedMsg(caddr_t m, size_t s)
Definition: tcpMsgSocket.h:27
The DtMsgCompressor class provides a means for compressing and uncompressing messages.
Definition: msgCompressor.h:31
bool myNeedSize
Whether we still need to receive the size field for the next/current message.
Definition: tcpMsgSocket.h:182
int myMutableOldQueueLevel
The queue level the last time the user was notified of queue state.
Definition: tcpMsgSocket.h:214
MAKRti::DtInetEndpoint myClientDestination
Definition: tcpMsgSocket.h:222
static const MAKRti::DtU32 theDefaultSockOpts
Definition: tcpMsgSocket.h:227
int myMaxQueuedMessages
The maximum size the send queue is allowed to reach.
Definition: tcpMsgSocket.h:209
size_t size
Definition: tcpMsgSocket.h:32
#define NULL
Definition: baseTypes13.h:8
This file contains the declaration of the DtMsgSocket base class.
bool myIsClient
Definition: tcpMsgSocket.h:219
MAKRti::DtInetBuffer myTestPacket
The buffer to store test packets in.
Definition: tcpMsgSocket.h:191
DtQueuedMsg()
Definition: tcpMsgSocket.h:26
virtual int sendMessage(caddr_t msg, size_t msgSize, bool deleteAfterSend, const MAKRti::DtInetAddr &destAddr=MAKRti::DtInetAddr::inaddrAny(), int port=0)=0
Sends a message.
The DtMsgBundler class provides a means for bundling and unbundling messages.
Definition: msgBundler.h:27
The DtTcpMsgSocket class provides an address family independent TCP socket that handles RTI messages...
Definition: tcpMsgSocket.h:40
This file contains the declaration of the DtMsgBundler class.
int myNumBytesReceived
The number of bytes we have so far received for the current message.
Definition: tcpMsgSocket.h:188
bool isConnected() const
Returns true if the socket is connected.
Definition: tcpMsgSocket.h:154
virtual void disableBundling()=0
Disables message bundling.
The DtMsgSocket provides a wrapper around the MAKRti::DtInetSocket class to operate on messages rathe...
Definition: msgSocket.h:28
DtUniquePtr< MAKRti::DtInetSocket > mySocket
The socket.
Definition: msgSocket.h:116
bool myCompressionEnabled
Whether message compression is enabled.
Definition: tcpMsgSocket.h:206
virtual bool flush()=0
Attempts to send any queued messages and bundled messages.
size_t remainingSize
Definition: tcpMsgSocket.h:34
DtMsgCompressor myMsgCompressor
Message compressor and uncompressor.
Definition: tcpMsgSocket.h:203
MAKRti::DtU16 myClientLocalPort
Definition: tcpMsgSocket.h:224
virtual int recvMessageWithSrc(caddr_t *buffptr, MAKRti::DtInetEndpoint &src)=0
Gets the next message from the stream of incoming data and sets the source of the message...
Definition: tcpMsgSocket.h:23
virtual void enableBundling(size_t maxBundleSize)=0
Enables message bundling and sets the maximum bundle size.
virtual void disableCompression()=0
Disables message compression.
caddr_t remainingMsg
Definition: tcpMsgSocket.h:33
#define DT_DLL_RTIUTIL
Definition: rtiMsConfig.h:160
bool myBundlingEnabled
Whether message bundling is enabled.
Definition: tcpMsgSocket.h:200
caddr_t msg
Definition: tcpMsgSocket.h:31