@@ -45,7 +45,7 @@ void tx_refcount_free(void* const user, const size_t size, void* const payload)
4545// Shared deleter for captured TX frames.
4646constexpr udpard_deleter_vtable_t tx_refcount_deleter_vt{ .free = &tx_refcount_free };
4747
48- bool capture_tx_frame (udpard_tx_t * const tx, udpard_tx_ejection_t * const ejection)
48+ bool capture_tx_frame_impl (udpard_tx_t * const tx, udpard_tx_ejection_t * const ejection)
4949{
5050 auto * frames = static_cast <std::vector<CapturedFrame>*>(tx->user );
5151 if (frames == nullptr ) {
@@ -58,6 +58,16 @@ bool capture_tx_frame(udpard_tx_t* const tx, udpard_tx_ejection_t* const ejectio
5858 return true ;
5959}
6060
61+ bool capture_tx_frame_subject (udpard_tx_t * const tx, udpard_tx_ejection_t * const ejection)
62+ {
63+ return capture_tx_frame_impl (tx, ejection);
64+ }
65+
66+ bool capture_tx_frame_p2p (udpard_tx_t * const tx, udpard_tx_ejection_t * const ejection, udpard_udpip_ep_t /* dest*/ )
67+ {
68+ return capture_tx_frame_impl (tx, ejection);
69+ }
70+
6171void drop_frame (const CapturedFrame& frame)
6272{
6373 udpard_tx_refcount_dec (udpard_bytes_t { .size = frame.datagram .size , .data = frame.datagram .data });
@@ -70,7 +80,8 @@ void fill_random(std::vector<uint8_t>& data)
7080 }
7181}
7282
73- constexpr udpard_tx_vtable_t tx_vtable{ .eject = &capture_tx_frame };
83+ constexpr udpard_tx_vtable_t tx_vtable{ .eject_subject = &capture_tx_frame_subject,
84+ .eject_p2p = &capture_tx_frame_p2p };
7485
7586// Feedback callback records completion.
7687void record_feedback (udpard_tx_t *, const udpard_tx_feedback_t fb)
@@ -203,12 +214,6 @@ void test_reliable_delivery_under_losses()
203214 udpard_udpip_ep_t { .ip = 0x0A000011U , .port = 7601U },
204215 udpard_udpip_ep_t { .ip = 0x0A000012U , .port = 7602U },
205216 };
206- const std::array<udpard_udpip_ep_t , UDPARD_IFACE_COUNT_MAX> topic_multicast{
207- udpard_make_subject_endpoint (111U ),
208- udpard_udpip_ep_t { .ip = 0x0A00000BU , .port = 7501U },
209- udpard_udpip_ep_t { .ip = 0x0A00000CU , .port = 7502U },
210- };
211-
212217 // Payload and context.
213218 std::vector<uint8_t > payload (4096 );
214219 fill_random (payload);
@@ -219,21 +224,21 @@ void test_reliable_delivery_under_losses()
219224 sub_rx.user = &ctx;
220225
221226 // Reliable transfer with staged losses.
222- FeedbackState fb{};
223- const udpard_bytes_scattered_t payload_view = make_scattered (payload.data (), payload.size ());
224- std::array< udpard_udpip_ep_t , UDPARD_IFACE_COUNT_MAX> dest_per_iface = topic_multicast ;
225- pub_tx.mtu [0 ] = 600 ;
226- pub_tx.mtu [1 ] = 900 ;
227- pub_tx. mtu [ 2 ] = 500 ;
228- const udpard_us_t start = 0 ;
229- const udpard_us_t deadline = start + 200000 ;
227+ FeedbackState fb{};
228+ const udpard_bytes_scattered_t payload_view = make_scattered (payload.data (), payload.size ());
229+ pub_tx. mtu [ 0 ] = 600 ;
230+ pub_tx.mtu [1 ] = 900 ;
231+ pub_tx.mtu [2 ] = 500 ;
232+ const udpard_us_t start = 0 ;
233+ const udpard_us_t deadline = start + 200000 ;
234+ const uint16_t iface_bitmap_all = UDPARD_IFACE_BITMAP_ALL ;
230235 const udpard_deleter_t tx_payload_deleter{ .vtable = &tx_refcount_deleter_vt, .context = nullptr };
231236 TEST_ASSERT_TRUE (udpard_tx_push (&pub_tx,
232237 start,
233238 deadline,
239+ iface_bitmap_all,
234240 udpard_prio_fast,
235241 topic_hash,
236- dest_per_iface.data (),
237242 1U ,
238243 payload_view,
239244 &record_feedback,
@@ -341,14 +346,14 @@ void test_reliable_stats_and_failures()
341346 TEST_ASSERT_TRUE (udpard_tx_new (&exp_tx, 0x9999000011112222ULL , 2U , 4 , exp_mem, &tx_vtable));
342347 exp_tx.user = &exp_frames;
343348 FeedbackState fb_fail{};
344- const udpard_udpip_ep_t exp_dest[UDPARD_IFACE_COUNT_MAX] = { udpard_make_subject_endpoint ( 99U ), {}, {} } ;
345- const udpard_bytes_scattered_t exp_payload = make_scattered (" ping" , 4 );
349+ const uint16_t iface_bitmap_1 = ( 1U << 0U ) ;
350+ const udpard_bytes_scattered_t exp_payload = make_scattered (" ping" , 4 );
346351 TEST_ASSERT_TRUE (udpard_tx_push (&exp_tx,
347352 0 ,
348353 10 ,
354+ iface_bitmap_1,
349355 udpard_prio_fast,
350356 0xABCULL ,
351- exp_dest,
352357 5U ,
353358 exp_payload,
354359 &record_feedback,
@@ -400,15 +405,14 @@ void test_reliable_stats_and_failures()
400405 TEST_ASSERT_TRUE (
401406 udpard_rx_port_new (&port, 0x12340000ULL , 64 , UDPARD_RX_REORDERING_WINDOW_UNORDERED, rx_mem, &callbacks));
402407
403- const udpard_udpip_ep_t src_dest[UDPARD_IFACE_COUNT_MAX] = { udpard_make_subject_endpoint (12U ), {}, {} };
404408 const udpard_bytes_scattered_t src_payload = make_scattered (ctx.expected .data (), ctx.expected .size ());
405409 FeedbackState fb_ignore{};
406410 TEST_ASSERT_TRUE (udpard_tx_push (&src_tx,
407411 0 ,
408412 1000 ,
413+ iface_bitmap_1,
409414 udpard_prio_fast,
410415 port.topic_hash ,
411- src_dest,
412416 7U ,
413417 src_payload,
414418 &record_feedback,
0 commit comments