-
-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is the initial implementation of UDP transport. It does in order guarantees (and consequently filters duplicates), but it does not guarantee delivery. The protocol limits payloads to 65000 bytes (minus headers for SP), but you really want to keep it to much less -- probably best for short messages that within a single MTU to avoid IP fragmentation and reassembly. This is unicast only for now (although there are plans for some support for multicast and broadcast as well as being able to perform automatic mesh building, but that will be in following work. Additional tunables are coming. This is only lightly tested at this point, and should be considered experimental. Its also undocumented.
- Loading branch information
Showing
19 changed files
with
2,142 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// | ||
// Copyright 2021 Staysail Systems, Inc. <[email protected]> | ||
// Copyright 2024 Staysail Systems, Inc. <[email protected]> | ||
// Copyright 2017 Capitar IT Group BV <[email protected]> | ||
// | ||
// This software is supplied under the terms of the MIT License, a | ||
|
@@ -20,9 +20,9 @@ extern int nni_msg_realloc(nni_msg *, size_t); | |
extern int nni_msg_reserve(nni_msg *, size_t); | ||
extern size_t nni_msg_capacity(nni_msg *); | ||
extern int nni_msg_dup(nni_msg **, const nni_msg *); | ||
extern void * nni_msg_header(nni_msg *); | ||
extern void *nni_msg_header(nni_msg *); | ||
extern size_t nni_msg_header_len(const nni_msg *); | ||
extern void * nni_msg_body(nni_msg *); | ||
extern void *nni_msg_body(nni_msg *); | ||
extern size_t nni_msg_len(const nni_msg *); | ||
extern int nni_msg_append(nni_msg *, const void *, size_t); | ||
extern int nni_msg_insert(nni_msg *, const void *, size_t); | ||
|
@@ -55,6 +55,14 @@ extern void nni_msg_clone(nni_msg *); | |
extern nni_msg *nni_msg_unique(nni_msg *); | ||
extern bool nni_msg_shared(nni_msg *); | ||
|
||
// Socket address access. Principally useful for transports like UDP, | ||
// which may need to remember or add the socket address later. | ||
// SP transports will generally not support upper layers setting the | ||
// address on send, but will take the information from the pipe. | ||
// It may be set on receive, depending upon the transport. | ||
extern const nng_sockaddr *nni_msg_address(const nni_msg *); | ||
extern void nni_msg_set_address(nng_msg *, const nng_sockaddr *); | ||
|
||
// nni_msg_pull_up ensures that the message is unique, and that any | ||
// header present is "pulled up" into the message body. If the function | ||
// cannot do this for any reason (out of space in the body), then NULL | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# | ||
# Copyright 2023 Staysail Systems, Inc. <[email protected]> | ||
# Copyright 2024 Staysail Systems, Inc. <[email protected]> | ||
# | ||
# This software is supplied under the terms of the MIT License, a | ||
# copy of which should be located in the distribution where this | ||
|
@@ -17,4 +17,4 @@ add_subdirectory(tcp) | |
add_subdirectory(tls) | ||
add_subdirectory(ws) | ||
add_subdirectory(zerotier) | ||
|
||
add_subdirectory(udp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# | ||
# Copyright 2024 Staysail Systems, Inc. <[email protected]> | ||
# | ||
# This software is supplied under the terms of the MIT License, a | ||
# copy of which should be located in the distribution where this | ||
# file was obtained (LICENSE.txt). A copy of the license may also be | ||
# found online at https://opensource.org/licenses/MIT. | ||
# | ||
|
||
# UDP transport | ||
nng_directory(udp) | ||
|
||
nng_sources_if(NNG_TRANSPORT_UDP udp.c) | ||
nng_defines_if(NNG_TRANSPORT_UDP NNG_TRANSPORT_UDP) | ||
nng_test_if(NNG_TRANSPORT_UDP udp_tran_test) |
Oops, something went wrong.