diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-22 18:32:34 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-22 18:42:24 +0100 |
| commit | f575de631ae39366d334167436a3fd540e45c068 (patch) | |
| tree | 89bf2b2e3f00dc2f8982305a54a92afa3030c72c /dev/lib/net | |
| parent | 10b3e4fbd0779833d3f2c7cff3c1d802664fa358 (diff) | |
feat: hpptest: new 'standard_terminate' structure from hpptest.hpp
feat: hpptest: new overload of must_pass for Generic, POSIX, and Win32.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/lib/net')
| -rw-r--r-- | dev/lib/net/modem.hpp | 11 | ||||
| -rw-r--r-- | dev/lib/net/url.hpp | 12 |
2 files changed, 17 insertions, 6 deletions
diff --git a/dev/lib/net/modem.hpp b/dev/lib/net/modem.hpp index a498f2e..fd64f72 100644 --- a/dev/lib/net/modem.hpp +++ b/dev/lib/net/modem.hpp @@ -5,8 +5,7 @@ * Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License. */ -#ifndef _OCL_NET_NETWORK_HPP -#define _OCL_NET_NETWORK_HPP +#pragma once #include <lib/tests/hpptest.hpp> @@ -22,13 +21,14 @@ namespace ocl::net { class modem; - using socket_type = int64_t; - /// ============================================================================= /// @brief Modem container concept, a container to read and write on a network stream. /// ============================================================================= class modem final { + public: + using socket_type = int64_t; + private: socket_type fd_{}; bool server_fd_{false}; @@ -145,7 +145,7 @@ namespace ocl::net int ret = ::bind(fd_, (struct sockaddr*)&addr_, sizeof(addr_)); bad_ = ret == -1; - + ::listen(fd_, modem::backlog_count); return bad_ == false; @@ -166,4 +166,3 @@ namespace ocl::net }; } // namespace ocl::net -#endif // ifndef _OCL_NET_NETWORK_HPP diff --git a/dev/lib/net/url.hpp b/dev/lib/net/url.hpp index 4bbc271..60440ad 100644 --- a/dev/lib/net/url.hpp +++ b/dev/lib/net/url.hpp @@ -24,6 +24,8 @@ namespace ocl::net http, https, mailto, + ftp, + tel, bad = 0xff, }; @@ -53,6 +55,16 @@ namespace ocl::net m_protocol_ = url_protocol::mailto; this->operator/=(protocol.substr(std::size("mailto:"))); } + else if (protocol.starts_with("tel:")) + { + m_protocol_ = url_protocol::tel; + this->operator/=(protocol.substr(std::size("tel:"))); + } + else if (protocol.starts_with("ftp:")) + { + m_protocol_ = url_protocol::ftp; + this->operator/=(protocol.substr(std::size("ftp:"))); + } } ~basic_url() = default; |
