diff --git a/controller/framework/Fxlib.py b/controller/framework/Fxlib.py index 9950866..bfb691a 100644 --- a/controller/framework/Fxlib.py +++ b/controller/framework/Fxlib.py @@ -19,10 +19,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -EVIO_VER_MJR = "20" -EVIO_VER_MNR = "7" -EVIO_VER_REV = "2" -EVIO_VER_REL = "{0}.{1}.{2}".format(EVIO_VER_MJR, EVIO_VER_MNR, EVIO_VER_REV) +import framework.Version as ver + +EVIO_VER_REL = "{0}.{1}.{2}".format(ver.EVIO_VER_MJR, ver.EVIO_VER_MNR, ver.EVIO_VER_REV) CONFIG = { "CFx": { diff --git a/controller/framework/Modlib.py b/controller/framework/Modlib.py index aeaa5ed..97ab833 100644 --- a/controller/framework/Modlib.py +++ b/controller/framework/Modlib.py @@ -20,11 +20,11 @@ # THE SOFTWARE. import subprocess - +import framework.Version as ver CTL_CREATE_CTRL_LINK = { "EVIO": { - "ProtocolVersion": 5, + "ProtocolVersion": ver.EVIO_VER_CTL, "TransactionId": 0, "ControlType": "TincanRequest", "Request": { @@ -38,7 +38,7 @@ CTL_CREATE_CTRL_LINK = { } CTL_CONFIGURE_LOGGING = { "EVIO": { - "ProtocolVersion": 5, + "ProtocolVersion": ver.EVIO_VER_CTL, "TransactionId": 0, "ControlType": "TincanRequest", "Request": { @@ -55,7 +55,7 @@ CTL_CONFIGURE_LOGGING = { } CTL_QUERY_TUNNEL_INFO = { "EVIO": { - "ProtocolVersion": 5, + "ProtocolVersion": ver.EVIO_VER_CTL, "TransactionId": 0, "ControlType": "TincanRequest", "Request": { @@ -67,7 +67,7 @@ CTL_QUERY_TUNNEL_INFO = { } CTL_CREATE_TUNNEL = { "EVIO": { - "ProtocolVersion": 5, + "ProtocolVersion": ver.EVIO_VER_CTL, "ControlType": "TincanRequest", "TransactionId": 0, "Request": { @@ -84,7 +84,7 @@ CTL_CREATE_TUNNEL = { } CTL_CREATE_LINK = { "EVIO": { - "ProtocolVersion": 5, + "ProtocolVersion": ver.EVIO_VER_CTL, "TransactionId": 0, "ControlType": "TincanRequest", "Request": { @@ -102,7 +102,7 @@ CTL_CREATE_LINK = { } CTL_REMOVE_TUNNEL = { "EVIO": { - "ProtocolVersion": 5, + "ProtocolVersion": ver.EVIO_VER_CTL, "TransactionId": 0, "ControlType": "TincanRequest", "Request": { @@ -114,7 +114,7 @@ CTL_REMOVE_TUNNEL = { } CTL_REMOVE_LINK = { "EVIO": { - "ProtocolVersion": 5, + "ProtocolVersion": ver.EVIO_VER_CTL, "TransactionId": 0, "ControlType": "TincanRequest", "Request": { @@ -126,7 +126,7 @@ CTL_REMOVE_LINK = { } RESP = { "EVIO": { - "ProtocolVersion": 5, + "ProtocolVersion": ver.EVIO_VER_CTL, "TransactionId": 0, "ControlType": "TincanResponse", "Request": { @@ -139,7 +139,7 @@ RESP = { } CTL_QUERY_LINK_STATS = { "EVIO": { - "ProtocolVersion": 5, + "ProtocolVersion": ver.EVIO_VER_CTL, "TransactionId": 0, "ControlType": "TincanRequest", "Request": { @@ -150,7 +150,7 @@ CTL_QUERY_LINK_STATS = { } CTL_QUERY_CAS = { "EVIO": { - "ProtocolVersion": 5, + "ProtocolVersion": ver.EVIO_VER_CTL, "TransactionId": 0, "ControlType": "TincanRequest", "Request": { diff --git a/controller/framework/Version.py b/controller/framework/Version.py new file mode 100644 index 0000000..de4a940 --- /dev/null +++ b/controller/framework/Version.py @@ -0,0 +1,26 @@ +# EdgeVPNio +# Copyright 2020, University of Florida +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +EVIO_VER_MJR = 0 +EVIO_VER_MNR = 0 +EVIO_VER_REV = 0 +EVIO_VER_BLD = 0 +EVIO_VER_CTL = 0 \ No newline at end of file diff --git a/controller/modules/TincanInterface.py b/controller/modules/TincanInterface.py index c3fd313..5b2c559 100644 --- a/controller/modules/TincanInterface.py +++ b/controller/modules/TincanInterface.py @@ -30,7 +30,7 @@ import traceback from distutils import spawn import framework.Modlib as modlib from framework.ControllerModule import ControllerModule - +import framework.Version as ver class TincanInterface(ControllerModule): def __init__(self, cfx_handle, module_config, module_name): @@ -68,7 +68,7 @@ class TincanInterface(ControllerModule): if sock == self._sock_svr: data = sock.recvfrom(self._cm_config["MaxReadSize"]) ctl = json.loads(data[0].decode("utf-8")) - if ctl["EVIO"]["ProtocolVersion"] != 5: + if ctl["EVIO"]["ProtocolVersion"] != ver.EVIO_VER_CTL: raise ValueError("Invalid control version detected") # Get the original CBT if this is the response if ctl["EVIO"]["ControlType"] == "TincanResponse": diff --git a/tincan/BUILD.gn b/tincan/BUILD.gn index 5aa8044..5da080b 100644 --- a/tincan/BUILD.gn +++ b/tincan/BUILD.gn @@ -20,6 +20,7 @@ executable("tincan") { if (is_linux) { sources += [ "trunk/src/linux/tapdev_lnx.cc", + "trunk/src/linux/lnx_exception.cc" ] include_dirs += [ diff --git a/tincan/trunk/include/basic_tunnel.h b/tincan/trunk/include/basic_tunnel.h index 02789c4..5f1fe0d 100644 --- a/tincan/trunk/include/basic_tunnel.h +++ b/tincan/trunk/include/basic_tunnel.h @@ -159,7 +159,7 @@ protected: void SetIgnoredNetworkInterfaces( const vector& ignored_list); - unique_ptr CreateVlink( + virtual unique_ptr CreateVlink( unique_ptr vlink_desc, unique_ptr peer_desc, cricket::IceRole ice_role); diff --git a/tincan/trunk/include/control_dispatch.h b/tincan/trunk/include/control_dispatch.h index 83bce3c..b86df85 100644 --- a/tincan/trunk/include/control_dispatch.h +++ b/tincan/trunk/include/control_dispatch.h @@ -72,17 +72,12 @@ private: msg_ = "No connection to Controller exists. " "Create one with the set_ctrl_endpoint control operation"; } - virtual ~DisconnectedControllerHandle() = default; + ~DisconnectedControllerHandle() override = default; private: - virtual void Deliver( - TincanControl &) { - RTC_LOG(LS_INFO) << msg_ << "\n"; - } - virtual void Deliver( - unique_ptr) - { - RTC_LOG(LS_INFO) << msg_ << "\n"; - } + void Deliver( + TincanControl &) override {} + void Deliver( + unique_ptr) override {} string msg_; }; }; // ControlDispatch diff --git a/tincan/trunk/include/control_listener.h b/tincan/trunk/include/control_listener.h index e363612..530c3a7 100644 --- a/tincan/trunk/include/control_listener.h +++ b/tincan/trunk/include/control_listener.h @@ -46,7 +46,7 @@ class ControlListener : { public: ControlListener(unique_ptr control_dispatch); - ~ControlListener(); + ~ControlListener() override; void ReadPacketHandler( AsyncPacketSocket * socket, const char * data, @@ -63,10 +63,7 @@ public: void CreateControllerLink( unique_ptr controller_addr ) override; - ControllerLink & GetControllerLink() override - { - return *this; - } + ControllerLink & GetControllerLink() override; std::unique_ptr ctrl_thread_; //thread to keep UDP socket listening run from tincan.cc diff --git a/tincan/trunk/include/linux/lnx_exception.h b/tincan/trunk/include/linux/lnx_exception.h index 4232ef4..c3f2e69 100644 --- a/tincan/trunk/include/linux/lnx_exception.h +++ b/tincan/trunk/include/linux/lnx_exception.h @@ -32,24 +32,10 @@ class LnxException : virtual public exception protected: string emsg; public: - LnxException(const string &arg, const char *file, int line) - { - ostringstream ostr; - ostr << file << ":" << line << ": " << arg << "@" << strerror(errno); - emsg = ostr.str(); - } - - LnxException() - {} - - ~LnxException() - {} - - const char* what() const _NOEXCEPT override - { - return emsg.c_str(); - } - + LnxException(const string &arg, const char *file, int line); + LnxException(); + ~LnxException() override; + const char* what() const _NOEXCEPT override; }; } // linux } // tincan diff --git a/tincan/trunk/include/linux/tapdev_lnx.h b/tincan/trunk/include/linux/tapdev_lnx.h index 76c62d6..bb12fc2 100644 --- a/tincan/trunk/include/linux/tapdev_lnx.h +++ b/tincan/trunk/include/linux/tapdev_lnx.h @@ -58,7 +58,7 @@ class TapDevLnx : { public: TapDevLnx(); - virtual ~TapDevLnx(); + ~TapDevLnx() override; sigslot::signal1 read_completion_; sigslot::signal1 write_completion_; void Open( diff --git a/tincan/trunk/include/tap_frame.h b/tincan/trunk/include/tap_frame.h index 936c720..f483662 100644 --- a/tincan/trunk/include/tap_frame.h +++ b/tincan/trunk/include/tap_frame.h @@ -56,7 +56,7 @@ public: //Copies the specifed amount of data into the TFB. TapFrame(uint8_t* data, uint32_t len); - virtual ~TapFrame(); + ~TapFrame() override; //Copies the TFB from the rhs frame to the lhs TapFrame &operator= (TapFrame & rhs); @@ -240,6 +240,7 @@ private: }; /////////////////////////////////////////////////////////////////////////////// // IP4Mapper patches IP4 addresses +/* class IP4AddressMapper { public: @@ -281,5 +282,6 @@ private: TapFrame & tf_; TapFrameProperties & fp_; }; +*/ } //namespace tincan #endif // TINCAN_TAP_FRAME_H_ diff --git a/tincan/trunk/include/tincan_base.h b/tincan/trunk/include/tincan_base.h index b6c89f7..ee98417 100644 --- a/tincan/trunk/include/tincan_base.h +++ b/tincan/trunk/include/tincan_base.h @@ -43,6 +43,7 @@ #include #include #include +#include "tincan_version.h" namespace tincan { using MacAddressType = std::array; @@ -153,12 +154,6 @@ namespace tincan } } } - - static const uint16_t kTincanVerMjr = 3; - static const uint16_t kTincanVerMnr = 0; - static const uint16_t kTincanVerRev = 0; - static const uint8_t kTincanControlVer = 5; - static const uint8_t kTincanLinkVer = 1; static const uint16_t kMaxMtuSize = 1500; static const uint16_t kTapHeaderSize = 2; static const uint16_t kEthHeaderSize = 14; diff --git a/tincan/trunk/include/tincan_version.h b/tincan/trunk/include/tincan_version.h new file mode 100644 index 0000000..9c8828b --- /dev/null +++ b/tincan/trunk/include/tincan_version.h @@ -0,0 +1,33 @@ +/* +* EdgeVPNio +* Copyright 2020, University of Florida +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +*/ +#ifndef TINCAN_VERSION_H_ +#define TINCAN_VERSION_H_ +namespace tincan +{ + static const uint16_t kTincanVerMjr = 0; + static const uint16_t kTincanVerMnr = 0; + static const uint16_t kTincanVerRev = 0; + static const uint16_t kTincanVerBld = 0; + static const uint8_t kTincanControlVer = 0; +} // namespace tincan +#endif // TINCAN_VERSION_H_ diff --git a/tincan/trunk/src/control_listener.cc b/tincan/trunk/src/control_listener.cc index 88e736d..f7056c3 100644 --- a/tincan/trunk/src/control_listener.cc +++ b/tincan/trunk/src/control_listener.cc @@ -86,6 +86,12 @@ ControlListener::CreateControllerLink( sf->CreateAsyncSocket(ctrl_addr_->family(), SOCK_DGRAM)); } +ControllerLink & +ControlListener::GetControllerLink() +{ + return *this; +} + void ControlListener::Run() { diff --git a/tincan/trunk/src/linux/lnx_exception.cc b/tincan/trunk/src/linux/lnx_exception.cc new file mode 100644 index 0000000..b2adcee --- /dev/null +++ b/tincan/trunk/src/linux/lnx_exception.cc @@ -0,0 +1,51 @@ +/* +* EdgeVPNio +* Copyright 2020, University of Florida +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +*/ +#include "tincan_base.h" +#include +#include "lnx_exception.h" + +namespace tincan +{ +namespace linux +{ +LnxException::LnxException(const string &arg, const char *file, int line) +{ + ostringstream ostr; + ostr << file << ":" << line << ": " << arg << "@" << strerror(errno); + emsg = ostr.str(); +} + +LnxException::LnxException() +{} + +LnxException::~LnxException() +{} + +const char* +LnxException::what() const _NOEXCEPT +{ + return emsg.c_str(); +} + +} // linux +} // tincan diff --git a/tincan/trunk/src/tincan_control.cc b/tincan/trunk/src/tincan_control.cc index 18fe632..e93ce1e 100644 --- a/tincan/trunk/src/tincan_control.cc +++ b/tincan/trunk/src/tincan_control.cc @@ -77,7 +77,7 @@ const Json::StaticString TincanControl::VnetDescription("VnetDescription"); const Json::StaticString TincanControl::Vlinks("Vlinks"); TincanControl::TincanControl() : - proto_ver_(tp.kTincanControlVer), + proto_ver_(kTincanControlVer), tag_(NextTagValue()), type_(CTTincanRequest), dict_req_(nullptr), @@ -86,7 +86,7 @@ TincanControl::TincanControl() : TincanControl::TincanControl( unique_ptr req) : - proto_ver_(tp.kTincanControlVer), + proto_ver_(kTincanControlVer), tag_(NextTagValue()), type_(CTTincanRequest), dict_req_(req.release()), @@ -96,7 +96,7 @@ TincanControl::TincanControl( TincanControl::TincanControl( unique_ptr req, unique_ptr resp) : - proto_ver_(tp.kTincanControlVer), + proto_ver_(kTincanControlVer), tag_(NextTagValue()), type_(CTTincanRequest), dict_req_(req.release()), @@ -128,7 +128,7 @@ TincanControl::TincanControl( throw TCEXCEPT(oss.str().c_str()); } uint32_t ver = ctrl[EVIO][ProtocolVersion].asUInt(); - if(ver != tp.kTincanControlVer) + if(ver != kTincanControlVer) { ostringstream oss; oss << "Invalid EVIO protocol version in control header (" << ver << ")"; diff --git a/tincan/trunk/src/tincan_main.cc b/tincan/trunk/src/tincan_main.cc index 67c219f..3b3f6e3 100644 --- a/tincan/trunk/src/tincan_main.cc +++ b/tincan/trunk/src/tincan_main.cc @@ -36,9 +36,10 @@ int main(int argc, char **argv) try { tp.ParseCmdlineArgs(argc, argv); if(tp.kVersionCheck) { - cout << tp.kTincanVerMjr << "." - << tp.kTincanVerMnr << "." - << tp.kTincanVerRev << endl; + cout << kTincanVerMjr << "." + << kTincanVerMnr << "." + << kTincanVerRev << "." + << kTincanVerBld << endl; } else if(tp.kNeedsHelp) { std::cout << "-v Version check.\n" <<