pub fn emit(&self, header: TcpHeader, data: RT::Buf, remote_link_addr: MacAddress) {
        if header.ack {
            let (recv_seq_no, _) = self.receiver.get_recv_seq_no();
            if self.state.get() == State::PassiveClose || self.state.get() == State::FinWait3 {
                assert_eq!(header.ack_num, recv_seq_no + Wrapping(1));
            } else {
                assert_eq!(header.ack_num, recv_seq_no);
            }
            self.receiver.set_ack_deadline(None);
            self.receiver.set_ack_seq_no(header.ack_num);
        }

        debug!("Sending {} bytes + {:?}", data.len(), header);
        let segment = TcpSegment {
            ethernet2_hdr: Ethernet2Header {
                dst_addr: remote_link_addr,
                src_addr: self.rt.local_link_addr(),
                ether_type: EtherType2::Ipv4,
            },
            ipv4_hdr: Ipv4Header::new(self.local.addr, self.remote.addr, Ipv4Protocol2::Tcp),
            tcp_hdr: header,
            data,
            tx_checksum_offload: self.rt.tcp_options().tx_checksum_offload(),
        };
        self.rt.transmit(segment);
    }
/// Transmit this message to our connected peer.
Transmit this message to our connected peer.
Transmit this message to our connected peer .
pub fn emit(&self, header: TcpHeader, data: RT::Buf, remote_link_addr: MacAddress) {
        if header.ack {
            let (recv_seq_no, _) = self.receiver.get_recv_seq_no();
            if self.state.get() == State::PassiveClose || self.state.get() == State::FinWait3 {
                assert_eq!(header.ack_num, recv_seq_no + Wrapping(1));
            } else {
                assert_eq!(header.ack_num, recv_seq_no);
            }
            self.receiver.set_ack_deadline(None);
            self.receiver.set_ack_seq_no(header.ack_num);
        }
        debug!("Sending {} bytes + {:?}", data.len(), header);
        let segment = TcpSegment {
            ethernet2_hdr: Ethernet2Header {
                dst_addr: remote_link_addr,
                src_addr: self.rt.local_link_addr(),
                ether_type: EtherType2::Ipv4,
            },
            ipv4_hdr: Ipv4Header::new(self.local.addr, self.remote.addr, Ipv4Protocol2::Tcp),
            tcp_hdr: header,
            data,
            tx_checksum_offload: self.rt.tcp_options().tx_checksum_offload(),
        };
        self.rt.transmit(segment);
    }
pub fn emit ( & self , header : TcpHeader , data : RT :: Buf , remote_link_addr : MacAddress ) { if header . ack { let ( recv_seq_no , _ ) = self . receiver . get_recv_seq_no ( ) ; if self . state . get ( ) == State :: PassiveClose || self . state . get ( ) == State :: FinWait3 { assert_eq ! ( header ack_num recv_seq_no Wrapping ( 1 ) ) ; } else { assert_eq ! ( header ack_num recv_seq_no ) ; } self . receiver . set_ack_deadline ( None ) ; self . receiver . set_ack_seq_no ( header . ack_num ) ; } debug ! ( " " data len ( ) header ) ; let segment = TcpSegment { ethernet2_hdr : Ethernet2Header { dst_addr : remote_link_addr , src_addr : self . rt . local_link_addr ( ) , ether_type : EtherType2 :: Ipv4 , } , ipv4_hdr : Ipv4Header :: new ( self . local . addr , self . remote . addr , Ipv4Protocol2 :: Tcp ) , tcp_hdr : header , data , tx_checksum_offload : self . rt . tcp_options ( ) . tx_checksum_offload ( ) , } ; self . rt . transmit ( segment ) ; }
Transmit this message to our connected peer.
Transmit this message to our connected peer .
&self
header
TcpHeader
data
RT::Buf
remote_link_addr
MacAddress
&self
header
TcpHeader
data
RT::Buf
remote_link_addr
MacAddress