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