summaryrefslogtreecommitdiffstats
path: root/src/stateless/trex_stateless.cpp
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2015-09-06 17:55:00 +0300
committerimarom <imarom@cisco.com>2015-09-06 17:55:00 +0300
commit3adfe9c3c8a6e2ce1cdc5bd1a673e428c18fa64b (patch)
tree9077fc5911716a4c286feb50ef7021447c061dd9 /src/stateless/trex_stateless.cpp
parentc625b6e4f6d71176ef1db5aab93f4e66939d7a25 (diff)
added more commands to RPC server
Diffstat (limited to 'src/stateless/trex_stateless.cpp')
-rw-r--r--src/stateless/trex_stateless.cpp46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/stateless/trex_stateless.cpp b/src/stateless/trex_stateless.cpp
index ff469d7e..2ab0c5d9 100644
--- a/src/stateless/trex_stateless.cpp
+++ b/src/stateless/trex_stateless.cpp
@@ -55,7 +55,7 @@ TrexStateless::~TrexStateless() {
delete m_ports[i];
}
- delete m_ports;
+ delete [] m_ports;
}
TrexStatelessPort * TrexStateless::get_port_by_id(uint8_t port_id) {
@@ -71,3 +71,47 @@ uint8_t TrexStateless::get_port_count() {
return m_port_count;
}
+/***************************
+ * trex stateless port
+ *
+ **************************/
+TrexStatelessPort::TrexStatelessPort(uint8_t port_id) : m_port_id(port_id) {
+ m_started = false;
+}
+
+
+/**
+ * starts the traffic on the port
+ *
+ */
+TrexStatelessPort::traffic_rc_e
+TrexStatelessPort::start_traffic(void) {
+ if (m_started) {
+ return (TRAFFIC_ERR_ALREADY_STARTED);
+ }
+
+ if (get_stream_table()->size() == 0) {
+ return (TRAFFIC_ERR_NO_STREAMS);
+ }
+
+ m_started = true;
+
+ return (TRAFFIC_OK);
+}
+
+void
+TrexStatelessPort::stop_traffic(void) {
+ if (m_started) {
+ m_started = false;
+ }
+}
+
+/**
+* access the stream table
+*
+*/
+TrexStreamTable * TrexStatelessPort::get_stream_table() {
+ return &m_stream_table;
+}
+
+