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(); -}