Lines Matching full:seg
574 Segment seg; in parse() local
575 seg.conv = bytes_to_long(buffer); in parse()
576 seg.seq = bytes_to_long(buffer + 4); in parse()
577 seg.ack = bytes_to_long(buffer + 8); in parse()
578 seg.flags = buffer[13]; in parse()
579 seg.wnd = bytes_to_short(buffer + 14); in parse()
581 seg.tsval = bytes_to_long(buffer + 16); in parse()
582 seg.tsecr = bytes_to_long(buffer + 20); in parse()
584 seg.data = reinterpret_cast<const char*>(buffer) + HEADER_SIZE; in parse()
585 seg.len = size - HEADER_SIZE; in parse()
588 RTC_LOG(LS_INFO) << "--> <CONV=" << seg.conv in parse()
589 << "><FLG=" << static_cast<unsigned>(seg.flags) in parse()
590 << "><SEQ=" << seg.seq << ":" << seg.seq + seg.len in parse()
591 << "><ACK=" << seg.ack << "><WND=" << seg.wnd in parse()
592 << "><TS=" << (seg.tsval % 10000) in parse()
593 << "><TSR=" << (seg.tsecr % 10000) << "><LEN=" << seg.len in parse()
597 return process(seg); in parse()
643 bool PseudoTcp::process(Segment& seg) { in process() argument
646 if (seg.conv != m_conv) { in process()
647 // if ((seg.flags & FLAG_RST) == 0) { in process()
648 // packet(tcb, seg.ack, 0, FLAG_RST, 0, 0); in process()
665 if (seg.flags & FLAG_RST) { in process()
672 if (seg.flags & FLAG_CTL) { in process()
673 if (seg.len == 0) { in process()
676 } else if (seg.data[0] == CTL_CONNECT) { in process()
680 parseOptions(&seg.data[1], seg.len - 1); in process()
697 RTC_LOG_F(LS_WARNING) << "Unknown control code: " << seg.data[0]; in process()
703 if ((seg.seq <= m_ts_lastack) && (m_ts_lastack < seg.seq + seg.len)) { in process()
704 m_ts_recent = seg.tsval; in process()
708 if ((seg.ack > m_snd_una) && (seg.ack <= m_snd_nxt)) { in process()
710 if (seg.tsecr) { in process()
711 int32_t rtt = rtc::TimeDiff32(now, seg.tsecr); in process()
735 m_snd_wnd = static_cast<uint32_t>(seg.wnd) << m_swnd_scale; in process()
737 uint32_t nAcked = seg.ack - m_snd_una; in process()
738 m_snd_una = seg.ack; in process()
785 } else if (seg.ack == m_snd_una) { in process()
788 m_snd_wnd = static_cast<uint32_t>(seg.wnd) << m_swnd_scale; in process()
791 if (seg.len > 0) { in process()
852 if (seg.seq != m_rcv_nxt) { in process()
854 } else if (seg.len != 0) { in process()
863 if (seg.seq > m_rcv_nxt) { in process()
865 } else if (seg.seq + seg.len <= m_rcv_nxt) { in process()
872 if (seg.seq < m_rcv_nxt) { in process()
873 uint32_t nAdjust = m_rcv_nxt - seg.seq; in process()
874 if (nAdjust < seg.len) { in process()
875 seg.seq += nAdjust; in process()
876 seg.data += nAdjust; in process()
877 seg.len -= nAdjust; in process()
879 seg.len = 0; in process()
886 if ((seg.seq + seg.len - m_rcv_nxt) > in process()
889 seg.seq + seg.len - m_rcv_nxt - static_cast<uint32_t>(available_space); in process()
890 if (nAdjust < seg.len) { in process()
891 seg.len -= nAdjust; in process()
893 seg.len = 0; in process()
897 bool bIgnoreData = (seg.flags & FLAG_CTL) || (m_shutdown != SD_NONE); in process()
900 if (seg.len > 0) { in process()
903 if (seg.seq == m_rcv_nxt) { in process()
904 m_rcv_nxt += seg.len; in process()
917 m_rbuf.ConsumeWriteBuffer(seg.len); in process()
918 m_rbuf.ConsumeReadData(seg.len); in process()
925 uint32_t nOffset = seg.seq - m_rcv_nxt; in process()
928 m_rbuf.WriteOffset(seg.data, seg.len, nOffset, NULL); in process()
936 if (seg.seq == m_rcv_nxt) { in process()
937 m_rbuf.ConsumeWriteBuffer(seg.len); in process()
938 m_rcv_nxt += seg.len; in process()
939 m_rcv_wnd -= seg.len; in process()
946 RTC_LOG(LS_INFO) << "Saving " << seg.len << " bytes (" << seg.seq in process()
947 << " -> " << seg.seq + seg.len << ")"; in process()
950 rseg.seq = seg.seq; in process()
951 rseg.len = seg.len; in process()
993 bool PseudoTcp::transmit(const SList::iterator& seg, uint32_t now) { in transmit() argument
994 if (seg->xmit >= ((m_state == TCP_ESTABLISHED) ? 15 : 30)) { in transmit()
999 uint32_t nTransmit = std::min(seg->len, m_mss); in transmit()
1002 uint32_t seq = seg->seq; in transmit()
1003 uint8_t flags = (seg->bCtrl ? FLAG_CTL : 0); in transmit()
1005 packet(seq, flags, seg->seq - m_snd_una, nTransmit); in transmit()
1037 if (nTransmit < seg->len) { in transmit()
1040 SSegment subseg(seg->seq + nTransmit, seg->len - nTransmit, seg->bCtrl); in transmit()
1041 // subseg.tstamp = seg->tstamp; in transmit()
1042 subseg.xmit = seg->xmit; in transmit()
1043 seg->len = nTransmit; in transmit()
1045 SList::iterator next = seg; in transmit()
1049 if (seg->xmit == 0) { in transmit()
1050 m_snd_nxt += seg->len; in transmit()
1052 seg->xmit += 1; in transmit()
1053 // seg->tstamp = now; in transmit()
1137 SList::iterator seg = it; in attemptSend() local
1140 if (seg->len > nAvailable) { in attemptSend()
1141 SSegment subseg(seg->seq + nAvailable, seg->len - nAvailable, seg->bCtrl); in attemptSend()
1142 seg->len = nAvailable; in attemptSend()
1146 if (!transmit(seg, now)) { in attemptSend()