1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 #include "IBluetoothSocket.hxx"
12 #include <osl/socket_decl.hxx>
15 #define MAX_LINE_LENGTH 20000
21 * [A wrapper for an osl StreamSocket to allow reading lines.]
23 * Currently wraps either an osl StreamSocket or a standard c socket,
24 * allowing reading and writing for our purposes. Should eventually be
25 * returned to being a StreamSocket wrapper if/when Bluetooth is
26 * integrated into osl Sockets.
28 class BufferedStreamSocket final
:
29 public IBluetoothSocket
,
30 private ::osl::StreamSocket
34 * Create a BufferedStreamSocket on top of an
37 explicit BufferedStreamSocket( const osl::StreamSocket
&aSocket
);
39 * Create a BufferedStreamSocket on top of a POSIX or WinSock socket.
41 explicit BufferedStreamSocket( int aSocket
);
42 BufferedStreamSocket( const BufferedStreamSocket
&aSocket
);
44 ~BufferedStreamSocket();
47 * Blocks until a line is read.
48 * Returns whatever the last call of recv returned, i.e. 0 or less
49 * if there was a problem in communications.
51 virtual sal_Int32
readLine( OString
& aLine
) override
;
53 virtual sal_Int32
write( const void* pBuffer
, sal_uInt32 n
) override
;
55 virtual void close() override
;
57 void getPeerAddr(osl::SocketAddr
&);
60 std::vector
<char> aBuffer
;
66 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */