TCPStream::fragments_type TCPStream::clone_fragments(const fragments_type& frags) { fragments_type new_frags; for (fragments_type::const_iterator it = frags.begin(); it != frags.end(); ++it) { new_frags.insert(make_pair(it->first, it->second->clone())); } return new_frags; }
bool TCPStream::generic_process(uint32_t &my_seq, uint32_t &other_seq, payload_type &pload, fragments_type &frags, TCP *tcp, RawPDU *raw) { bool added_some(false); if(tcp->get_flag(TCP::FIN) || tcp->get_flag(TCP::RST)) fin_sent = true; if(raw && tcp->seq() >= my_seq) { frags[tcp->seq()] = static_cast<RawPDU*>(tcp->release_inner_pdu()); fragments_type::iterator it = frags.begin(); while(it != frags.end() && it->first == my_seq) { pload.insert( pload.end(), it->second->payload().begin(), it->second->payload().end() ); my_seq += it->second->payload_size(); delete it->second; frags.erase(it); it = frags.begin(); added_some = true; } } return added_some; }
void TCPStream::free_fragments(fragments_type& frags) { for (fragments_type::iterator it = frags.begin(); it != frags.end(); ++it) { delete it->second; } }