Skip to content

Commit f167765

Browse files
committed
Fix Windows and SSL Wrappers
- Fixed SocketInit not always being odr-used when Sockets are used - Fixed SocketInit throwing errors which would call terminate() - Fixed SSL Wrappers copy constructor to really use up_ref - Fixed SSL Wrappers constness handling
1 parent 99cb1d1 commit f167765

26 files changed

Lines changed: 318 additions & 91 deletions

‎.github/workflows/cmake-multi-platform.yml‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
c_compiler: gcc
5050

5151
steps:
52-
- uses: actions/checkout@v3
52+
- uses: actions/checkout@v7
5353

5454
- name: Set Env
5555
shell: bash
@@ -84,6 +84,18 @@ jobs:
8484
with:
8585
name: compile_commands.json
8686
path: ${{ env.BUILD_OUTPUT_DIR }}/compile_commands.json
87+
archive: false
88+
89+
- uses: actions/upload-artifact@v4
90+
with:
91+
name: libcppsockets-${{ runner.os }}-${{ matrix.c_compiler }}-${{ matrix.build_type }}.so
92+
path: ${{ env.BUILD_OUTPUT_DIR }}/libcppsockets.so
93+
archive: false
94+
95+
- uses: actions/upload-artifact@v4
96+
with:
97+
name: unit_tests-${{ runner.os }}-${{ matrix.c_compiler }}-${{ matrix.build_type }}
98+
path: ${{ env.BUILD_OUTPUT_DIR }}/unit_tests*
8799

88100
- name: Test
89101
working-directory: ${{ env.BUILD_OUTPUT_DIR }}

‎.gitignore‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
build/
22

3-
libcppsockets.so
3+
file-share
4+
file-share-cli
5+
*.so
6+
*.dll
7+
*.exe
48
compile_commands.json
59

610
*.tmp

‎CMakeLists.txt‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Author Francois Michaut
55
##
66
## Started on Sun Aug 28 19:26:51 2022 Francois Michaut
7-
## Last update Wed Aug 20 17:05:18 2025 Francois Michaut
7+
## Last update Thu Jul 2 01:56:37 2026 Francois Michaut
88
##
99
## CMakeLists.txt : CMake to build the CppSockets library
1010
##
@@ -31,6 +31,7 @@ add_library(cppsockets
3131
source/Socket.cpp
3232
source/SocketInit.cpp
3333
)
34+
3435
target_include_directories(cppsockets
3536
PUBLIC
3637
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
@@ -39,6 +40,8 @@ target_include_directories(cppsockets
3940
${PROJECT_SOURCE_DIR}/private
4041
)
4142

43+
target_compile_definitions(cppsockets PRIVATE CPPSOCKETS_DLL_EXPORTS=1)
44+
4245
find_package(OpenSSL 3.0 COMPONENTS SSL)
4346
target_link_libraries(cppsockets OpenSSL::SSL)
4447
if(WIN32)

‎include/CppSockets/Address.hpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*
2-
** Project CppSockets, 2022
2+
** Project LibCppSockets, 2022
33
**
44
** Author Francois Michaut
55
**
66
** Started on Sun Feb 13 17:09:05 2022 Francois Michaut
7-
** Last update Sat Jun 20 09:12:58 2026 Francois Michaut
7+
** Last update Wed Jul 1 14:19:51 2026 Francois Michaut
88
**
99
** Address.hpp : Interface to represent network addresses
1010
*/

‎include/CppSockets/IPv4.hpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*
2-
** Project CppSockets, 2022
2+
** Project LibCppSockets, 2022
33
**
44
** Author Francois Michaut
55
**
66
** Started on Sun Feb 13 17:05:02 2022 Francois Michaut
7-
** Last update Wed Aug 20 12:57:35 2025 Francois Michaut
7+
** Last update Wed Jul 1 14:19:39 2026 Francois Michaut
88
**
99
** IPv4.hpp : Class used to represent and manipulate IPv4 addresses
1010
*/

‎include/CppSockets/OSDetection.hpp‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
/*
2-
** Project CppSockets, 2023
2+
** Project LibCppSockets, 2023
33
**
44
** Author Francois Michaut
55
**
66
** Started on Tue May 9 23:20:20 2023 Francois Michaut
7-
** Last update Sun May 14 14:03:20 2023 Francois Michaut
7+
** Last update Wed Jul 1 14:20:01 2026 Francois Michaut
88
**
99
** OSDetection.hpp : OS Detection macros
1010
*/
1111

1212
#pragma once
1313

1414
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
15-
#define OS_WINDOWS
15+
#define OS_WINDOWS 1
1616
#elif defined (__APPLE__)
17-
#define OS_UNIX
18-
#define OS_APPLE
17+
#define OS_UNIX 1
18+
#define OS_APPLE 1
1919
#elif defined(__linux__)
20-
#define OS_UNIX
21-
#define OS_LINUX
20+
#define OS_UNIX 1
21+
#define OS_LINUX 1
2222
#elif defined(__unix__)
23-
#define OS_UNIX
23+
#define OS_UNIX 1
2424
#else
25-
#error "Unknown compiler, please open a issue or pull request to support your compiler"
25+
#error "Unknown OS, please open a issue or pull request to support your OS"
2626
#endif

‎include/CppSockets/Socket.hpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*
2-
** Project CppSockets, 2022
2+
** Project LibCppSockets, 2022
33
**
44
** Author Francois Michaut
55
**
66
** Started on Sat Jan 15 01:17:42 2022 Francois Michaut
7-
** Last update Wed Aug 20 14:01:21 2025 Francois Michaut
7+
** Last update Wed Jul 1 14:20:12 2026 Francois Michaut
88
**
99
** Socket.hpp : Portable C++ socket class
1010
*/

‎include/CppSockets/Tls/Certificate.hpp‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
** Author Francois Michaut
55
**
66
** Started on Fri Aug 1 09:50:33 2025 Francois Michaut
7-
** Last update Wed Aug 20 17:17:44 2025 Francois Michaut
7+
** Last update Thu Jul 2 01:03:49 2026 Francois Michaut
88
**
99
** Certificate.hpp : Classes to create and manage Certificates
1010
*/
@@ -27,6 +27,7 @@ namespace CppSockets {
2727
x509Name();
2828
x509Name(X509_NAME_ptr ptr);
2929
x509Name(X509_NAME *ptr, bool own = true);
30+
x509Name(const X509_NAME *ptr);
3031

3132
x509Name(const x509Name &other) { *this = other; }
3233
x509Name(x509Name &&other) noexcept = default;
@@ -73,6 +74,7 @@ namespace CppSockets {
7374
x509NameEntry();
7475
x509NameEntry(X509_NAME_ENTRY_ptr ptr);
7576
x509NameEntry(X509_NAME_ENTRY *ptr, bool own = true);
77+
x509NameEntry(const X509_NAME_ENTRY *ptr);
7678
x509NameEntry(const std::string &name, int type, const std::u8string &data);
7779
x509NameEntry(const ASN1_OBJECT *obj, int type, const std::u8string &data);
7880
x509NameEntry(int nid, int type, const std::u8string &data);
@@ -103,6 +105,7 @@ namespace CppSockets {
103105
x509Extension();
104106
x509Extension(X509_EXTENSION_ptr ptr);
105107
x509Extension(X509_EXTENSION *ptr, bool own = true);
108+
x509Extension(const X509_EXTENSION *ptr);
106109
x509Extension(int nid, int crit, ASN1_OCTET_STRING *data);
107110
x509Extension(const ASN1_OBJECT *obj, int crit, ASN1_OCTET_STRING *data);
108111

@@ -119,8 +122,8 @@ namespace CppSockets {
119122
void set_object(const ASN1_OBJECT *obj);
120123
void set_critical(bool crit);
121124

122-
[[nodiscard]] auto get_data() const -> ASN1_OCTET_STRING *;
123-
[[nodiscard]] auto get_object() const -> ASN1_OBJECT *;
125+
[[nodiscard]] auto get_data() const -> const ASN1_OCTET_STRING *;
126+
[[nodiscard]] auto get_object() const -> const ASN1_OBJECT *;
124127
[[nodiscard]] auto get_critical() const -> bool;
125128

126129
[[nodiscard]] auto get() const -> X509_EXTENSION * { return m_ptr.get(); }
@@ -134,6 +137,7 @@ namespace CppSockets {
134137
x509Certificate();
135138
x509Certificate(X509_ptr ptr);
136139
x509Certificate(X509 *ptr, bool own = true);
140+
x509Certificate(const X509 *ptr);
137141
explicit x509Certificate(const std::filesystem::path &pem_file_path);
138142

139143
x509Certificate(const x509Certificate &other) { *this = other; }

‎include/CppSockets/Tls/Context.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
** Author Francois Michaut
55
**
66
** Started on Wed Aug 20 14:13:44 2025 Francois Michaut
7-
** Last update Fri Aug 22 21:43:02 2025 Francois Michaut
7+
** Last update Tue Jun 30 08:19:16 2026 Francois Michaut
88
**
99
** Context.hpp : Context for TLS sockets
1010
*/

‎include/CppSockets/Tls/Utils.hpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
** Author Francois Michaut
55
**
66
** Started on Fri Aug 1 09:54:53 2025 Francois Michaut
7-
** Last update Wed Aug 20 16:49:57 2025 Francois Michaut
7+
** Last update Wed Jul 1 19:48:56 2026 Francois Michaut
88
**
99
** Utils.hpp : Tls Utility types
1010
*/
@@ -58,4 +58,5 @@ namespace CppSockets {
5858

5959
// Don't leak macros
6060
#undef CPP_SOCKETS_TLS_UTILS_DEFINE_DTOR
61+
#undef CPP_SOCKETS_TLS_UTILS_DEFINE_PTR_CMD_PREFIX
6162
#undef CPP_SOCKETS_TLS_UTILS_DEFINE_PTR

0 commit comments

Comments
 (0)