LCOV - code coverage report
Current view: top level - vnsw/agent/services - arp_entry.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 10 12 83.3 %
Date: 2026-11-09 02:10:49 Functions: 7 9 77.8 %
Legend: Lines: hit not hit

          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_arp_entry_hpp
       7             : #define vnsw_agent_arp_entry_hpp
       8             : 
       9             : struct ArpKey {
      10        4600 :     ArpKey(in_addr_t addr, const VrfEntry *ventry) : ip(addr), vrf(ventry) {};
      11       11717 :     ArpKey(const ArpKey &key) : ip(key.ip), vrf(key.vrf) {};
      12       20942 :     bool operator <(const ArpKey &rhs) const {
      13       20942 :         if (vrf != rhs.vrf)
      14       13011 :             return vrf < rhs.vrf;
      15        7931 :         return (ip < rhs.ip);
      16             :     }
      17             : 
      18             :     in_addr_t ip;
      19             :     const VrfEntry *vrf;
      20             : };
      21             : 
      22             : // Represents each Arp entry maintained by the ARP module
      23             : class ArpEntry {
      24             : public:
      25             :     enum State {
      26             :         INITING = 0x01,
      27             :         RESOLVING = 0x02,
      28             :         ACTIVE = 0x04,
      29             :         RERESOLVING  = 0x08,
      30             :     };
      31             : 
      32             :     ArpEntry(boost::asio::io_context &io, ArpHandler *handler,
      33             :              ArpKey &key, const VrfEntry *vrf, State state,
      34             :               const Interface *itf);
      35             :     virtual ~ArpEntry();
      36             : 
      37         220 :     const ArpKey &key() const { return key_; }
      38           0 :     State state() const { return state_; }
      39           6 :     const MacAddress &mac_address() const { return mac_address_; }
      40         977 :     const Interface *get_interface() const { return interface_.get(); }
      41             : 
      42             :     bool HandleArpRequest();
      43             :     void HandleArpReply(const MacAddress &);
      44             :     bool RetryExpiry();
      45             :     bool AgingExpiry();
      46             :     void SendGratuitousArp();
      47             :     bool DeleteArpRoute();
      48             :     bool IsResolved();
      49             :     void Resync(bool policy, const VnListType &vnlist,
      50             :                 const SecurityGroupList &sg,
      51             :                 const TagList &tag);
      52           2 :     int retry_count() const { return retry_count_; }
      53           0 :     void SetState(State state) { state_ = state; }
      54             : private:
      55             :     void StartTimer(uint32_t timeout, uint32_t mtype);
      56             :     void SendArpRequest();
      57             :     void AddArpRoute(bool resolved);
      58             :     void HandleDerivedArpRequest();
      59             :     bool IsDerived();
      60             : 
      61             :     boost::asio::io_context &io_;
      62             :     ArpKey key_;
      63             :     const VrfEntry *nh_vrf_;
      64             :     MacAddress mac_address_;
      65             :     State state_;
      66             :     int retry_count_;
      67             :     boost::intrusive_ptr<ArpHandler> handler_;
      68             :     Timer *arp_timer_;
      69             :     InterfaceConstRef interface_;
      70             :     DISALLOW_COPY_AND_ASSIGN(ArpEntry);
      71             : };
      72             : 
      73             : #endif // vnsw_agent_arp_entry_hpp

Generated by: LCOV version 1.14