MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
udpMsgSocket.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2010 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: udpMsgSocket.h,v $ $Revision: $ $State: Exp $
7 *********************************************************************/
8 
12 
13 #pragma once
14 
15 #include "msgSocket.h"
16 #include "msgBundler.h"
17 #include "msgCompressor.h"
18 
19 #include <vlutil/vlInetUdpSocket.h>
20 
21 const size_t DtDefaultMaxPacketSize = 15000;
22 
23 using namespace MAKRti;
24 
29 {
30 public:
31 
35  DtUdpMsgSocket(DtBoost::shared_ptr<DtMsgHeaderReader> hdrReader,
36  size_t maxPacketSize = DtDefaultMaxPacketSize);
37 
39  virtual ~DtUdpMsgSocket();
40 
56  virtual void openSocket(const DtInetEndpoint& dest,
57  DtU32 flags = DtDefaultSockOpts, DtU16 localPort = 0,
58  DtInetDevice* hostIf = NULL);
59 
61  virtual int sendMessage(caddr_t msg, size_t msgSize, bool deleteAfterSend,
62  const DtInetAddr& destAddr = DtInetAddr::inaddrAny(), int port = 0);
63 
66  virtual bool flush();
67 
69  virtual int recvMessage(caddr_t *buffptr);
70 
72  virtual int recvMessageWithSrc(caddr_t *buffptr, DtInetEndpoint& src);
73 
75  virtual void enableBundling(size_t maxBundleSize);
76 
78  virtual void disableBundling();
79 
81  virtual void enableCompression(DtU8 compressionLevel);
82 
84  virtual void disableCompression();
85 
92  virtual bool joinMulticastGroup( const DtInetAddr& grpAddr,
93  DtInetDevice* device = NULL );
94  virtual bool joinMulticastGroup( const DtInetEndpoint& grpEndpoint,
95  DtInetDevice* device = NULL );
96  virtual bool dropMulticastGroup( const DtInetAddr& grpAddr,
97  DtInetDevice* device = NULL );
98  virtual bool dropMulticastGroup( const DtInetEndpoint& grpEndpoint,
99  DtInetDevice* device = NULL );
100 
103  virtual bool setMcastTtlOption( DtU32 ttl );
104 
106  virtual void setRetryOnSend(unsigned int numRetries, double waitPeriod);
107 
109  virtual DtU32 maxMsgSize() const;
110 
112  virtual bool isOpen() const;
113 
115  DtInetUdpSocket* inetUdpSocket();
116 
118  virtual void setFilterPort(int port) { myFilterPort = port; }
119 
120 protected:
121 
123  virtual int sendPacket(caddr_t msg, size_t msgSize,
124  const DtInetAddr& destAddr = DtInetAddr::inaddrAny(),
125  int port = 0);
126 
128  virtual int doSendPacket(caddr_t msg, size_t msgSize,
129  const DtInetAddr& destAddr = DtInetAddr::inaddrAny(),
130  int port = 0);
131 
133  virtual int retrySendTo(caddr_t msg, size_t msgSize,
134  const DtInetAddr& destAddr = DtInetAddr::inaddrAny(),
135  int port = 0);
136 
138  virtual int recv(caddr_t *buffptr, DtInetEndpoint* ep);
139 
140 protected:
141 
143  DtInetEndpoint myEndpoint;
144 
146  std::map<DtInetAddr, DtMsgBundler*> myMsgBundlers;
147 
151 
154 
157 
160 
162  DtInetEndpoint myLastSourceEndpoint;
163 
166 
168  unsigned int myMaxSendRetries;
169 
172 
175 };
176 
177 
178 inline DtInetUdpSocket* DtUdpMsgSocket::inetUdpSocket()
179 {
180  return static_cast<DtInetUdpSocket*>(mySocket.get());
181 }
bool myCompressionEnabled
Whether message compression is enabled.
Definition: udpMsgSocket.h:159
DtInetUdpSocket * inetUdpSocket()
Returns a pointer to the DtInetUdpSocket.
Definition: udpMsgSocket.h:178
bool myBundlingEnabled
Whether message bundling is enabled.
Definition: udpMsgSocket.h:153
size_t myMaxPacketSize
The maximum packet size.
Definition: udpMsgSocket.h:165
DtInetEndpoint myLastSourceEndpoint
Source endpoint of last data received.
Definition: udpMsgSocket.h:162
This file contains the declaration of the DtMsgCompressor class.
double mySendRetryPeriod
The wait period between send retries.
Definition: udpMsgSocket.h:171
DtInetEndpoint myEndpoint
The current endpoint to send to.
Definition: udpMsgSocket.h:143
unsigned int myMaxSendRetries
The maximum number of times to try resending.
Definition: udpMsgSocket.h:168
The DtMsgCompressor class provides a means for compressing and uncompressing messages.
Definition: msgCompressor.h:31
std::map< DtInetAddr, DtMsgBundler * > myMsgBundlers
Message bundlers for outgoing messages for each destination address.
Definition: udpMsgSocket.h:146
virtual void setFilterPort(int port)
Sets the filter port. All messages sent from this port on this machine will be filtered.
Definition: udpMsgSocket.h:118
#define NULL
Definition: baseTypes13.h:8
This file contains the declaration of the DtMsgSocket base class.
const size_t DtDefaultMaxPacketSize
Definition: udpMsgSocket.h:21
The DtMsgBundler class provides a means for bundling and unbundling messages.
Definition: msgBundler.h:26
This file contains the declaration of the DtMsgBundler class.
The DtMsgSocket provides a wrapper around the DtInetSocket class to operate on messages rather than j...
Definition: msgSocket.h:29
int myFilterPort
All messages sent from this port on this machine will be filtered.
Definition: udpMsgSocket.h:174
DtMsgBundler myDefaultMsgBundler
Message bundler for the default destination.
Definition: udpMsgSocket.h:150
#define DT_DLL_RTIUTIL
Definition: rtiMsConfig.h:127
The DtUdpMsgSocket class provides an address family independent UDP socket that handles RTI messages...
Definition: udpMsgSocket.h:28
DtMsgCompressor myMsgCompressor
Message compressor and uncompressor.
Definition: udpMsgSocket.h:156

Document ID: Generated on Mon Sep 7 15:40:32 EDT 2020 from SVN revision 217499
Copyright © 2005-2020 MAK Technologies Inc. All Rights Reserved (www.mak.com)