22 #ifdef DtUSE_UTILITIES_NAMESPACE
23 namespace DtUSE_UTILITIES_NAMESPACE
33 #define DtRead ((DtU32) 0x01)
35 #define DtWrite ((DtU32) 0x02)
37 #define DtReadWrite (DtRead | DtWrite)
44 #define DtBindToDestAddr ((DtU32) 0x08)
49 #define DtQuiet ((DtU32) 0x10)
55 #define DtSockOptStrictMulticastBinding ((DtU32) 0x20)
58 #define DtSockOptNonBlocking ((DtU32) 0x40) // MSG_DONTWAIT not supported
61 #define DtSockOptNonBlocking ((DtU32) MSG_DONTWAIT)
65 #define DtSockOptNoDelay ((DtU32) 0x80)
73 #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)
80 #define DtSockOptAddrReuse ((DtU32) 0x400)
81 #define DtSockOptPortReuse ((DtU32) 0x800)
82 #define DtSockOptAllReuse (DtSockOptAddrReuse | DtSockOptPortReuse)
85 #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