@@ -186,13 +186,38 @@ impl SimpleNetwork {
186186 status. to_result_with_val ( || NonNull :: new ( tx_buf. cast ( ) ) )
187187 }
188188
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 varies based on the type of network interface. In
192+ /// typical scenarios, the protocol is implemented for Ethernet devices,
193+ /// meaning 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+ /// [IANA IEEE 802 Numbers][ethertype] for examples. Typically, this is
212+ /// `0x0800` (IPv4) or `0x0806` (ARP).
213+ ///
214+ /// [ethertype]: https://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml#ieee-802-numbers-1
190215 pub fn transmit (
191216 & self ,
192217 header_size : usize ,
193218 buffer : & [ u8 ] ,
194219 src_addr : Option < MacAddress > ,
195- dest_addr : Option < MacAddress > ,
220+ dst_addr : Option < MacAddress > ,
196221 protocol : Option < u16 > ,
197222 ) -> Result {
198223 unsafe {
@@ -202,7 +227,7 @@ impl SimpleNetwork {
202227 buffer. len ( ) ,
203228 buffer. as_ptr ( ) . cast ( ) ,
204229 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 ( ) ) ,
230+ dst_addr . as_ref ( ) . map ( ptr:: from_ref) . unwrap_or ( ptr:: null ( ) ) ,
206231 protocol. as_ref ( ) . map ( ptr:: from_ref) . unwrap_or ( ptr:: null ( ) ) ,
207232 )
208233 }
0 commit comments