mirror of
https://github.com/mfontanini/libtins
synced 2026-01-23 02:35:57 +01:00
Replaced calls to PDU::rfind_pdu to find_pdu on TCPStreamFollower.
This commit is contained in:
@@ -340,29 +340,32 @@ void TCPStreamFollower::follow_streams(ForwardIterator start, ForwardIterator en
|
||||
|
||||
template<typename DataFunctor, typename EndFunctor>
|
||||
bool TCPStreamFollower::callback(PDU &pdu, const DataFunctor &data_fun, const EndFunctor &end_fun) {
|
||||
IP &ip = pdu.rfind_pdu<IP>();
|
||||
TCP &tcp = pdu.rfind_pdu<TCP>();
|
||||
IP *ip = pdu.find_pdu<IP>();
|
||||
TCP *tcp = pdu.find_pdu<TCP>();
|
||||
if(!ip || !tcp) {
|
||||
return true;
|
||||
}
|
||||
TCPStream::StreamInfo info(
|
||||
ip.src_addr(), ip.dst_addr(),
|
||||
tcp.sport(), tcp.dport()
|
||||
ip->src_addr(), ip->dst_addr(),
|
||||
tcp->sport(), tcp->dport()
|
||||
);
|
||||
sessions_type::iterator it = sessions.find(info);
|
||||
if(it == sessions.end()) {
|
||||
std::swap(info.client_addr, info.server_addr);
|
||||
std::swap(info.client_port, info.server_port);
|
||||
if((it = sessions.find(info)) == sessions.end()) {
|
||||
if(tcp.get_flag(TCP::SYN) && !tcp.get_flag(TCP::ACK)) {
|
||||
if(tcp->get_flag(TCP::SYN) && !tcp->get_flag(TCP::ACK)) {
|
||||
sessions.insert(
|
||||
std::make_pair(
|
||||
info,
|
||||
TCPStream(&ip, &tcp, last_identifier++)
|
||||
TCPStream(ip, tcp, last_identifier++)
|
||||
)
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(it->second.update(&ip, &tcp))
|
||||
if(it->second.update(ip, tcp))
|
||||
data_fun(it->second);
|
||||
// We're done with this stream
|
||||
if(it->second.is_finished()) {
|
||||
|
||||
Reference in New Issue
Block a user