diff options
Diffstat (limited to 'src/stateless/messaging')
-rw-r--r-- | src/stateless/messaging/trex_stateless_messaging.cpp | 32 | ||||
-rw-r--r-- | src/stateless/messaging/trex_stateless_messaging.h | 52 |
2 files changed, 79 insertions, 5 deletions
diff --git a/src/stateless/messaging/trex_stateless_messaging.cpp b/src/stateless/messaging/trex_stateless_messaging.cpp index 7edf0f13..1cbacb6f 100644 --- a/src/stateless/messaging/trex_stateless_messaging.cpp +++ b/src/stateless/messaging/trex_stateless_messaging.cpp @@ -181,6 +181,36 @@ TrexStatelessDpUpdate::clone() { return new_msg; } + +/************************* + push PCAP message + ************************/ +bool +TrexStatelessDpPushPCAP::handle(TrexStatelessDpCore *dp_core) { + dp_core->push_pcap(m_port_id, + m_event_id, + m_pcap_filename, + m_ipg_usec, + m_speedup, + m_count, + m_duration); + return true; +} + +TrexStatelessCpToDpMsgBase * +TrexStatelessDpPushPCAP::clone() { + TrexStatelessCpToDpMsgBase *new_msg = new TrexStatelessDpPushPCAP(m_port_id, + m_event_id, + m_pcap_filename, + m_ipg_usec, + m_speedup, + m_count, + m_duration); + + return new_msg; +} + + /************************* barrier message ************************/ @@ -203,7 +233,7 @@ TrexStatelessDpBarrier::clone() { bool TrexDpPortEventMsg::handle() { TrexStatelessPort *port = get_stateless_obj()->get_port_by_id(m_port_id); - port->get_dp_events().on_core_reporting_in(m_event_id, m_thread_id); + port->get_dp_events().on_core_reporting_in(m_event_id, m_thread_id, get_status()); return (true); } diff --git a/src/stateless/messaging/trex_stateless_messaging.h b/src/stateless/messaging/trex_stateless_messaging.h index 0eed01bd..9b1f2e31 100644 --- a/src/stateless/messaging/trex_stateless_messaging.h +++ b/src/stateless/messaging/trex_stateless_messaging.h @@ -246,6 +246,43 @@ private: double m_factor; }; + +/** + * psuh a PCAP message + */ +class TrexStatelessDpPushPCAP : public TrexStatelessCpToDpMsgBase { +public: + + TrexStatelessDpPushPCAP(uint8_t port_id, + int event_id, + const std::string &pcap_filename, + double ipg_usec, + double speedup, + uint32_t count, + double duration) : m_pcap_filename(pcap_filename) { + m_port_id = port_id; + m_event_id = event_id; + m_ipg_usec = ipg_usec; + m_speedup = speedup; + m_count = count; + m_duration = duration; + } + + virtual bool handle(TrexStatelessDpCore *dp_core); + + virtual TrexStatelessCpToDpMsgBase * clone(); + +private: + std::string m_pcap_filename; + int m_event_id; + double m_ipg_usec; + double m_speedup; + double m_duration; + uint32_t m_count; + uint8_t m_port_id; +}; + + /** * barrier message for DP core * @@ -267,6 +304,7 @@ private: int m_event_id; }; + /************************* messages from DP to CP **********************/ /** @@ -303,10 +341,11 @@ public: class TrexDpPortEventMsg : public TrexStatelessDpToCpMsgBase { public: - TrexDpPortEventMsg(int thread_id, uint8_t port_id, int event_id) { - m_thread_id = thread_id; - m_port_id = port_id; - m_event_id = event_id; + TrexDpPortEventMsg(int thread_id, uint8_t port_id, int event_id, bool status = true) { + m_thread_id = thread_id; + m_port_id = port_id; + m_event_id = event_id; + m_status = status; } virtual bool handle(); @@ -323,10 +362,15 @@ public: return m_event_id; } + bool get_status() { + return m_status; + } + private: int m_thread_id; uint8_t m_port_id; int m_event_id; + bool m_status; }; |