osmux: Replace deprecated osmux_xfrm_input_* APIs in examples & tests
Change-Id: I7f3f8d40f89ffdd135a73316ee60fd429ba2a5b0
This commit is contained in:
parent
36ca79e708
commit
6fe1f35001
|
@ -83,11 +83,7 @@ static void osmux_deliver(struct msgb *batch_msg, void *data)
|
||||||
* This is the input handle for osmux. It stores the last osmux sequence that
|
* This is the input handle for osmux. It stores the last osmux sequence that
|
||||||
* has been used and the deliver function that sends the osmux batch.
|
* has been used and the deliver function that sends the osmux batch.
|
||||||
*/
|
*/
|
||||||
struct osmux_in_handle h_input = {
|
struct osmux_in_handle *h_input;
|
||||||
.osmux_seq = 0, /* sequence number to start OSmux message from */
|
|
||||||
.batch_factor = 4, /* batch up to 4 RTP messages */
|
|
||||||
.deliver = osmux_deliver,
|
|
||||||
};
|
|
||||||
|
|
||||||
#define MAX_CONCURRENT_CALLS 8
|
#define MAX_CONCURRENT_CALLS 8
|
||||||
|
|
||||||
|
@ -165,9 +161,9 @@ int read_cb(struct osmo_dgram *conn)
|
||||||
if (ccid < 0)
|
if (ccid < 0)
|
||||||
register_ccid(rtph->ssrc);
|
register_ccid(rtph->ssrc);
|
||||||
|
|
||||||
while ((ret = osmux_xfrm_input(&h_input, msg, ccid)) > 0) {
|
while ((ret = osmux_xfrm_input(h_input, msg, ccid)) > 0) {
|
||||||
/* batch full, deliver it */
|
/* batch full, deliver it */
|
||||||
osmux_xfrm_input_deliver(&h_input);
|
osmux_xfrm_input_deliver(h_input);
|
||||||
}
|
}
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
printf("something is wrong\n");
|
printf("something is wrong\n");
|
||||||
|
@ -217,7 +213,10 @@ int main(int argc, char *argv[])
|
||||||
/*
|
/*
|
||||||
* initialize OSMUX handlers.
|
* initialize OSMUX handlers.
|
||||||
*/
|
*/
|
||||||
osmux_xfrm_input_init(&h_input);
|
h_input = osmux_xfrm_input_alloc(tall_test);
|
||||||
|
osmux_xfrm_input_set_initial_seqnum(h_input, 0);
|
||||||
|
osmux_xfrm_input_set_batch_factor(h_input, 4);
|
||||||
|
osmux_xfrm_input_set_deliver_cb(h_input, osmux_deliver, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* initialize datagram server.
|
* initialize datagram server.
|
||||||
|
|
|
@ -65,11 +65,7 @@ static void deliver(struct msgb *batch_msg)
|
||||||
* This is the input handle for osmux. It stores the last osmux sequence that
|
* This is the input handle for osmux. It stores the last osmux sequence that
|
||||||
* has been used and the deliver function that sends the osmux batch.
|
* has been used and the deliver function that sends the osmux batch.
|
||||||
*/
|
*/
|
||||||
struct osmux_in_handle h_input = {
|
struct osmux_in_handle *h_input;
|
||||||
.osmux_seq = 0, /* sequence number to start OSmux message from */
|
|
||||||
.batch_factor = 4, /* batch up to 4 RTP messages */
|
|
||||||
.deliver = deliver,
|
|
||||||
};
|
|
||||||
|
|
||||||
#define MAX_CONCURRENT_CALLS 8
|
#define MAX_CONCURRENT_CALLS 8
|
||||||
|
|
||||||
|
@ -124,9 +120,9 @@ static int pcap_test_run(struct msgb *msg)
|
||||||
if (ccid < 0)
|
if (ccid < 0)
|
||||||
register_ccid(rtph->ssrc);
|
register_ccid(rtph->ssrc);
|
||||||
|
|
||||||
while ((ret = osmux_xfrm_input(&h_input, msg, ccid)) > 0) {
|
while ((ret = osmux_xfrm_input(h_input, msg, ccid)) > 0) {
|
||||||
/* batch full, deliver it */
|
/* batch full, deliver it */
|
||||||
osmux_xfrm_input_deliver(&h_input);
|
osmux_xfrm_input_deliver(h_input);
|
||||||
}
|
}
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
printf("something is wrong\n");
|
printf("something is wrong\n");
|
||||||
|
@ -189,7 +185,10 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
osmo_pcap.timer.cb = osmo_pcap_pkt_timer_cb;
|
osmo_pcap.timer.cb = osmo_pcap_pkt_timer_cb;
|
||||||
|
|
||||||
osmux_xfrm_input_init(&h_input);
|
h_input = osmux_xfrm_input_alloc(tall_test);
|
||||||
|
osmux_xfrm_input_set_initial_seqnum(h_input, 0);
|
||||||
|
osmux_xfrm_input_set_batch_factor(h_input, 4);
|
||||||
|
osmux_xfrm_input_set_deliver_cb(h_input, deliver, NULL);
|
||||||
|
|
||||||
h_output = osmux_xfrm_output_alloc(tall_test);
|
h_output = osmux_xfrm_output_alloc(tall_test);
|
||||||
osmux_xfrm_output_set_rtp_ssrc(h_output, 0);
|
osmux_xfrm_output_set_rtp_ssrc(h_output, 0);
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
static uint16_t rtp_next_seq;
|
static uint16_t rtp_next_seq;
|
||||||
static uint16_t rtp_next_ts;
|
static uint16_t rtp_next_ts;
|
||||||
|
|
||||||
|
void *tall_ctx;
|
||||||
|
|
||||||
#define TIME_RTP_PKT_MS 20
|
#define TIME_RTP_PKT_MS 20
|
||||||
#define BATCH_FACTOR 6
|
#define BATCH_FACTOR 6
|
||||||
/* ----------------------------- */
|
/* ----------------------------- */
|
||||||
|
@ -194,6 +196,7 @@ static void test_amr_ft_change_middle_batch(void)
|
||||||
int rc;
|
int rc;
|
||||||
const uint8_t cid = 30;
|
const uint8_t cid = 30;
|
||||||
bool osmux_transmitted = false;
|
bool osmux_transmitted = false;
|
||||||
|
struct osmux_in_handle *h_input;
|
||||||
|
|
||||||
printf("===%s===\n", __func__);
|
printf("===%s===\n", __func__);
|
||||||
|
|
||||||
|
@ -202,27 +205,25 @@ static void test_amr_ft_change_middle_batch(void)
|
||||||
clock_override_set(0, 0);
|
clock_override_set(0, 0);
|
||||||
rtp_init(0, 0);
|
rtp_init(0, 0);
|
||||||
|
|
||||||
struct osmux_in_handle h_input = {
|
h_input = osmux_xfrm_input_alloc(tall_ctx);
|
||||||
.osmux_seq = 0, /* sequence number to start OSmux message from */
|
osmux_xfrm_input_set_initial_seqnum(h_input, 0);
|
||||||
.batch_factor = 4, /* batch up to 4 RTP messages */
|
osmux_xfrm_input_set_batch_factor(h_input, 4);
|
||||||
.deliver = test_amr_ft_change_middle_batch_osmux_deliver_cb,
|
osmux_xfrm_input_set_deliver_cb(h_input,
|
||||||
.data = &osmux_transmitted,
|
test_amr_ft_change_middle_batch_osmux_deliver_cb,
|
||||||
};
|
&osmux_transmitted);
|
||||||
|
osmux_xfrm_input_open_circuit(h_input, cid, false);
|
||||||
osmux_xfrm_input_init(&h_input);
|
|
||||||
osmux_xfrm_input_open_circuit(&h_input, cid, false);
|
|
||||||
|
|
||||||
/* First RTP frame at t=0 */
|
/* First RTP frame at t=0 */
|
||||||
msg = rtp_next();
|
msg = rtp_next();
|
||||||
rtp_append_amr(msg, AMR_FT_2);
|
rtp_append_amr(msg, AMR_FT_2);
|
||||||
rc = osmux_xfrm_input(&h_input, msg, cid);
|
rc = osmux_xfrm_input(h_input, msg, cid);
|
||||||
OSMO_ASSERT(rc == 0);
|
OSMO_ASSERT(rc == 0);
|
||||||
|
|
||||||
/* Second RTP frame at t=20 */
|
/* Second RTP frame at t=20 */
|
||||||
clock_override_add(0, TIME_RTP_PKT_MS*1000);
|
clock_override_add(0, TIME_RTP_PKT_MS*1000);
|
||||||
msg = rtp_next();
|
msg = rtp_next();
|
||||||
rtp_append_amr(msg, AMR_FT_2);
|
rtp_append_amr(msg, AMR_FT_2);
|
||||||
rc = osmux_xfrm_input(&h_input, msg, cid);
|
rc = osmux_xfrm_input(h_input, msg, cid);
|
||||||
OSMO_ASSERT(rc == 0);
|
OSMO_ASSERT(rc == 0);
|
||||||
|
|
||||||
/* Third RTP frame at t=40, AMR FT changes: */
|
/* Third RTP frame at t=40, AMR FT changes: */
|
||||||
|
@ -230,7 +231,7 @@ static void test_amr_ft_change_middle_batch(void)
|
||||||
clock_override_add(0, TIME_RTP_PKT_MS*1000);
|
clock_override_add(0, TIME_RTP_PKT_MS*1000);
|
||||||
msg = rtp_next();
|
msg = rtp_next();
|
||||||
rtp_append_amr(msg, AMR_FT_6);
|
rtp_append_amr(msg, AMR_FT_6);
|
||||||
rc = osmux_xfrm_input(&h_input, msg, cid);
|
rc = osmux_xfrm_input(h_input, msg, cid);
|
||||||
OSMO_ASSERT(rc == 0);
|
OSMO_ASSERT(rc == 0);
|
||||||
|
|
||||||
/* Forth RTP frame at t=60, AMR FT changes again: */
|
/* Forth RTP frame at t=60, AMR FT changes again: */
|
||||||
|
@ -238,7 +239,7 @@ static void test_amr_ft_change_middle_batch(void)
|
||||||
clock_override_add(0, TIME_RTP_PKT_MS*1000);
|
clock_override_add(0, TIME_RTP_PKT_MS*1000);
|
||||||
msg = rtp_next();
|
msg = rtp_next();
|
||||||
rtp_append_amr(msg, AMR_FT_1);
|
rtp_append_amr(msg, AMR_FT_1);
|
||||||
rc = osmux_xfrm_input(&h_input, msg, cid);
|
rc = osmux_xfrm_input(h_input, msg, cid);
|
||||||
OSMO_ASSERT(rc == 0);
|
OSMO_ASSERT(rc == 0);
|
||||||
|
|
||||||
/* t=80, osmux batch is scheduled to be transmitted: */
|
/* t=80, osmux batch is scheduled to be transmitted: */
|
||||||
|
@ -248,8 +249,8 @@ static void test_amr_ft_change_middle_batch(void)
|
||||||
OSMO_ASSERT(osmux_transmitted == true);
|
OSMO_ASSERT(osmux_transmitted == true);
|
||||||
|
|
||||||
clock_debug("Closing circuit");
|
clock_debug("Closing circuit");
|
||||||
osmux_xfrm_input_close_circuit(&h_input, cid);
|
osmux_xfrm_input_close_circuit(h_input, cid);
|
||||||
osmux_xfrm_input_fini(&h_input);
|
talloc_free(h_input);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_last_amr_cmr_f_q_used_osmux_deliver_cb(struct msgb *batch_msg, void *data)
|
static void test_last_amr_cmr_f_q_used_osmux_deliver_cb(struct msgb *batch_msg, void *data)
|
||||||
|
@ -285,6 +286,7 @@ static void test_last_amr_cmr_f_q_used(void)
|
||||||
const uint8_t cid = 32;
|
const uint8_t cid = 32;
|
||||||
bool osmux_transmitted = false;
|
bool osmux_transmitted = false;
|
||||||
struct amr_hdr *amrh;
|
struct amr_hdr *amrh;
|
||||||
|
struct osmux_in_handle *h_input;
|
||||||
|
|
||||||
printf("===%s===\n", __func__);
|
printf("===%s===\n", __func__);
|
||||||
|
|
||||||
|
@ -294,15 +296,13 @@ static void test_last_amr_cmr_f_q_used(void)
|
||||||
clock_override_set(0, 0);
|
clock_override_set(0, 0);
|
||||||
rtp_init(0, 0);
|
rtp_init(0, 0);
|
||||||
|
|
||||||
struct osmux_in_handle h_input = {
|
h_input = osmux_xfrm_input_alloc(tall_ctx);
|
||||||
.osmux_seq = 0, /* sequence number to start OSmux message from */
|
osmux_xfrm_input_set_initial_seqnum(h_input, 0);
|
||||||
.batch_factor = 3, /* batch up to 3 RTP messages */
|
osmux_xfrm_input_set_batch_factor(h_input, 3);
|
||||||
.deliver = test_last_amr_cmr_f_q_used_osmux_deliver_cb,
|
osmux_xfrm_input_set_deliver_cb(h_input,
|
||||||
.data = &osmux_transmitted,
|
test_last_amr_cmr_f_q_used_osmux_deliver_cb,
|
||||||
};
|
&osmux_transmitted);
|
||||||
|
osmux_xfrm_input_open_circuit(h_input, cid, false);
|
||||||
osmux_xfrm_input_init(&h_input);
|
|
||||||
osmux_xfrm_input_open_circuit(&h_input, cid, false);
|
|
||||||
|
|
||||||
/* First RTP frame at t=0 */
|
/* First RTP frame at t=0 */
|
||||||
msg = rtp_next();
|
msg = rtp_next();
|
||||||
|
@ -310,7 +310,7 @@ static void test_last_amr_cmr_f_q_used(void)
|
||||||
amrh->f = 1;
|
amrh->f = 1;
|
||||||
amrh->q = 1;
|
amrh->q = 1;
|
||||||
amrh->cmr = 0;
|
amrh->cmr = 0;
|
||||||
rc = osmux_xfrm_input(&h_input, msg, cid);
|
rc = osmux_xfrm_input(h_input, msg, cid);
|
||||||
OSMO_ASSERT(rc == 0);
|
OSMO_ASSERT(rc == 0);
|
||||||
|
|
||||||
/* Second RTP frame at t=20, CMR changes 0->1 */
|
/* Second RTP frame at t=20, CMR changes 0->1 */
|
||||||
|
@ -321,7 +321,7 @@ static void test_last_amr_cmr_f_q_used(void)
|
||||||
amrh->f = 1;
|
amrh->f = 1;
|
||||||
amrh->q = 1;
|
amrh->q = 1;
|
||||||
amrh->cmr = 1;
|
amrh->cmr = 1;
|
||||||
rc = osmux_xfrm_input(&h_input, msg, cid);
|
rc = osmux_xfrm_input(h_input, msg, cid);
|
||||||
OSMO_ASSERT(rc == 0);
|
OSMO_ASSERT(rc == 0);
|
||||||
|
|
||||||
/* Third RTP frame at t=40, q changes 1->0, CMR changes 1->2: */
|
/* Third RTP frame at t=40, q changes 1->0, CMR changes 1->2: */
|
||||||
|
@ -332,7 +332,7 @@ static void test_last_amr_cmr_f_q_used(void)
|
||||||
amrh->f = 0;
|
amrh->f = 0;
|
||||||
amrh->q = 0;
|
amrh->q = 0;
|
||||||
amrh->cmr = 2;
|
amrh->cmr = 2;
|
||||||
rc = osmux_xfrm_input(&h_input, msg, cid);
|
rc = osmux_xfrm_input(h_input, msg, cid);
|
||||||
OSMO_ASSERT(rc == 0);
|
OSMO_ASSERT(rc == 0);
|
||||||
|
|
||||||
/* t=60, osmux batch is scheduled to be transmitted: */
|
/* t=60, osmux batch is scheduled to be transmitted: */
|
||||||
|
@ -342,8 +342,8 @@ static void test_last_amr_cmr_f_q_used(void)
|
||||||
OSMO_ASSERT(osmux_transmitted == true);
|
OSMO_ASSERT(osmux_transmitted == true);
|
||||||
|
|
||||||
clock_debug("Closing circuit");
|
clock_debug("Closing circuit");
|
||||||
osmux_xfrm_input_close_circuit(&h_input, cid);
|
osmux_xfrm_input_close_circuit(h_input, cid);
|
||||||
osmux_xfrm_input_fini(&h_input);
|
talloc_free(h_input);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_initial_osmux_seqnum_osmux_deliver_cb(struct msgb *batch_msg, void *data)
|
static void test_initial_osmux_seqnum_osmux_deliver_cb(struct msgb *batch_msg, void *data)
|
||||||
|
@ -375,6 +375,7 @@ static void test_initial_osmux_seqnum(void)
|
||||||
const uint8_t cid = 33;
|
const uint8_t cid = 33;
|
||||||
bool osmux_transmitted = false;
|
bool osmux_transmitted = false;
|
||||||
struct amr_hdr *amrh;
|
struct amr_hdr *amrh;
|
||||||
|
struct osmux_in_handle *h_input;
|
||||||
|
|
||||||
printf("===%s===\n", __func__);
|
printf("===%s===\n", __func__);
|
||||||
|
|
||||||
|
@ -384,15 +385,13 @@ static void test_initial_osmux_seqnum(void)
|
||||||
clock_override_set(0, 0);
|
clock_override_set(0, 0);
|
||||||
rtp_init(0, 0);
|
rtp_init(0, 0);
|
||||||
|
|
||||||
struct osmux_in_handle h_input = {
|
h_input = osmux_xfrm_input_alloc(tall_ctx);
|
||||||
.osmux_seq = 123, /* sequence number to start OSmux message from */
|
osmux_xfrm_input_set_initial_seqnum(h_input, 123);
|
||||||
.batch_factor = 1, /* batch up to 1 RTP messages */
|
osmux_xfrm_input_set_batch_factor(h_input, 1);
|
||||||
.deliver = test_initial_osmux_seqnum_osmux_deliver_cb,
|
osmux_xfrm_input_set_deliver_cb(h_input,
|
||||||
.data = &osmux_transmitted,
|
test_initial_osmux_seqnum_osmux_deliver_cb,
|
||||||
};
|
&osmux_transmitted);
|
||||||
|
osmux_xfrm_input_open_circuit(h_input, cid, false);
|
||||||
osmux_xfrm_input_init(&h_input);
|
|
||||||
osmux_xfrm_input_open_circuit(&h_input, cid, false);
|
|
||||||
|
|
||||||
/* First RTP frame at t=0 */
|
/* First RTP frame at t=0 */
|
||||||
msg = rtp_next();
|
msg = rtp_next();
|
||||||
|
@ -400,7 +399,7 @@ static void test_initial_osmux_seqnum(void)
|
||||||
amrh->f = 1;
|
amrh->f = 1;
|
||||||
amrh->q = 1;
|
amrh->q = 1;
|
||||||
amrh->cmr = 0;
|
amrh->cmr = 0;
|
||||||
rc = osmux_xfrm_input(&h_input, msg, cid);
|
rc = osmux_xfrm_input(h_input, msg, cid);
|
||||||
OSMO_ASSERT(rc == 0);
|
OSMO_ASSERT(rc == 0);
|
||||||
|
|
||||||
/* t=20, osmux batch is scheduled to be transmitted: */
|
/* t=20, osmux batch is scheduled to be transmitted: */
|
||||||
|
@ -410,8 +409,8 @@ static void test_initial_osmux_seqnum(void)
|
||||||
OSMO_ASSERT(osmux_transmitted == true);
|
OSMO_ASSERT(osmux_transmitted == true);
|
||||||
|
|
||||||
clock_debug("Closing circuit");
|
clock_debug("Closing circuit");
|
||||||
osmux_xfrm_input_close_circuit(&h_input, cid);
|
osmux_xfrm_input_close_circuit(h_input, cid);
|
||||||
osmux_xfrm_input_fini(&h_input);
|
talloc_free(h_input);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
@ -422,7 +421,7 @@ int main(int argc, char **argv)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *tall_ctx = talloc_named_const(NULL, 1, "Root context");
|
tall_ctx = talloc_named_const(NULL, 1, "Root context");
|
||||||
msgb_talloc_ctx_init(tall_ctx, 0);
|
msgb_talloc_ctx_init(tall_ctx, 0);
|
||||||
osmo_init_logging2(tall_ctx, &log_info);
|
osmo_init_logging2(tall_ctx, &log_info);
|
||||||
log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE);
|
log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE);
|
||||||
|
|
|
@ -120,11 +120,7 @@ static void osmux_deliver(struct msgb *batch_msg, void *data)
|
||||||
msgb_free(batch_msg);
|
msgb_free(batch_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct osmux_in_handle h_input = {
|
struct osmux_in_handle *h_input;
|
||||||
.osmux_seq = 0, /* sequence number to start OSmux message from */
|
|
||||||
.batch_factor = 4, /* batch up to 4 RTP messages */
|
|
||||||
.deliver = osmux_deliver,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void sigalarm_handler(int foo)
|
static void sigalarm_handler(int foo)
|
||||||
{
|
{
|
||||||
|
@ -161,8 +157,8 @@ static void osmux_test_marker(int num_ccid)
|
||||||
}
|
}
|
||||||
|
|
||||||
rtp_pkts++;
|
rtp_pkts++;
|
||||||
while (osmux_xfrm_input(&h_input, msg, j) > 0) {
|
while (osmux_xfrm_input(h_input, msg, j) > 0) {
|
||||||
osmux_xfrm_input_deliver(&h_input);
|
osmux_xfrm_input_deliver(h_input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clock_override_add(0, PKT_TIME_USEC);
|
clock_override_add(0, PKT_TIME_USEC);
|
||||||
|
@ -215,13 +211,13 @@ static void osmux_test_loop(int ccid)
|
||||||
* gaps between two messages to test the osmux replaying
|
* gaps between two messages to test the osmux replaying
|
||||||
* feature.
|
* feature.
|
||||||
*/
|
*/
|
||||||
osmux_xfrm_input(&h_input, msg, (i % 2) + ccid);
|
osmux_xfrm_input(h_input, msg, (i % 2) + ccid);
|
||||||
|
|
||||||
if (i % 4 == 0) {
|
if (i % 4 == 0) {
|
||||||
/* After four RTP messages, squash them into the OSMUX
|
/* After four RTP messages, squash them into the OSMUX
|
||||||
* batch and call the routine to deliver it.
|
* batch and call the routine to deliver it.
|
||||||
*/
|
*/
|
||||||
osmux_xfrm_input_deliver(&h_input);
|
osmux_xfrm_input_deliver(h_input);
|
||||||
|
|
||||||
/* The first two RTP message (one per circuit ID batch)
|
/* The first two RTP message (one per circuit ID batch)
|
||||||
* are delivered immediately, wait until the three RTP
|
* are delivered immediately, wait until the three RTP
|
||||||
|
@ -280,22 +276,29 @@ int main(void)
|
||||||
alarm(10);
|
alarm(10);
|
||||||
|
|
||||||
/* Check if marker bit features work correctly */
|
/* Check if marker bit features work correctly */
|
||||||
osmux_xfrm_input_init(&h_input);
|
h_input = osmux_xfrm_input_alloc(tall_ctx);
|
||||||
|
osmux_xfrm_input_set_initial_seqnum(h_input, 0);
|
||||||
|
osmux_xfrm_input_set_batch_factor(h_input, 4);
|
||||||
|
osmux_xfrm_input_set_deliver_cb(h_input, osmux_deliver, NULL);
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
osmux_xfrm_input_open_circuit(&h_input, i, 0);
|
osmux_xfrm_input_open_circuit(h_input, i, 0);
|
||||||
osmux_test_marker(4);
|
osmux_test_marker(4);
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
osmux_xfrm_input_close_circuit(&h_input, i);
|
osmux_xfrm_input_close_circuit(h_input, i);
|
||||||
osmux_xfrm_input_fini(&h_input);
|
TALLOC_FREE(h_input);
|
||||||
|
|
||||||
osmux_xfrm_input_init(&h_input);
|
h_input = osmux_xfrm_input_alloc(tall_ctx);
|
||||||
|
osmux_xfrm_input_set_initial_seqnum(h_input, 0);
|
||||||
|
osmux_xfrm_input_set_batch_factor(h_input, 4);
|
||||||
|
osmux_xfrm_input_set_deliver_cb(h_input, osmux_deliver, NULL);
|
||||||
|
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
osmux_xfrm_input_open_circuit(&h_input, i, 0);
|
osmux_xfrm_input_open_circuit(h_input, i, 0);
|
||||||
|
|
||||||
/* Add two circuits with dummy padding */
|
/* Add two circuits with dummy padding */
|
||||||
osmux_xfrm_input_open_circuit(&h_input, 2, 1);
|
osmux_xfrm_input_open_circuit(h_input, 2, 1);
|
||||||
osmux_xfrm_input_open_circuit(&h_input, 3, 1);
|
osmux_xfrm_input_open_circuit(h_input, 3, 1);
|
||||||
|
|
||||||
/* Wait 10 times to make sure dummy padding timer works fine */
|
/* Wait 10 times to make sure dummy padding timer works fine */
|
||||||
for (i = 0; i < 10; i++)
|
for (i = 0; i < 10; i++)
|
||||||
|
@ -309,16 +312,16 @@ int main(void)
|
||||||
osmux_test_loop(2);
|
osmux_test_loop(2);
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
osmux_xfrm_input_close_circuit(&h_input, i);
|
osmux_xfrm_input_close_circuit(h_input, i);
|
||||||
|
|
||||||
/* Reopen with two circuits and retest */
|
/* Reopen with two circuits and retest */
|
||||||
osmux_xfrm_input_open_circuit(&h_input, 0, 0);
|
osmux_xfrm_input_open_circuit(h_input, 0, 0);
|
||||||
osmux_xfrm_input_open_circuit(&h_input, 1, 1);
|
osmux_xfrm_input_open_circuit(h_input, 1, 1);
|
||||||
osmux_test_loop(0);
|
osmux_test_loop(0);
|
||||||
osmux_xfrm_input_close_circuit(&h_input, 0);
|
osmux_xfrm_input_close_circuit(h_input, 0);
|
||||||
osmux_xfrm_input_close_circuit(&h_input, 1);
|
osmux_xfrm_input_close_circuit(h_input, 1);
|
||||||
|
|
||||||
osmux_xfrm_input_fini(&h_input);
|
TALLOC_FREE(h_input);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(h_output); i++) {
|
for (i = 0; i < ARRAY_SIZE(h_output); i++) {
|
||||||
clock_debug("Flushing CID %u\n", i);
|
clock_debug("Flushing CID %u\n", i);
|
||||||
|
|
Loading…
Reference in New Issue