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 }

Document ID: Generated on Fri Sep 27 00:57:56 EDT 2019 from SVN revision 201708
Copyright © 2005-2018 VT MÄK Inc. All Rights Reserved (www.mak.com)