OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
packet_interface.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_packet_interface_hpp
6 #define vnsw_agent_packet_interface_hpp
7 
9 // Implementation of Pkt Interface. Interface is used to exchange packets
10 // between vrouter to agent
12 
13 struct PacketInterfaceData;
14 
15 class PacketInterface : public Interface {
16 public:
17  PacketInterface(const std::string &name);
18  virtual ~PacketInterface();
19 
20  virtual bool CmpInterface(const DBEntry &rhs) const { return false; }
21 
22  std::string ToString() const { return "PKT <" + name() + ">"; }
23  KeyPtr GetDBRequestKey() const;
24 
25  // Helper function to enqueue DBRequest to create a Pkt Interface
26  static void CreateReq(InterfaceTable *table, const std::string &ifname,
28  static void Create(InterfaceTable *table, const std::string &ifname,
30  // Helper function to enqueue DBRequest to delete a Pkt Interface
31  static void DeleteReq(InterfaceTable *table, const std::string &ifname);
32  static void Delete(InterfaceTable *table, const std::string &ifname);
33  void PostAdd();
34  bool Delete(const DBRequest *req);
35  bool OnChange(PacketInterfaceData *data);
36  virtual void ObtainOsSpecificParams(const std::string &name, Agent *agent);
37 
38 private:
40 };
41 
44  const std::string &name) :
45  InterfaceKey(AgentKey::ADD_DEL_CHANGE, Interface::PACKET, uuid, name,
46  false) {
47  }
48 
49  virtual ~PacketInterfaceKey() {}
50 
51  Interface *AllocEntry(const InterfaceTable *table) const {
52  return new PacketInterface(name_);
53  }
55  const InterfaceData *data) const {
56  return new PacketInterface(name_);
57  }
58 
59  InterfaceKey *Clone() const {
60  return new PacketInterfaceKey(*this);
61  }
62 };
63 
66  InterfaceData(NULL, NULL, transport) {
67  PktInit();
68  }
69 };
70 
71 #endif // vnsw_agent_packet_interface_hpp
InterfaceKey * Clone() const
std::string ToString() const
static void CreateReq(InterfaceTable *table, const std::string &ifname, Interface::Transport transport)
Definition: interface.cc:665
Interface::Transport transport() const
Definition: interface.h:138
void PktInit()
Definition: interface.h:258
boost::uuids::uuid uuid
bool OnChange(PacketInterfaceData *data)
Definition: interface.cc:698
std::unique_ptr< DBRequestKey > KeyPtr
Definition: db_entry.h:25
DISALLOW_COPY_AND_ASSIGN(PacketInterface)
std::string name_
Definition: interface.h:245
virtual ~PacketInterface()
Definition: interface.cc:646
PacketInterfaceData(Interface::Transport transport)
Definition: agent.h:358
virtual ~PacketInterfaceKey()
virtual void ObtainOsSpecificParams(const std::string &name, Agent *agent)
void Delete()
Definition: db_entry.cc:131
PacketInterface(const std::string &name)
Definition: interface.cc:642
PacketInterfaceKey(const boost::uuids::uuid &uuid, const std::string &name)
virtual bool CmpInterface(const DBEntry &rhs) const
KeyPtr GetDBRequestKey() const
Definition: interface.cc:649
static void Create(InterfaceTable *table, const std::string &ifname, Interface::Transport transport)
Definition: interface.cc:674
const std::string & name() const
Definition: interface.h:114
Interface * AllocEntry(const InterfaceTable *table, const InterfaceData *data) const
static void DeleteReq(InterfaceTable *table, const std::string &ifname)
Definition: interface.cc:683
Interface * AllocEntry(const InterfaceTable *table) const