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