21 #ifdef DtUSE_UTILITIES_NAMESPACE
22 namespace DtUSE_UTILITIES_NAMESPACE
32 #define DtRead ((DtU32) 0x01)
34 #define DtWrite ((DtU32) 0x02)
36 #define DtReadWrite (DtRead | DtWrite)
43 #define DtBindToDestAddr ((DtU32) 0x08)
48 #define DtQuiet ((DtU32) 0x10)
54 #define DtSockOptStrictMulticastBinding ((DtU32) 0x20)
57 #define DtSockOptNonBlocking ((DtU32) 0x40) // MSG_DONTWAIT not supported
60 #define DtSockOptNonBlocking ((DtU32) MSG_DONTWAIT)
64 #define DtSockOptNoDelay ((DtU32) 0x80)
72 #define DtSockAsyncRead ((DtU32) 0x100)
73 #define DtSockAsyncWrite ((DtU32) 0x200)
74 #define DtAsyncReadWrite (DtSockAsyncRead | DtSockAsyncWrite)
75 #define DtSockWriteable ((DtU32)DtWrite | DtSockAsyncWrite)
76 #define DtSockReadable ((DtU32)DtRead | DtSockAsyncRead)
79 #define DtSockOptAddrReuse ((DtU32) 0x400)
80 #define DtSockOptPortReuse ((DtU32) 0x800)
81 #define DtSockOptAllReuse (DtSockOptAddrReuse | DtSockOptPortReuse)
84 #define DtSockDisablePreProcCallbacks ((DtU32) 0x1000)
85 #define DtSockDisablePostProcCallbacks ((DtU32) 0x2000)
86 #define DtSockDisableCallbacks (DtSockDisablePreProcCallbacks || DtSockDisablePostProcCallbacks)
89 #define DtDefaultSockOpts (DtU32)(DtReadWrite | DtSockOptAllReuse | DtSockOptNoDelay)
229 virtual bool setLocalPort(
DtU16 port );
230 virtual DtU16 localPort()
const;
243 virtual bool bindToDevice(
const DtInetDevice* hostIf = NULL ) = 0;
256 virtual bool openSocket() = 0;
262 virtual bool closeSocket() = 0;
272 virtual bool connectToDestination() = 0;
282 virtual int send( caddr_t packet,
size_t size,
DtU32 flags = 0 ) = 0;
283 virtual int sendTo( caddr_t packet,
size_t size,
308 DtU32 flags = 0 ) = 0;
315 DtU32 flags = 0 ) = 0;
338 virtual DtU32 protocol()
const;
344 virtual int descriptor()
const = 0;
362 virtual bool setNonBlockingOption(
bool onOrOff ) = 0;
363 virtual bool setReuseAddressOption(
bool onOrOff ) = 0;
364 virtual bool setSendBufferSize(
DtU32 size ) = 0;
365 virtual bool setReceiveBufferSize(
DtU32 size ) = 0;
366 virtual bool setDoNotRouteOption(
bool onOrOff ) = 0;
367 virtual bool setSendLowWatermark(
DtU32 size ) = 0;
368 virtual bool setReceiveLowWatermark(
DtU32 size ) = 0;
370 virtual bool isNonBlocking()
const;
371 virtual bool isNoDelay()
const;
372 virtual bool getReuseAddressOption() = 0;
373 virtual bool getDoNotRouteOption() = 0;
374 virtual DtU32 getSendBufferSize() = 0;
375 virtual DtU32 getReceiveBufferSize() = 0;
376 virtual DtU32 getBytesAvailable() = 0;
377 virtual DtU32 getSendLowWatermark() = 0;
378 virtual DtU32 getReceiveLowWatermark() = 0;
383 virtual bool isIPv4()
const;
384 virtual bool isIPv6()
const;
385 virtual bool isTcp()
const;
386 virtual bool isUdp()
const;
390 virtual int getLastError();
391 virtual DtString getLastErrorString();
392 virtual bool isErrorWouldBlockOrTryAgain();
393 virtual void clearError();
396 virtual int getTerminationCode();
397 virtual DtString getTerminationString();
405 virtual DtU64 totalBytesSent()
const;
406 virtual DtU64 totalPacketsSent()
const;
407 virtual DtU64 totalBytesReceived()
const;
408 virtual DtU64 totalPacketsReceived()
const;
411 virtual void clearStats();
430 inline HANDLE getReadHandle()
const {
return myInetReadHandle; }
446 HANDLE myInetReadHandle;
484 return mySentByteCount;
489 return mySentPacketCount;
494 return myReceivedByteCount;
499 return myReceivedPacketCount;
505 mySentPacketCount = 0;
506 myReceivedByteCount = 0;
507 myReceivedPacketCount = 0;
514 DtInetSockCallbackList::iterator iter = cbList.begin();
515 while ( !found && iter != cbList.end() )
517 if ( cb == iter->second->myCb )
520 cbList.erase( iter );
532 #ifdef DtUSE_UTILITIES_NAMESPACE