Implement patty_ax25_sock_flow_left()

Implement patty_ax25_sock_flow_left() as a means to determine how many
I frames a peer may receive; this can be used to determine when to set
the P/F bit of outgoing I frames to implicitly require an RR or RNR
acknowledgement
This commit is contained in:
XANTRONIX Development 2020-08-23 00:26:17 -05:00 committed by XANTRONIX Industrial
parent df9efb8b3a
commit dfa2ff547a
2 changed files with 11 additions and 5 deletions

View file

@ -200,6 +200,8 @@ void patty_ax25_sock_vs_incr(patty_ax25_sock *sock);
void patty_ax25_sock_vr_incr(patty_ax25_sock *sock);
int patty_ax25_sock_flow_left(patty_ax25_sock *sock);
int patty_ax25_sock_flow_full(patty_ax25_sock *sock);
/*

View file

@ -535,6 +535,14 @@ void *patty_ax25_sock_assembler_read(patty_ax25_sock *sock,
return buf + 1;
}
int patty_ax25_sock_flow_left(patty_ax25_sock *sock) {
if (sock->n_window_tx == 1) {
return 1;
}
return sock->vs - tx_seq(sock, sock->va + sock->n_window_tx);
}
int patty_ax25_sock_flow_full(patty_ax25_sock *sock) {
/*
* 6.4.1 Sending I Frames
@ -644,11 +652,7 @@ error_invalid_type:
}
static inline uint16_t control_i(patty_ax25_sock *sock, int ns) {
int flag = 0;
if (sock->vs == tx_seq(sock, sock->va + sock->n_window_tx - 1)) {
flag = 1;
}
int flag = patty_ax25_sock_flow_left(sock) == 1? 1: 0;
switch (sock->mode) {
case PATTY_AX25_SOCK_SABM: