VR-Link API Documentation for HLA Evolved
vlInetUdpSocket.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 *********************************************************************/
10 #pragma once
11 
12 #include <vlutil/vlInetSocket.h>
13 
14 #ifdef DtUSE_UTILITIES_NAMESPACE
15 namespace DtUSE_UTILITIES_NAMESPACE
16 {
17 #endif
18 
19 class DtInetUdpSockPimpl;
20 
24 {
25 public:
28 
52  DtInetUdpSocket( const DtInetEndpoint& dest, DtU16 localPort = 0,
53  DtInetDevice* hostIf = NULL, DtU32 flags = DtDefaultSockOpts,
54  bool immediateOpen = true );
55 
57  virtual ~DtInetUdpSocket();
58 
71  virtual bool setDestination( const DtInetEndpoint& dest );
72 
76  virtual bool openSocket();
77 
81  virtual bool closeSocket();
82 
93  virtual bool bindToDevice( const DtInetDevice* hostIf = NULL );
94 
110  virtual bool connectToDestination();
111 
114  virtual bool disconnect();
115 
126  virtual int send( caddr_t packet, size_t size, DtU32 flags = 0 );
127  virtual int sendTo( caddr_t packet, size_t size,
128  DtInetEndpoint& dest, DtU32 flags = 0 );
129 
130  virtual int sendChain( DtInetBufferChain& packets, DtU32 flags = 0 );
131  virtual int sendChainTo( DtInetBufferChain& packets,
132  DtInetEndpoint& dest, DtU32 flags = 0 );
134 
145 
151  virtual DtInetSockRcvStatus recv( caddr_t buff, size_t buffSize,
152  DtU32 flags = 0 );
153 
162  virtual DtInetSockRcvStatus recvToChain( DtInetBufferChain& packets,
163  DtU32 flags = 0 );
164 
167  virtual DtInetSockRcvStatus recvFrom( caddr_t buff, size_t buffSize,
168  DtInetEndpoint& src,
169  DtU32 flags = 0 );
170  virtual DtInetSockRcvStatus recvToChainFrom( DtInetBufferChain& packets,
171  DtInetEndpoint& src,
172  DtU32 flags = 0 );
174 
177  virtual bool isOk();
178 
180  virtual int descriptor() const;
181 
184  virtual bool setSocket( const DtInetEndpoint& dest, DtU16 localPort = 0,
185  DtInetDevice* hostIf = NULL,
186  DtU32 flags = DtDefaultSockOpts );
187 
192  virtual bool setNonBlockingOption( bool onOrOff );
193  virtual bool setSendBufferSize( DtU32 size );
194  virtual bool setReceiveBufferSize( DtU32 size );
195  virtual bool setBroadcastOption( bool onOrOff );
196  virtual bool setReuseAddressOption( bool onOrOff );
197  virtual bool setDoNotRouteOption( bool onOrOff );
198  virtual bool setSendLowWatermark( DtU32 size );
199  virtual bool setReceiveLowWatermark( DtU32 size );
200  virtual bool setMcastDevice( const DtInetAddr& devAddr );
201  virtual bool setMcastDevice( DtInetDevice* hostIf );
202 
203  virtual DtU32 getSendBufferSize();
204  virtual DtU32 getReceiveBufferSize();
205  virtual DtU32 getBytesAvailable();
206  virtual bool getBroadcastOption();
207  virtual bool getReuseAddressOption();
208  virtual bool getDoNotRouteOption();
209  virtual DtU32 getSendLowWatermark();
210  virtual DtU32 getReceiveLowWatermark();
212 
221  virtual bool joinMulticastGroup( const DtInetAddr& grpAddr,
222  DtInetDevice* device = NULL );
223  virtual bool joinMulticastGroup( const DtInetEndpoint& grpEndpoint,
224  DtInetDevice* device = NULL );
225  virtual bool dropMulticastGroup( const DtInetAddr& grpAddr,
226  DtInetDevice* device = NULL );
227  virtual bool dropMulticastGroup( const DtInetEndpoint& grpEndpoint,
228  DtInetDevice* device = NULL );
231  virtual bool setMcastTtlOption( DtU32 ttl );
233 
236  virtual void* udpSocket();
237 
238 protected:
239 
240 private:
242  DtInetUdpSocket( const DtInetUdpSocket& orig );
243 
245  DtInetUdpSocket& operator=(const DtInetUdpSocket& orig);
246 
248  friend class DtInetUdpSockPimpl;
249  DtInetUdpSockPimpl* myAsyncPimpl;
250 
251 protected:
252  void* myIoService;
253  void* myUdpSocket;
254 
257  // Since DtInetAddr can be either an IPv4 or IPv6 address the use of a
258  // std::map would be problematic since there's no easy way to compare
259  // addresses without defining a predicate functor.
260  typedef std::pair<DtInetAddr, DtInetAddr> DtInetMcastGroupIntfcBinding;
261  typedef std::vector<DtInetMcastGroupIntfcBinding> DtInetMcastGroupBindings;
263 
264 };
265 // end of class DtInetUdpSocket
266 
267 #ifdef DtUSE_UTILITIES_NAMESPACE
268 }
269 #endif
270 
271 
272 

Document ID: Generated on Wed Aug 14 15:35:11 EDT 2013 from SVN revision 130445
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)