File: fu-redfish.rs

package info (click to toggle)
fwupd 2.0.20-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 32,504 kB
  • sloc: ansic: 277,388; python: 11,485; xml: 9,493; sh: 1,625; makefile: 167; cpp: 19; asm: 11; javascript: 9
file content (94 lines) | stat: -rw-r--r-- 1,990 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Copyright 2023 Richard Hughes <richard@hughsie.com>
// SPDX-License-Identifier: LGPL-2.1-or-later

enum FuRedfishRequestPerformFlags {
    None = 0,
    LoadJson = 1 << 0,
    UseCache = 1 << 1,
    UseEtag = 1 << 2,
}

#[derive(New, ParseStream)]
#[repr(C, packed)]
struct FuStructRedfishProtocolOverIp {
    service_uuid: Guid,
    host_ip_assignment_type: u8,
    host_ip_address_format: u8,
    host_ip_address: [u8; 16],
    host_ip_mask: [u8; 16],
    service_ip_assignment_type: u8,
    service_ip_address_format: u8,
    service_ip_address: [u8; 16],
    service_ip_mask: [u8; 16],
    service_ip_port: u16le,
    service_ip_vlan_id: u32le,
    service_hostname_len: u8,
// optional service_hostname goes here
}

#[derive(ToString)]
enum FuRedfishInterfaceType {
    UsbNetwork = 0x02,
    PciNetwork = 0x03,
    UsbNetworkV2 = 0x04,
    PciNetworkV2 = 0x05,
}

enum FuRedfishIpAssignmentType {
    Static = 0x00,
    Dhcp = 0x02,
    AutoConfig = 0x03,
    HostSelect = 0x04,
}

enum FuRedfishIpAddressFormat {
    Unknown = 0x00,
    V4 = 0x01,
    V6 = 0x02,
}

#[repr(u8)]
#[derive(ToString)]
enum FuRedfishSmbiosInterfaceType {
    Unknown = 0x00,
    Kcs = 0x02,
    8250Uart = 0x03,
    16450Uart = 0x04,
    16550Uart = 0x05,
    16650Uart = 0x06,
    16750Uart = 0x07,
    16850Uart = 0x08,
    Mctp = 0x3F,
    Network = 0x40,
    Oem = 0xF0,
}

#[derive(ParseStream, Default)]
#[repr(C, packed)]
struct FuStructRedfishSmbiosType42 {
    type: u8 == 42,
    length: u8,
    handle: u16le,
    interface_type: FuRedfishSmbiosInterfaceType = Network,
    data_length: u8,
    // data: [u8; data_length],
    // protocol_cnt: u8,
    // protocol_records
}

#[derive(ToString)]
enum FuRedfishNetworkDeviceState {
    Unknown = 0,
    Unmanaged = 10,
    Unavailable = 20,
    Disconnected = 30,
    Prepare = 40,
    Config = 50,
    NeedAuth = 60,
    IpConfig = 70,
    IpCheck = 80,
    Secondaries = 90,
    Activated = 100,
    Deactivating = 110,
    Failed = 120,
}