OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
arp_handler.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef vnsw_agent_arp_handler_hpp
6 #define vnsw_agent_arp_handler_hpp
7 
8 #include "pkt/proto_handler.h"
9 
10 #define GRATUITOUS_ARP 0x0100 // keep this different from standard ARP commands
11 
12 struct ArpKey;
13 class ArpEntry;
15 
16 class ArpHandler : public ProtoHandler {
17 public:
18  static const uint16_t kMaxArpProbes = 256;
19  ArpHandler(Agent *agent, boost::shared_ptr<PktInfo> info,
20  boost::asio::io_context &io);
21  virtual ~ArpHandler();
22 
23  bool Run();
24  void SendArp(uint16_t op, const MacAddress &smac, in_addr_t sip,
25  const MacAddress &tmac, const MacAddress &dmac,
26  in_addr_t tip, uint32_t itf, uint32_t vrf);
27  void SendArpRequestByPlen(const VmInterface *vm_interface,
28  const MacAddress &smac,
29  const ArpPathPreferenceState *data,
30  const Ip4Address &tpa);
31  friend void intrusive_ptr_add_ref(const ArpHandler *p);
32  friend void intrusive_ptr_release(const ArpHandler *p);
33 
34 private:
35  uint32_t MaxArpProbeAddresses() const;
36  bool HandlePacket();
37  bool HandleMessage();
38  void EntryDelete(ArpKey &key);
39  uint16_t ArpHdr(const MacAddress &smac, in_addr_t sip,
40  const MacAddress &tmac, in_addr_t tip, uint16_t op);
41 
42  ether_arp *arp_;
43  in_addr_t arp_tpa_;
44  mutable tbb::atomic<uint32_t> refcount_;
46 };
47 
48 #endif // vnsw_agent_arp_handler_hpp
void EntryDelete(ArpKey &key)
Definition: arp_handler.cc:344
friend void intrusive_ptr_add_ref(const ArpHandler *p)
Definition: arp_handler.cc:458
in_addr_t arp_tpa_
Definition: arp_handler.h:43
Agent * agent() const
Definition: proto_handler.h:80
void SendArpRequestByPlen(const VmInterface *vm_interface, const MacAddress &smac, const ArpPathPreferenceState *data, const Ip4Address &tpa)
Definition: arp_handler.cc:392
uint16_t ArpHdr(const MacAddress &smac, in_addr_t sip, const MacAddress &tmac, in_addr_t tip, uint16_t op)
Definition: arp_handler.cc:353
uint32_t MaxArpProbeAddresses() const
Definition: arp_handler.cc:452
tbb::atomic< uint32_t > refcount_
Definition: arp_handler.h:44
bool HandlePacket()
Definition: arp_handler.cc:50
Definition: agent.h:358
DISALLOW_COPY_AND_ASSIGN(ArpHandler)
static const uint16_t kMaxArpProbes
Definition: arp_handler.h:18
ArpHandler(Agent *agent, boost::shared_ptr< PktInfo > info, boost::asio::io_context &io)
Definition: arp_handler.cc:18
boost::asio::ip::address_v4 Ip4Address
Definition: address.h:14
friend void intrusive_ptr_release(const ArpHandler *p)
Definition: arp_handler.cc:462
virtual ~ArpHandler()
Definition: arp_handler.cc:24
void SendArp(uint16_t op, const MacAddress &smac, in_addr_t sip, const MacAddress &tmac, const MacAddress &dmac, in_addr_t tip, uint32_t itf, uint32_t vrf)
Definition: arp_handler.cc:369
bool Run()
Definition: arp_handler.cc:27
bool HandleMessage()
Definition: arp_handler.cc:254
ether_arp * arp_
Definition: arp_handler.h:42