LCOV - code coverage report
Current view: top level - vnsw/agent/services - icmp_error_proto.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 8 12 66.7 %
Date: 2026-08-03 02:19:58 Functions: 3 7 42.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : #ifndef VNSW_AGENT_SERVICES_ICMP_ERROR_PROTO_H_
       5             : #define VNSW_AGENT_SERVICES_ICMP_ERROR_PROTO_H_
       6             : 
       7             : #include <boost/asio.hpp>
       8             : #include "pkt/proto.h"
       9             : 
      10             : struct FlowKey;
      11             : 
      12             : class IcmpErrorProto : public Proto {
      13             :  public:
      14             :     struct Stats {
      15           1 :         Stats() { Reset(); }
      16           1 :         ~Stats() { }
      17           1 :         void Reset() {
      18           1 :             df_msgs = 0;
      19           1 :             drops = 0;
      20           1 :             interface_errors = 0;
      21           1 :             invalid_flow_index = 0;
      22           1 :         }
      23             : 
      24             :         uint32_t df_msgs;
      25             :         uint32_t drops;
      26             :         uint32_t interface_errors;
      27             :         uint32_t invalid_flow_index;
      28             :     };
      29             :     typedef boost::function<bool(uint32_t, FlowKey *, bool *)> FlowIndexToKeyFn;
      30             : 
      31             :     IcmpErrorProto(Agent *agent, boost::asio::io_context &io);
      32             :     virtual ~IcmpErrorProto();
      33             : 
      34             :     void Shutdown() { }
      35           0 :     void Register(FlowIndexToKeyFn fn) { flow_index_to_key_fn_ = fn; }
      36             :     bool FlowIndexToKey(uint32_t index, FlowKey *key, bool *is_nat_flow);
      37             :     ProtoHandler *AllocProtoHandler(boost::shared_ptr<PktInfo> info,
      38             :                                     boost::asio::io_context &io);
      39             : 
      40             :     void incrememt_df_msgs() { stats_.df_msgs++; }
      41           0 :     void increment_drops() { stats_.drops++; }
      42           0 :     void increment_interface_errors() { stats_.interface_errors++; }
      43           0 :     void increment_invalid_flow_index() { stats_.invalid_flow_index++; }
      44             :     const Stats &GetStats() const { return stats_; }
      45             :     void ClearStats() { stats_.Reset(); }
      46             : 
      47             :  private:
      48             :     Stats stats_;
      49             :     FlowIndexToKeyFn flow_index_to_key_fn_;
      50             :     DISALLOW_COPY_AND_ASSIGN(IcmpErrorProto);
      51             : };
      52             : 
      53             : #endif  // VNSW_AGENT_SERVICES_ICMP_ERROR_PROTO_H_

Generated by: LCOV version 1.14