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: 1 12 8.3 %
Date: 2026-06-22 02:21:21 Functions: 1 9 11.1 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14