uefi_raw/protocol/network/
ip4_config2.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2
3use crate::protocol::network::ip4::Ip4RouteTable;
4use crate::{guid, Char16, Event, Guid, Ipv4Address, MacAddress, Status};
5use core::ffi::c_void;
6
7newtype_enum! {
8    pub enum Ip4Config2DataType: i32 => {
9        INTERFACE_INFO = 0,
10        POLICY         = 1,
11        MANUAL_ADDRESS = 2,
12        GATEWAY        = 3,
13        DNS_SERVER     = 4,
14        MAXIMUM        = 5,
15    }
16}
17
18#[derive(Debug)]
19#[repr(C)]
20pub struct Ip4Config2InterfaceInfo {
21    pub name: [Char16; 32],
22    pub if_type: u8,
23    pub hw_addr_size: u32,
24    pub hw_addr: MacAddress,
25    pub station_addr: Ipv4Address,
26    pub subnet_mask: Ipv4Address,
27    pub route_table_size: u32,
28    pub route_table: *mut Ip4RouteTable,
29}
30
31newtype_enum! {
32    pub enum Ip4Config2Policy: i32 => {
33        STATIC = 0,
34        DHCP   = 1,
35        MAX    = 2,
36    }
37}
38
39#[derive(Debug)]
40#[repr(C)]
41pub struct Ip4Config2ManualAddress {
42    pub address: Ipv4Address,
43    pub subnet_mask: Ipv4Address,
44}
45
46#[derive(Debug)]
47#[repr(C)]
48pub struct Ip4Config2Protocol {
49    pub set_data: unsafe extern "efiapi" fn(
50        this: *mut Self,
51        data_type: Ip4Config2DataType,
52        data_size: usize,
53        data: *const c_void,
54    ) -> Status,
55
56    pub get_data: unsafe extern "efiapi" fn(
57        this: *mut Self,
58        data_type: Ip4Config2DataType,
59        data_size: *mut usize,
60        data: *mut c_void,
61    ) -> Status,
62
63    pub register_data_notify: unsafe extern "efiapi" fn(
64        this: *mut Self,
65        data_type: Ip4Config2DataType,
66        event: Event,
67    ) -> Status,
68
69    pub unregister_data_notify: unsafe extern "efiapi" fn(
70        this: *mut Self,
71        data_type: Ip4Config2DataType,
72        event: Event,
73    ) -> Status,
74}
75
76impl Ip4Config2Protocol {
77    pub const GUID: Guid = guid!("5b446ed1-e30b-4faa-871a-3654eca36080");
78}