Skip to content

Commit 12e8406

Browse files
committed
uefi: SNP transmit: document parameters
1 parent 35e5ab7 commit 12e8406

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

uefi/src/proto/network/snp.rs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,36 @@ impl SimpleNetwork {
213213
status.to_result_with_val(|| NonNull::new(tx_buf.cast()))
214214
}
215215

216-
/// Place a packet in the transmit queue of a network interface.
216+
/// Place a packet in the transmit queue of the network interface.
217+
///
218+
/// The packet structure depends on the type of network interface,
219+
/// effectively this is always a (wired) ethernet interface. In these cases,
220+
/// this functino transmits ethernet frames.
221+
///
222+
/// The header of the packet can be filled by the function with the given
223+
/// parameters , but the buffer must already contain the space for the
224+
/// header.
225+
///
226+
/// # Arguments
227+
/// - `header_size`: The size in bytes of the media header to be filled by
228+
/// the `transmit()` function. If this is `0`, the (ethernet frame) header
229+
/// will not be filled by the function and taken as-is from the buffer.
230+
/// If it is nonzero, then it must be equal to `media_header_size` of
231+
/// the corresponding [`NetworkMode`] and the `dst_addr` and `protocol`
232+
/// parameters must not be `None`.
233+
/// - `buffer`: The buffer containing the whole network packet with all
234+
/// its payload including the header for the medium.
235+
/// - `src_addr`: The optional source address.
236+
/// - `dst_addr`: The optional destination address.
237+
/// - `protocol`: Ether Type as of RFC 3232. See
238+
/// https://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml#ieee-802-numbers-1
239+
/// for examples. Typically, this is `0x0800` (IPv4) or `0x0806` (ARP).
217240
pub fn transmit(
218241
&self,
219242
header_size: usize,
220243
buffer: &[u8],
221244
src_addr: Option<MacAddress>,
222-
dest_addr: Option<MacAddress>,
245+
dst_addr: Option<MacAddress>,
223246
protocol: Option<u16>,
224247
) -> Result {
225248
(self.transmit)(
@@ -228,7 +251,7 @@ impl SimpleNetwork {
228251
buffer.len(),
229252
buffer.as_ptr().cast(),
230253
src_addr.as_ref(),
231-
dest_addr.as_ref(),
254+
dst_addr.as_ref(),
232255
protocol.as_ref(),
233256
)
234257
.to_result()

0 commit comments

Comments
 (0)