22 #ifdef DtUSE_UTILITIES_NAMESPACE
23 namespace DtUSE_UTILITIES_NAMESPACE
33 #define DtRead ((DtU32) 0x01)
34 #define DtWrite ((DtU32) 0x02)
36 #define DtReadWrite (DtRead | DtWrite)
38 #define DtBindToDestAddr ((DtU32) 0x08)
45 #define DtQuiet ((DtU32) 0x10)
55 #define DtSockOptStrictMulticastBinding ((DtU32) 0x20)
58 #define DtSockOptNonBlocking ((DtU32) 0x40) // MSG_DONTWAIT not supported
61 #define DtSockOptNonBlocking ((DtU32) MSG_DONTWAIT)
63 #define DtSockOptNoDelay ((DtU32) 0x80)
66 #define DtSockAsyncRead ((DtU32) 0x100)
74 #define DtSockAsyncWrite ((DtU32) 0x200)
75 #define DtAsyncReadWrite (DtSockAsyncRead | DtSockAsyncWrite)
76 #define DtSockWriteable ((DtU32)DtWrite | DtSockAsyncWrite)
77 #define DtSockReadable ((DtU32)DtRead | DtSockAsyncRead)
78 #define DtSockOptAddrReuse ((DtU32) 0x400)
81 #define DtSockOptPortReuse ((DtU32) 0x800)
82 #define DtSockOptAllReuse (DtSockOptAddrReuse | DtSockOptPortReuse)
83 #define DtSockDisablePreProcCallbacks ((DtU32) 0x1000)
86 #define DtSockDisablePostProcCallbacks ((DtU32) 0x2000)
87 #define DtSockDisableCallbacks (DtSockDisablePreProcCallbacks || DtSockDisablePostProcCallbacks)
90 #define DtDefaultSockOpts (DtU32)(DtReadWrite | DtSockOptAllReuse | DtSockOptNoDelay)
231 virtual bool setLocalPort(
DtU16 port );
232 virtual DtU16 localPort()
const;
245 virtual bool bindToDevice(
const DtInetDevice* hostIf = NULL ) = 0;
258 virtual bool openSocket() = 0;
264 virtual bool closeSocket() = 0;
274 virtual bool connectToDestination() = 0;
284 virtual int send( caddr_t packet,
size_t size,
DtU32 flags = 0 ) = 0;
285 virtual int sendTo( caddr_t packet,
size_t size,
310 DtU32 flags = 0 ) = 0;
317 DtU32 flags = 0 ) = 0;
340 virtual DtU32 protocol()
const;
346 virtual unsigned descriptor()
const = 0;
367 virtual bool setNonBlockingOption(
bool onOrOff ) = 0;
368 virtual bool setReuseAddressOption(
bool onOrOff ) = 0;
369 virtual bool setSendBufferSize(
DtU32 size ) = 0;
370 virtual bool setReceiveBufferSize(
DtU32 size ) = 0;
371 virtual bool setDoNotRouteOption(
bool onOrOff ) = 0;
372 virtual bool setSendLowWatermark(
DtU32 size ) = 0;
373 virtual bool setReceiveLowWatermark(
DtU32 size ) = 0;
375 virtual bool isNonBlocking()
const;
376 virtual bool isNoDelay()
const;
377 virtual bool getReuseAddressOption() = 0;
378 virtual bool getDoNotRouteOption() = 0;
379 virtual DtU32 getSendBufferSize() = 0;
380 virtual DtU32 getReceiveBufferSize() = 0;
381 virtual DtU32 getBytesAvailable() = 0;
382 virtual DtU32 getSendLowWatermark() = 0;
383 virtual DtU32 getReceiveLowWatermark() = 0;
388 virtual bool isIPv4()
const;
389 virtual bool isIPv6()
const;
390 virtual bool isTcp()
const;
391 virtual bool isUdp()
const;
395 virtual int getLastError();
396 virtual DtString getLastErrorString();
397 virtual bool isErrorWouldBlockOrTryAgain();
398 virtual void clearError();
401 virtual int getTerminationCode();
402 virtual DtString getTerminationString();
410 virtual DtU64 totalBytesSent()
const;
411 virtual DtU64 totalPacketsSent()
const;
412 virtual DtU64 totalBytesReceived()
const;
413 virtual DtU64 totalPacketsReceived()
const;
416 virtual void clearStats();
438 inline HANDLE getReadHandle()
const {
return myInetReadHandle; }
454 HANDLE myInetReadHandle;
494 return mySentByteCount;
499 return mySentPacketCount;
504 return myReceivedByteCount;
509 return myReceivedPacketCount;
515 mySentPacketCount = 0;
516 myReceivedByteCount = 0;
517 myReceivedPacketCount = 0;
524 DtInetSockCallbackList::iterator iter = cbList.begin();
525 while ( !found && iter != cbList.end() )
527 if ( cb == iter->second->myCb )
530 cbList.erase( iter );
542 #ifdef DtUSE_UTILITIES_NAMESPACE
virtual DtU64 totalBytesReceived() const
Definition: vlInetSocket.h:502
int myCallOrder
Definition: vlInetSocket.h:190
bool myNoDelayEnabled
Definition: vlInetSocket.h:467
Definition: vlInetSocket.h:139
DtU32 myFlags
Definition: vlInetSocket.h:464
Definition: vlInetSocket.h:133
Contains the DtString class declaration.
DtInetSockRcvStatus
Socket state enumeration.
Definition: vlInetSocket.h:129
std::multimap< int, DtInetSocketProcessingCbInfo * > DtInetSockCallbackList
Socket state enumeration.
Definition: vlInetSocket.h:192
std::vector< DtInetBuffer * > DtInetBufferChain
Socket state enumeration.
Definition: vlInetSocket.h:105
Definition: vlInetSocket.h:147
DtInetSockCallbackList myPreSendCallbacks
Definition: vlInetSocket.h:478
Definition: vlInetSocket.h:119
This file contains the declaration of DtClock and DtTime.
unsigned long long DtU64
-------—— Network Layout for a long long (64 bytes unsigned)
Definition: vlMachineTypes.h:185
The DtInetSocket class provides a protocol independant, address family independant base class for TCP...
Definition: vlInetSocket.h:201
int myErrorCode
Definition: vlInetSocket.h:470
Definition: vlInetSocket.h:120
DtThreadSafe< std::deque< DtTime > > DtInetThreadSafeTSQueue
Socket state enumeration.
Definition: vlInetSocket.h:108
Definition: vlInetSocket.h:117
DtInetEndpoint myLocalEndpoint
Definition: vlInetSocket.h:457
void * myUsr
Definition: vlInetSocket.h:189
Definition: vlInetSocket.h:176
Definition: vlInetSocket.h:115
int recv(int s, char *buf, int bufLen, int flags)
Definition: vlInetSocket.h:136
DtInetSockFlushStatus
Socket state enumeration.
Definition: vlInetSocket.h:144
virtual DtTime receiveTime()
Definition: vlInetSocket.h:431
This file contains the declaration of the DtInetEndpoint class.
bool myStartImmediately
Definition: vlInetSocket.h:468
DtInetSocketProcessingCallback myCb
Definition: vlInetSocket.h:188
DtInetAddrFamily
Definition: vlInetAddrUtils.h:55
The DtInetEndpoint class provides a protocol independant, address family independent mechanism to rep...
Definition: vlInetEndpoint.h:33
#define DtDELETE(x)
DT_FD_ZERO_USES_MEMSET.
Definition: vlUtil.h:91
DtInetSockCallbackList myPreRecvCallbacks
Definition: vlInetSocket.h:476
DtInetSockProcessingType
Socket state enumeration.
Definition: vlInetSocket.h:153
std::pair< void *, DtInetBuffer * > DtInetBuffQueueEntry
Socket state enumeration.
Definition: vlInetSocket.h:106
DtString myTerminationString
Definition: vlInetSocket.h:474
DtInetSockState
Socket state enumeration.
Definition: vlInetSocket.h:112
Definition: vlInetSocket.h:123
This file declares useful defaults constants and static methods for IP address handling.
DtInetSockCallbackList myPostSendCallbacks
Definition: vlInetSocket.h:479
DtInetDevice * myHostIf
Definition: vlInetSocket.h:460
Definition: vlInetSocket.h:134
DtString myErrorString
Definition: vlInetSocket.h:471
int myTerminationCode
Definition: vlInetSocket.h:473
Definition: vlInetSocket.h:156
Definition: vlInetSocket.h:158
virtual bool findAndRemoveCallback(DtInetSockCallbackList &cbList, DtInetSocketProcessingCallback cb)
Definition: vlInetSocket.h:520
Definition: vlInetSocket.h:118
Definition: vlInetSocket.h:124
virtual void clearStats()
Reset all statistics.
Definition: vlInetSocket.h:512
DtInetSocketProcessingCbInfo(DtInetSocketProcessingCallback cb, void *usr, int order)
Definition: vlInetSocket.h:180
std::vector< char > DtInetBuffer
Socket state enumeration.
Definition: vlInetSocket.h:104
DtInetSockState myState
Definition: vlInetSocket.h:462
This file contains the declaration of the DtInetAddr class.
Definition: vlInetDevice.h:101
Definition: vlInetSocket.h:122
Definition: vlInetSocket.h:135
virtual DtU32 flags()
Get the flags for this socket.
Definition: vlInetSocket.h:349
DtTime myReceiveTime
Definition: vlInetSocket.h:488
Definition: vlInetSocket.h:155
Definition: vlInetSocket.h:131
virtual DtU64 totalPacketsSent() const
Definition: vlInetSocket.h:497
DtThreadSafe< std::deque< DtInetBuffQueueEntry > > DtInetThreadSafeQueue
Socket state enumeration.
Definition: vlInetSocket.h:107
This file contains the declaration of the DtInetDevice class.
Definition: vlInetSocket.h:116
virtual DtU64 totalBytesSent() const
Get traffic statistics.
Definition: vlInetSocket.h:492
unsigned short DtU16
A 16 bit unsigned integer value.
Definition: vlMachineTypes.h:140
int send(int s, char *buf, int bufLen, int flags)
Definition: vlInetSocket.h:146
virtual DtU64 totalPacketsReceived() const
Definition: vlInetSocket.h:507
DtU64 myReceivedByteCount
Definition: vlInetSocket.h:484
Definition: vlInetSocket.h:157
unsigned long DtU32
A 32 bit unsigned integer value.
Definition: vlMachineTypes.h:153
a thread safe interface to a value.
Definition: vlThreadSafe.h:104
DtU64 myReceivedPacketCount
Definition: vlInetSocket.h:485
Instances of DtString are used to represent strings.
Definition: vlString.h:29
int(* DtInetSocketProcessingCallback)(DtInetSocket *sock, int size, DtInetBufferChain &buffChain, DtInetEndpoint &ep, void *usr)
Callbacks Pre- / Post- processing callback prototype.
Definition: vlInetSocket.h:172
Defines a thread-safe template class for variables.
DtInetEndpoint myRemoteEndpoint
Definition: vlInetSocket.h:458
#define DtDefaultSockOpts
Marks the Socket as Writable.
Definition: vlInetSocket.h:90
Definition: vlInetSocket.h:114
Definition: vlInetSocket.h:148
Definition: vlInetSocket.h:132
bool myAsync
Definition: vlInetSocket.h:465
bool myNonBlockingEnabled
Definition: vlInetSocket.h:466
This file declares useful defaults constants and static methods employed with the networking abstract...
DtU64 mySentByteCount
Definition: vlInetSocket.h:482
#define DT_DLL_VLUTIL
Definition: vlMachineTypes.h:109
DtInetSockCallbackList myPostRecvCallbacks
Definition: vlInetSocket.h:477
DtU64 mySentPacketCount
Definition: vlInetSocket.h:483
Definition: vlInetSocket.h:121