Version set at build

pull/8/head
Ken 2020-10-21 23:49:43 -04:00
parent ee68f8a632
commit 34bdd1f9a9
17 changed files with 158 additions and 66 deletions

View File

@ -19,10 +19,9 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
EVIO_VER_MJR = "20" import framework.Version as ver
EVIO_VER_MNR = "7"
EVIO_VER_REV = "2" EVIO_VER_REL = "{0}.{1}.{2}".format(ver.EVIO_VER_MJR, ver.EVIO_VER_MNR, ver.EVIO_VER_REV)
EVIO_VER_REL = "{0}.{1}.{2}".format(EVIO_VER_MJR, EVIO_VER_MNR, EVIO_VER_REV)
CONFIG = { CONFIG = {
"CFx": { "CFx": {

View File

@ -20,11 +20,11 @@
# THE SOFTWARE. # THE SOFTWARE.
import subprocess import subprocess
import framework.Version as ver
CTL_CREATE_CTRL_LINK = { CTL_CREATE_CTRL_LINK = {
"EVIO": { "EVIO": {
"ProtocolVersion": 5, "ProtocolVersion": ver.EVIO_VER_CTL,
"TransactionId": 0, "TransactionId": 0,
"ControlType": "TincanRequest", "ControlType": "TincanRequest",
"Request": { "Request": {
@ -38,7 +38,7 @@ CTL_CREATE_CTRL_LINK = {
} }
CTL_CONFIGURE_LOGGING = { CTL_CONFIGURE_LOGGING = {
"EVIO": { "EVIO": {
"ProtocolVersion": 5, "ProtocolVersion": ver.EVIO_VER_CTL,
"TransactionId": 0, "TransactionId": 0,
"ControlType": "TincanRequest", "ControlType": "TincanRequest",
"Request": { "Request": {
@ -55,7 +55,7 @@ CTL_CONFIGURE_LOGGING = {
} }
CTL_QUERY_TUNNEL_INFO = { CTL_QUERY_TUNNEL_INFO = {
"EVIO": { "EVIO": {
"ProtocolVersion": 5, "ProtocolVersion": ver.EVIO_VER_CTL,
"TransactionId": 0, "TransactionId": 0,
"ControlType": "TincanRequest", "ControlType": "TincanRequest",
"Request": { "Request": {
@ -67,7 +67,7 @@ CTL_QUERY_TUNNEL_INFO = {
} }
CTL_CREATE_TUNNEL = { CTL_CREATE_TUNNEL = {
"EVIO": { "EVIO": {
"ProtocolVersion": 5, "ProtocolVersion": ver.EVIO_VER_CTL,
"ControlType": "TincanRequest", "ControlType": "TincanRequest",
"TransactionId": 0, "TransactionId": 0,
"Request": { "Request": {
@ -84,7 +84,7 @@ CTL_CREATE_TUNNEL = {
} }
CTL_CREATE_LINK = { CTL_CREATE_LINK = {
"EVIO": { "EVIO": {
"ProtocolVersion": 5, "ProtocolVersion": ver.EVIO_VER_CTL,
"TransactionId": 0, "TransactionId": 0,
"ControlType": "TincanRequest", "ControlType": "TincanRequest",
"Request": { "Request": {
@ -102,7 +102,7 @@ CTL_CREATE_LINK = {
} }
CTL_REMOVE_TUNNEL = { CTL_REMOVE_TUNNEL = {
"EVIO": { "EVIO": {
"ProtocolVersion": 5, "ProtocolVersion": ver.EVIO_VER_CTL,
"TransactionId": 0, "TransactionId": 0,
"ControlType": "TincanRequest", "ControlType": "TincanRequest",
"Request": { "Request": {
@ -114,7 +114,7 @@ CTL_REMOVE_TUNNEL = {
} }
CTL_REMOVE_LINK = { CTL_REMOVE_LINK = {
"EVIO": { "EVIO": {
"ProtocolVersion": 5, "ProtocolVersion": ver.EVIO_VER_CTL,
"TransactionId": 0, "TransactionId": 0,
"ControlType": "TincanRequest", "ControlType": "TincanRequest",
"Request": { "Request": {
@ -126,7 +126,7 @@ CTL_REMOVE_LINK = {
} }
RESP = { RESP = {
"EVIO": { "EVIO": {
"ProtocolVersion": 5, "ProtocolVersion": ver.EVIO_VER_CTL,
"TransactionId": 0, "TransactionId": 0,
"ControlType": "TincanResponse", "ControlType": "TincanResponse",
"Request": { "Request": {
@ -139,7 +139,7 @@ RESP = {
} }
CTL_QUERY_LINK_STATS = { CTL_QUERY_LINK_STATS = {
"EVIO": { "EVIO": {
"ProtocolVersion": 5, "ProtocolVersion": ver.EVIO_VER_CTL,
"TransactionId": 0, "TransactionId": 0,
"ControlType": "TincanRequest", "ControlType": "TincanRequest",
"Request": { "Request": {
@ -150,7 +150,7 @@ CTL_QUERY_LINK_STATS = {
} }
CTL_QUERY_CAS = { CTL_QUERY_CAS = {
"EVIO": { "EVIO": {
"ProtocolVersion": 5, "ProtocolVersion": ver.EVIO_VER_CTL,
"TransactionId": 0, "TransactionId": 0,
"ControlType": "TincanRequest", "ControlType": "TincanRequest",
"Request": { "Request": {

View File

@ -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

View File

@ -30,7 +30,7 @@ import traceback
from distutils import spawn from distutils import spawn
import framework.Modlib as modlib import framework.Modlib as modlib
from framework.ControllerModule import ControllerModule from framework.ControllerModule import ControllerModule
import framework.Version as ver
class TincanInterface(ControllerModule): class TincanInterface(ControllerModule):
def __init__(self, cfx_handle, module_config, module_name): def __init__(self, cfx_handle, module_config, module_name):
@ -68,7 +68,7 @@ class TincanInterface(ControllerModule):
if sock == self._sock_svr: if sock == self._sock_svr:
data = sock.recvfrom(self._cm_config["MaxReadSize"]) data = sock.recvfrom(self._cm_config["MaxReadSize"])
ctl = json.loads(data[0].decode("utf-8")) 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") raise ValueError("Invalid control version detected")
# Get the original CBT if this is the response # Get the original CBT if this is the response
if ctl["EVIO"]["ControlType"] == "TincanResponse": if ctl["EVIO"]["ControlType"] == "TincanResponse":

View File

@ -20,6 +20,7 @@ executable("tincan") {
if (is_linux) { if (is_linux) {
sources += [ sources += [
"trunk/src/linux/tapdev_lnx.cc", "trunk/src/linux/tapdev_lnx.cc",
"trunk/src/linux/lnx_exception.cc"
] ]
include_dirs += [ include_dirs += [

View File

@ -159,7 +159,7 @@ protected:
void SetIgnoredNetworkInterfaces( void SetIgnoredNetworkInterfaces(
const vector<string>& ignored_list); const vector<string>& ignored_list);
unique_ptr<VirtualLink> CreateVlink( virtual unique_ptr<VirtualLink> CreateVlink(
unique_ptr<VlinkDescriptor> vlink_desc, unique_ptr<VlinkDescriptor> vlink_desc,
unique_ptr<PeerDescriptor> unique_ptr<PeerDescriptor>
peer_desc, cricket::IceRole ice_role); peer_desc, cricket::IceRole ice_role);

View File

@ -72,17 +72,12 @@ private:
msg_ = "No connection to Controller exists. " msg_ = "No connection to Controller exists. "
"Create one with the set_ctrl_endpoint control operation"; "Create one with the set_ctrl_endpoint control operation";
} }
virtual ~DisconnectedControllerHandle() = default; ~DisconnectedControllerHandle() override = default;
private: private:
virtual void Deliver( void Deliver(
TincanControl &) { TincanControl &) override {}
RTC_LOG(LS_INFO) << msg_ << "\n"; void Deliver(
} unique_ptr<TincanControl>) override {}
virtual void Deliver(
unique_ptr<TincanControl>)
{
RTC_LOG(LS_INFO) << msg_ << "\n";
}
string msg_; string msg_;
}; };
}; // ControlDispatch }; // ControlDispatch

View File

@ -46,7 +46,7 @@ class ControlListener :
{ {
public: public:
ControlListener(unique_ptr<ControlDispatch> control_dispatch); ControlListener(unique_ptr<ControlDispatch> control_dispatch);
~ControlListener(); ~ControlListener() override;
void ReadPacketHandler( void ReadPacketHandler(
AsyncPacketSocket * socket, AsyncPacketSocket * socket,
const char * data, const char * data,
@ -63,10 +63,7 @@ public:
void CreateControllerLink( void CreateControllerLink(
unique_ptr<SocketAddress> controller_addr unique_ptr<SocketAddress> controller_addr
) override; ) override;
ControllerLink & GetControllerLink() override ControllerLink & GetControllerLink() override;
{
return *this;
}
std::unique_ptr<Thread> ctrl_thread_; std::unique_ptr<Thread> ctrl_thread_;
//thread to keep UDP socket listening run from tincan.cc //thread to keep UDP socket listening run from tincan.cc

View File

@ -32,24 +32,10 @@ class LnxException : virtual public exception
protected: protected:
string emsg; string emsg;
public: public:
LnxException(const string &arg, const char *file, int line) LnxException(const string &arg, const char *file, int line);
{ LnxException();
ostringstream ostr; ~LnxException() override;
ostr << file << ":" << line << ": " << arg << "@" << strerror(errno); const char* what() const _NOEXCEPT override;
emsg = ostr.str();
}
LnxException()
{}
~LnxException()
{}
const char* what() const _NOEXCEPT override
{
return emsg.c_str();
}
}; };
} // linux } // linux
} // tincan } // tincan

View File

@ -58,7 +58,7 @@ class TapDevLnx :
{ {
public: public:
TapDevLnx(); TapDevLnx();
virtual ~TapDevLnx(); ~TapDevLnx() override;
sigslot::signal1<AsyncIo *> read_completion_; sigslot::signal1<AsyncIo *> read_completion_;
sigslot::signal1<AsyncIo *> write_completion_; sigslot::signal1<AsyncIo *> write_completion_;
void Open( void Open(

View File

@ -56,7 +56,7 @@ public:
//Copies the specifed amount of data into the TFB. //Copies the specifed amount of data into the TFB.
TapFrame(uint8_t* data, uint32_t len); TapFrame(uint8_t* data, uint32_t len);
virtual ~TapFrame(); ~TapFrame() override;
//Copies the TFB from the rhs frame to the lhs //Copies the TFB from the rhs frame to the lhs
TapFrame &operator= (TapFrame & rhs); TapFrame &operator= (TapFrame & rhs);
@ -240,6 +240,7 @@ private:
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// IP4Mapper patches IP4 addresses // IP4Mapper patches IP4 addresses
/*
class IP4AddressMapper class IP4AddressMapper
{ {
public: public:
@ -281,5 +282,6 @@ private:
TapFrame & tf_; TapFrame & tf_;
TapFrameProperties & fp_; TapFrameProperties & fp_;
}; };
*/
} //namespace tincan } //namespace tincan
#endif // TINCAN_TAP_FRAME_H_ #endif // TINCAN_TAP_FRAME_H_

View File

@ -43,6 +43,7 @@
#include <utility> #include <utility>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include "tincan_version.h"
namespace tincan namespace tincan
{ {
using MacAddressType = std::array<uint8_t, 6>; using MacAddressType = std::array<uint8_t, 6>;
@ -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 kMaxMtuSize = 1500;
static const uint16_t kTapHeaderSize = 2; static const uint16_t kTapHeaderSize = 2;
static const uint16_t kEthHeaderSize = 14; static const uint16_t kEthHeaderSize = 14;

View File

@ -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_

View File

@ -86,6 +86,12 @@ ControlListener::CreateControllerLink(
sf->CreateAsyncSocket(ctrl_addr_->family(), SOCK_DGRAM)); sf->CreateAsyncSocket(ctrl_addr_->family(), SOCK_DGRAM));
} }
ControllerLink &
ControlListener::GetControllerLink()
{
return *this;
}
void void
ControlListener::Run() ControlListener::Run()
{ {

View File

@ -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 <errno.h>
#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

View File

@ -77,7 +77,7 @@ const Json::StaticString TincanControl::VnetDescription("VnetDescription");
const Json::StaticString TincanControl::Vlinks("Vlinks"); const Json::StaticString TincanControl::Vlinks("Vlinks");
TincanControl::TincanControl() : TincanControl::TincanControl() :
proto_ver_(tp.kTincanControlVer), proto_ver_(kTincanControlVer),
tag_(NextTagValue()), tag_(NextTagValue()),
type_(CTTincanRequest), type_(CTTincanRequest),
dict_req_(nullptr), dict_req_(nullptr),
@ -86,7 +86,7 @@ TincanControl::TincanControl() :
TincanControl::TincanControl( TincanControl::TincanControl(
unique_ptr<Json::Value> req) : unique_ptr<Json::Value> req) :
proto_ver_(tp.kTincanControlVer), proto_ver_(kTincanControlVer),
tag_(NextTagValue()), tag_(NextTagValue()),
type_(CTTincanRequest), type_(CTTincanRequest),
dict_req_(req.release()), dict_req_(req.release()),
@ -96,7 +96,7 @@ TincanControl::TincanControl(
TincanControl::TincanControl( TincanControl::TincanControl(
unique_ptr<Json::Value> req, unique_ptr<Json::Value> req,
unique_ptr<Json::Value> resp) : unique_ptr<Json::Value> resp) :
proto_ver_(tp.kTincanControlVer), proto_ver_(kTincanControlVer),
tag_(NextTagValue()), tag_(NextTagValue()),
type_(CTTincanRequest), type_(CTTincanRequest),
dict_req_(req.release()), dict_req_(req.release()),
@ -128,7 +128,7 @@ TincanControl::TincanControl(
throw TCEXCEPT(oss.str().c_str()); throw TCEXCEPT(oss.str().c_str());
} }
uint32_t ver = ctrl[EVIO][ProtocolVersion].asUInt(); uint32_t ver = ctrl[EVIO][ProtocolVersion].asUInt();
if(ver != tp.kTincanControlVer) if(ver != kTincanControlVer)
{ {
ostringstream oss; ostringstream oss;
oss << "Invalid EVIO protocol version in control header (" << ver << ")"; oss << "Invalid EVIO protocol version in control header (" << ver << ")";

View File

@ -36,9 +36,10 @@ int main(int argc, char **argv)
try { try {
tp.ParseCmdlineArgs(argc, argv); tp.ParseCmdlineArgs(argc, argv);
if(tp.kVersionCheck) { if(tp.kVersionCheck) {
cout << tp.kTincanVerMjr << "." cout << kTincanVerMjr << "."
<< tp.kTincanVerMnr << "." << kTincanVerMnr << "."
<< tp.kTincanVerRev << endl; << kTincanVerRev << "."
<< kTincanVerBld << endl;
} }
else if(tp.kNeedsHelp) { else if(tp.kNeedsHelp) {
std::cout << "-v Version check.\n" << std::cout << "-v Version check.\n" <<