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_PKT_INIT__ 7 : #define __VNSW_PKT_INIT__ 8 : 9 : #include <sandesh/sandesh_trace.h> 10 : 11 : class PktHandler; 12 : class FlowTable; 13 : class FlowProto; 14 : class PacketBufferManager; 15 : class ControlInterface; 16 : class FlowMgmtManager; 17 : 18 : // Packet Module 19 : class PktModule { 20 : public: 21 : PktModule(Agent *agent); 22 : virtual ~PktModule(); 23 : 24 : typedef std::vector<FlowMgmtManager *> FlowMgmtManagerList; 25 : void Init(bool run_with_vrouter); 26 : void Shutdown(); 27 : void IoShutdown(); 28 : void FlushFlows(); 29 : void InitDone(); 30 : 31 : Agent *agent() const { return agent_; } 32 8296 : PktHandler *pkt_handler() const { return pkt_handler_.get(); } 33 : FlowTable *flow_table(uint16_t index) const; 34 2623 : PacketBufferManager *packet_buffer_manager() const { 35 2623 : return packet_buffer_manager_.get(); 36 : } 37 5 : FlowMgmtManagerList flow_mgmt_manager_list() const { 38 5 : return flow_mgmt_manager_list_; 39 : } 40 4031 : FlowMgmtManager *flow_mgmt_manager(uint16_t index) const { 41 4031 : assert(index < flow_mgmt_manager_list_.size()); 42 4031 : return flow_mgmt_manager_list_[index]; 43 : } 44 6361 : FlowProto *get_flow_proto() const { return flow_proto_.get(); } 45 : 46 : void set_control_interface(ControlInterface *val); 47 2231 : ControlInterface *control_interface() const { return control_interface_; } 48 : 49 : std::vector<FlowMgmtManager *>::const_iterator 50 0 : flow_mgmt_manager_iterator_begin() const { 51 0 : return flow_mgmt_manager_list_.begin(); 52 : } 53 : std::vector<FlowMgmtManager *>::const_iterator 54 0 : flow_mgmt_manager_iterator_end() const { 55 0 : return flow_mgmt_manager_list_.end(); 56 : } 57 : void CreateInterfaces(); 58 : 59 : private: 60 : Agent *agent_; 61 : ControlInterface *control_interface_; 62 : boost::scoped_ptr<PktHandler> pkt_handler_; 63 : boost::scoped_ptr<FlowProto> flow_proto_; 64 : boost::scoped_ptr<PacketBufferManager> packet_buffer_manager_; 65 : FlowMgmtManagerList flow_mgmt_manager_list_; 66 : DISALLOW_COPY_AND_ASSIGN(PktModule); 67 : }; 68 : 69 : extern SandeshTraceBufferPtr PacketTraceBuf; 70 : 71 : #endif // __VNSW_PKT_INIT__