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 __PKT_SANDESH_FLOW_H__ 7 : #define __PKT_SANDESH_FLOW_H__ 8 : 9 : #include "base/task.h" 10 : #include "pkt/flow_table.h" 11 : #include "pkt/pkt_types.h" 12 : #include "vrouter/flow_stats/flow_stats_collector.h" 13 : 14 : class PktSandeshFlow : public Task { 15 : public: 16 : static const int kMaxFlowResponse = 100; 17 : static const char kDelimiter = '-'; 18 : static const std::string start_key; 19 : PktSandeshFlow(Agent *agent, FlowRecordsResp *obj, std::string resp_ctx, 20 : std::string key); 21 : virtual ~PktSandeshFlow(); 22 : 23 : void SendResponse(SandeshResponse *resp); 24 : bool SetFlowKey(std::string key); 25 : static std::string GetFlowKey(const FlowKey &key, uint16_t partition_id); 26 : 27 : virtual bool Run(); 28 0 : std::string Description() const { return "PktSandeshFlow"; } 29 : void SetSandeshFlowData(std::vector<SandeshFlowData> &list, FlowEntry *fe, 30 : const FlowExportInfo *info); 31 0 : void set_delete_op(bool delete_op) {delete_op_ = delete_op;} 32 : 33 : protected: 34 : FlowRecordsResp *resp_obj_; 35 : std::string resp_data_; 36 : FlowKey flow_iteration_key_; 37 : bool key_valid_; 38 : bool delete_op_; 39 : Agent *agent_; 40 : uint16_t partition_id_; 41 : 42 : private: 43 : DISALLOW_COPY_AND_ASSIGN(PktSandeshFlow); 44 : }; 45 : 46 : class PktSandeshFlowStats : public PktSandeshFlow { 47 : public: 48 : PktSandeshFlowStats(Agent *agent, FlowStatsCollectorRecordsResp *obj, std::string resp_ctx, 49 : std::string key); 50 0 : virtual ~PktSandeshFlowStats() {} 51 : bool SetProtoKey(std::string key); 52 : virtual bool Run(); 53 : bool SetProto(std::string &key); 54 : private: 55 : uint32_t proto_; 56 : uint32_t port_; 57 : FlowStatsCollectorRecordsResp *resp_; 58 : DISALLOW_COPY_AND_ASSIGN(PktSandeshFlowStats); 59 : }; 60 : #endif