diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-10-05 18:26:50 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-10-05 18:26:50 -0700 |
| commit | defc7bf583753444851cb651466d91240fa4fbc8 (patch) | |
| tree | 1d55cc1373a04cc48c9d8954d6f1a602a8375267 /src/core/message.h | |
| parent | eef8f5f4a4d8d05470503e7f6dc7270c7e488cb5 (diff) | |
| download | nng-defc7bf583753444851cb651466d91240fa4fbc8.tar.gz nng-defc7bf583753444851cb651466d91240fa4fbc8.tar.bz2 nng-defc7bf583753444851cb651466d91240fa4fbc8.zip | |
msg: add sockaddr to message structure
This is expected to be useful for new transports where we need
the sock address to properly reply (think UDP with multicast).
Diffstat (limited to 'src/core/message.h')
| -rw-r--r-- | src/core/message.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/core/message.h b/src/core/message.h index 7e35ba75..9f88cbe8 100644 --- a/src/core/message.h +++ b/src/core/message.h @@ -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 |
