diff options
author | Dan Klein <danklein10@gmail.com> | 2015-11-24 08:54:53 +0200 |
---|---|---|
committer | Dan Klein <danklein10@gmail.com> | 2015-11-24 08:54:53 +0200 |
commit | e7cb8b0f6c2fbe08d2086a7408040ac7d12aee5a (patch) | |
tree | 1b27e542fe9f3ae4abdc8245b804cda25a6e2c2f /src/stateless/cp/trex_streams_compiler.h | |
parent | 597f74d8ed10abc3dd9df7e81ecea5ac2f5c714e (diff) | |
parent | f3861d504353729724086dec82c79e818224554f (diff) |
Merge branch 'master' into dan_stateless
Diffstat (limited to 'src/stateless/cp/trex_streams_compiler.h')
-rw-r--r-- | src/stateless/cp/trex_streams_compiler.h | 59 |
1 files changed, 53 insertions, 6 deletions
diff --git a/src/stateless/cp/trex_streams_compiler.h b/src/stateless/cp/trex_streams_compiler.h index 06f992ed..17ca3c74 100644 --- a/src/stateless/cp/trex_streams_compiler.h +++ b/src/stateless/cp/trex_streams_compiler.h @@ -23,9 +23,11 @@ limitations under the License. #include <stdint.h> #include <vector> +#include <string> class TrexStreamsCompiler; class TrexStream; +class GraphNodeMap; /** * compiled object for a table of streams @@ -40,33 +42,78 @@ public: ~TrexStreamsCompiledObj(); struct obj_st { - double m_pps; - uint8_t *m_pkt; - uint16_t m_pkt_len; - uint8_t m_port_id; + + TrexStream * m_stream; }; const std::vector<obj_st> & get_objects() { return m_objs; } + uint8_t get_port_id(){ + return (m_port_id); + } + + /** + * clone the compiled object + * + */ + TrexStreamsCompiledObj * clone(); + + double get_multiplier(){ + return (m_mul); + } + + bool get_all_streams_continues(){ + return (m_all_continues); + } + + void Dump(FILE *fd); + private: - void add_compiled_stream(double pps, uint8_t *pkt, uint16_t pkt_len); + void add_compiled_stream(TrexStream * stream, + uint32_t my_dp_id, int next_dp_id); + void add_compiled_stream(TrexStream * stream); + std::vector<obj_st> m_objs; + bool m_all_continues; uint8_t m_port_id; double m_mul; }; class TrexStreamsCompiler { public: + /** * compiles a vector of streams to an object passable to the DP * * @author imarom (28-Oct-15) * */ - bool compile(const std::vector<TrexStream *> &streams, TrexStreamsCompiledObj &obj); + bool compile(const std::vector<TrexStream *> &streams, TrexStreamsCompiledObj &obj, std::string *fail_msg = NULL); + + /** + * + * returns a reference pointer to the last compile warnings + * if no warnings were produced - the vector is empty + */ + const std::vector<std::string> & get_last_compile_warnings() { + return m_warnings; + } + +private: + + void pre_compile_check(const std::vector<TrexStream *> &streams, + GraphNodeMap & nodes); + void allocate_pass(const std::vector<TrexStream *> &streams, GraphNodeMap *nodes); + void direct_pass(GraphNodeMap *nodes); + void check_for_unreachable_streams(GraphNodeMap *nodes); + void check_stream(const TrexStream *stream); + void add_warning(const std::string &warning); + void err(const std::string &err); + + std::vector<std::string> m_warnings; }; #endif /* __TREX_STREAMS_COMPILER_H__ */ |