@@ -213,13 +213,36 @@ impl SimpleNetwork {
213
213
status. to_result_with_val ( || NonNull :: new ( tx_buf. cast ( ) ) )
214
214
}
215
215
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).
217
240
pub fn transmit (
218
241
& self ,
219
242
header_size : usize ,
220
243
buffer : & [ u8 ] ,
221
244
src_addr : Option < MacAddress > ,
222
- dest_addr : Option < MacAddress > ,
245
+ dst_addr : Option < MacAddress > ,
223
246
protocol : Option < u16 > ,
224
247
) -> Result {
225
248
( self . transmit ) (
@@ -228,7 +251,7 @@ impl SimpleNetwork {
228
251
buffer. len ( ) ,
229
252
buffer. as_ptr ( ) . cast ( ) ,
230
253
src_addr. as_ref ( ) ,
231
- dest_addr . as_ref ( ) ,
254
+ dst_addr . as_ref ( ) ,
232
255
protocol. as_ref ( ) ,
233
256
)
234
257
. to_result ( )
0 commit comments