1use crate::VersionInfo;
5use bitfield_struct::bitfield;
6use hvdef::Vtl;
7use inspect::Inspect;
8use mesh::payload::Protobuf;
9use open_enum::open_enum;
10use std::mem::size_of;
11use std::ops::BitAnd;
12use std::ops::BitAndAssign;
13use std::ops::BitOr;
14use std::ops::Deref;
15use std::ops::DerefMut;
16use thiserror::Error;
17use zerocopy::FromBytes;
18use zerocopy::FromZeros;
19use zerocopy::Immutable;
20use zerocopy::IntoBytes;
21use zerocopy::KnownLayout;
22use zerocopy::Unalign;
23
24#[macro_use]
25mod macros;
26
27type Guid = guid::Guid;
28
29pub const VMBUS_MESSAGE_REDIRECT_CONNECTION_ID: u32 = 0x800074;
30
31pub const STATUS_SUCCESS: i32 = 0;
32pub const STATUS_UNSUCCESSFUL: i32 = 0x8000ffff_u32 as i32;
33pub const STATUS_CONNECTION_REFUSED: i32 = 0xc0000236_u32 as i32;
34
35pub const HEADER_SIZE: usize = size_of::<MessageHeader>();
36pub const MAX_MESSAGE_SIZE: usize = hvdef::HV_MESSAGE_PAYLOAD_SIZE;
37
38vmbus_messages! {
59 pub enum Message, MessageType {
60 1 OFFER_CHANNEL { OfferChannel V1 },
61 2 RESCIND_CHANNEL_OFFER { RescindChannelOffer V1 },
62 3 REQUEST_OFFERS { RequestOffers V1 },
63 4 ALL_OFFERS_DELIVERED { AllOffersDelivered V1 },
64 5 OPEN_CHANNEL {
65 OpenChannel2 Copper features:(guest_specified_signal_parameters | channel_interrupt_redirection),
66 OpenChannel V1
67 },
68 6 OPEN_CHANNEL_RESULT { OpenResult V1 },
69 7 CLOSE_CHANNEL { CloseChannel V1 },
70 8 GPADL_HEADER { GpadlHeader V1 },
71 9 GPADL_BODY { GpadlBody V1 },
72 10 GPADL_CREATED { GpadlCreated V1 },
73 11 GPADL_TEARDOWN { GpadlTeardown V1 },
74 12 GPADL_TORNDOWN { GpadlTorndown V1 },
75 13 REL_ID_RELEASED { RelIdReleased V1 },
76 14 INITIATE_CONTACT {
77 InitiateContact2 0 check_size:true,
81 InitiateContact 0
82 },
83 15 VERSION_RESPONSE {
84 VersionResponse3 0 check_size:true,
85 VersionResponse2 0 check_size:true,
86 VersionResponse 0
87 },
88 16 UNLOAD { Unload V1 },
89 17 UNLOAD_COMPLETE { UnloadComplete Win7 },
90 18 OPEN_RESERVED_CHANNEL { OpenReservedChannel Win10 },
91 19 CLOSE_RESERVED_CHANNEL { CloseReservedChannel 0 },
92 20 CLOSE_RESERVED_RESPONSE { CloseReservedChannelResponse Win10 },
93 21 TL_CONNECT_REQUEST {
94 TlConnectRequest2 Win10Rs5 check_size:true,
97 TlConnectRequest Win10
98 },
99 22 MODIFY_CHANNEL { ModifyChannel Win10Rs3_0 },
100 23 TL_CONNECT_REQUEST_RESULT { TlConnectResult Win10Rs3_0 },
101 24 MODIFY_CHANNEL_RESPONSE { ModifyChannelResponse Iron },
102 25 MODIFY_CONNECTION { ModifyConnection Copper features:modify_connection },
103 26 MODIFY_CONNECTION_RESPONSE { ModifyConnectionResponse Copper features:modify_connection },
104 27 PAUSE { Pause Copper features:pause_resume },
105 28 PAUSE_RESPONSE { PauseResponse Copper features:pause_resume },
106 29 RESUME { Resume Copper features:pause_resume },
107 }
108}
109
110#[derive(Debug, Error)]
112pub enum ParseError {
113 #[error("message too small: {0:?}")]
115 MessageTooSmall(Option<MessageType>),
116 #[error("unexpected or unsupported message type: {0:?}")]
119 InvalidMessageType(MessageType),
120}
121
122pub trait VmbusMessage: Sized {
124 const MESSAGE_TYPE: MessageType;
126
127 const MESSAGE_SIZE: usize = HEADER_SIZE + size_of::<Self>();
129}
130
131#[repr(C)]
133#[derive(Copy, Clone, Debug, Eq, PartialEq, IntoBytes, FromBytes, Immutable, KnownLayout)]
134pub struct MessageHeader {
135 message_type: MessageType,
136 padding: u32,
137}
138
139impl MessageHeader {
140 pub fn new(message_type: MessageType) -> Self {
142 Self {
143 message_type,
144 padding: 0,
145 }
146 }
147
148 pub fn message_type(&self) -> MessageType {
149 self.message_type
150 }
151}
152
153#[derive(Inspect)]
154#[bitfield(u32)]
155#[derive(IntoBytes, FromBytes, Immutable, KnownLayout, PartialEq, Eq)]
156pub struct FeatureFlags {
157 pub guest_specified_signal_parameters: bool, pub channel_interrupt_redirection: bool, pub modify_connection: bool, pub client_id: bool, pub confidential_channels: bool, pub pause_resume: bool, pub server_specified_monitor_pages: bool, #[bits(25)]
194 _reserved: u32,
195}
196
197impl FeatureFlags {
198 pub fn contains(&self, other: FeatureFlags) -> bool {
200 self.into_bits() & other.into_bits() == other.into_bits()
201 }
202}
203
204impl BitAnd for FeatureFlags {
205 type Output = Self;
206
207 fn bitand(self, rhs: Self) -> Self::Output {
208 (self.into_bits() & rhs.into_bits()).into()
209 }
210}
211
212impl BitAndAssign for FeatureFlags {
213 fn bitand_assign(&mut self, rhs: Self) {
214 *self = (self.into_bits() & rhs.into_bits()).into()
215 }
216}
217
218impl BitOr for FeatureFlags {
219 type Output = Self;
220
221 fn bitor(self, rhs: Self) -> Self::Output {
222 (self.into_bits() | rhs.into_bits()).into()
223 }
224}
225
226#[repr(transparent)]
227#[derive(
228 Copy,
229 Clone,
230 Debug,
231 Eq,
232 PartialEq,
233 Ord,
234 PartialOrd,
235 Hash,
236 IntoBytes,
237 FromBytes,
238 Immutable,
239 KnownLayout,
240 Protobuf,
241)]
242#[mesh(package = "vmbus")]
243pub struct GpadlId(pub u32);
244
245#[repr(transparent)]
246#[derive(
247 Copy,
248 Clone,
249 Debug,
250 Eq,
251 Inspect,
252 PartialEq,
253 Ord,
254 PartialOrd,
255 Hash,
256 IntoBytes,
257 FromBytes,
258 Immutable,
259 KnownLayout,
260 Protobuf,
261)]
262#[inspect(transparent)]
263pub struct ChannelId(pub u32);
264
265pub struct ConnectionId(pub u32);
266
267impl ConnectionId {
268 pub fn new(channel_id: u32, vtl: Vtl, sint: u8) -> Self {
270 Self(channel_id | (sint as u32) << 12 | (vtl as u32) << 16)
271 }
272}
273
274#[repr(C)]
275#[derive(Copy, Clone, Debug, Eq, PartialEq, IntoBytes, FromBytes, Immutable, KnownLayout)]
276pub struct InitiateContact {
277 pub version_requested: u32,
278 pub target_message_vp: u32,
279 pub interrupt_page_or_target_info: u64, pub parent_to_child_monitor_page_gpa: u64,
281 pub child_to_parent_monitor_page_gpa: u64,
282}
283
284#[repr(C)]
287#[derive(Copy, Clone, Debug, Eq, PartialEq, IntoBytes, FromBytes, Immutable, KnownLayout)]
288pub struct InitiateContact2 {
289 pub initiate_contact: InitiateContact,
290 pub client_id: Guid,
291}
292
293impl From<InitiateContact> for InitiateContact2 {
294 fn from(value: InitiateContact) -> Self {
295 Self {
296 initiate_contact: value,
297 ..FromZeros::new_zeroed()
298 }
299 }
300}
301
302#[bitfield(u64)]
304pub struct TargetInfo {
305 pub sint: u8,
306 pub vtl: u8,
307 pub _padding: u16,
308 pub feature_flags: u32,
309}
310
311pub const fn make_version(major: u16, minor: u16) -> u32 {
312 ((major as u32) << 16) | (minor as u32)
313}
314
315#[repr(u32)]
316#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Inspect)]
317pub enum Version {
318 V1 = make_version(0, 13),
319 Win7 = make_version(1, 1),
320 Win8 = make_version(2, 4),
321 Win8_1 = make_version(3, 0),
322 Win10 = make_version(4, 0),
323 Win10Rs3_0 = make_version(4, 1),
324 Win10Rs3_1 = make_version(5, 0),
325 Win10Rs4 = make_version(5, 1),
326 Win10Rs5 = make_version(5, 2),
327 Iron = make_version(5, 3),
328 Copper = make_version(6, 0),
329}
330
331open_enum! {
332 #[derive(IntoBytes, FromBytes, Immutable, KnownLayout)]
334 pub enum ConnectionState: u8 {
335 SUCCESSFUL = 0,
336 FAILED_LOW_RESOURCES = 1,
337 FAILED_UNKNOWN_FAILURE = 2,
338 }
339}
340
341#[repr(C)]
342#[derive(Copy, Clone, Debug, Eq, PartialEq, IntoBytes, FromBytes, Immutable, KnownLayout)]
343pub struct VersionResponse {
344 pub version_supported: u8,
345 pub connection_state: ConnectionState,
346 pub padding: u16,
347 pub selected_version_or_connection_id: u32,
348}
349
350#[repr(C)]
355#[derive(Copy, Clone, Debug, Eq, PartialEq, IntoBytes, FromBytes, Immutable, KnownLayout)]
356pub struct VersionResponse2 {
357 pub version_response: VersionResponse,
358 pub supported_features: u32,
359}
360
361#[repr(C)]
364#[derive(Copy, Clone, Debug, Eq, PartialEq, IntoBytes, FromBytes, Immutable, KnownLayout)]
365pub struct VersionResponse3 {
366 pub version_response2: VersionResponse2,
367 pub _padding: u32,
368 pub parent_to_child_monitor_page_gpa: u64,
370 pub child_to_parent_monitor_page_gpa: u64,
371}
372
373impl From<VersionResponse> for VersionResponse2 {
374 fn from(value: VersionResponse) -> Self {
375 Self {
376 version_response: value,
377 ..FromZeros::new_zeroed()
378 }
379 }
380}
381
382impl From<VersionResponse2> for VersionResponse3 {
383 fn from(value: VersionResponse2) -> Self {
384 Self {
385 version_response2: value,
386 ..FromZeros::new_zeroed()
387 }
388 }
389}
390
391impl From<VersionResponse> for VersionResponse3 {
392 fn from(value: VersionResponse) -> Self {
393 let version_response: VersionResponse2 = value.into();
394 version_response.into()
395 }
396}
397
398#[derive(
400 Copy, Clone, PartialEq, Eq, IntoBytes, FromBytes, Immutable, KnownLayout, Protobuf, Inspect,
401)]
402#[repr(C, align(4))]
403#[mesh(transparent)]
404#[inspect(transparent)]
405pub struct UserDefinedData([u8; 120]);
406
407impl UserDefinedData {
408 pub fn as_pipe_params(&self) -> &PipeUserDefinedParameters {
409 PipeUserDefinedParameters::ref_from_bytes(
410 &self.0[0..size_of::<PipeUserDefinedParameters>()],
411 )
412 .expect("from bytes should not fail")
413 }
414
415 pub fn as_pipe_params_mut(&mut self) -> &mut PipeUserDefinedParameters {
416 PipeUserDefinedParameters::mut_from_bytes(
417 &mut self.0[0..size_of::<PipeUserDefinedParameters>()],
418 )
419 .expect("from bytes should not fail")
420 }
421
422 pub fn as_hvsock_params(&self) -> &HvsockUserDefinedParameters {
423 HvsockUserDefinedParameters::ref_from_bytes(
424 &self.0[0..size_of::<HvsockUserDefinedParameters>()],
425 )
426 .expect("from bytes should not fail")
427 }
428
429 pub fn as_hvsock_params_mut(&mut self) -> &mut HvsockUserDefinedParameters {
430 HvsockUserDefinedParameters::mut_from_bytes(
431 &mut self.0[0..size_of::<HvsockUserDefinedParameters>()],
432 )
433 .expect("from bytes should not fail")
434 }
435}
436
437impl Deref for UserDefinedData {
438 type Target = [u8; 120];
439
440 fn deref(&self) -> &Self::Target {
441 &self.0
442 }
443}
444
445impl DerefMut for UserDefinedData {
446 fn deref_mut(&mut self) -> &mut Self::Target {
447 &mut self.0
448 }
449}
450
451impl From<[u8; 120]> for UserDefinedData {
452 fn from(value: [u8; 120]) -> Self {
453 Self(value)
454 }
455}
456
457impl From<UserDefinedData> for [u8; 120] {
458 fn from(value: UserDefinedData) -> Self {
459 value.0
460 }
461}
462
463impl Default for UserDefinedData {
464 fn default() -> Self {
465 Self::new_zeroed()
466 }
467}
468
469impl std::fmt::Debug for UserDefinedData {
470 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
471 if self.0.iter().all(|&b| b == 0) {
472 write!(f, "UserDefinedData([<all-zeroes>])")
474 } else {
475 write!(f, "UserDefinedData([")?;
477 for byte in &self.0 {
478 write!(f, "{:02X}", byte)?;
479 }
480 write!(f, "])")
481 }
482 }
483}
484
485#[repr(C)]
486#[derive(
487 Copy, Clone, Debug, Inspect, PartialEq, Eq, IntoBytes, FromBytes, Immutable, KnownLayout,
488)]
489#[inspect(extra = "Self::inspect_extra")]
490pub struct OfferChannel {
491 pub interface_id: Guid,
492 pub instance_id: Guid,
493 #[inspect(skip)]
494 pub rsvd: [u32; 4],
495 pub flags: OfferFlags,
496 pub mmio_megabytes: u16,
497 pub user_defined: UserDefinedData,
498 pub subchannel_index: u16,
499 pub mmio_megabytes_optional: u16,
500 pub channel_id: ChannelId,
501 pub monitor_id: u8,
502 pub monitor_allocated: u8,
503 pub is_dedicated: u16,
504 pub connection_id: u32,
505}
506
507impl OfferChannel {
508 fn inspect_extra(&self, resp: &mut inspect::Response<'_>) {
509 const SHUTDOWN_IC: Guid = guid::guid!("0e0b6031-5213-4934-818b-38d90ced39db");
517 const KVP_IC: Guid = guid::guid!("a9a0f4e7-5a45-4d96-b827-8a841e8c03e6");
518 const VSS_IC: Guid = guid::guid!("35fa2e29-ea23-4236-96ae-3a6ebacba440");
519 const TIMESYNC_IC: Guid = guid::guid!("9527e630-d0ae-497b-adce-e80ab0175caf");
520 const HEARTBEAT_IC: Guid = guid::guid!("57164f39-9115-4e78-ab55-382f3bd5422d");
521 const RDV_IC: Guid = guid::guid!("276aacf4-ac15-426c-98dd-7521ad3f01fe");
522
523 const INHERITED_ACTIVATION: Guid = guid::guid!("3375baf4-9e15-4b30-b765-67acb10d607b");
524
525 const NET: Guid = guid::guid!("f8615163-df3e-46c5-913f-f2d2f965ed0e");
526 const SCSI: Guid = guid::guid!("ba6163d9-04a1-4d29-b605-72e2ffb1dc7f");
527 const VPCI: Guid = guid::guid!("44c4f61d-4444-4400-9d52-802e27ede19f");
528
529 resp.field_with("interface_name", || match self.interface_id {
530 SHUTDOWN_IC => "shutdown_ic",
531 KVP_IC => "kvp_ic",
532 VSS_IC => "vss_ic",
533 TIMESYNC_IC => "timesync_ic",
534 HEARTBEAT_IC => "heartbeat_ic",
535 RDV_IC => "rdv_ic",
536 INHERITED_ACTIVATION => "inherited_activation",
537 NET => "net",
538 SCSI => "scsi",
539 VPCI => "vpci",
540 _ => "unknown",
541 });
542 }
543}
544
545#[derive(Inspect)]
546#[bitfield(u16)]
547#[derive(IntoBytes, FromBytes, Immutable, KnownLayout, PartialEq, Eq, Protobuf)]
548#[mesh(transparent)]
549pub struct OfferFlags {
550 pub enumerate_device_interface: bool, pub confidential_ring_buffer: bool, pub confidential_external_memory: bool, #[bits(1)]
557 _reserved1: u16,
558 pub named_pipe_mode: bool, #[bits(8)]
560 _reserved2: u16,
561 pub tlnpi_provider: bool, #[bits(2)]
563 _reserved3: u16,
564}
565
566open_enum! {
567 #[derive(IntoBytes, FromBytes, Immutable, KnownLayout)]
569 pub enum PipeType: u32 {
570 BYTE = 0,
571 MESSAGE = 4,
572 }
573}
574
575#[repr(C)]
577#[derive(Copy, Clone, IntoBytes, FromBytes, Immutable, KnownLayout)]
578pub struct PipeUserDefinedParameters {
579 pub pipe_type: PipeType,
580}
581
582#[repr(C)]
583#[derive(Copy, Clone, IntoBytes, FromBytes, Immutable, KnownLayout)]
584pub struct HvsockUserDefinedParameters {
585 pub pipe_params: PipeUserDefinedParameters,
586 pub is_for_guest_accept: u8,
587 pub is_for_guest_container: u8,
588 pub version: Unalign<HvsockParametersVersion>, pub silo_id: Unalign<Guid>, pub _padding: [u8; 2],
591}
592
593impl HvsockUserDefinedParameters {
594 pub fn new(is_for_guest_accept: bool, is_for_guest_container: bool, silo_id: Guid) -> Self {
595 Self {
596 pipe_params: PipeUserDefinedParameters {
597 pipe_type: PipeType::BYTE,
598 },
599 is_for_guest_accept: is_for_guest_accept.into(),
600 is_for_guest_container: is_for_guest_container.into(),
601 version: Unalign::new(HvsockParametersVersion::RS5),
602 silo_id: Unalign::new(silo_id),
603 _padding: [0; 2],
604 }
605 }
606}
607
608open_enum! {
609 #[derive(IntoBytes, FromBytes, Immutable, KnownLayout)]
611 pub enum HvsockParametersVersion: u32 {
612 PRE_RS5 = 0,
613 RS5 = 1,
614 }
615}
616
617#[repr(C)]
618#[derive(Copy, Clone, Debug, PartialEq, Eq, IntoBytes, FromBytes, Immutable, KnownLayout)]
619pub struct RescindChannelOffer {
620 pub channel_id: ChannelId,
621}
622
623#[repr(C)]
624#[derive(Copy, Clone, Debug, IntoBytes, FromBytes, Immutable, KnownLayout)]
625pub struct GpadlHeader {
626 pub channel_id: ChannelId,
627 pub gpadl_id: GpadlId,
628 pub len: u16,
629 pub count: u16,
630}
631
632impl GpadlHeader {
633 pub const MAX_DATA_VALUES: usize = (MAX_MESSAGE_SIZE - Self::MESSAGE_SIZE) / size_of::<u64>();
635}
636
637#[repr(C)]
638#[derive(Copy, Clone, Debug, IntoBytes, FromBytes, Immutable, KnownLayout)]
639pub struct GpadlBody {
640 pub rsvd: u32,
641 pub gpadl_id: GpadlId,
642}
643
644impl GpadlBody {
645 pub const MAX_DATA_VALUES: usize = (MAX_MESSAGE_SIZE - Self::MESSAGE_SIZE) / size_of::<u64>();
647}
648
649#[repr(C)]
650#[derive(Copy, Clone, Eq, PartialEq, Debug, IntoBytes, FromBytes, Immutable, KnownLayout)]
651pub struct GpadlCreated {
652 pub channel_id: ChannelId,
653 pub gpadl_id: GpadlId,
654 pub status: i32,
655}
656
657pub const VP_INDEX_DISABLE_INTERRUPT: u32 = u32::MAX;
659
660pub fn vp_index_if_enabled(vp_index: u32) -> Option<u32> {
662 (vp_index != VP_INDEX_DISABLE_INTERRUPT).then_some(vp_index)
663}
664
665#[repr(C)]
666#[derive(Debug, Copy, Clone, Eq, PartialEq, IntoBytes, FromBytes, Immutable, KnownLayout)]
667pub struct OpenChannel {
668 pub channel_id: ChannelId,
669 pub open_id: u32,
670 pub ring_buffer_gpadl_id: GpadlId,
671 pub target_vp: u32,
672 pub downstream_ring_buffer_page_offset: u32,
673 pub user_data: UserDefinedData,
674}
675
676#[bitfield(u16)]
677#[derive(IntoBytes, FromBytes, Immutable, KnownLayout, PartialEq, Eq)]
678pub struct OpenChannelFlags {
679 pub redirect_interrupt: bool,
682
683 #[bits(15)]
684 pub unused: u16,
685}
686
687#[repr(C)]
690#[derive(Debug, Copy, Clone, Eq, PartialEq, IntoBytes, FromBytes, Immutable, KnownLayout)]
691pub struct OpenChannel2 {
692 pub open_channel: OpenChannel,
693
694 pub connection_id: u32,
696 pub event_flag: u16,
697
698 pub flags: OpenChannelFlags,
700}
701
702impl From<OpenChannel> for OpenChannel2 {
703 fn from(value: OpenChannel) -> Self {
704 Self {
705 open_channel: value,
706 ..FromZeros::new_zeroed()
707 }
708 }
709}
710
711#[repr(C)]
712#[derive(PartialEq, Eq, Debug, Copy, Clone, IntoBytes, FromBytes, Immutable, KnownLayout)]
713pub struct OpenResult {
714 pub channel_id: ChannelId,
715 pub open_id: u32,
716 pub status: u32,
717}
718
719#[repr(C)]
720#[derive(Debug, Copy, Clone, IntoBytes, FromBytes, Immutable, KnownLayout)]
721pub struct CloseChannel {
722 pub channel_id: ChannelId,
723}
724
725#[repr(C)]
726#[derive(Debug, Copy, Clone, IntoBytes, FromBytes, Immutable, KnownLayout)]
727pub struct RelIdReleased {
728 pub channel_id: ChannelId,
729}
730
731#[repr(C)]
732#[derive(Debug, Copy, Clone, IntoBytes, FromBytes, Immutable, KnownLayout)]
733pub struct GpadlTeardown {
734 pub channel_id: ChannelId,
735 pub gpadl_id: GpadlId,
736}
737
738#[repr(C)]
739#[derive(Debug, Copy, Clone, Eq, PartialEq, IntoBytes, FromBytes, Immutable, KnownLayout)]
740pub struct GpadlTorndown {
741 pub gpadl_id: GpadlId,
742}
743
744#[repr(C)]
745#[derive(Debug, Copy, Clone, IntoBytes, FromBytes, Immutable, KnownLayout)]
746pub struct OpenReservedChannel {
747 pub channel_id: ChannelId,
748 pub target_vp: u32,
749 pub target_sint: u32,
750 pub ring_buffer_gpadl: GpadlId,
751 pub downstream_page_offset: u32,
752}
753
754#[repr(C)]
755#[derive(Debug, Copy, Clone, IntoBytes, FromBytes, Immutable, KnownLayout)]
756pub struct CloseReservedChannel {
757 pub channel_id: ChannelId,
758 pub target_vp: u32,
759 pub target_sint: u32,
760}
761
762#[repr(C)]
763#[derive(PartialEq, Eq, Debug, Copy, Clone, IntoBytes, FromBytes, Immutable, KnownLayout)]
764pub struct CloseReservedChannelResponse {
765 pub channel_id: ChannelId,
766}
767
768#[repr(C)]
769#[derive(Debug, Copy, Clone, IntoBytes, FromBytes, Immutable, KnownLayout)]
770pub struct TlConnectRequest {
771 pub endpoint_id: Guid,
772 pub service_id: Guid,
773}
774
775#[repr(C)]
776#[derive(Debug, Copy, Clone, IntoBytes, FromBytes, Immutable, KnownLayout)]
777pub struct TlConnectRequest2 {
778 pub base: TlConnectRequest,
779 pub silo_id: Guid,
780}
781
782impl From<TlConnectRequest> for TlConnectRequest2 {
783 fn from(value: TlConnectRequest) -> Self {
784 Self {
785 base: value,
786 ..FromZeros::new_zeroed()
787 }
788 }
789}
790
791#[repr(C)]
792#[derive(Debug, Copy, Clone, IntoBytes, FromBytes, Immutable, KnownLayout)]
793pub struct TlConnectResult {
794 pub endpoint_id: Guid,
795 pub service_id: Guid,
796 pub status: i32,
797}
798
799#[repr(C)]
800#[derive(Debug, Copy, Clone, IntoBytes, FromBytes, Immutable, KnownLayout)]
801pub struct ModifyChannel {
802 pub channel_id: ChannelId,
803 pub target_vp: u32,
804}
805
806#[repr(C)]
807#[derive(PartialEq, Eq, Debug, Copy, Clone, IntoBytes, FromBytes, Immutable, KnownLayout)]
808pub struct ModifyChannelResponse {
809 pub channel_id: ChannelId,
810 pub status: i32,
811}
812
813#[repr(C)]
814#[derive(PartialEq, Eq, Debug, Copy, Clone, IntoBytes, FromBytes, Immutable, KnownLayout)]
815pub struct ModifyConnection {
816 pub parent_to_child_monitor_page_gpa: u64,
817 pub child_to_parent_monitor_page_gpa: u64,
818}
819
820#[repr(C)]
821#[derive(PartialEq, Eq, Debug, Copy, Clone, IntoBytes, FromBytes, Immutable, KnownLayout)]
822pub struct ModifyConnectionResponse {
823 pub connection_state: ConnectionState,
824}
825
826#[repr(C)]
830#[derive(Copy, Clone, Debug, Eq, PartialEq, IntoBytes, FromBytes, Immutable, KnownLayout)]
831pub struct RequestOffers {}
832
833#[repr(C)]
834#[derive(Copy, Clone, Debug, Eq, PartialEq, IntoBytes, FromBytes, Immutable, KnownLayout)]
835pub struct Unload {}
836
837#[repr(C)]
838#[derive(Copy, Clone, Debug, Eq, PartialEq, IntoBytes, FromBytes, Immutable, KnownLayout)]
839pub struct UnloadComplete {}
840
841#[repr(C)]
842#[derive(Copy, Clone, Debug, Eq, PartialEq, IntoBytes, FromBytes, Immutable, KnownLayout)]
843pub struct AllOffersDelivered {}
844
845#[repr(C)]
846#[derive(Copy, Clone, Debug, Eq, PartialEq, IntoBytes, FromBytes, Immutable, KnownLayout)]
847pub struct Pause;
848
849#[repr(C)]
850#[derive(Copy, Clone, Debug, Eq, PartialEq, IntoBytes, FromBytes, Immutable, KnownLayout)]
851pub struct PauseResponse;
852
853#[repr(C)]
854#[derive(Copy, Clone, Debug, Eq, PartialEq, IntoBytes, FromBytes, Immutable, KnownLayout)]
855pub struct Resume;