Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ extend-exclude = [
[default]
extend-ignore-identifiers-re = [
# uefi-raw/src/protocol/device_path.rs
"PnP"
"PnP",
# uefi-raw/src/protocol/network/tcpv4.rs
"ANDed"
]

[default.extend-words]
Expand Down
1 change: 1 addition & 0 deletions uefi-raw/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# uefi-raw - [Unreleased]

## Added
- Added `Tcpv4Protocol`.

## Changed

Expand Down
77 changes: 76 additions & 1 deletion uefi-raw/src/protocol/network/ip4.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

use crate::Ipv4Address;
use crate::{Boolean, Ipv4Address};

#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(C)]
Expand All @@ -9,3 +9,78 @@ pub struct Ip4RouteTable {
pub subnet_mask: Ipv4Address,
pub gateway_addr: Ipv4Address,
}

/// Defined in [UEFI Specification, Section 28.3.5](https://uefi.org/specs/UEFI/2.11/28_Network_Protocols_TCP_IP_and_Configuration.html#efi-ip4-protocol-getmodedata)
#[derive(Debug)]
#[repr(C)]
pub struct Ip4ModeData {
/// Set to `TRUE` after this [`Tcp4Protocol`] instance has been
/// successfully configured.
pub is_started: Boolean,
/// The maximum packet size, in bytes, of the packet which the
/// upper layer driver could feed.
pub max_packet_size: u32,
/// Current configuration settings.
pub config_data: Ip4ConfigData,
/// Set to `TRUE` when the [`Tcp4Protocol`] instance has a
/// station address and subnet mask.
pub is_configured: Boolean,
/// Number of joined multicast groups.
pub group_count: u32,
/// List of joined multicast group addresses.
pub group_table: *const Ipv4Address,
/// Number of entries in the routing table.
pub route_count: u32,
/// Routing table entries.
pub route_table: *const Ip4RouteTable,
/// Number of entries in the supported ICMP types list.
pub icmp_type_count: u32,
/// Array of ICMP types and codes that are supported.
pub icmp_type_list: *const Ip4IcmpType,
}

/// Defined in [UEFI Specification, Section 28.3.5](https://uefi.org/specs/UEFI/2.11/28_Network_Protocols_TCP_IP_and_Configuration.html#efi-ip4-protocol-getmodedata)
#[derive(Debug)]
#[repr(C)]
pub struct Ip4IcmpType {
/// ICMP message type.
pub type_: u8,
/// ICMP message code.
pub code: u8,
}

#[derive(Debug)]
#[repr(C)]
pub struct Ip4ConfigData {
/// Default protocol to be used.
///
/// See <https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml>.
pub default_protocol: u8,
/// Set to `TRUE` to receive all IPv4 packets.
pub accept_any_protocol: Boolean,
/// Set to `TRUE` to receive ICMP error packets.
pub accept_icmp_errors: Boolean,
/// Set to `TRUE` to receive broadcast IPv4 packets.
pub accept_broadcast: Boolean,
/// Set to `TRUE` to receive all IPv4 packets in promiscuous mode.
pub accept_promiscuous: Boolean,
/// Set to `TRUE` to use the default IPv4 address and routing
/// table.
pub use_default_address: Boolean,
/// Station IPv4 address.
pub station_address: Ipv4Address,
/// Subnet mask for the station address.
pub subnet_mask: Ipv4Address,
/// Type of service field in transmitted IPv4 packets.
pub type_of_service: u8,
/// Time to live field in transmitted IPv4 packets.
pub time_to_live: u8,
/// Set to `TRUE` to disable fragmentation.
pub do_not_fragment: Boolean,
/// Set to `TRUE` to enable raw data mode.
pub raw_data: Boolean,
/// Receive timeout in milliseconds.
pub receive_timeout: u32,
/// Transmit timeout in milliseconds.
pub transmit_timeout: u32,
}
1 change: 1 addition & 0 deletions uefi-raw/src/protocol/network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ pub mod ip4;
pub mod ip4_config2;
pub mod pxe;
pub mod snp;
pub mod tcp4;
pub mod tls;
Loading
Loading