pub fn write_next_frame(&mut self, buf: &mut [u8]) -> Option<NonZeroUsize> {
        // We try to send ARP replies first.
        if self.pending_arp_reply_dest.is_some() {
            return match self.write_arp_reply(buf) {
                Ok(something) => {
                    METRICS.mmds.tx_count.inc();
                    self.pending_arp_reply_dest = None;
                    something
                }
                Err(_) => {
                    METRICS.mmds.tx_errors.inc();
                    None
                }
            };
        } else {
            let call_write = match self.tcp_handler.next_segment_status() {
                NextSegmentStatus::Available => true,
                NextSegmentStatus::Timeout(value) => timestamp_cycles() >= value,
                NextSegmentStatus::Nothing => false,
            };

            if call_write {
                return match self.write_packet(buf) {
                    Ok(something) => {
                        METRICS.mmds.tx_count.inc();
                        something
                    }
                    Err(_) => {
                        METRICS.mmds.tx_errors.inc();
                        None
                    }
                };
            }
        }
        None
    }
// Allows the MMDS network stack to write a frame to the specified buffer. Will return:
// - None, if the MMDS network stack has no frame to send at this point. The buffer can be
// used for something else by the device model.
// - Some(len), if a frame of the given length has been written to the specified buffer.
Allows the MMDS network stack to write a frame to the specified buffer. Will return:
None, if the MMDS network stack has no frame to send at this point. The buffer can be
used for something else by the device model.
Some(len), if a frame of the given length has been written to the specified buffer.
Allows the MMDS network stack to write a frame to the specified buffer . Will return : None if the MMDS network stack has no frame to send at this point . The buffer can be used for something else by the device model . Some ( len ) if a frame of the given length has been written to the specified buffer .
pub fn write_next_frame(&mut self, buf: &mut [u8]) -> Option<NonZeroUsize> {
        // We try to send ARP replies first.
        if self.pending_arp_reply_dest.is_some() {
            return match self.write_arp_reply(buf) {
                Ok(something) => {
                    METRICS.mmds.tx_count.inc();
                    self.pending_arp_reply_dest = None;
                    something
                }
                Err(_) => {
                    METRICS.mmds.tx_errors.inc();
                    None
                }
            };
        } else {
            let call_write = match self.tcp_handler.next_segment_status() {
                NextSegmentStatus::Available => true,
                NextSegmentStatus::Timeout(value) => timestamp_cycles() >= value,
                NextSegmentStatus::Nothing => false,
            };
            if call_write {
                return match self.write_packet(buf) {
                    Ok(something) => {
                        METRICS.mmds.tx_count.inc();
                        something
                    }
                    Err(_) => {
                        METRICS.mmds.tx_errors.inc();
                        None
                    }
                };
            }
        }
        None
    }
pub fn write_next_frame ( & mut self , buf : & mut [ u8 ] ) -> Option < NonZeroUsize > { // We try to send ARP replies first. if self . pending_arp_reply_dest . is_some ( ) { return match self . write_arp_reply ( buf ) { Ok ( something ) => { METRICS . mmds . tx_count . inc ( ) ; self . pending_arp_reply_dest = None ; something } Err ( _ ) => { METRICS . mmds . tx_errors . inc ( ) ; None } } ; } else { let call_write = match self . tcp_handler . next_segment_status ( ) { NextSegmentStatus :: Available => true , NextSegmentStatus :: Timeout ( value ) => timestamp_cycles ( ) >= value , NextSegmentStatus :: Nothing => false , } ; if call_write { return match self . write_packet ( buf ) { Ok ( something ) => { METRICS . mmds . tx_count . inc ( ) ; something } Err ( _ ) => { METRICS . mmds . tx_errors . inc ( ) ; None } } ; } } None }
Allows the MMDS network stack to write a frame to the specified buffer.
Allows the MMDS network stack to write a frame to the specified buffer .
&mut self
buf
&mut [u8]
&mut self
buf
&mut [u8]