diff options
Diffstat (limited to 'cpp/src/Ice/UdpTransceiver.h')
-rw-r--r-- | cpp/src/Ice/UdpTransceiver.h | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/cpp/src/Ice/UdpTransceiver.h b/cpp/src/Ice/UdpTransceiver.h index df764db8b60..0a1fc7155ba 100644 --- a/cpp/src/Ice/UdpTransceiver.h +++ b/cpp/src/Ice/UdpTransceiver.h @@ -10,20 +10,17 @@ #ifndef ICE_UDP_TRANSCEIVER_H #define ICE_UDP_TRANSCEIVER_H -#ifdef __hpux -# define _XOPEN_SOURCE_EXTENDED -#endif - #include <Ice/InstanceF.h> #include <Ice/TraceLevelsF.h> #include <Ice/LoggerF.h> #include <Ice/StatsF.h> #include <Ice/Transceiver.h> #include <Ice/Protocol.h> +#include <Ice/Network.h> #include <IceUtil/Mutex.h> -#ifndef _WIN32 -# include <sys/socket.h> // For struct sockaddr_storage +#ifdef ICE_OS_WINRT +# include <deque> #endif namespace IceInternal @@ -31,8 +28,6 @@ namespace IceInternal class UdpEndpoint; -class SUdpTransceiver; - class UdpTransceiver : public Transceiver, public NativeInfo { enum State @@ -46,15 +41,17 @@ class UdpTransceiver : public Transceiver, public NativeInfo public: virtual NativeInfoPtr getNativeInfo(); -#ifdef ICE_USE_IOCP +#if defined(ICE_USE_IOCP) virtual AsyncInfo* getAsyncInfo(SocketOperation); +#elif defined(ICE_OS_WINRT) + virtual void setCompletedHandler(SocketOperationCompletedHandler^); #endif virtual SocketOperation initialize(); virtual void close(); virtual bool write(Buffer&); virtual bool read(Buffer&); -#ifdef ICE_USE_IOCP +#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) virtual bool startWrite(Buffer&); virtual void finishWrite(Buffer&); virtual void startRead(Buffer&); @@ -69,12 +66,19 @@ public: private: - UdpTransceiver(const InstancePtr&, const struct sockaddr_storage&, const std::string&, int); + UdpTransceiver(const InstancePtr&, const Address&, const std::string&, int); UdpTransceiver(const InstancePtr&, const std::string&, int, const std::string&, bool); + virtual ~UdpTransceiver(); void setBufSize(const InstancePtr&); +#ifdef ICE_OS_WINRT + bool checkIfErrorOrCompleted(SocketOperation, Windows::Foundation::IAsyncInfo^); + void appendMessage(Windows::Networking::Sockets::DatagramSocketMessageReceivedEventArgs^); + Windows::Networking::Sockets::DatagramSocketMessageReceivedEventArgs^ readMessage(); +#endif + friend class UdpEndpointI; friend class UdpConnector; @@ -82,24 +86,35 @@ private: const Ice::LoggerPtr _logger; const Ice::StatsPtr _stats; const bool _incoming; - const struct sockaddr_storage _addr; - struct sockaddr_storage _mcastAddr; - struct sockaddr_storage _peerAddr; - + + const Address _addr; + Address _mcastAddr; + Address _peerAddr; + State _state; int _rcvSize; int _sndSize; static const int _udpOverhead; static const int _maxPacketSize; -#ifdef ICE_USE_IOCP +#if defined(ICE_USE_IOCP) AsyncInfo _read; AsyncInfo _write; - struct sockaddr_storage _readAddr; + Address _readAddr; socklen_t _readAddrLen; +#elif defined(ICE_OS_WINRT) + AsyncInfo _write; + + Windows::Storage::Streams::DataWriter^ _writer; + + SocketOperationCompletedHandler^ _completedHandler; + Windows::Foundation::AsyncOperationCompletedHandler<unsigned int>^ _writeOperationCompletedHandler; + + IceUtil::Mutex _mutex; + bool _readPending; + std::deque<Windows::Networking::Sockets::DatagramSocketMessageReceivedEventArgs^> _received; #endif }; } - #endif |