diff options
Diffstat (limited to 'cpp/src/IceBT/StreamSocket.h')
-rw-r--r-- | cpp/src/IceBT/StreamSocket.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/cpp/src/IceBT/StreamSocket.h b/cpp/src/IceBT/StreamSocket.h new file mode 100644 index 00000000000..a11f1cd149d --- /dev/null +++ b/cpp/src/IceBT/StreamSocket.h @@ -0,0 +1,57 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef ICE_BT_STREAM_SOCKET_H +#define ICE_BT_STREAM_SOCKET_H + +#include <IceBT/Config.h> +#include <IceBT/InstanceF.h> + +#include <IceUtil/Shared.h> +#include <Ice/Network.h> +#include <Ice/Buffer.h> + +namespace IceBT +{ + +class StreamSocket : public IceInternal::NativeInfo +{ +public: + + StreamSocket(const InstancePtr&, SOCKET); + virtual ~StreamSocket(); + + size_t getSendPacketSize(size_t); + size_t getRecvPacketSize(size_t); + + void setBufferSize(int rcvSize, int sndSize); + + IceInternal::SocketOperation read(IceInternal::Buffer&); + IceInternal::SocketOperation write(IceInternal::Buffer&); + + ssize_t read(char*, size_t); + ssize_t write(const char*, size_t); + + void close(); + const std::string& toString() const; + +private: + + void init(); + + const InstancePtr _instance; + SocketAddress _addr; + std::string _desc; +}; +typedef IceUtil::Handle<StreamSocket> StreamSocketPtr; + +} + +#endif + |