Commit graph

284 commits

Author SHA1 Message Date
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 aa59777f99 Fix create_id_easy not parsing ipv4 addr correctly 2019-12-17 12:52:10 +09:00
Stephen Seo 58493ee936 Fix UnitTests using C++17 (now uses C++11) 2019-12-11 21:24:28 +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 d94b44e4de More documentation, fix constants to be #define'd 2019-12-06 20:49:30 +09:00
Stephen Seo 4d623c3837 Update .gitignore 2019-12-04 15:08:25 +09:00
Stephen Seo 6742e06596 More work on Doxygen style documentation 2019-12-04 13:08:30 +09:00
Stephen Seo feb859d745 Begin doxygen-style documentation WIP 2019-11-27 20:26:40 +09:00
Stephen Seo 69256839ac Minor fixes/refactorings 2019-11-27 20:12:57 +09:00
Stephen Seo 04fa5ca017 Add is_valid_context(), fixes/refactorings 2019-11-27 19:47:51 +09:00
Stephen Seo 8d1dbead20 Add set_libsodium_key_easy(), fixes/refactorings 2019-11-27 19:41:38 +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 c24273ea65 Add unset_libsodium_keys()
Still untested
2019-11-21 12:23:40 +09:00
Stephen Seo 240ed9821f Add set peer_pk, sk/pk, start/stop threaded update
Note, this code is UNTESTED.
2019-11-19 20:55:20 +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 f2b4672318 Add way to specify sleep time for threaded update 2019-11-13 14:06:48 +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 d86b7e4e1d Fix use of addr/socket types 2019-11-11 13:37: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 a11c99e115 Remove unused TSQueue and RingBuffer 2019-11-06 14:42:35 +09:00
Stephen Seo 7c889eee6a Fixes and improvements (add use of TSLQueue)
Replace "unsigned long long" in TSLQueue with "unsigned long" to keep
compatibility with C.

Add top_and_pop_and_rsize() to TSLQueue.

Fix log levels in UDPC.

Replace TSQueue with TSLQueue in UDPC_Context.
Also fix NetworkTest with TSLQueue related changes.
2019-11-06 14:39:09 +09:00
Stephen Seo 742db465dd Minor fix to size pointer in TSLQueue iterator
Prevent pointer change errors by making the pointer itself const.
2019-11-06 13:34:55 +09:00
Stephen Seo a5873624aa Fix size count in TSLQueue when using iterator 2019-11-06 13:32:39 +09:00
Stephen Seo 3f338be365 Add more tests to UnitTest for TSLQueue 2019-11-06 12:54:03 +09:00
Stephen Seo 3830be6e2d Add iterator to TSLQueue
Removed shared_ptr "locks", replaced by iterator owning a lock_guard.
2019-11-03 18:46:25 +09:00
Stephen Seo 10899ffaab Replace std::list with own doubly-linked-list
TODO iterator
2019-10-29 20:33:16 +09:00
Stephen Seo 3dc12683e8 Add remove() to TSLQueue's iterator wrapper
Minor additions to UnitTest.
2019-10-28 11:09:48 +09:00
Stephen Seo 78862dc29d Add WIP UnitTests for TSLQueue 2019-10-24 20:25:41 +09:00
Stephen Seo aa132fbf12 Add prefix inc/dec to TSLQIterWrapper 2019-10-24 17:58:13 +09:00
Stephen Seo ebedd06fdb Add missing impl fn to TSLQueue 2019-10-24 17:51:40 +09:00
Stephen Seo 04d8abab84 Add impl of TSLQueue (TODO UnitTests) 2019-10-24 17:49:28 +09:00
Stephen Seo 0402442929 Begin work on TSLQueue 2019-10-22 20:24:23 +09:00
Stephen Seo 0f435613bc Refactor logging
Removed redundant checking of logging type in log_impl* .
2019-10-22 19:27:55 +09:00
Stephen Seo b11d87ca12 Rework sendPkts (sending queue)
Changed sendPkts in ConnectionData to std::deque, added a TSQueue
cSendPkts to Context. Queued packets will be moved to corresponding
ConnectionData instances during update, dropping with a warning those
where a connection does not exist.

Minor other fixes.

Some additions to TSQueue.
2019-09-27 20:19:48 +09:00
Stephen Seo 98e88237ce Implement header verification via libsodium
The original 20 byte header is now verified with public-key-crypto using
libsodium.

Also some fixes where ntohs/htons was not used where it should be.
2019-09-23 20:11:12 +09:00
Stephen Seo 328d44fbb6 Add support for MINGW compiler 2019-09-21 12:15:49 +09:00
Stephen Seo aa7255c2e5 Fixes and improvements
Fix use of accept-connections flag.
Fix use of TSQueue (add top_and_pop_and_rsize fn).
Reduce sleep time of threadedUpdate to 8 ms.
2019-09-20 16:59:16 +09:00
Stephen Seo 27528bfbc5 Use macro to conditionally log
This should skip evaluating log parameters if the log level is not met.
2019-09-20 14:26:59 +09:00
Stephen Seo 5a3c7cd9a0 Many fixes, including sending packets with payload
Implemented UDPC_get_received
Added UDPC_get_list_connected and UDPC_free_list_connected.
2019-09-20 14:02:41 +09:00
Stephen Seo f6ba9e21b6 Fix parsing of ipv6 link-local address
Add support for numeric id in suffix of ipv6 link-local address.
2019-09-19 14:30:10 +09:00
Stephen Seo 71f7bc4977 Fix Windows support 2019-09-19 12:23:15 +09:00
Stephen Seo 0e22357d55 Rename enum types to avoid name conflict 2019-09-19 10:58:19 +09:00
Stephen Seo 8661af9529 Attempt to make code platform agnostic
Getting scope_id from device name from ipv6 link-local address was
previously using only a unix supported api. Added (untested) code to do
the same for windows machines.
2019-09-19 10:35:22 +09:00