Deskflow
1.26.0.418
Keyboard and mouse sharing utility
Toggle main menu visibility
Loading...
Searching...
No Matches
ProtocolUtil.h
Go to the documentation of this file.
1
/*
2
* Deskflow -- mouse and keyboard sharing utility
3
* SPDX-FileCopyrightText: (C) 2026 Deskflow Developers
4
* SPDX-FileCopyrightText: (C) 2012 - 2016 Synergy App Ltd
5
* SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman
6
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
7
*/
8
9
#pragma once
10
11
#include "
io/IOException.h
"
12
13
#include <cstdint>
14
#include <stdarg.h>
15
#include <vector>
16
17
namespace
deskflow
{
18
class
IStream
;
19
}
20
22
26
class
ProtocolUtil
27
{
28
public
:
30
47
static
void
writef
(
deskflow::IStream
*,
const
char
*fmt, ...);
48
50
65
static
bool
readf
(
deskflow::IStream
*,
const
char
*fmt, ...);
66
67
private
:
68
static
void
vwritef(
deskflow::IStream
*,
const
char
*fmt, uint32_t size, va_list);
69
static
void
vreadf(
deskflow::IStream
*,
const
char
*fmt, va_list);
70
71
static
uint32_t getLength(
const
char
*fmt, va_list);
72
static
void
writef
(std::vector<uint8_t> &,
const
char
*fmt, va_list);
73
static
uint32_t eatLength(
const
char
**fmt);
74
static
void
read(
deskflow::IStream
*,
void
*, uint32_t);
75
79
static
uint8_t read1ByteInt(
deskflow::IStream
*stream);
80
static
uint16_t read2BytesInt(
deskflow::IStream
*stream);
81
static
uint32_t read4BytesInt(
deskflow::IStream
*stream);
82
86
static
void
readVector1ByteInt(
deskflow::IStream
*, std::vector<uint8_t> &);
87
static
void
readVector2BytesInt(
deskflow::IStream
*, std::vector<uint16_t> &);
88
static
void
readVector4BytesInt(
deskflow::IStream
*, std::vector<uint32_t> &);
89
static
uint32_t readVectorSize(
deskflow::IStream
*stream);
90
94
static
void
readBytes(
deskflow::IStream
*, uint32_t, std::string *);
95
};
96
98
102
class
XIOReadMismatch
:
public
IOException
103
{
104
public
:
105
// BaseException overrides
106
QString
getWhat
()
const
throw
()
override
;
107
};
IOException.h
IOException
The IOException class Generic i/o exception class.
Definition
IOException.h:17
ProtocolUtil
Deskflow protocol utilities.
Definition
ProtocolUtil.h:27
ProtocolUtil::writef
static void writef(deskflow::IStream *, const char *fmt,...)
Write formatted data.
Definition
ProtocolUtil.cpp:70
ProtocolUtil::readf
static bool readf(deskflow::IStream *, const char *fmt,...)
Read formatted data.
Definition
ProtocolUtil.cpp:85
XIOReadMismatch
Mismatched read exception.
Definition
ProtocolUtil.h:103
XIOReadMismatch::getWhat
QString getWhat() const override
Get a human readable string describing the exception.
Definition
ProtocolUtil.cpp:571
deskflow::IStream
Bidirectional stream interface.
Definition
IStream.h:22
deskflow
Definition
DaemonApp.h:18
src
lib
deskflow
ProtocolUtil.h
Generated by
1.18.0