(Re)implement patty_ax25_sock_reset()
Begin to reimplement patty_ax25_sock_reset() to follow the AX.25 v2.2 Specification, Section 6.5 "Resetting Procedure" indications to set V(S) and V(R) to 0
This commit is contained in:
parent
df7c0fad38
commit
0aea65487a
3 changed files with 14 additions and 2 deletions
|
@ -96,6 +96,8 @@ patty_ax25_sock *patty_ax25_sock_new(enum patty_ax25_proto proto,
|
|||
|
||||
void patty_ax25_sock_destroy(patty_ax25_sock *sock);
|
||||
|
||||
int patty_ax25_sock_reset(patty_ax25_sock *sock);
|
||||
|
||||
int patty_ax25_sock_upgrade(patty_ax25_sock *sock,
|
||||
enum patty_ax25_version version);
|
||||
|
||||
|
|
|
@ -1275,7 +1275,7 @@ static int handle_dm(patty_ax25_server *server,
|
|||
goto error_client_by_sock;
|
||||
}
|
||||
|
||||
patty_ax25_sock_init(sock);
|
||||
patty_ax25_sock_reset(sock);
|
||||
|
||||
return respond_connect(client, -1, ECONNREFUSED);
|
||||
|
||||
|
@ -1423,7 +1423,7 @@ static int handle_xid(patty_ax25_server *server,
|
|||
goto error_client_by_sock;
|
||||
}
|
||||
|
||||
patty_ax25_sock_init(remote);
|
||||
patty_ax25_sock_reset(remote);
|
||||
|
||||
return respond_connect(client, -1, errno);
|
||||
}
|
||||
|
|
10
src/sock.c
10
src/sock.c
|
@ -176,6 +176,16 @@ void patty_ax25_sock_destroy(patty_ax25_sock *sock) {
|
|||
free(sock);
|
||||
}
|
||||
|
||||
/*
|
||||
* AX.25 v2.2 Specification, Section 6.5 "Resetting Procedure"
|
||||
*/
|
||||
int patty_ax25_sock_reset(patty_ax25_sock *sock) {
|
||||
sock->seq_send = 0;
|
||||
sock->seq_recv = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int patty_ax25_sock_upgrade(patty_ax25_sock *sock,
|
||||
enum patty_ax25_version version) {
|
||||
if (sock->version >= version) {
|
||||
|
|
Loading…
Add table
Reference in a new issue