@@ -186,13 +186,36 @@ impl SimpleNetwork {
186
186
status. to_result_with_val ( || NonNull :: new ( tx_buf. cast ( ) ) )
187
187
}
188
188
189
- /// Place a packet in the transmit queue of a network interface.
189
+ /// Place a packet in the transmit queue of the network interface.
190
+ ///
191
+ /// The packet structure depends on the type of network interface, but
192
+ /// effectively this is always a (wired) ethernet interface. In these cases,
193
+ /// this function transmits ethernet frames.
194
+ ///
195
+ /// The header of the packet can be filled by the function with the given
196
+ /// parameters, but the buffer must already reserve the space for the
197
+ /// header.
198
+ ///
199
+ /// # Arguments
200
+ /// - `header_size`: The size in bytes of the media header to be filled by
201
+ /// the `transmit()` function. If this is `0`, the (ethernet frame) header
202
+ /// will not be filled by the function and taken as-is from the buffer.
203
+ /// If it is nonzero, then it must be equal to `media_header_size` of
204
+ /// the corresponding [`NetworkMode`] and the `dst_addr` and `protocol`
205
+ /// parameters must not be `None`.
206
+ /// - `buffer`: The buffer containing the whole network packet with all
207
+ /// its payload including the header for the medium.
208
+ /// - `src_addr`: The optional source address.
209
+ /// - `dst_addr`: The optional destination address.
210
+ /// - `protocol`: Ether Type as of RFC 3232. See
211
+ /// <https://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml#ieee-802-numbers-1>
212
+ /// for examples. Typically, this is `0x0800` (IPv4) or `0x0806` (ARP).
190
213
pub fn transmit (
191
214
& self ,
192
215
header_size : usize ,
193
216
buffer : & [ u8 ] ,
194
217
src_addr : Option < MacAddress > ,
195
- dest_addr : Option < MacAddress > ,
218
+ dst_addr : Option < MacAddress > ,
196
219
protocol : Option < u16 > ,
197
220
) -> Result {
198
221
unsafe {
@@ -202,7 +225,7 @@ impl SimpleNetwork {
202
225
buffer. len ( ) ,
203
226
buffer. as_ptr ( ) . cast ( ) ,
204
227
src_addr. as_ref ( ) . map ( ptr:: from_ref) . unwrap_or ( ptr:: null ( ) ) ,
205
- dest_addr . as_ref ( ) . map ( ptr:: from_ref) . unwrap_or ( ptr:: null ( ) ) ,
228
+ dst_addr . as_ref ( ) . map ( ptr:: from_ref) . unwrap_or ( ptr:: null ( ) ) ,
206
229
protocol. as_ref ( ) . map ( ptr:: from_ref) . unwrap_or ( ptr:: null ( ) ) ,
207
230
)
208
231
}
0 commit comments