uefi_raw/protocol/network/
ip4_config2.rs

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
use crate::protocol::network::ip4::Ip4RouteTable;
use crate::{guid, Char16, Event, Guid, Ipv4Address, MacAddress, Status};
use core::ffi::c_void;

newtype_enum! {
    pub enum Ip4Config2DataType: i32 => {
        INTERFACE_INFO = 0,
        POLICY         = 1,
        MANUAL_ADDRESS = 2,
        GATEWAY        = 3,
        DNS_SERVER     = 4,
        MAXIMUM        = 5,
    }
}

#[derive(Debug)]
#[repr(C)]
pub struct Ip4Config2InterfaceInfo {
    pub name: [Char16; 32],
    pub if_type: u8,
    pub hw_addr_size: u32,
    pub hw_addr: MacAddress,
    pub station_addr: Ipv4Address,
    pub subnet_mask: Ipv4Address,
    pub route_table_size: u32,
    pub route_table: *mut Ip4RouteTable,
}

newtype_enum! {
    pub enum Ip4Config2Policy: i32 => {
        STATIC = 0,
        DHCP   = 1,
        MAX    = 2,
    }
}

#[derive(Debug)]
#[repr(C)]
pub struct Ip4Config2ManualAddress {
    pub address: Ipv4Address,
    pub subnet_mask: Ipv4Address,
}

#[derive(Debug)]
#[repr(C)]
pub struct Ip4Config2Protocol {
    pub set_data: unsafe extern "efiapi" fn(
        this: *mut Self,
        data_type: Ip4Config2DataType,
        data_size: usize,
        data: *const c_void,
    ) -> Status,

    pub get_data: unsafe extern "efiapi" fn(
        this: *mut Self,
        data_type: Ip4Config2DataType,
        data_size: *mut usize,
        data: *mut c_void,
    ) -> Status,

    pub register_data_notify: unsafe extern "efiapi" fn(
        this: *mut Self,
        data_type: Ip4Config2DataType,
        event: Event,
    ) -> Status,

    pub unregister_data_notify: unsafe extern "efiapi" fn(
        this: *mut Self,
        data_type: Ip4Config2DataType,
        event: Event,
    ) -> Status,
}

impl Ip4Config2Protocol {
    pub const GUID: Guid = guid!("5b446ed1-e30b-4faa-871a-3654eca36080");
}