Back to index

natlog  0.91.0
remove.cc
Go to the documentation of this file.
00001 #include "pcaprecord.ih"
00002 
00003 void PcapRecord::remove(PcapPacket const &packet)
00004 {
00005     size_t idx = 0;
00006 
00007     for (auto &element: d_connections)
00008     {
00009         if (
00010             element != 0
00011             &&
00012             element->source.port == packet.sourcePort()
00013             &&
00014             memcmp(&element->source.addr, &packet.sourceAddr(), 
00015                     sizeof(struct in_addr)) == 0
00016         )
00017         {
00018             imsg << "Rem #" << idx << endl;
00019             log(element, packet.seconds(), packet.microSeconds());
00020             delete element;
00021             element = 0;
00022             return;
00023         }
00024         ++idx;
00025     }
00026 
00027 //    cout << "FIN/ACK: no record for " << 
00028 //            packet.sourceIP().dottedDecimalAddress() << 
00029 //            " (" << packet.sourcePort() << ") to " <<
00030 //            packet.destIP().dottedDecimalAddress() << 
00031 //            " (" << packet.destPort() << ')' << endl;
00032 }
00033