1use bitfield_struct::bitfield;
7use guid::Guid;
8use zerocopy::FromBytes;
9use zerocopy::Immutable;
10use zerocopy::IntoBytes;
11use zerocopy::KnownLayout;
12use zerocopy::Unaligned;
13
14pub const CRASHDUMP_GUID: Guid = guid::guid!("427b03e7-4ceb-4286-b5fc-486f4a1dd439");
15
16#[bitfield(u64)]
18#[derive(IntoBytes, FromBytes, Immutable, KnownLayout, PartialEq, Eq)]
19pub struct Capabilities {
20 pub windows_config_v1: bool,
21 pub linux_config_v1: bool,
22 #[bits(62)]
23 pub reserved: u64,
24}
25
26open_enum::open_enum! {
27 #[derive(IntoBytes, FromBytes, Immutable, KnownLayout)]
29 pub enum DumpType: u32 {
30 NONE = 0x00000000,
31 ELF = 0x00000001,
32 KDUMP = 0x00000002,
33 }
34}
35
36#[derive(Debug, Copy, Clone, PartialEq, Eq, IntoBytes, FromBytes, Immutable, KnownLayout)]
38#[repr(C, packed)]
39pub struct ConfigV1 {
40 pub max_dump_size: u64,
41 pub dump_type: DumpType,
42}
43
44#[derive(Debug, Copy, Clone, PartialEq, Eq, IntoBytes, FromBytes, Immutable, KnownLayout)]
46#[repr(C, packed)]
47pub struct CompletionInfoV1 {
48 pub major_version: u32,
49 pub minor_version: u32,
50 pub version_banner: [u8; 256],
51 pub vtl: u8,
52}
53
54open_enum::open_enum! {
60 #[derive(IntoBytes, FromBytes, Immutable, KnownLayout)]
62 pub enum MessageType : u64 {
63 INVALID = 0, REQUEST_GET_CAPABILITIES_V1 = 0x00000001,
67 REQUEST_GET_WINDOWS_DUMP_CONFIG_V1 = 0x00000002,
68 REQUEST_WINDOWS_DUMP_START_V1 = 0x00000003,
69 REQUEST_WINDOWS_DUMP_WRITE_V1 = 0x00000004,
70 REQUEST_WINDOWS_DUMP_COMPLETE_V1 = 0x00000005,
71 REQUEST_GET_NIX_DUMP_CONFIG_V1 = 0x00000102,
72 REQUEST_NIX_DUMP_START_V1 = 0x00000103,
73 REQUEST_NIX_DUMP_WRITE_V1 = 0x00000104,
74 REQUEST_NIX_DUMP_COMPLETE_V1 = 0x00000105,
75
76 RESPONSE_GET_CAPABILITIES_V1 = 0x00010001,
78 RESPONSE_GET_WINDOWS_DUMP_CONFIG_V1 = 0x00010002,
79 RESPONSE_WINDOWS_DUMP_START_V1 = 0x00010003,
80 RESPONSE_WINDOWS_DUMP_WRITE_V1 = 0x00010004,
81 RESPONSE_WINDOWS_DUMP_COMPLETE_V1 = 0x00010005,
82 RESPONSE_GET_NIX_DUMP_CONFIG_V1 = 0x00010102,
83 RESPONSE_NIX_DUMP_START_V1 = 0x00010103,
84 RESPONSE_NIX_DUMP_WRITE_V1 = 0x00010104,
85 RESPONSE_NIX_DUMP_COMPLETE_V1 = 0x00010105,
86 }
87}
88
89#[derive(Debug, Copy, Clone, PartialEq, Eq, IntoBytes, FromBytes, Immutable, KnownLayout)]
91#[repr(C, packed)]
92pub struct Header {
93 pub activity_id: Guid,
95 pub message_type: MessageType,
96}
97
98#[derive(Debug, Copy, Clone, PartialEq, Eq, IntoBytes, FromBytes, Immutable, KnownLayout)]
100#[repr(C, packed)]
101pub struct DumpCapabilitiesRequestV1 {
102 pub header: Header,
103}
104
105#[derive(Debug, Copy, Clone, PartialEq, Eq, IntoBytes, FromBytes, Immutable, KnownLayout)]
107#[repr(C, packed)]
108pub struct DumpCapabilitiesResponseV1 {
109 pub header: Header,
110 pub capabilities: Capabilities,
111}
112
113#[derive(Debug, Copy, Clone, PartialEq, Eq, IntoBytes, FromBytes, Immutable, KnownLayout)]
115#[repr(C, packed)]
116pub struct DumpConfigRequestV1 {
117 pub header: Header,
118}
119
120#[derive(Debug, Copy, Clone, PartialEq, Eq, IntoBytes, FromBytes, Immutable, KnownLayout)]
122#[repr(C, packed)]
123pub struct DumpConfigResponseV1 {
124 pub header: Header,
125 pub config: ConfigV1,
126}
127
128#[derive(Debug, Copy, Clone, PartialEq, Eq, IntoBytes, FromBytes, Immutable, KnownLayout)]
130#[repr(C, packed)]
131pub struct DumpStartRequestV1 {
132 pub header: Header,
133}
134
135#[derive(Debug, Copy, Clone, PartialEq, Eq, IntoBytes, FromBytes, Immutable, KnownLayout)]
137#[repr(C, packed)]
138pub struct DumpStartResponseV1 {
139 pub header: Header,
140 pub status: i32,
142}
143
144#[derive(
147 Debug, Copy, Clone, PartialEq, Eq, IntoBytes, FromBytes, Immutable, KnownLayout, Unaligned,
148)]
149#[repr(C, packed)]
150pub struct DumpWriteRequestV1 {
151 pub header: Header,
152 pub offset: u64,
153 pub size: u32,
154}
155
156#[derive(Debug, Copy, Clone, PartialEq, Eq, IntoBytes, FromBytes, Immutable, KnownLayout)]
159#[repr(C, packed)]
160pub struct DumpWriteResponseV1 {
161 pub header: Header,
162 pub status: i32,
164}
165
166#[derive(Debug, Copy, Clone, PartialEq, Eq, IntoBytes, FromBytes, Immutable, KnownLayout)]
168#[repr(C, packed)]
169pub struct DumpCompleteRequestV1 {
170 pub header: Header,
171 pub info: CompletionInfoV1,
172}