From edd3b6bc34f211bd3d58642d0c69ce1b5bb9dc3b Mon Sep 17 00:00:00 2001 From: gdamore Date: Thu, 9 Oct 2025 01:22:20 +0000 Subject: deploy: 9c834956456924df7c885ab8b79573721acaff5c --- ref/api/msg.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'ref/api/msg.html') diff --git a/ref/api/msg.html b/ref/api/msg.html index 28e23337..b2c19276 100644 --- a/ref/api/msg.html +++ b/ref/api/msg.html @@ -246,15 +246,15 @@

Messages

Messages in Scalability Protocols are the fundamental unit of transmission and reception, as these protocols are fundamentally message-oriented.

-

Messages have a body, containing the application-supplied -payload, and a header, containing protocol specific routing and similar +

Messages have a body, containing the application-supplied +payload, and a header, containing protocol specific routing and similar related information.

tip

-

Only applications using raw mode need to access the message header. +

Only applications using raw mode need to access the message header. Very few NNG applications do this.

Message Structure

@@ -268,7 +268,7 @@ and a header.

The nng_msg_alloc function allocates a new message. It takes a size argument, and returns a message with a preallocated body of that size in the msgp parameter.

-

If it succeeds, it returns zero, otherwise this function may return NNG_ENOMEM, +

If it succeeds, it returns zero, otherwise this function may return NNG_ENOMEM, indicating that insufficient memory is available to allocate a new message.

Destroy a Message

void nng_msg_free(nng_msg *msg);
@@ -278,7 +278,7 @@ indicating that insufficient memory is available to allocate a new message.

int nng_msg_dup(nng_msg **dup, nng_msg *msg);
 

The nng_msg_dup function duplicates the message msg, storing a pointer -to the new duplicate in dup. This function also returns zero on success, or NNG_ENOMEM +to the new duplicate in dup. This function also returns zero on success, or NNG_ENOMEM if memory is exhausted.

Message Size and Capacity

size_t nng_msg_capacity(nng_msg *msg);
@@ -311,7 +311,7 @@ If reallocation fails due to insufficient memory, then the original is left inta
 is at least capacity bytes. Use of this function to ensure the total anticipated
 capacity is present in the message may help prevent many small allocations.

Both nng_msg_realloc and nng_msg_reserve return zero on success, or may return -NNG_ENOMEM if insufficient memory exists to preform allocation.

+NNG_ENOMEM if insufficient memory exists to preform allocation.

@@ -418,7 +418,7 @@ int nng_msg_header_insert_u64(nng_msg *msg, uint64_t val64);

Appending data to a message header is done by using the nng_msg_header_append functions, and inserting data in the header is done using the nng_msg_header_insert functions.

-

These functions act just like the nng_msg_append and nng_msg_insert functions, +

These functions act just like the nng_msg_append and nng_msg_insert functions, except that they operate on the message header rather than the message body.

Consume from Header

int nng_msg_header_chop(nng_msg *msg, size_t size);
@@ -433,16 +433,16 @@ int nng_msg_header_trim_u64(nng_msg *msg, uint64_t *val64);
 

The nng_msg_header_trim functions remove data from the beginning of the message header, and the nng_msg_header_chop functions remove data from the end of the message header.

-

These functions act just like the nng_msg_trim and nng_msg_chop functions, +

These functions act just like the nng_msg_trim and nng_msg_chop functions, except that they operate the message header rather than the message body.

Message Pipe

nng_pipe nng_msg_get_pipe(nng_msg *msg);
 void nng_msg_get_pipe(nng_msg *msg, nng_pipe p);
 
-

The nng_msg_set_pipe function sets the pipe associated with msg to p. +

The nng_msg_set_pipe function sets the pipe associated with msg to p. This is most often useful when used with protocols that support directing a message to a specific peer. -For example the PAIR version 1 protocol can do +For example the PAIR version 1 protocol can do this when NNG_OPT_PAIR1_POLY mode is set.

The nng_msg_get_pipe function returns the pipe that was previously set on the message m, either directly by the application, or when the message was received by the protocol.

-- cgit v1.2.3-70-g09d2