Skip to content

Commit 6355c3c

Browse files
committed
feat(ffi): add support for DVC pipe proxy
1 parent 56d48e1 commit 6355c3c

29 files changed

+1055
-21
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ffi/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ diplomat = "0.7"
1616
diplomat-runtime = "0.7"
1717
ironrdp = { path = "../crates/ironrdp", features = ["session", "connector", "dvc", "svc", "rdpdr", "rdpsnd", "graphics", "input", "cliprdr", "displaycontrol"] }
1818
ironrdp-cliprdr-native.path = "../crates/ironrdp-cliprdr-native"
19+
ironrdp-dvc-pipe-proxy.path = "../crates/ironrdp-dvc-pipe-proxy"
1920
ironrdp-core = { path = "../crates/ironrdp-core", features = ["alloc"] }
2021
sspi = { version = "0.16", features = ["network_client"] }
2122
thiserror = "2"

ffi/dotnet/Devolutions.IronRdp/Generated/ActiveStage.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,34 @@ public VecU8 SubmitClipboardFormatData(FormatDataResponse formatDataResponse)
217217
}
218218
}
219219

220+
/// <exception cref="IronRdpException"></exception>
221+
/// <returns>
222+
/// A <c>VecU8</c> allocated on Rust side.
223+
/// </returns>
224+
public VecU8 SendDvcPipeProxyMessage(DvcPipeProxyMessage message)
225+
{
226+
unsafe
227+
{
228+
if (_inner == null)
229+
{
230+
throw new ObjectDisposedException("ActiveStage");
231+
}
232+
Raw.DvcPipeProxyMessage* messageRaw;
233+
messageRaw = message.AsFFI();
234+
if (messageRaw == null)
235+
{
236+
throw new ObjectDisposedException("DvcPipeProxyMessage");
237+
}
238+
Raw.SessionFfiResultBoxVecU8BoxIronRdpError result = Raw.ActiveStage.SendDvcPipeProxyMessage(_inner, messageRaw);
239+
if (!result.isOk)
240+
{
241+
throw new IronRdpException(new IronRdpError(result.Err));
242+
}
243+
Raw.VecU8* retVal = result.Ok;
244+
return new VecU8(retVal);
245+
}
246+
}
247+
220248
/// <exception cref="IronRdpException"></exception>
221249
/// <returns>
222250
/// A <c>ActiveStageOutputIterator</c> allocated on Rust side.

ffi/dotnet/Devolutions.IronRdp/Generated/ClientConnector.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,29 @@ public void WithDynamicChannelDisplayControl()
128128
}
129129
}
130130

131+
/// <exception cref="IronRdpException"></exception>
132+
public void WithDynamicChannelPipeProxy(DvcPipeProxyConfig config)
133+
{
134+
unsafe
135+
{
136+
if (_inner == null)
137+
{
138+
throw new ObjectDisposedException("ClientConnector");
139+
}
140+
Raw.DvcPipeProxyConfig* configRaw;
141+
configRaw = config.AsFFI();
142+
if (configRaw == null)
143+
{
144+
throw new ObjectDisposedException("DvcPipeProxyConfig");
145+
}
146+
Raw.ConnectorFfiResultVoidBoxIronRdpError result = Raw.ClientConnector.WithDynamicChannelPipeProxy(_inner, configRaw);
147+
if (!result.isOk)
148+
{
149+
throw new IronRdpException(new IronRdpError(result.Err));
150+
}
151+
}
152+
}
153+
131154
/// <exception cref="IronRdpException"></exception>
132155
public bool ShouldPerformSecurityUpgrade()
133156
{

ffi/dotnet/Devolutions.IronRdp/Generated/Config.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ public partial class Config: IDisposable
1515
{
1616
private unsafe Raw.Config* _inner;
1717

18+
public DvcPipeProxyConfig? DvcPipeProxy
19+
{
20+
get
21+
{
22+
return GetDvcPipeProxy();
23+
}
24+
}
25+
1826
/// <summary>
1927
/// Creates a managed <c>Config</c> from a raw handle.
2028
/// </summary>
@@ -41,6 +49,26 @@ public static ConfigBuilder GetBuilder()
4149
}
4250
}
4351

52+
/// <returns>
53+
/// A <c>DvcPipeProxyConfig</c> allocated on Rust side.
54+
/// </returns>
55+
public DvcPipeProxyConfig? GetDvcPipeProxy()
56+
{
57+
unsafe
58+
{
59+
if (_inner == null)
60+
{
61+
throw new ObjectDisposedException("Config");
62+
}
63+
Raw.DvcPipeProxyConfig* retVal = Raw.Config.GetDvcPipeProxy(_inner);
64+
if (retVal == null)
65+
{
66+
return null;
67+
}
68+
return new DvcPipeProxyConfig(retVal);
69+
}
70+
}
71+
4472
/// <summary>
4573
/// Returns the underlying raw handle.
4674
/// </summary>

ffi/dotnet/Devolutions.IronRdp/Generated/ConfigBuilder.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ public string Domain
7171
}
7272
}
7373

74+
public DvcPipeProxyConfig DvcPipeProxy
75+
{
76+
set
77+
{
78+
SetDvcPipeProxy(value);
79+
}
80+
}
81+
7482
public bool EnableCredssp
7583
{
7684
set
@@ -454,6 +462,24 @@ public void SetPointerSoftwareRendering(bool pointerSoftwareRendering)
454462
}
455463
}
456464

465+
public void SetDvcPipeProxy(DvcPipeProxyConfig dvcPipeProxy)
466+
{
467+
unsafe
468+
{
469+
if (_inner == null)
470+
{
471+
throw new ObjectDisposedException("ConfigBuilder");
472+
}
473+
Raw.DvcPipeProxyConfig* dvcPipeProxyRaw;
474+
dvcPipeProxyRaw = dvcPipeProxy.AsFFI();
475+
if (dvcPipeProxyRaw == null)
476+
{
477+
throw new ObjectDisposedException("DvcPipeProxyConfig");
478+
}
479+
Raw.ConfigBuilder.SetDvcPipeProxy(_inner, dvcPipeProxyRaw);
480+
}
481+
}
482+
457483
/// <exception cref="IronRdpException"></exception>
458484
/// <returns>
459485
/// A <c>Config</c> allocated on Rust side.
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
// <auto-generated/> by Diplomat
2+
3+
#pragma warning disable 0105
4+
using System;
5+
using System.Runtime.InteropServices;
6+
7+
using Devolutions.IronRdp.Diplomat;
8+
#pragma warning restore 0105
9+
10+
namespace Devolutions.IronRdp;
11+
12+
#nullable enable
13+
14+
public partial class DvcPipeProxyConfig: IDisposable
15+
{
16+
private unsafe Raw.DvcPipeProxyConfig* _inner;
17+
18+
public DvcPipeProxyMessageSink MessageSink
19+
{
20+
get
21+
{
22+
return GetMessageSink();
23+
}
24+
}
25+
26+
/// <summary>
27+
/// Creates a managed <c>DvcPipeProxyConfig</c> from a raw handle.
28+
/// </summary>
29+
/// <remarks>
30+
/// Safety: you should not build two managed objects using the same raw handle (may causes use-after-free and double-free).
31+
/// <br/>
32+
/// This constructor assumes the raw struct is allocated on Rust side.
33+
/// If implemented, the custom Drop implementation on Rust side WILL run on destruction.
34+
/// </remarks>
35+
public unsafe DvcPipeProxyConfig(Raw.DvcPipeProxyConfig* handle)
36+
{
37+
_inner = handle;
38+
}
39+
40+
/// <returns>
41+
/// A <c>DvcPipeProxyConfig</c> allocated on Rust side.
42+
/// </returns>
43+
public static DvcPipeProxyConfig New(DvcPipeProxyMessageSink messageSink)
44+
{
45+
unsafe
46+
{
47+
Raw.DvcPipeProxyMessageSink* messageSinkRaw;
48+
messageSinkRaw = messageSink.AsFFI();
49+
if (messageSinkRaw == null)
50+
{
51+
throw new ObjectDisposedException("DvcPipeProxyMessageSink");
52+
}
53+
Raw.DvcPipeProxyConfig* retVal = Raw.DvcPipeProxyConfig.New(messageSinkRaw);
54+
return new DvcPipeProxyConfig(retVal);
55+
}
56+
}
57+
58+
public void AddPipeProxy(DvcPipeProxyDescriptor descriptor)
59+
{
60+
unsafe
61+
{
62+
if (_inner == null)
63+
{
64+
throw new ObjectDisposedException("DvcPipeProxyConfig");
65+
}
66+
Raw.DvcPipeProxyDescriptor* descriptorRaw;
67+
descriptorRaw = descriptor.AsFFI();
68+
if (descriptorRaw == null)
69+
{
70+
throw new ObjectDisposedException("DvcPipeProxyDescriptor");
71+
}
72+
Raw.DvcPipeProxyConfig.AddPipeProxy(_inner, descriptorRaw);
73+
}
74+
}
75+
76+
/// <returns>
77+
/// A <c>DvcPipeProxyMessageSink</c> allocated on Rust side.
78+
/// </returns>
79+
public DvcPipeProxyMessageSink GetMessageSink()
80+
{
81+
unsafe
82+
{
83+
if (_inner == null)
84+
{
85+
throw new ObjectDisposedException("DvcPipeProxyConfig");
86+
}
87+
Raw.DvcPipeProxyMessageSink* retVal = Raw.DvcPipeProxyConfig.GetMessageSink(_inner);
88+
return new DvcPipeProxyMessageSink(retVal);
89+
}
90+
}
91+
92+
/// <summary>
93+
/// Returns the underlying raw handle.
94+
/// </summary>
95+
public unsafe Raw.DvcPipeProxyConfig* AsFFI()
96+
{
97+
return _inner;
98+
}
99+
100+
/// <summary>
101+
/// Destroys the underlying object immediately.
102+
/// </summary>
103+
public void Dispose()
104+
{
105+
unsafe
106+
{
107+
if (_inner == null)
108+
{
109+
return;
110+
}
111+
112+
Raw.DvcPipeProxyConfig.Destroy(_inner);
113+
_inner = null;
114+
115+
GC.SuppressFinalize(this);
116+
}
117+
}
118+
119+
~DvcPipeProxyConfig()
120+
{
121+
Dispose();
122+
}
123+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
// <auto-generated/> by Diplomat
2+
3+
#pragma warning disable 0105
4+
using System;
5+
using System.Runtime.InteropServices;
6+
7+
using Devolutions.IronRdp.Diplomat;
8+
#pragma warning restore 0105
9+
10+
namespace Devolutions.IronRdp;
11+
12+
#nullable enable
13+
14+
public partial class DvcPipeProxyDescriptor: IDisposable
15+
{
16+
private unsafe Raw.DvcPipeProxyDescriptor* _inner;
17+
18+
/// <summary>
19+
/// Creates a managed <c>DvcPipeProxyDescriptor</c> from a raw handle.
20+
/// </summary>
21+
/// <remarks>
22+
/// Safety: you should not build two managed objects using the same raw handle (may causes use-after-free and double-free).
23+
/// <br/>
24+
/// This constructor assumes the raw struct is allocated on Rust side.
25+
/// If implemented, the custom Drop implementation on Rust side WILL run on destruction.
26+
/// </remarks>
27+
public unsafe DvcPipeProxyDescriptor(Raw.DvcPipeProxyDescriptor* handle)
28+
{
29+
_inner = handle;
30+
}
31+
32+
/// <returns>
33+
/// A <c>DvcPipeProxyDescriptor</c> allocated on Rust side.
34+
/// </returns>
35+
public static DvcPipeProxyDescriptor New(string channelName, string pipeName)
36+
{
37+
unsafe
38+
{
39+
byte[] channelNameBuf = DiplomatUtils.StringToUtf8(channelName);
40+
byte[] pipeNameBuf = DiplomatUtils.StringToUtf8(pipeName);
41+
nuint channelNameBufLength = (nuint)channelNameBuf.Length;
42+
nuint pipeNameBufLength = (nuint)pipeNameBuf.Length;
43+
fixed (byte* channelNameBufPtr = channelNameBuf)
44+
{
45+
fixed (byte* pipeNameBufPtr = pipeNameBuf)
46+
{
47+
Raw.DvcPipeProxyDescriptor* retVal = Raw.DvcPipeProxyDescriptor.New(channelNameBufPtr, channelNameBufLength, pipeNameBufPtr, pipeNameBufLength);
48+
return new DvcPipeProxyDescriptor(retVal);
49+
}
50+
}
51+
}
52+
}
53+
54+
/// <summary>
55+
/// Returns the underlying raw handle.
56+
/// </summary>
57+
public unsafe Raw.DvcPipeProxyDescriptor* AsFFI()
58+
{
59+
return _inner;
60+
}
61+
62+
/// <summary>
63+
/// Destroys the underlying object immediately.
64+
/// </summary>
65+
public void Dispose()
66+
{
67+
unsafe
68+
{
69+
if (_inner == null)
70+
{
71+
return;
72+
}
73+
74+
Raw.DvcPipeProxyDescriptor.Destroy(_inner);
75+
_inner = null;
76+
77+
GC.SuppressFinalize(this);
78+
}
79+
}
80+
81+
~DvcPipeProxyDescriptor()
82+
{
83+
Dispose();
84+
}
85+
}

0 commit comments

Comments
 (0)