mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 15:27:35 +00:00
SpiceAgent: Add support for reading chunks larger than 2048 bytes
This commit is contained in:
parent
3b6d63f723
commit
50a8db3922
3 changed files with 69 additions and 24 deletions
44
Userland/Services/SpiceAgent/ChunkHeader.h
Normal file
44
Userland/Services/SpiceAgent/ChunkHeader.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Caoimhe Byrne <caoimhebyrne06@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/Traits.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
namespace SpiceAgent {
|
||||
|
||||
class [[gnu::packed]] ChunkHeader {
|
||||
public:
|
||||
// Indicates where the message has come from
|
||||
enum class Port : u32 {
|
||||
Client = 1,
|
||||
|
||||
// There are currently no messages which are meant for the server, so all messages sent by the agent (us) with this port are discarded.
|
||||
Server
|
||||
};
|
||||
|
||||
ChunkHeader(Port port, u32 size)
|
||||
: m_port(port)
|
||||
, m_size(size)
|
||||
{
|
||||
}
|
||||
|
||||
Port port() const { return m_port; }
|
||||
u32 size() const { return m_size; }
|
||||
|
||||
private:
|
||||
Port m_port { Port::Client };
|
||||
u32 m_size { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template<>
|
||||
struct AK::Traits<SpiceAgent::ChunkHeader> : public AK::GenericTraits<SpiceAgent::ChunkHeader> {
|
||||
static constexpr bool is_trivially_serializable() { return true; }
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue