MAK RTIspy API Documentation for HLA Evolved
 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 
13 
14 #ifndef udpMsgSocket_H_
15 #define udpMsgSocket_H_
16 
17 #include "msgSocket.h"
18 #include "msgBundler.h"
19 #include "msgCompressor.h"
20 
21 #include <vlutil/vlInetUdpSocket.h>
22 
23 const size_t DtDefaultMaxPacketSize = 15000;
24 
25 using namespace MAKRti;
26 
31 {
32 public:
33 
37  DtUdpMsgSocket(DtBoost::shared_ptr<DtMsgHeaderReader> hdrReader,
38  size_t maxPacketSize = DtDefaultMaxPacketSize);
39 
41  virtual ~DtUdpMsgSocket();
42 
58  virtual void openSocket(const DtInetEndpoint& dest,
59  DtU32 flags = DtDefaultSockOpts, DtU16 localPort = 0,
60  DtInetDevice* hostIf = NULL);
61 
63  virtual int sendMessage(caddr_t msg, size_t msgSize, bool deleteAfterSend,
64  const DtInetAddr& destAddr = DtInetAddr::inaddrAny());
65 
68  virtual bool flush();
69 
71  virtual int recvMessage(caddr_t *buffptr);
72 
74  virtual int recvMessageWithSrc(caddr_t *buffptr, DtInetEndpoint& src);
75 
77  virtual void enableBundling(size_t maxBundleSize);
78 
80  virtual void disableBundling();
81 
83  virtual void enableCompression(DtU8 compressionLevel);
84 
86  virtual void disableCompression();
87 
94  virtual bool joinMulticastGroup( const DtInetAddr& grpAddr,
95  DtInetDevice* device = NULL );
96  virtual bool joinMulticastGroup( const DtInetEndpoint& grpEndpoint,
97  DtInetDevice* device = NULL );
98  virtual bool dropMulticastGroup( const DtInetAddr& grpAddr,
99  DtInetDevice* device = NULL );
100  virtual bool dropMulticastGroup( const DtInetEndpoint& grpEndpoint,
101  DtInetDevice* device = NULL );
102 
105  virtual bool setMcastTtlOption( DtU32 ttl );
106 
108  virtual void setRetryOnSend(unsigned int numRetries, double waitPeriod);
109 
111  virtual DtU32 maxMsgSize() const;
112 
114  virtual bool isOpen() const;
115 
117  DtInetUdpSocket* inetUdpSocket();
118 
121  void setFilterPort(int port) { myFilterPort = port; }
122 
123 protected:
124 
126  virtual int sendPacket(caddr_t msg, size_t msgSize,
127  const DtInetAddr& destAddr = DtInetAddr::inaddrAny());
128 
130  virtual int retrySendTo(caddr_t msg, size_t msgSize,
131  const DtInetAddr& destAddr = DtInetAddr::inaddrAny());
132 
134  virtual int recv(caddr_t *buffptr, DtInetEndpoint* ep);
135 
136 protected:
137 
139  DtInetEndpoint myEndpoint;
140 
142  std::map<DtInetAddr, DtMsgBundler*> myMsgBundlers;
143 
147 
150 
153 
156 
158  DtInetEndpoint myLastSourceEndpoint;
159 
162 
164  unsigned int myMaxSendRetries;
165 
168 
171 };
172 
173 
174 inline DtInetUdpSocket* DtUdpMsgSocket::inetUdpSocket()
175 {
176  return static_cast<DtInetUdpSocket*>(mySocket.get());
177 }
178 
179 #endif

Document ID: Generated on Mon Mar 21 09:41:37 EDT 2016 from SVN revision 163228
Copyright © 2005-2015 VT MÄK Inc. All Rights Reserved (www.mak.com)