summaryrefslogtreecommitdiffstats
path: root/src/stateless
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-04-12 14:26:10 +0300
committerimarom <imarom@cisco.com>2016-04-12 14:59:59 +0300
commit5a26a09958318032868d82a7d2d0207464e1af2d (patch)
treecdf99b60d8b298a5f4fc6fbd2e431dcd442aebb0 /src/stateless
parent2a3c0616c8cfb6b11a83ab8dc6a45e315d16bd26 (diff)
events API and RX core util.
Diffstat (limited to 'src/stateless')
-rw-r--r--src/stateless/cp/trex_api_class.h30
-rw-r--r--src/stateless/cp/trex_stateless.cpp2
2 files changed, 27 insertions, 5 deletions
diff --git a/src/stateless/cp/trex_api_class.h b/src/stateless/cp/trex_api_class.h
index 78933d23..748d1478 100644
--- a/src/stateless/cp/trex_api_class.h
+++ b/src/stateless/cp/trex_api_class.h
@@ -75,20 +75,42 @@ public:
m_handler = utl_generate_random_str(seed, 8);
}
+ std::string ver(int major, int minor) {
+ std::stringstream ss;
+ ss << major << "." << minor;
+ return ss.str();
+ }
+
+ std::string get_server_ver() {
+ return ver(m_major, m_major);
+ }
+
std::string & verify_api(int major, int minor) {
std::stringstream ss;
ss << "API type '" << type_to_name(m_type) << "': ";
-
+
assert(m_type < API_CLASS_TYPE_MAX);
+ bool fail = false;
+
/* for now a simple major check */
if (major < m_major) {
- ss << "server has a major newer API version - server: '" << m_major << "', client: '" << major << "'";
- throw TrexAPIException(ss.str());
+ ss << "server has a newer major API version";
+ fail = true;
}
if (major > m_major) {
- ss << "server has an older API version - server: '" << m_major << "', client: '" << major << "'";
+ ss << "server has an older major API version";
+ fail = true;
+ }
+
+ if (minor > m_minor) {
+ ss << "client revision API is newer than server";
+ fail = true;
+ }
+
+ if (fail) {
+ ss << " - server: '" << get_server_ver() << "', client: '" << ver(major, minor) << "'";
throw TrexAPIException(ss.str());
}
diff --git a/src/stateless/cp/trex_stateless.cpp b/src/stateless/cp/trex_stateless.cpp
index f6f81b96..c86c5f65 100644
--- a/src/stateless/cp/trex_stateless.cpp
+++ b/src/stateless/cp/trex_stateless.cpp
@@ -54,7 +54,7 @@ TrexStateless::TrexStateless(const TrexStatelessCfg &cfg) {
m_publisher = cfg.m_publisher;
/* API core version */
- m_api_classes[APIClass::API_CLASS_TYPE_CORE].init(APIClass::API_CLASS_TYPE_CORE, 1, 0);
+ m_api_classes[APIClass::API_CLASS_TYPE_CORE].init(APIClass::API_CLASS_TYPE_CORE, 1, 1);
}
/**