Skip to content

Commit ac8b38e

Browse files
docs
1 parent 3b4a1ed commit ac8b38e

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

libudpard/udpard.h

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ extern "C"
9191
/// uint64 transfer_id
9292
/// # Payload follows only for KIND_RESPONSE.
9393
///
94-
/// The extent of P2P ports must be at least this large to accommodate the header.
94+
/// The extent of P2P ports includes this header; udpard_rx_port_new_p2p adds it automatically.
9595
#define UDPARD_P2P_HEADER_BYTES 24U
9696

9797
/// Timestamps supplied by the application must be non-negative monotonically increasing counts of microseconds.
@@ -180,7 +180,7 @@ typedef struct udpard_remote_t
180180
udpard_udpip_ep_t endpoints[UDPARD_IFACE_COUNT_MAX]; ///< Zeros in unavailable ifaces.
181181
} udpard_remote_t;
182182

183-
/// Returns true if the given UDP/IP endpoint appears to be valid. Zero port or IP are considered invalid.
183+
/// Returns true if the given UDP/IP endpoint appears to be valid. Zero IP/port are considered invalid.
184184
bool udpard_is_valid_endpoint(const udpard_udpip_ep_t ep);
185185

186186
/// Returns the destination multicast UDP/IP endpoint for the given subject-ID.
@@ -439,11 +439,11 @@ bool udpard_tx_new(udpard_tx_t* const self,
439439
/// The user_transfer_reference is an opaque pointer that will be stored for each enqueued item of this transfer.
440440
/// The library itself does not use or check this value in any way, so it can be NULL if not needed.
441441
///
442-
/// The function returns the number of payload fragments enqueued, which is always a positive number, on success.
442+
/// The function returns the number of datagrams enqueued, which is always a positive number, on success.
443443
/// In case of failure, the function returns zero. Runtime failures increment the corresponding error counters,
444444
/// while invocations with invalid arguments just return zero without modifying the queue state.
445445
///
446-
/// The enqueued transfer will be emitted over all interfaces for which a valid (non-zero) remote endpoint is provided.
446+
/// The enqueued transfer will be emitted over all interfaces for which udpard_is_valid_endpoint(remote_ep[i]) is true.
447447
///
448448
/// An attempt to push a transfer with a (topic hash, transfer-ID) pair that is already enqueued will fail,
449449
/// as that violates the transfer-ID uniqueness requirement stated above.
@@ -500,7 +500,7 @@ void udpard_tx_poll(udpard_tx_t* const self, const udpard_us_t now, const uint32
500500
void udpard_tx_refcount_inc(const udpard_bytes_t tx_payload_view);
501501
void udpard_tx_refcount_dec(const udpard_bytes_t tx_payload_view);
502502

503-
/// Drops all enqueued items; afterward, the instance is safe to discard. Callbacks will not be invoked.
503+
/// Drops all enqueued items; afterward, the instance is safe to discard. Reliable transfer callbacks are still invoked.
504504
void udpard_tx_free(udpard_tx_t* const self);
505505

506506
// =====================================================================================================================
@@ -604,8 +604,8 @@ typedef struct udpard_rx_t
604604
uint64_t errors_frame_malformed; ///< A received frame was malformed and thus dropped.
605605
uint64_t errors_transfer_malformed; ///< A transfer could not be reassembled correctly.
606606

607-
/// Whenever an ack fails to transmit, the counter is incremented.
608-
/// The specific error can be determined by checking the specific counters in the corresponding tx instance.
607+
/// Incremented when an ack cannot be enqueued (including when tx is NULL).
608+
/// If tx is available, inspect its error counters for details.
609609
uint64_t errors_ack_tx;
610610

611611
/// The transmission pipeline is needed to manage ack transmission and removal of acknowledged transfers.
@@ -715,8 +715,8 @@ struct udpard_rx_transfer_t
715715
/// it is the sum of the sizes of all its fragments. For example, if the sender emitted a transfer of 2000
716716
/// bytes split into two frames, 1408 bytes in the first frame and 592 bytes in the second frame,
717717
/// then the payload_size_stored will be 2000 and the payload buffer will contain two fragments of 1408 and
718-
/// 592 bytes. If the received payload exceeds the configured extent, (some of) the excess payload may be
719-
/// discarded and the payload_size_stored will be set accordingly, but it may still exceed the extent somewhat.
718+
/// 592 bytes. If the received payload exceeds the configured extent, fragments starting past the extent are
719+
/// dropped but fragments crossing it are kept, so payload_size_stored may exceed the extent.
720720
///
721721
/// The application is given ownership of the payload buffer, so it is required to free it after use;
722722
/// this requires freeing both the handles and the payload buffers they point to.
@@ -726,9 +726,9 @@ struct udpard_rx_transfer_t
726726
/// If the payload is empty, the corresponding buffer pointers may be NULL.
727727
size_t payload_size_stored;
728728

729-
/// The original size of the transfer payload before extent-based truncation, in bytes.
730-
/// This value is provided for informational purposes only; the application should not attempt to access
731-
/// the excess payload as it has already been discarded. Cannot be less than payload_size_stored.
729+
/// The original size of the transfer payload before extent-based dropping, in bytes.
730+
/// This may exceed the stored payload if fragments beyond the extent were skipped. Cannot be less than
731+
/// payload_size_stored.
732732
size_t payload_size_wire;
733733

734734
/// The payload is stored in a tree of fragments ordered by their offset within the payload.
@@ -786,8 +786,9 @@ void udpard_rx_poll(udpard_rx_t* const self, const udpard_us_t now);
786786
///
787787
/// The extent defines the maximum possible size of received objects, considering also possible future data type
788788
/// versions with new fields. It is safe to pick larger values. Note well that the extent is not the same thing as
789-
/// the maximum size of the object, it is usually larger! Transfers that carry payloads that exceed the specified
790-
/// extent will be accepted anyway but the excess payload will be truncated away, as mandated by the Specification.
789+
/// the maximum size of the object, it is usually larger! Transfers that carry payloads beyond the specified extent
790+
/// still keep fragments that start before the extent, so the delivered payload may exceed it; fragments starting past
791+
/// the limit are dropped.
791792
///
792793
/// The topic hash is needed to detect and ignore transfers that use different topics on the same subject-ID.
793794
/// The collision callback is invoked if a topic hash collision is detected.
@@ -841,7 +842,7 @@ void udpard_rx_port_free(udpard_rx_t* const rx, udpard_rx_port_t* const port);
841842
/// and k is the number of fragments retained in memory for the corresponding in-progress transfer.
842843
/// No data copying takes place.
843844
///
844-
/// Returns true on successful processing, false if any of the arguments are invalid.
845+
/// Returns false if any of the arguments are invalid.
845846
bool udpard_rx_port_push(udpard_rx_t* const rx,
846847
udpard_rx_port_t* const port,
847848
const udpard_us_t timestamp,

0 commit comments

Comments
 (0)