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
# 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": {

View File

@ -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": {

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
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":

View File

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

View File

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

View File

@ -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<TincanControl>)
{
RTC_LOG(LS_INFO) << msg_ << "\n";
}
void Deliver(
TincanControl &) override {}
void Deliver(
unique_ptr<TincanControl>) override {}
string msg_;
};
}; // ControlDispatch

View File

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

View File

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

View File

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

View File

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

View File

@ -43,6 +43,7 @@
#include <utility>
#include <unordered_map>
#include <vector>
#include "tincan_version.h"
namespace tincan
{
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 kTapHeaderSize = 2;
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));
}
ControllerLink &
ControlListener::GetControllerLink()
{
return *this;
}
void
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");
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<Json::Value> 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<Json::Value> req,
unique_ptr<Json::Value> 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 << ")";

View File

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