mirror of
https://github.com/Devolutions/IronRDP.git
synced 2025-08-04 15:18:17 +00:00
feat(server): implement some Encoder Debug
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
c2164716c3
commit
137d91ae7a
1 changed files with 26 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
|||
mod bitmap;
|
||||
pub(crate) mod rfx;
|
||||
|
||||
use core::cmp;
|
||||
use core::{cmp, fmt};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use ironrdp_core::{Encode, WriteCursor};
|
||||
|
@ -32,6 +32,14 @@ pub(crate) struct UpdateEncoder {
|
|||
bitmap_updater: BitmapUpdater,
|
||||
}
|
||||
|
||||
impl fmt::Debug for UpdateEncoder {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("UpdateEncoder")
|
||||
.field("bitmap_update", &self.bitmap_updater)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl UpdateEncoder {
|
||||
pub(crate) fn new(surface_flags: CmdFlags, remotefx: Option<(EntropyBits, u8)>) -> Self {
|
||||
let pdu_encoder = PduEncoder::new();
|
||||
|
@ -118,6 +126,7 @@ impl UpdateEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
enum BitmapUpdater {
|
||||
None(NoneHandler),
|
||||
Bitmap(BitmapHandler),
|
||||
|
@ -138,6 +147,7 @@ trait BitmapUpdateHandler {
|
|||
fn handle<'a>(&mut self, bitmap: BitmapUpdate, encoder: &'a mut PduEncoder) -> Result<UpdateFragmenter<'a>>;
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct NoneHandler;
|
||||
|
||||
impl BitmapUpdateHandler for NoneHandler {
|
||||
|
@ -156,6 +166,12 @@ struct BitmapHandler {
|
|||
bitmap: BitmapEncoder,
|
||||
}
|
||||
|
||||
impl fmt::Debug for BitmapHandler {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("BitmapHandler").finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl BitmapHandler {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
|
@ -184,6 +200,7 @@ impl BitmapUpdateHandler for BitmapHandler {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct RemoteFxHandler {
|
||||
remotefx: RfxEncoder,
|
||||
codec_id: u8,
|
||||
|
@ -284,6 +301,14 @@ pub(crate) struct UpdateFragmenter<'a> {
|
|||
data: &'a [u8],
|
||||
}
|
||||
|
||||
impl fmt::Debug for UpdateFragmenter<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("UpdateFragmenter")
|
||||
.field("len", &self.data.len())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> UpdateFragmenter<'a> {
|
||||
pub(crate) fn new(code: UpdateCode, data: &'a [u8]) -> Self {
|
||||
Self { code, index: 0, data }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue