LCOV - code coverage report
Current view: top level - src - DNS-binpac.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 2 51 3.9 %
Date: 2010-12-13 Functions: 2 19 10.5 %
Branches: 2 44 4.5 %

           Branch data     Line data    Source code
       1                 :            : // $Id:$
       2                 :            : 
       3                 :            : #include "DNS-binpac.h"
       4                 :            : #include "TCP_Reassembler.h"
       5                 :            : 
       6                 :          0 : DNS_UDP_Analyzer_binpac::DNS_UDP_Analyzer_binpac(Connection* conn)
       7                 :          0 : : Analyzer(AnalyzerTag::DNS_UDP_BINPAC, conn)
       8                 :            :         {
       9                 :          0 :         interp = new binpac::DNS::DNS_Conn(this);
      10                 :          0 :         did_session_done = 0;
      11                 :          0 :         ADD_ANALYZER_TIMER(&DNS_UDP_Analyzer_binpac::ExpireTimer,
      12                 :            :                         network_time + dns_session_timeout, 1, TIMER_DNS_EXPIRE);
      13                 :          0 :         }
      14                 :            : 
      15                 :          0 : DNS_UDP_Analyzer_binpac::~DNS_UDP_Analyzer_binpac()
      16                 :            :         {
      17 [ #  # ][ #  # ]:          0 :         delete interp;
                 [ #  # ]
      18 [ #  # ][ #  # ]:          0 :         }
                 [ #  # ]
      19                 :            : 
      20                 :          0 : void DNS_UDP_Analyzer_binpac::Done()
      21                 :            :         {
      22                 :          0 :         Analyzer::Done();
      23                 :            : 
      24         [ #  # ]:          0 :         if ( ! did_session_done )
      25                 :          0 :                 Event(udp_session_done);
      26                 :          0 :         }
      27                 :            : 
      28                 :          0 : void DNS_UDP_Analyzer_binpac::DeliverPacket(int len, const u_char* data, bool orig, int seq, const IP_Hdr* ip, int caplen)
      29                 :            :         {
      30                 :          0 :         Analyzer::DeliverPacket(len, data, orig, seq, ip, caplen);
      31                 :          0 :         interp->NewData(orig, data, data + len);
      32                 :          0 :         }
      33                 :            : 
      34                 :          0 : void DNS_UDP_Analyzer_binpac::ExpireTimer(double t)
      35                 :            :         {
      36                 :            :         // The - 1.0 in the following is to allow 1 second for the
      37                 :            :         // common case of a single request followed by a single reply,
      38                 :            :         // so we don't needlessly set the timer twice in that case.
      39 [ #  # ][ #  # ]:          0 :         if ( t - Conn()->LastTime() >= dns_session_timeout - 1.0 || terminating )
                 [ #  # ]
      40                 :            :                 {
      41                 :          0 :                 Event(connection_timeout);
      42                 :          0 :                 sessions->Remove(Conn());
      43                 :            :                 }
      44                 :            :         else
      45                 :          0 :                 ADD_ANALYZER_TIMER(&DNS_UDP_Analyzer_binpac::ExpireTimer,
      46                 :            :                                 t + dns_session_timeout, 1, TIMER_DNS_EXPIRE);
      47                 :          0 :         }
      48                 :            : 
      49                 :          0 : DNS_TCP_Analyzer_binpac::DNS_TCP_Analyzer_binpac(Connection* conn)
      50                 :          0 : : TCP_ApplicationAnalyzer(AnalyzerTag::DNS_TCP_BINPAC, conn)
      51                 :            :         {
      52                 :          0 :         interp = new binpac::DNS_on_TCP::DNS_TCP_Conn(this);
      53                 :          0 :         }
      54                 :            : 
      55                 :          0 : DNS_TCP_Analyzer_binpac::~DNS_TCP_Analyzer_binpac()
      56                 :            :         {
      57 [ #  # ][ #  # ]:          0 :         delete interp;
                 [ #  # ]
      58 [ #  # ][ #  # ]:          0 :         }
                 [ #  # ]
      59                 :            : 
      60                 :          0 : void DNS_TCP_Analyzer_binpac::Done()
      61                 :            :         {
      62                 :          0 :         TCP_ApplicationAnalyzer::Done();
      63                 :            : 
      64                 :          0 :         interp->FlowEOF(true);
      65                 :          0 :         interp->FlowEOF(false);
      66                 :          0 :         }
      67                 :            : 
      68                 :          0 : void DNS_TCP_Analyzer_binpac::EndpointEOF(TCP_Reassembler* endp)
      69                 :            :         {
      70                 :          0 :         TCP_ApplicationAnalyzer::EndpointEOF(endp);
      71                 :          0 :         interp->FlowEOF(endp->IsOrig());
      72                 :          0 :         }
      73                 :            : 
      74                 :            : void DNS_TCP_Analyzer_binpac::DeliverStream(int len, const u_char* data,
      75                 :          0 :                                                 bool orig)
      76                 :            :         {
      77                 :          0 :         TCP_ApplicationAnalyzer::DeliverStream(len, data, orig);
      78                 :            : 
      79         [ #  # ]:          0 :         assert(TCP());
      80                 :            : 
      81 [ #  # ][ #  # ]:          0 :         if ( TCP()->IsPartial() || TCP()->HadGap(orig) )
                 [ #  # ]
      82                 :            :                 // punt-on-partial or stop-on-gap.
      83                 :          0 :                 return;
      84                 :            : 
      85                 :          0 :         interp->NewData(orig, data, data + len);
      86                 :            :         }
      87                 :            : 
      88                 :          0 : void DNS_TCP_Analyzer_binpac::Undelivered(int seq, int len, bool orig)
      89                 :            :         {
      90                 :          0 :         TCP_ApplicationAnalyzer::Undelivered(seq, len, orig);
      91                 :          0 :         interp->NewGap(orig, len);
      92 [ +  - ][ +  - ]:          6 :         }

Generated by: LCOV version 1.8