l2udptest_client: fix compilation
This commit is contained in:
parent
f51b1da9d5
commit
774f5c0420
|
@ -120,9 +120,10 @@ static result_t transmit(const uint8_t *data, size_t len)
|
|||
}
|
||||
|
||||
|
||||
void rx_data_to_tun(struct connection_ctx_s *conn, const uint8_t *data, size_t len)
|
||||
void rx_data_to_tun(struct connection_ctx_s *conn, const uint8_t *data, size_t len, void *user_ctx)
|
||||
{
|
||||
(void)conn;
|
||||
(void)user_ctx;
|
||||
|
||||
int ret = write(m_tunfd, data, len);
|
||||
if(ret < 0) {
|
||||
|
@ -130,6 +131,13 @@ void rx_data_to_tun(struct connection_ctx_s *conn, const uint8_t *data, size_t l
|
|||
}
|
||||
}
|
||||
|
||||
void conn_evt_cb(struct connection_ctx_s *conn, connection_evt_t evt, void *user_ctx)
|
||||
{
|
||||
(void)conn;
|
||||
(void)evt;
|
||||
(void)user_ctx;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
@ -157,7 +165,7 @@ int main(int argc, char **argv)
|
|||
ham64_t my_address, peer_address;
|
||||
ham64_encode(MY_CALL, &my_address);
|
||||
ham64_encode(PEER_CALL, &peer_address);
|
||||
RESULT_CHECK(connection_init(&l2conn, &my_address, &peer_address, rx_data_to_tun));
|
||||
RESULT_CHECK(connection_init(&l2conn, &my_address, &peer_address, rx_data_to_tun, conn_evt_cb, NULL));
|
||||
|
||||
// force connection into the established state
|
||||
l2conn.conn_state = CONN_STATE_ESTABLISHED;
|
||||
|
@ -268,10 +276,10 @@ int main(int argc, char **argv)
|
|||
while(true) {
|
||||
uint8_t packet_buf[2048];
|
||||
size_t packet_size;
|
||||
bool end_burst;
|
||||
|
||||
packet_size = connection_encode_next_packet(&l2conn,
|
||||
connection_get_next_expected_seq(&l2conn),
|
||||
packet_buf, sizeof(packet_buf));
|
||||
packet_buf, sizeof(packet_buf), &end_burst);
|
||||
|
||||
if(packet_size == 0) {
|
||||
// no more packets available
|
||||
|
@ -283,6 +291,11 @@ int main(int argc, char **argv)
|
|||
|
||||
burst_len++;
|
||||
RESULT_CHECK(transmit(packet_buf, packet_size));
|
||||
|
||||
if(end_burst) {
|
||||
LOG(LVL_DEBUG, "Ending burst on request.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
connection_tx_clean_empty_packet(&l2conn);
|
||||
|
@ -298,8 +311,6 @@ int main(int argc, char **argv)
|
|||
LOG(LVL_INFO, "TX -> RX");
|
||||
on_air = false;
|
||||
|
||||
retransmit_time = get_hires_time() + HRTIME_SEC(1) + HRTIME_SEC(1.0 * rand() / RAND_MAX);
|
||||
|
||||
block_tx_for(TX_SWITCH_BACKOFF_AFTER_RX_ON);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue