@@ -478,12 +478,10 @@ uint32_t udpard_tx_p2p(udpard_tx_t* const self,
478478/// The returned item (if any) is guaranteed to be non-expired (deadline>=now).
479479udpard_tx_item_t * udpard_tx_peek (udpard_tx_t * const self , const udpard_us_t now );
480480
481- /// Transfers the ownership of the specified item to the application. The item does not necessarily need to be the
482- /// top one -- it is safe to dequeue any item. The item is dequeued but not invalidated; it is the responsibility of
483- /// the application to deallocate its memory later.
484- /// The memory SHALL NOT be deallocated UNTIL this function is invoked (use udpard_tx_free()).
481+ /// Transfers the ownership of the specified item to the application. The item does not have to be the top one.
482+ /// The item is dequeued but not invalidated; the application must deallocate its memory later; see udpard_tx_free().
483+ /// The memory SHALL NOT be deallocated UNTIL this function is invoked.
485484/// If any of the arguments are NULL, the function has no effect.
486- /// This function does not invoke the dynamic memory manager.
487485void udpard_tx_pop (udpard_tx_t * const self , udpard_tx_item_t * const item );
488486
489487/// This is a simple helper that frees the memory allocated for the item and its payload.
@@ -516,7 +514,7 @@ typedef struct udpard_rx_memory_resources_t
516514/// -----------------------------------------−-------------------------------------------------------------------------
517515/// ORDERED Strictly increasing transfer-ID May delay transfers Non-negative number of microseconds
518516/// UNORDERED Unique transfer-ID Ordering not guaranteed UDPARD_REORDERING_WINDOW_UNORDERED
519- /// STATELESS Constant time, constant memory Single -frame only, duplicates UDPARD_REORDERING_WINDOW_STATELESS
517+ /// STATELESS Constant time, constant memory 1 -frame only, dups, no responses UDPARD_REORDERING_WINDOW_STATELESS
520518///
521519/// If not sure, choose the ORDERED mode with a ~5 ms reordering window for all topics except for request-response
522520/// RPC-style, in which case choose UNORDERED. The STATELESS mode is chiefly intended just for the heartbeat topic.
@@ -616,6 +614,9 @@ typedef struct udpard_rx_port_t
616614 /// which is easy to implement since each port gets a dedicated set of memory resources.
617615 udpard_tree_t * index_session_by_remote_uid ;
618616
617+ /// Opaque pointer for the application use only. Not accessed by the library.
618+ void * user ;
619+
619620 /// Do not access. This is used to prevent accidental reentry from within the callbacks.
620621 bool invoked ;
621622} udpard_rx_port_t ;
@@ -705,11 +706,10 @@ typedef struct udpard_rx_t
705706
706707/// The extent of the P2P port is set to SIZE_MAX by default (no truncation at all).
707708/// The application can alter it via udpard_rx_t::p2p_port.extent at any moment if needed; it takes effect immediately
708- /// but may in some cases cause in-progress transfers to be lost if increased mid-transfer.
709- ///
710- /// To free a udpard_rx_t instance, the application must simply free all its ports using udpard_rx_port_free().
711- /// The RX instance will be safe to discard afterward.
712- ///
709+ /// but may in some cases cause in-progress transfers to be lost if increased mid-transfer,
710+ /// so it is best to do it once after initialization.
711+ /// The application does not need to initialize the P2P port itself; it is initialized automatically.
712+ /// The application must push the datagrams arriving to its P2P sockets into this port using udpard_rx_port_push().
713713/// True on success, false if any of the arguments are invalid.
714714bool udpard_rx_new (udpard_rx_t * const self ,
715715 const uint64_t local_uid ,
@@ -718,6 +718,13 @@ bool udpard_rx_new(udpard_rx_t* const self,
718718 const udpard_rx_on_collision_t on_collision ,
719719 const udpard_rx_on_ack_mandate_t on_ack_mandate );
720720
721+ /// Returns all memory allocated for the entire RX stack, including all ports, sessions, slots, fragments, etc.
722+ /// It is safe to invoke this at any time, but the instance and its ports shall not be used again unless
723+ /// re-initialized. Only memory that is allocated by the library is returned; the ports and the RX instance
724+ /// themselves are not freed.
725+ /// The function has no effect if the argument is NULL.
726+ void udpard_rx_free (udpard_rx_t * const self );
727+
721728/// Must be invoked at least every few milliseconds (more often is fine) to purge timed-out sessions and eject
722729/// received transfers when the reordering window expires. If this is invoked simultaneously with rx subscription
723730/// reception, then this function should ideally be invoked after the reception handling.
0 commit comments