OpenSDN source code
controller/src/vnsw/agent/pkt/proto.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  * Copyright Contributors to the OpenSDN project
4  */
5 
6 #ifndef vnsw_agent_proto_hpp
7 #define vnsw_agent_proto_hpp
8 
9 #include "pkt_handler.h"
10 
11 class Agent;
12 class ProtoHandler;
13 class TokenPool;
14 
15 // Protocol task (work queue for each protocol)
16 class Proto {
17 public:
19 
20  Proto(Agent *agent, const char *task_name, PktHandler::PktModuleName mod,
21  boost::asio::io_context &io);
22  virtual ~Proto();
23 
24  virtual bool Validate(PktInfo *msg) { return true; }
25  virtual bool Enqueue(boost::shared_ptr<PktInfo> msg);
26  virtual void ProcessStats(PktStatsType::Type type) { return; }
27  virtual ProtoHandler *AllocProtoHandler(boost::shared_ptr<PktInfo> info,
28  boost::asio::io_context &io) = 0;
29 
30  void FreeBuffer(PktInfo *msg);
31  bool ProcessProto(boost::shared_ptr<PktInfo> msg_info);
32  bool RunProtoHandler(ProtoHandler *handler);
33  void set_trace(bool val) { trace_ = val; }
34  void set_free_buffer(bool val) { free_buffer_ = val; }
35  boost::asio::io_context &get_io_service() const { return io_; }
36  Agent *agent() const { return agent_; }
37  const ProtoWorkQueue *work_queue() const { return &work_queue_; }
38  virtual void TokenAvailable(TokenPool *pool) {assert(0);}
39 protected:
42  bool trace_;
44  boost::asio::io_context &io_;
46 
47 private:
49 };
50 
51 #endif // vnsw_agent_proto_hpp
Definition: agent.h:361
bool ProcessProto(boost::shared_ptr< PktInfo > msg_info)
bool RunProtoHandler(ProtoHandler *handler)
boost::asio::io_context & get_io_service() const
DISALLOW_COPY_AND_ASSIGN(Proto)
void FreeBuffer(PktInfo *msg)
void set_free_buffer(bool val)
virtual void TokenAvailable(TokenPool *pool)
virtual bool Enqueue(boost::shared_ptr< PktInfo > msg)
virtual bool Validate(PktInfo *msg)
boost::asio::io_context & io_
const ProtoWorkQueue * work_queue() const
WorkQueue< boost::shared_ptr< PktInfo > > ProtoWorkQueue
virtual ProtoHandler * AllocProtoHandler(boost::shared_ptr< PktInfo > info, boost::asio::io_context &io)=0
Proto(Agent *agent, const char *task_name, PktHandler::PktModuleName mod, boost::asio::io_context &io)
PktHandler::PktModuleName module_
virtual void ProcessStats(PktStatsType::Type type)
uint8_t type
Definition: load_balance.h:2
Definition: io_utils.cc:12