OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
control_interface.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef vnsw_agent_pkt_control_interface_hpp
6 #define vnsw_agent_pkt_control_interface_hpp
7 
8 #include <string>
9 #include <boost/bind.hpp>
10 #include <boost/function.hpp>
11 #include <boost/asio.hpp>
12 
13 #include <pkt/pkt_handler.h>
14 
15 class PktHandler;
16 
17 // ControlInterface is base class for control packet I/O between agent and
18 // dataplane. Control packets can be for ARP resolution, Diagnostics, Flow
19 // setup traps etc...
21 public:
22  static const uint32_t kMaxPacketSize = 9060;
23 
25  virtual ~ControlInterface() { }
26 
30  }
31 
34 
35  // Initialize the implementation of COntrolInterface
36  virtual void InitControlInterface() = 0;
37 
38  // Shutdown control packet interface
39  virtual void ShutdownControlInterface() = 0;
40 
41  // Stop I/O operations
42  virtual void IoShutdownControlInterface() = 0;
43 
44  // Name of the control interface
45  virtual const std::string &Name() const = 0;
46 
47  // Length of header added by implementation of ControlInterface. Buffer
48  // passed in Send should reserve atleast EncapsulationLength() bytes
49  // TBD : To go from here
50  virtual uint32_t EncapsulationLength() const = 0;
51 
52  // Transmit packet on ControlInterface
53  virtual int Send(const AgentHdr &hdr, const PacketBufferPtr &pkt) = 0;
54 
55  // Handle control packet. AgentHdr is already decoded
56  bool Process(const AgentHdr &hdr, const PacketBufferPtr &pkt) {
57  pkt_handler_->HandleRcvPkt(hdr, pkt);
58  return true;
59  }
60 
61  PktHandler *pkt_handler() const { return pkt_handler_; }
62 private:
64 
66 };
67 
68 #endif // vnsw_agent_pkt_control_interface_hpp
boost::shared_ptr< PacketBuffer > PacketBufferPtr
Definition: packet_buffer.h:18
virtual ~ControlInterface()
bool Process(const AgentHdr &hdr, const PacketBufferPtr &pkt)
DISALLOW_COPY_AND_ASSIGN(ControlInterface)
PktHandler * pkt_handler() const
virtual void ShutdownControlInterface()=0
void Init(PktHandler *pkt_handler)
virtual void IoShutdownControlInterface()=0
virtual void InitControlInterface()=0
virtual const std::string & Name() const =0
virtual int Send(const AgentHdr &hdr, const PacketBufferPtr &pkt)=0
virtual uint32_t EncapsulationLength() const =0
PktHandler * pkt_handler_
static const uint32_t kMaxPacketSize
void HandleRcvPkt(const AgentHdr &hdr, const PacketBufferPtr &buff)
Definition: pkt_handler.cc:411