diff options
| author | Amlal <amlal@nekernel.org> | 2025-08-09 21:54:20 +0200 |
|---|---|---|
| committer | Amlal <amlal@nekernel.org> | 2025-08-09 21:54:20 +0200 |
| commit | 87f10dad540971c4aa22d892c676dce590ca189a (patch) | |
| tree | 98d926138b5bb6df704f73a6843a520dc6f736eb /dev | |
| parent | 8b7b48fe4acf0482580930eaebaa2f316727f864 (diff) | |
feat: move network.hpp to net/ and working on url.hpp
Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'dev')
| -rw-r--r-- | dev/lib/except/error.hpp | 2 | ||||
| -rw-r--r-- | dev/lib/fix/parser.hpp | 6 | ||||
| -rw-r--r-- | dev/lib/memory/tracked_ptr.hpp | 2 | ||||
| -rw-r--r-- | dev/lib/net/network.hpp (renamed from dev/lib/fix/network.hpp) | 24 | ||||
| -rw-r--r-- | dev/lib/net/url.hpp | 8 | ||||
| -rw-r--r-- | dev/lib/utility/cgi.hpp | 22 | ||||
| -rw-r--r-- | dev/lib/utility/embfs.hpp | 8 |
7 files changed, 40 insertions, 32 deletions
diff --git a/dev/lib/except/error.hpp b/dev/lib/except/error.hpp index 6e75f16..486d2e6 100644 --- a/dev/lib/except/error.hpp +++ b/dev/lib/except/error.hpp @@ -14,7 +14,7 @@ namespace snu::except using runtime_error = std::runtime_error; using fix_error = runtime_error; using math_error = runtime_error; - using cgi_error = runtime_error; + using cgi_error = runtime_error; } // namespace snu::except #endif // _SNU_ERR_HPP
\ No newline at end of file diff --git a/dev/lib/fix/parser.hpp b/dev/lib/fix/parser.hpp index 5701783..f0f7141 100644 --- a/dev/lib/fix/parser.hpp +++ b/dev/lib/fix/parser.hpp @@ -27,7 +27,7 @@ namespace snu::fix struct basic_range; template <typename char_type> - struct basic_range_data; + class basic_range_data; /// @brief Buffer+Length structure template <typename char_type = char> @@ -65,7 +65,7 @@ namespace snu::fix bool is_valid() { - return bytes_ && length_ > 0; + return this->bytes_ && this->length_ > 0; } operator bool() @@ -98,7 +98,7 @@ namespace snu::fix static inline const char_type* begin = detail::begin_fix<char_type>(); explicit basic_range_data() = default; - ~basic_range_data() = default; + ~basic_range_data() = default; basic_range_data& operator=(const basic_range_data&) = default; basic_range_data(const basic_range_data&) = default; diff --git a/dev/lib/memory/tracked_ptr.hpp b/dev/lib/memory/tracked_ptr.hpp index 2607b5b..c767b67 100644 --- a/dev/lib/memory/tracked_ptr.hpp +++ b/dev/lib/memory/tracked_ptr.hpp @@ -128,7 +128,7 @@ namespace snu::memory this->reset(); } - tracked_ptr(const tracked_ptr&) = delete; + tracked_ptr(const tracked_ptr&) = delete; tracked_ptr& operator=(const tracked_ptr&) = delete; public: diff --git a/dev/lib/fix/network.hpp b/dev/lib/net/network.hpp index edd4c26..22cc5b2 100644 --- a/dev/lib/fix/network.hpp +++ b/dev/lib/net/network.hpp @@ -1,32 +1,32 @@ /* - * File: fix/network.hpp - * Purpose: Financial Information Exchange in C++ + * File: net/network.hpp + * Purpose: Modem concept in modern C++ * Author: Amlal El Mahrouss (founder@snu.systems) * Copyright 2025, Amlal El Mahrouss and SNU Systems Corp. */ -#ifndef _SNU_FIX_NETWORK_HPP -#define _SNU_FIX_NETWORK_HPP +#ifndef _SNU_NET_NETWORK_HPP +#define _SNU_NET_NETWORK_HPP #include <arpa/inet.h> #include <sys/socket.h> #include <utility> #include <cstddef> -#define SNU_MODEM : protected snu::fix::basic_delivery_modem +#define SNU_MODEM : protected snu::net::basic_delivery_modem -namespace snu::fix +namespace snu::net { class basic_delivery_modem; - typedef int32_t delivery_socket_type; + typedef int64_t socket_type; - /// @brief a delivery modem is a container which establishes a comm. channel between the FIX session and application. + /// @brief Delivery modem concept, a container to read and write on a network stream. class basic_delivery_modem { public: explicit basic_delivery_modem() = default; - virtual ~basic_delivery_modem() = default; + virtual ~basic_delivery_modem() = default; basic_delivery_modem& operator=(const basic_delivery_modem&) = default; basic_delivery_modem(const basic_delivery_modem&) = default; @@ -36,7 +36,7 @@ namespace snu::fix static constexpr auto backlog_count = 18U; public: - delivery_socket_type fd_{}; + socket_type fd_{}; template <typename T> bool receive(T& out, std::size_t len) noexcept @@ -112,6 +112,6 @@ namespace snu::fix return true; } }; -} // namespace snu::fix +} // namespace snu::net -#endif // ifndef _SNU_FIX_NETWORK_HPP
\ No newline at end of file +#endif // ifndef _SNU_NET_NETWORK_HPP
\ No newline at end of file diff --git a/dev/lib/net/url.hpp b/dev/lib/net/url.hpp new file mode 100644 index 0000000..6c4dc36 --- /dev/null +++ b/dev/lib/net/url.hpp @@ -0,0 +1,8 @@ +/* + * File: net/url.hpp + * Purpose: URL container in modern C++ + * Author: Amlal El Mahrouss (founder@snu.systems) + * Copyright 2025, Amlal El Mahrouss and SNU Systems Corp. + */ + +#pragma once diff --git a/dev/lib/utility/cgi.hpp b/dev/lib/utility/cgi.hpp index 8e2170e..57625b8 100644 --- a/dev/lib/utility/cgi.hpp +++ b/dev/lib/utility/cgi.hpp @@ -32,35 +32,35 @@ namespace snu public: explicit basic_writer() = default; - ~basic_writer() = default; + ~basic_writer() = default; basic_writer& operator=(const basic_writer&) = default; basic_writer(const basic_writer&) = default; public: - basic_writer& binary(const std::basic_stringstream<char_type>& ss_html) + basic_writer& binary(const std::basic_stringstream<char_type>& ss_in) { - return this->eval_("application/octet-stream", ss_html); + return this->eval_("application/octet-stream", ss_in); } - basic_writer& html(const std::basic_stringstream<char_type>& ss_html) + basic_writer& html(const std::basic_stringstream<char_type>& ss_in) { - return this->eval_("text/html", ss_html); + return this->eval_("text/html", ss_in); } - basic_writer& xml(const std::basic_stringstream<char_type>& ss_html) + basic_writer& xml(const std::basic_stringstream<char_type>& ss_in) { - return this->eval_("application/xml", ss_html); + return this->eval_("application/xml", ss_in); } - basic_writer& json(const std::basic_stringstream<char_type>& ss_html) + basic_writer& json(const std::basic_stringstream<char_type>& ss_in) { - return this->eval_("application/json", ss_html); + return this->eval_("application/json", ss_in); } - basic_writer& js(const std::basic_stringstream<char_type>& ss_html) + basic_writer& js(const std::basic_stringstream<char_type>& ss_in) { - return this->eval_("text/javascript", ss_html); + return this->eval_("text/javascript", ss_in); } }; } // namespace cgi diff --git a/dev/lib/utility/embfs.hpp b/dev/lib/utility/embfs.hpp index fea379c..3acc867 100644 --- a/dev/lib/utility/embfs.hpp +++ b/dev/lib/utility/embfs.hpp @@ -23,10 +23,10 @@ namespace snu::embfs inline constexpr const size_t _superblock_name_len = 16; inline constexpr const size_t _superblock_reserve_len = 462; - - inline constexpr const size_t _inode_name_len = 128; - inline constexpr const size_t _inode_arr_len = 12; - inline constexpr const size_t _inode_lookup_len = 8; + + inline constexpr const size_t _inode_name_len = 128; + inline constexpr const size_t _inode_arr_len = 12; + inline constexpr const size_t _inode_lookup_len = 8; #ifdef EMBFS_28BIT_LBA typedef std::uint32_t lba_t; |
