Line data Source code
1 : /* 2 : * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. 3 : * Copyright Contributors to the OpenSDN project 4 : */ 5 : 6 : #ifndef vnsw_agent_icmp_proto_h_ 7 : #define vnsw_agent_icmp_proto_h_ 8 : 9 : #include "pkt/proto.h" 10 : #include "services/icmp_handler.h" 11 : 12 : class IcmpProto : public Proto { 13 : public: 14 : struct IcmpStats { 15 8 : IcmpStats() { Reset(); } 16 18 : void Reset() { icmp_gw_ping = icmp_gw_ping_err = icmp_drop = 17 18 : icmp_intf_not_inst = icmp_no_l3fwd = 0; } 18 : 19 : uint32_t icmp_gw_ping; 20 : uint32_t icmp_gw_ping_err; 21 : uint32_t icmp_drop; 22 : uint32_t icmp_intf_not_inst; 23 : uint32_t icmp_no_l3fwd; 24 : }; 25 : 26 2 : void Shutdown() {} 27 : IcmpProto(Agent *agent, boost::asio::io_context &io); 28 : virtual ~IcmpProto(); 29 : ProtoHandler *AllocProtoHandler(boost::shared_ptr<PktInfo> info, 30 : boost::asio::io_context &io); 31 : 32 0 : void IncrStatsGwPing() { stats_.icmp_gw_ping++; } 33 0 : void IncrStatsGwPingErr() { stats_.icmp_gw_ping_err++; } 34 0 : void IncrStatsDrop() { stats_.icmp_drop++; } 35 0 : void IncrStatsIntfNotInst() { stats_.icmp_intf_not_inst++; } 36 0 : void IncrStatsNoL3Fwd() { stats_.icmp_no_l3fwd++; } 37 20 : const IcmpStats &GetStats() const { return stats_; } 38 10 : void ClearStats() { stats_.Reset(); } 39 : 40 : private: 41 : IcmpStats stats_; 42 : DISALLOW_COPY_AND_ASSIGN(IcmpProto); 43 : }; 44 : 45 : #endif // vnsw_agent_icmp_proto_h_