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