Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
IDataSocket.h
Go to the documentation of this file.
1/*
2 * Deskflow -- mouse and keyboard sharing utility
3 * SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
4 * SPDX-FileCopyrightText: (C) 2004 Chris Schoeneman
5 * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
6 */
7
8#pragma once
9
10#include "base/EventTypes.h"
11#include "io/IStream.h"
12#include "net/ISocket.h"
13
15
20{
21public:
23 {
24 public:
25 explicit ConnectionFailedInfo(const char *what) : m_what(what)
26 {
27 // do nothing
28 }
29 std::string m_what;
30 };
31
32 explicit IDataSocket(const IEventQueue *events)
33 {
34 // do nothing
35 }
36
38
39
41
47 virtual void connect(const NetworkAddress &) = 0;
48
50
51 // ISocket overrides
52 // close() and getEventTarget() aren't pure to work around a bug
53 // in VC++6. it claims the methods are unused locals and warns
54 // that it's removing them. it's presumably tickled by inheriting
55 // methods with identical signatures from both superclasses.
56 void bind(const NetworkAddress &) override = 0;
57 void close() override;
58 void *getEventTarget() const override;
59
60 // IStream overrides
61 uint32_t read(void *buffer, uint32_t n) override = 0;
62 void write(const void *buffer, uint32_t n) override = 0;
63 void flush() override = 0;
64 void shutdownInput() override = 0;
65 void shutdownOutput() override = 0;
66 bool isReady() const override = 0;
67 uint32_t getSize() const override = 0;
68 virtual bool isFatal() const = 0;
69};
ConnectionFailedInfo(const char *what)
Definition IDataSocket.h:25
std::string m_what
Definition IDataSocket.h:29
void bind(const NetworkAddress &) override=0
Bind socket to address.
uint32_t read(void *buffer, uint32_t n) override=0
Read from stream.
void flush() override=0
Flush the stream.
virtual void connect(const NetworkAddress &)=0
Connect socket.
void close() override
Close socket.
Definition IDataSocket.cpp:15
virtual bool isFatal() const =0
void write(const void *buffer, uint32_t n) override=0
Write to stream.
void shutdownInput() override=0
Shutdown input.
IDataSocket(const IEventQueue *events)
Definition IDataSocket.h:32
bool isReady() const override=0
Test if read() will succeed.
void shutdownOutput() override=0
Shutdown output.
void * getEventTarget() const override
Get event target.
Definition IDataSocket.cpp:21
uint32_t getSize() const override=0
Get bytes available to read.
Event queue interface.
Definition IEventQueue.h:32
Generic socket interface.
Definition ISocket.h:22
Network address type.
Definition NetworkAddress.h:18
Bidirectional stream interface.
Definition IStream.h:24