VR-Link API Documentation for HLA 1516
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes

DtSocket provides a low level interface for packet I/O with VR-Link applications. More...

+ Inheritance diagram for DtSocket:
+ Collaboration diagram for DtSocket:

List of all members.

Public Member Functions

 DtSocket ()
 Default constructor.
virtual ~DtSocket ()
 Default Destructor.
virtual int DtSend (caddr_t packet, size_t size, DtIpv4Addr addr=DtUSE_DEFAULT_IP_ADDR)
 DtSend is called when someone wants to send a packet to this "Socket", in other words, all outgoing messages are passed to this socket via DtSend().
virtual int sendTo (caddr_t packet, size_t size, DtIpv4Addr addr=DtUSE_DEFAULT_IP_ADDR)=0
 sendTo is a pure virtual function which subclasses should impliment to take packets and place them on a network interface.
virtual int DtRecv (caddr_t *buffptr, int *status=0)=0
 DtReceiv is he function which VR-Link uses to read packets from the socket.
virtual int DtRecv (caddr_t buff, size_t)=0
caddr_t DtRecv ()
virtual DtFlushStatus flush ()
 Send buffered messages.
virtual DtFlushStatus flush (long &byteCount)
 Send buffered messages.
virtual void setReceiveBufferSize (int newsize)
 Change the socket's receive buffer size that the OS uses to collect incoming data from the network.
virtual void setSendBufferSize (int newsize)
 Change the socket's send buffer size that the OS uses when writing data to the network.
virtual void setBundling (int maxSize)
virtual int isBundling ()
virtual void setUnbundling (int)
virtual DtIpv4Addr lastSourceInetAddr ()
virtual int DtReportPktsRcvd (void)
virtual void DtBecomeNonBlocking (void)
virtual void notifyMe ()
virtual int listenToMulticastGroup (DtIpv4Addr addr, DtIpv4Addr netInterface=DtUSE_DEFAULT_IP_ADDR)
virtual int dropMulticastGroup (DtIpv4Addr addr, DtIpv4Addr netInterface=DtUSE_DEFAULT_IP_ADDR)
virtual int setMcastTtl (int)
virtual void setMcastDevice (DtIpv4Addr)
virtual DtFilterTestexerciseId ()
virtual DtFilterTestprotocolVersion ()
virtual DtFilterTestpduKind ()
virtual DtFilterTestipAddr ()
virtual int readFd ()
 Get the file descriptor for reading and writing to this socket.
virtual int writeFd ()
virtual bool isOk () const

Static Public Member Functions

static void initializeNetwork ()
static void setQuietSockets (bool quietVal)
 These functions determine whether a socket will print messages, informative or error.
static bool areQuietSockets ()

Public Attributes

int myBlockingFlag
int pkts_rcvd

Protected Types

typedef std::vector< char > Buffer
typedef std::map< DtIpv4Addr,
Buffer
BufferMap

Protected Member Functions

virtual bool accept (char *buf, DtIpv4Addr iaddr)

Static Protected Member Functions

static int getConfig (const char *device, int sock, ifconf *ifc)
 Get ifconfig information by filling in ifc.

Protected Attributes

BufferMap myBufferMap
int myBundlingFlag
int myMaxBundleSize
int mySockFd

Static Protected Attributes

static bool theAreQuietSockets
 Should a socket print messages, informative or error.

Private Member Functions

 DtSocket (const DtSocket &)
 Not Implemented.
DtSocketoperator= (const DtSocket &)
 Not Implemented.

Private Attributes

DtFilterTest myVersionFilter
DtFilterTest myExerciseFilter
DtFilterTest myKindFilter
DtFilterTest myAddrFilter

Detailed Description

DtSocket provides a low level interface for packet I/O with VR-Link applications.

Users should not that this class is poorly named, as no socket is opened or used by DtSocket. Instead DtSocket provides an interface for other "Socket" classes such as DtTcpSocket and DtNetSocket which actualy open Sockets.

Deprecated:
This class is replaced by DtInetSocket as of VR-Link 3.13

Member Typedef Documentation

typedef std::vector<char> DtSocket::Buffer [protected]
typedef std::map<DtIpv4Addr, Buffer> DtSocket::BufferMap [protected]

Constructor & Destructor Documentation

Default constructor.

virtual DtSocket::~DtSocket ( ) [virtual]

Default Destructor.

DtSocket::DtSocket ( const DtSocket ) [private]

Not Implemented.


Member Function Documentation

virtual bool DtSocket::accept ( char *  buf,
DtIpv4Addr  iaddr 
) [protected, virtual]
static bool DtSocket::areQuietSockets ( ) [static]
virtual int DtSocket::dropMulticastGroup ( DtIpv4Addr  addr,
DtIpv4Addr  netInterface = DtUSE_DEFAULT_IP_ADDR 
) [virtual]

Reimplemented in DtNetSocket.

virtual void DtSocket::DtBecomeNonBlocking ( void  ) [virtual]
virtual int DtSocket::DtRecv ( caddr_t *  buffptr,
int *  status = 0 
) [pure virtual]

DtReceiv is he function which VR-Link uses to read packets from the socket.

Users who wish to provide another mechanisim, such as shared memory, or loopback, will need to impliment or override these functions to return new packets. Depending on the implementation in derived DtSockets, one of the forms of DtRecv may be faster than the other.

DtRecv has an optional status argument that could more elegantly be implemented as different return codes, but this would break older code.

Note:
If a derived class complains "... hides virtual DtRecv() ...", make sure you have BOTH overloads of DtRecv declared and defined in the subclass.

Implemented in DtNetSocket, DtClientSocket, DtTcpSocket, DtQueueSocket, and DtSocketPairSocket.

virtual int DtSocket::DtRecv ( caddr_t  buff,
size_t   
) [pure virtual]
See also:
DtRecv(caddr_t *buffptr, int *status=0)

Implemented in DtNetSocket, DtTcpSocket, DtClientSocket, DtQueueSocket, and DtSocketPairSocket.

caddr_t DtSocket::DtRecv ( )
See also:
DtRecv(caddr_t *buffptr, int *status=0)
virtual int DtSocket::DtReportPktsRcvd ( void  ) [virtual]
virtual int DtSocket::DtSend ( caddr_t  packet,
size_t  size,
DtIpv4Addr  addr = DtUSE_DEFAULT_IP_ADDR 
) [virtual]

DtSend is called when someone wants to send a packet to this "Socket", in other words, all outgoing messages are passed to this socket via DtSend().

The name DtSend does not match the MAK coding standards but is preserved for historical reasions. Users should not override this function. Rather, users wishing to impliment new socket functionaltity should override sendTo(). If bundling is set then packets are bundled in this function.

See also:
sendTo

Reimplemented in DtGroupSocket.

virtual DtFilterTest* DtSocket::exerciseId ( ) [virtual]
virtual DtFlushStatus DtSocket::flush ( ) [virtual]

Send buffered messages.

Returns the status indicating error, flush is complete or incomplete.

Reimplemented in DtTcpSocket.

virtual DtFlushStatus DtSocket::flush ( long &  byteCount) [virtual]

Send buffered messages.

Number of flushed bytes returned in provided parameter. Returns the status indicating error, flush is complete or incomplete.

Reimplemented in DtTcpSocket.

static int DtSocket::getConfig ( const char *  device,
int  sock,
ifconf *  ifc 
) [static, protected]

Get ifconfig information by filling in ifc.

Returns 1/0 for success/failure.

static void DtSocket::initializeNetwork ( ) [static]
virtual DtFilterTest* DtSocket::ipAddr ( ) [virtual]
virtual int DtSocket::isBundling ( ) [virtual]
virtual bool DtSocket::isOk ( ) const [virtual]

Reimplemented in DtNetSocket, DtTcpSocket, and DtClientSocket.

Reimplemented in DtNetSocket, and DtClientSocket.

virtual int DtSocket::listenToMulticastGroup ( DtIpv4Addr  addr,
DtIpv4Addr  netInterface = DtUSE_DEFAULT_IP_ADDR 
) [virtual]

Reimplemented in DtNetSocket.

virtual void DtSocket::notifyMe ( ) [virtual]

Reimplemented in DtClientSocket.

DtSocket& DtSocket::operator= ( const DtSocket ) [private]

Not Implemented.

virtual DtFilterTest* DtSocket::pduKind ( ) [virtual]
virtual DtFilterTest* DtSocket::protocolVersion ( ) [virtual]
virtual int DtSocket::readFd ( ) [virtual]

Get the file descriptor for reading and writing to this socket.

NOTE: Not all DtSocket have associated file descriptors. Those that do not will have readFd()/writeFd() return -1.

Reimplemented in DtNetSocket, DtClientSocket, and DtSocketPairSocket.

virtual int DtSocket::sendTo ( caddr_t  packet,
size_t  size,
DtIpv4Addr  addr = DtUSE_DEFAULT_IP_ADDR 
) [pure virtual]

sendTo is a pure virtual function which subclasses should impliment to take packets and place them on a network interface.

This function is called by DtSend which deals with bundling.

Implemented in DtNetSocket, DtAsyncNetSocket, DtClientSocket, DtTcpSocket, DtQueueSocket, and DtSocketPairSocket.

virtual void DtSocket::setBundling ( int  maxSize) [virtual]

Reimplemented in DtNetSocket.

Referenced by DtNetSocket::setBundling().

virtual void DtSocket::setMcastDevice ( DtIpv4Addr  ) [virtual]

Reimplemented in DtNetSocket.

virtual int DtSocket::setMcastTtl ( int  ) [virtual]

Reimplemented in DtNetSocket, and DtClientSocket.

static void DtSocket::setQuietSockets ( bool  quietVal) [static]

These functions determine whether a socket will print messages, informative or error.

virtual void DtSocket::setReceiveBufferSize ( int  newsize) [virtual]

Change the socket's receive buffer size that the OS uses to collect incoming data from the network.

Call this method if you find that you are dropping pkts even when the network load is small.

virtual void DtSocket::setSendBufferSize ( int  newsize) [virtual]

Change the socket's send buffer size that the OS uses when writing data to the network.

Call this method if your application may send very large packets ( generally the default is > 8 kbytes ).

virtual void DtSocket::setUnbundling ( int  ) [virtual]

Reimplemented in DtNetSocket, and DtClientSocket.

virtual int DtSocket::writeFd ( ) [virtual]

Member Data Documentation

int DtSocket::myBundlingFlag [protected]
int DtSocket::myMaxBundleSize [protected]
int DtSocket::mySockFd [protected]
bool DtSocket::theAreQuietSockets [static, protected]

Should a socket print messages, informative or error.


The documentation for this class was generated from the following file:

Document ID: Generated on Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)