Commit graph

61 commits

Author SHA1 Message Date
Stephen Seo ef164561c1 Reduce verbosity of unit test logs
All checks were successful
Publish doxygen documentation to seodisparate.com / doxygen-gen-and-publish (push) Successful in 0s
Run UnitTests / build-and-run-tests (push) Successful in 22s
2024-01-12 16:36:01 +09:00
Stephen Seo 3f2c49572b Add UnitTest file for CXX11_shared_spin_lock
All checks were successful
Publish doxygen documentation to seodisparate.com / doxygen-gen-and-publish (push) Successful in 0s
2024-01-12 13:55:28 +09:00
Stephen Seo 05087406b1 Reland C++11 "shared_lock" with iter remove fix
On iterator remove, the iterator will trade the read lock for a write
lock, and trade back for a read lock once the remove has been completed.
2024-01-12 13:32:05 +09:00
Stephen Seo c03eae1c15 UnitTest for start/stop threaded update and fix
All checks were successful
Publish doxygen documentation to seodisparate.com / doxygen-gen-and-publish (push) Successful in 0s
2024-01-11 20:07:25 +09:00
Stephen Seo 611287b377 Revert "Impl "RWLock" for use in TSLQueue"
This reverts commit cf27a6bb76.

The use of "shared_lock" in TSLQueue is unsafe because of two things:

  - The TSLQueue iterator takes a "read" lock.
  - The TSLQueue iterator can erase the current element.
2023-07-22 17:28:33 +09:00
Stephen Seo cf27a6bb76 Impl "RWLock" for use in TSLQueue
This project supports C++11, and std::shared_lock was made available in
C++17, thus a "shared_spin_lock" was created with similar functionality.
This "shared_spin_lock" is used in TSLQueue.
2023-07-22 16:33:09 +09:00
Stephen Seo 64a0995e21 Fix CMakeLists.txt, handle -Weffc++ warnings 2023-07-22 13:25:43 +09:00
Stephen Seo 77d69cabbc Impl "unsafe" versions of UDPC_atostr(...)
These "unsafe" versions are guaranteed to not have the returned address
strings be overwritten by UDPC, but they must be manually free'd later
(as mentioned in the documentation).
2023-06-22 13:25:26 +09:00
Stephen Seo 211715fc56 Fix potential nullptr deref in free_PacketInfo_ptr 2023-04-19 19:11:03 +09:00
Stephen Seo 3fac706d86 Add UDPC_free_PacketInfo_ptr(...)
Also add unit test for this function.
2023-04-19 18:50:26 +09:00
Stephen Seo 087d3cfc6f Impl handling Ctrl-C for Windows in NetworkTest 2023-01-10 12:14:57 +09:00
Stephen Seo e774a54349 Handle SIGINT (Ctrl-C) in NetworkTest 2022-11-23 14:13:44 +09:00
Stephen Seo b0e996cda3 Attempt to make NetworkTest work on Windows 2020-04-28 20:55:16 +09:00
Stephen Seo d3fb621406 Minor fixes 2020-04-27 19:34:04 +09:00
Stephen Seo 445a221a5b Fix check addr endianness in a4toa6 function 2020-04-27 11:47:50 +09:00
Stephen Seo 31ca4ddc44 Impl create id with hostname
Previously, ids could only be created with an ip address. Now they can
be made with a hostname, which will be looked up by UDPC.

Also fix client still requesting connections even if
accept-new-connections flag is false.
2020-04-26 18:52:06 +09:00
Stephen Seo cf6ff5a040 Change how UDPC_PacketInfo handles it's data
The "data" member variable in UDPC_PacketInfo is now handled as a
pointer to dynamic data, instead of an array with a fixed size. Every
time a UDPC_PacketInfo is received from the context,
UDPC_free_PacketInfo() must be called on it to avoid a memory leak.
2020-04-15 19:56:15 +09:00
Stephen Seo c37909bde3 Add helpers converting network-order (big-endian) 2020-01-16 20:28:42 +09:00
Stephen Seo f588d409c9 Truncate "UDPConnection" to "UDPC" 2020-01-09 16:57:01 +09:00
Stephen Seo 7996bd5c36 Client on connect fail now returns FAIL_CONNECT
Previously, returned event was DISCONNECT. FAIL_CONNECT is a new event
enum value.
2020-01-05 14:49:37 +09:00
Stephen Seo 42fde9a2d0 Implement publickey whitelist (using libsodium)
Renamed "mutex" to "conMapMutex" since it is mainly used to lock access
to the connection map.

Removed UDPC_client_initiate_connection_pk() as publickey whitelisting
replaces its functionality.
2020-01-02 20:54:32 +09:00
Stephen Seo 1a39039065 Fix received packet storing unnecessary header
Added rtt (uint16_t) to UDPC_PacketInfo.
2019-12-27 13:35:28 +09:00
Stephen Seo 4b36d05ccc Minor fixes, improvements
When UDPC_ConnectionId is initialized, all of its bytes are now zeroed
out.
2019-12-18 14:20:29 +09:00
Stephen Seo 5ec344b733 Add way to get connection queued size
Requires locking the mutex for access to conMap.
2019-12-18 13:47:46 +09:00
Stephen Seo 62ac6e779f Bug fixes
Fixed not setting output int to 0 to specify zero connections when
returning connection IDs.
2019-12-17 20:58:44 +09:00
Stephen Seo dbdade3b00 Impl disc. request (untested), del make_unique 2019-12-17 20:05:56 +09:00
Stephen Seo a4efd98890 Replace "poor man's optional" with std::unique_ptr 2019-12-17 19:12:54 +09:00
Stephen Seo ece17e1aca Drop support from C++17 to C++11
std::optional replaced with Entry in TSLQueue (which is basically a poor
man's optional).
2019-12-11 20:00:48 +09:00
Stephen Seo 7c444cb460 Impl auth-policy for handling with(out) auth 2019-12-09 21:27:58 +09:00
Stephen Seo 6b14d86822 Fixes for setting pub/sec keys
Added more to NetworkTest to test new changes.
2019-11-21 15:15:05 +09:00
Stephen Seo 4cfe35ecd1 libsodium support is now optional
Packet struture has been changed to support UDPC without libsodium
sending packets to UDPC with libsodium.
2019-11-18 17:37:03 +09:00
Stephen Seo f9e1bca4c1 Add UDPC_create_id_easy
UDPC_create_id_easy will detect if the input addr string is link local
or not, and will create the ipv6 address based on it.
2019-11-13 12:15:12 +09:00
Stephen Seo 90b36e3061 Convert NetworkTest to C from C++ 2019-11-13 11:47:53 +09:00
Stephen Seo 7b5cf3b6f8 Add events, refactorings
Added event system to lessen the use of the main mutex and instead use
thread safe data structures (TSLQueue). Also can enable and check events
during execution (connect, disconnect, good mode, bad mode).

Fixes and refactorings.
2019-11-11 16:08:51 +09:00
Stephen Seo 00c1be07dc Replace c_impl, remove rust_binding, with cpp_impl 2019-11-11 13:08:36 +09:00
Stephen Seo 1eed614ded Add buildgen rust binding 2019-04-17 15:15:53 +09:00
Stephen Seo 2bd2e868b2 Change UDPConnection to set listen address
Add some documentation, fix NetworkTest with new change.
2019-03-06 19:53:15 +09:00
Stephen Seo 71fd812137 Minor fix to NetworkTest 2019-03-06 13:49:56 +09:00
Stephen Seo 4be79ace7c Fix received callback, minor change to NetworkTest 2019-03-06 13:39:54 +09:00
Stephen Seo aab8cfe407 Fix threaded update 2019-03-05 12:56:05 +09:00
Stephen Seo 0ff6bd13a7 Change NetworkTest to exit after disconnect 2019-03-05 12:11:57 +09:00
Stephen Seo f8950fa08e Fix endianness of addr, minor fixes 2019-03-04 19:05:07 +09:00
Stephen Seo 9134079b8d More fixes 2019-03-04 18:17:28 +09:00
Stephen Seo aa094224bc Fix NetworkTest 2019-03-04 17:56:40 +09:00
Stephen Seo ec9c3399bf Fixes to NetworkTest 2019-03-04 17:48:32 +09:00
Stephen Seo d38c7ac105 Add NetworkTest executable
To be used to debug UDPConnection.
2019-03-04 15:20:22 +09:00
Stephen Seo 89afc58bc7 Add UDPC_strtoa 2019-03-04 15:05:21 +09:00
Stephen Seo 29e3940c14 Add push_..._realloc to Deque 2019-02-21 12:34:35 +09:00
Stephen Seo 40f4df0fba Update unit tests for HashMap, fixes 2019-02-18 12:24:34 +09:00
Stephen Seo 6476617b1b Minor fix to unit test for HashMap 2019-02-15 17:00:10 +09:00