Beginning the design of the program. It could change in the future.

This commit is contained in:
Florent Denef 2021-01-23 15:13:08 +01:00
parent 7ea618bcbf
commit 980f48959c
No known key found for this signature in database
GPG Key ID: 873C3ACCF970C74E
7 changed files with 118 additions and 6 deletions

View File

@ -8,23 +8,35 @@ set(CMAKE_CXX_COMPILER_LAUNCHER ccache)
find_package(Boost REQUIRED COMPONENTS system)
find_package(OpenSSL REQUIRED)
find_package(OpenMP REQUIRED)
include_directories(${Boost_INCLUDE_DIR} ${OpenSSL_INCLUDE_DIR})
set(COMPILE_DEFINITIONS
$<$<CONFIG:DEBUG>:_GLIBCXX_DEBUG>
BOOST_ASIO_NO_DEPRECATED
BOOST_ASIO_NO_TS_EXECUTORS
#[[_FORTIFY_SOURCE=2]]
)
set(COMPILE_FLAGS
-pipe
-march=skylake # change to native or your architecture.
-mtune=skylake # same as above
-mrdrnd
-mrdseed # be careful about this, this is linked to the x86 architecture.
-mrdrnd # same as above
-stdlib=libc++
-Wpedantic
-Wall
-Wextra
-Wpessimizing-move
-Wredundant-move
-Wmove
-Wopenmp
-funroll-loops
-flto=thin -fwhole-program-vtables
-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
)
set(LINKER_OPTIONS
PRIVATE -Wl,--sort-common,--as-needed
-stdlib=libc++
-flto=thin
-fwhole-program-vtables
-fuse-ld=gold
@ -32,16 +44,24 @@ set(LINKER_OPTIONS
set(LINKER_FLAGS
jemalloc
${Boost_LIBRARIES}
OpenSSL::SSL
OpenMP::OpenMP_CXX
)
file(GLOB HEADERS includes/*.hpp)
set(FILES
main.cpp)
main.cpp
src/network.cpp
include/information.hpp
src/cache_files.cpp
include/cache_files.hpp
)
add_executable(GeminiServer ${FILES})
target_precompile_headers(GeminiServer PRIVATE ${HEADERS})
target_compile_definitions(GeminiServer PRIVATE _GLIBCXX_DEBUG BOOST_ASIO_NO_DEPRECATED BOOST_ASIO_NO_TS_EXECUTORS)
target_compile_definitions(GeminiServer PRIVATE ${COMPILE_DEFINITIONS})
target_compile_options(GeminiServer PRIVATE ${COMPILE_FLAGS})
target_link_options(GeminiServer ${LINKER_OPTIONS})
target_link_libraries(GeminiServer ${Boost_LIBRARIES} ${LINKER_FLAGS} OpenSSL::SSL)
target_link_libraries(GeminiServer ${LINKER_FLAGS})

46
class_diagram.puml Normal file
View File

@ -0,0 +1,46 @@
@startuml
Configuration ..> "produces" Information
Network ..> "uses" TaskRequest
Network ..> "uses" Information
TaskRequest ..> "uses" Information
TaskRequest ..> "uses" CacheFiles
class TaskRequest {
- request: string
}
class Network {
- context: io_context
- ssl: ssl::stream<tcp>
+ Network()
+ Network(&&)
+ operator=(&&)
}
class Configuration {
+ filename: const string
+ Configuration(string filename)
+ create_infos(): Information
}
class Information {
+ enable_cache: const bool
+ cache_size: const int
+ ssl_pem_path: const path
+ ssl_cert_path: const path
}
class CacheFiles {
- files: unordered_set<string>
- content: unordered_map<string, string>
+ CacheFiles()
+ get_files(): files
+ get_content(): content
}
@enduml

15
include/cache_files.hpp Normal file
View File

@ -0,0 +1,15 @@
#ifndef GEMINISERVER_CACHE_FILES_HPP
#define GEMINISERVER_CACHE_FILES_HPP
namespace gemini {
/**
* \brief This class is used to store the files in cache.
*/
class CacheFiles {
};
}
#endif //GEMINISERVER_CACHE_FILES_HPP

14
include/information.hpp Normal file
View File

@ -0,0 +1,14 @@
#ifndef GEMINISERVER_INFORMATION_HPP
#define GEMINISERVER_INFORMATION_HPP
namespace gemini {
/**
* \brief This struct is used to store information inside, used by any other class/struct.
*/
struct Information {
};
}
#endif //GEMINISERVER_INFORMATION_HPP

15
include/network.hpp Normal file
View File

@ -0,0 +1,15 @@
#ifndef GEMINISERVER_NETWORK_HPP
#define GEMINISERVER_NETWORK_HPP
namespace gemini {
/**
* \brief This is class is used for all the network things for the server.
*/
class Network {
};
}
#endif //GEMINISERVER_NETWORK_HPP

1
src/cache_files.cpp Normal file
View File

@ -0,0 +1 @@
#include "../include/cache_files.hpp"

1
src/network.cpp Normal file
View File

@ -0,0 +1 @@
#include "../include/network.hpp"