From 4b562c3aa764b78e78f7ab6ce12d16e0c86d10f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Mon, 18 Sep 2017 10:08:36 +0200 Subject: [PATCH] Remove old files. Gonna make this library in a C compatible way. --- CMakeLists.txt | 7 +++- include/neocomm/NeoComm.hpp | 21 ---------- include/neocomm/Node.hpp | 78 ------------------------------------- src/Node.cpp | 33 ---------------- 4 files changed, 5 insertions(+), 134 deletions(-) delete mode 100644 include/neocomm/NeoComm.hpp delete mode 100644 include/neocomm/Node.hpp delete mode 100644 src/Node.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c01a94..bdf350c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,8 +38,7 @@ include_directories( "include/" SYSTEM OPENDHT_INCLUDE_DIRS) -set(SRCS - src/Node.cpp) +set(SRCS) set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wextra -Wpedantic -Werror -Wfatal-errors -pedantic-errors -fno-elide-constructors") set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") @@ -54,6 +53,10 @@ else() add_definitions("-DDEBUG") endif() +if(WIN32) + add_definitions("-DWOE32") +endif() + if(BUILD_SHARED_LIB) add_library(${TARGET_NAME} SHARED ${SRCS}) else() diff --git a/include/neocomm/NeoComm.hpp b/include/neocomm/NeoComm.hpp deleted file mode 100644 index 55dcf33..0000000 --- a/include/neocomm/NeoComm.hpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2017 Ortega Froysa, Nicolás - * Author: Ortega Froysa, Nicolás - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -#pragma once - -#include "Node.hpp" diff --git a/include/neocomm/Node.hpp b/include/neocomm/Node.hpp deleted file mode 100644 index fb0baf0..0000000 --- a/include/neocomm/Node.hpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2017 Ortega Froysa, Nicolás - * Author: Ortega Froysa, Nicolás - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -#pragma once - -#include -#include - -#ifndef DEFAULT_PORT -# define DEFAULT_PORT 4323 -#endif - -namespace neocomm { - /** - * @brief A node meant to connect to the neocomm network. - */ - class Node { - public: - /** - * @brief Initialize local node. - */ - Node(); - virtual ~Node(); - - /** - * @brief Bind the node to a port. - * - * @param port Local port to bind to. - */ - void bind(const short &port = DEFAULT_PORT); - - /** - * @brief Connect to a network via specified host. - * - * @param host Hostname of network node. - * @param port Connection port/service. - */ - void connect(const std::string &host, const short &port); - /** - * @brief Load a file of nodes which have been used before. - * - * @param path Path to the node export file. - */ - void connect(const std::string &path); - - /** - * @brief Export the current list of nodes into a file. - * - * @param path Path to the file in which to save the node list. - */ - void exportNodeList(const std::string &path); - - /** - * @brief Retrieve the current status of the connection. - * - * @return String describing connection status. - */ - //inline const std::string getStatus(); - private: - dht::DhtRunner node; - dht::NetId status; - }; -} diff --git a/src/Node.cpp b/src/Node.cpp deleted file mode 100644 index 988751a..0000000 --- a/src/Node.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2017 Ortega Froysa, Nicolás - * Author: Ortega Froysa, Nicolás - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -#include "neocomm/Node.hpp" - -neocomm::Node::Node() : status(0) { } - -void neocomm::Node::bind(const short &port) { - node.run(port, dht::crypto::generateIdentity(), true, status); -} - -void neocomm::Node::connect(const std::string &host, const short &port) { - node.bootstrap(host.c_str(), std::to_string(port).c_str()); -} - -neocomm::Node::~Node() { - node.join(); -}