everywhere same code header
reformatings cdoc
This commit is contained in:
parent
12de026842
commit
713e7a1f95
@ -5,22 +5,26 @@
|
|||||||
## libcurl (with sources)
|
## libcurl (with sources)
|
||||||
## libconfig (with sources)
|
## libconfig (with sources)
|
||||||
#
|
#
|
||||||
# documenation build needs doxygen to be installed.
|
# for documenation build doxygen needs to be installed.
|
||||||
|
# for test build gtest needs to be installed.
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
project(iprefresher DESCRIPTION "Dynu ip refresher")
|
project(iprefresher DESCRIPTION "Dynu ip refresher")
|
||||||
SET(PROJECT_VERSION 1.3.3)
|
SET(PROJECT_VERSION 1.3.3)
|
||||||
SET(CMAKE_CXX_STANDARD 17)
|
|
||||||
|
|
||||||
# CONFIGURATION
|
# CONFIGURATION
|
||||||
SET(CMAKE_BUILD_TYPE Release) # manually SET build type (Release / Debug)
|
SET(CMAKE_BUILD_TYPE Release) # manually SET build type (Release / Debug)
|
||||||
SET(LIB_METHOD STATIC) #SHARED / STATIC
|
SET(LIB_METHOD STATIC) #SHARED / STATIC
|
||||||
|
|
||||||
option(BUILD_DOC "Build documentation" OFF) # additional dependency for Doxygen
|
option(BUILD_DOC "Build documentation" ON) # additional dependency for Doxygen
|
||||||
option(PACKAGING "Allow Packaging to <exe>, <deb> or <rpm>" ON) # additional dependencies for RPMbuild,dpkg or NSIS
|
option(PACKAGING "Allow Packaging to <exe>, <deb> or <rpm>" ON) # additional dependencies for RPMbuild,dpkg or NSIS
|
||||||
option(TESTS "Build Tests" ON) # additional dependencies for GTEST - to build tests
|
option(TESTS "Build Tests" ON) # additional dependencies for GTEST - to build tests
|
||||||
set(WinBuild false)
|
set(WinBuild false)
|
||||||
|
|
||||||
|
# helper variables
|
||||||
|
SET(CMAKE_CXX_STANDARD 17)
|
||||||
|
string(TIMESTAMP TIMESTAMP_NOW "%d.%m.%Y")
|
||||||
|
|
||||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||||
@ -131,8 +135,18 @@ message("")
|
|||||||
FILE(READ ${CMAKE_SOURCE_DIR}/config/iprefresher.cfg SAMPLECONFIG)
|
FILE(READ ${CMAKE_SOURCE_DIR}/config/iprefresher.cfg SAMPLECONFIG)
|
||||||
#add version header
|
#add version header
|
||||||
FILE(WRITE ${CMAKE_SOURCE_DIR}/inc/Version.h
|
FILE(WRITE ${CMAKE_SOURCE_DIR}/inc/Version.h
|
||||||
"\#pragma once
|
"/**
|
||||||
|
* Version header to store Version, Config dir and a Sample config
|
||||||
|
* Do not edit this file manually, it is generated by the cmake script!
|
||||||
|
*
|
||||||
|
* @author Lukas Heiligenbrunner
|
||||||
|
* @date ${TIMESTAMP_NOW}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Version {
|
namespace Version {
|
||||||
const std::string VERSION = \"${PROJECT_VERSION}\";
|
const std::string VERSION = \"${PROJECT_VERSION}\";
|
||||||
const std::string ConfigDir = \"${CONFIG_PATH}\";
|
const std::string ConfigDir = \"${CONFIG_PATH}\";
|
||||||
@ -146,20 +160,18 @@ add_library(api ${LIB_METHOD}
|
|||||||
src/api/DynuAPI.cpp
|
src/api/DynuAPI.cpp
|
||||||
src/api/IPAPI.cpp)
|
src/api/IPAPI.cpp)
|
||||||
|
|
||||||
add_library(logger ${LIB_METHOD}
|
add_library(dynuiprefresher ${LIB_METHOD}
|
||||||
src/FileLogger.cpp
|
|
||||||
src/Logger.cpp)
|
|
||||||
|
|
||||||
|
|
||||||
SET(SOURCE
|
|
||||||
src/IPRefresher.cpp
|
src/IPRefresher.cpp
|
||||||
src/Config.cpp
|
src/Config.cpp
|
||||||
src/IpHelper.cpp)
|
src/IpHelper.cpp
|
||||||
|
src/FileLogger.cpp
|
||||||
|
src/Logger.cpp
|
||||||
|
)
|
||||||
|
|
||||||
add_executable(iprefresher src/main.cpp ${SOURCE})
|
add_executable(iprefresher src/main.cpp)
|
||||||
|
|
||||||
# LINK generated LIBS #
|
# LINK generated LIBS #
|
||||||
target_link_libraries(iprefresher api logger ${CURL_LIBRARIES} ${LIBCONFIG++_LIBRARIES})
|
target_link_libraries(iprefresher dynuiprefresher api ${CURL_LIBRARIES} ${LIBCONFIG++_LIBRARIES})
|
||||||
|
|
||||||
# setting install targets
|
# setting install targets
|
||||||
IF (NOT ${WinBuild})
|
IF (NOT ${WinBuild})
|
||||||
@ -209,6 +221,8 @@ if (${PACKAGING})
|
|||||||
# generate post script for checking if configuration already exists
|
# generate post script for checking if configuration already exists
|
||||||
FILE(WRITE ${CMAKE_SOURCE_DIR}/postinst
|
FILE(WRITE ${CMAKE_SOURCE_DIR}/postinst
|
||||||
"#!/bin/bash
|
"#!/bin/bash
|
||||||
|
# Post installation script for linux packages
|
||||||
|
# do not edit this file manually, it is generated by the cmake script
|
||||||
if [ ! -f ${CONFIG_PATH} ]; then
|
if [ ! -f ${CONFIG_PATH} ]; then
|
||||||
cat > ${CONFIG_PATH} <<- EOM
|
cat > ${CONFIG_PATH} <<- EOM
|
||||||
${SAMPLECONFIG}EOM
|
${SAMPLECONFIG}EOM
|
||||||
@ -311,7 +325,7 @@ if (TESTS)
|
|||||||
# create an exectuable in which the tests will be stored
|
# create an exectuable in which the tests will be stored
|
||||||
add_executable(${TESTNAME} ${ARGN})
|
add_executable(${TESTNAME} ${ARGN})
|
||||||
# link the Google test infrastructure, mocking library, and a default main fuction to
|
# link the Google test infrastructure, mocking library, and a default main fuction to
|
||||||
target_link_libraries(${TESTNAME} gtest gtest_main -lpthread -lm api logger ${CURL_LIBRARIES} ${LIBCONFIG++_LIBRARIES})
|
target_link_libraries(${TESTNAME} gtest gtest_main -lpthread -lm dynuiprefresher api ${CURL_LIBRARIES} ${LIBCONFIG++_LIBRARIES})
|
||||||
# see https://cmake.org/cmake/help/v3.10/module/GoogleTest.html for more options to pass to it
|
# see https://cmake.org/cmake/help/v3.10/module/GoogleTest.html for more options to pass to it
|
||||||
gtest_discover_tests(${TESTNAME}
|
gtest_discover_tests(${TESTNAME}
|
||||||
WORKING_DIRECTORY ${PROJECT_DIR}
|
WORKING_DIRECTORY ${PROJECT_DIR}
|
||||||
|
17
inc/Config.h
17
inc/Config.h
@ -1,14 +1,14 @@
|
|||||||
//
|
/**
|
||||||
// Created by lukas on 11.02.20.
|
* A static class to manage the configuration file, read/write parameters to it.
|
||||||
//
|
*
|
||||||
|
* @author Lukas Heiligenbrunner
|
||||||
|
* @date 11.02.2020
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
/**
|
|
||||||
* A static class to manage the configuration file, read/write parameters to it.
|
|
||||||
*/
|
|
||||||
class Config {
|
class Config {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -75,11 +75,12 @@ private:
|
|||||||
*/
|
*/
|
||||||
static bool telegramSupport;
|
static bool telegramSupport;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* helper variables for storing keys and ids
|
||||||
|
*/
|
||||||
static std::string dynuapikey;
|
static std::string dynuapikey;
|
||||||
|
|
||||||
static std::string domainid; //id of the dynu domain
|
static std::string domainid; //id of the dynu domain
|
||||||
static std::string domainname;
|
static std::string domainname;
|
||||||
|
|
||||||
static std::string telegramApiKey;
|
static std::string telegramApiKey;
|
||||||
static std::string chatId;
|
static std::string chatId;
|
||||||
};
|
};
|
@ -1,6 +1,9 @@
|
|||||||
//
|
/**
|
||||||
// Created by lukas on 05.05.19.
|
* Read and write current ip to a temp file to remember last ip until restart
|
||||||
//
|
*
|
||||||
|
* @author Lukas Heiligenbrunner
|
||||||
|
* @date 05.05.2019
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
//
|
/**
|
||||||
// Created by lukas on 02.08.19.
|
* IPrefresher library
|
||||||
//
|
* - start checking ip once
|
||||||
|
* - or in loop mode
|
||||||
|
*
|
||||||
|
* @author Lukas Heiligenbrunner
|
||||||
|
* @date 06.04.2019
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
//
|
/**
|
||||||
// Created by lukas on 07.05.20.
|
* A helper class for general IP String actions
|
||||||
//
|
*
|
||||||
|
* @author Lukas Heiligenbrunner
|
||||||
|
* @date 07.05.2020
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
/**
|
|
||||||
* General helper class for IP actions
|
|
||||||
*/
|
|
||||||
class IpHelper {
|
class IpHelper {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
10
inc/Logger.h
10
inc/Logger.h
@ -1,6 +1,10 @@
|
|||||||
//
|
/**
|
||||||
// Created by lukas on 26.10.19.
|
* Fancy console log output format
|
||||||
//
|
* todo log level support
|
||||||
|
*
|
||||||
|
* @author Lukas Heiligenbrunner
|
||||||
|
* @date 26.10.2019
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
//
|
/**
|
||||||
// Created by lukas on 06.04.19.
|
* API class
|
||||||
//
|
* - manages all curl download stuff
|
||||||
|
* - easy POST/GET requests
|
||||||
|
*
|
||||||
|
* @author Lukas Heiligenbrunner
|
||||||
|
* @date 06.04.2019
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
//
|
/**
|
||||||
// Created by lukas on 18.06.19.
|
* Dynu API - Refresh the IP
|
||||||
//
|
*
|
||||||
|
* @author Lukas Heiligenbrunner
|
||||||
|
* @date 18.06.2019
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -24,8 +27,18 @@ public:
|
|||||||
void init(const std::string &dynuApiKey, const std::string &domainId, const std::string &domainName);
|
void init(const std::string &dynuApiKey, const std::string &domainId, const std::string &domainName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string dynuapikey; // Dynu API key
|
/**
|
||||||
|
* Dynu API Key
|
||||||
|
*/
|
||||||
|
std::string dynuapikey;
|
||||||
|
|
||||||
std::string domainid; //id of the dynu domain
|
/**
|
||||||
|
* Dynu Domain ID
|
||||||
|
*/
|
||||||
|
std::string domainid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Domain name eg. "mydomain.dynu.net"
|
||||||
|
*/
|
||||||
std::string domainname;
|
std::string domainname;
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
//
|
/**
|
||||||
// Created by lukas on 07.04.19.
|
* A Hashmap class for easier Key-Value maps
|
||||||
//
|
*
|
||||||
|
* @author Lukas Heiligenbrunner
|
||||||
|
* @date 07.04.2019
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
//
|
/**
|
||||||
// Created by lukas on 18.06.19.
|
* IPAPI for getting global ip of current network
|
||||||
//
|
*
|
||||||
|
* @author Lukas Heiligenbrunner
|
||||||
|
* @date 18.06.2019
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
//
|
/**
|
||||||
// Created by lukas on 08.05.19.
|
* Telegram API for sending message to specific chat
|
||||||
//
|
*
|
||||||
|
* @author Lukas Heiligenbrunner
|
||||||
|
* @date 08.05.2019
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
//
|
|
||||||
// Created by lukas on 11.02.20.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "Version.h"
|
#include "Version.h"
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
//
|
|
||||||
// Created by lukas on 05.05.19.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "FileLogger.h"
|
#include "FileLogger.h"
|
||||||
#include "IpHelper.h"
|
#include "IpHelper.h"
|
||||||
|
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
//
|
|
||||||
// Created by lukas on 02.08.19.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "IPRefresher.h"
|
#include "IPRefresher.h"
|
||||||
#include "FileLogger.h"
|
#include "FileLogger.h"
|
||||||
#include "api/IPAPI.h"
|
#include "api/IPAPI.h"
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
//
|
|
||||||
// Created by lukas on 07.05.20.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "IpHelper.h"
|
#include "IpHelper.h"
|
||||||
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
//
|
|
||||||
// Created by lukas on 26.10.19.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
//
|
|
||||||
// Created by lukas on 06.04.19.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "api/API.h"
|
#include "api/API.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
//
|
|
||||||
// Created by lukas on 18.06.19.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "api/DynuAPI.h"
|
#include "api/DynuAPI.h"
|
||||||
|
|
||||||
bool DynuAPI::refreshIp(std::string ip) {
|
bool DynuAPI::refreshIp(std::string ip) {
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
//
|
|
||||||
// Created by lukas on 18.06.19.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "api/IPAPI.h"
|
#include "api/IPAPI.h"
|
||||||
|
|
||||||
std::string IPAPI::getGlobalIp() {
|
std::string IPAPI::getGlobalIp() {
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
//
|
|
||||||
// Created by lukas on 08.05.19.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "api/TelegramAPI.h"
|
#include "api/TelegramAPI.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
//
|
|
||||||
// Created by lukas on 18.06.19.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "Version.h"
|
#include "Version.h"
|
||||||
#include "IPRefresher.h"
|
#include "IPRefresher.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user