From 04cd913840298b4aaffcd1a335535f01ec68c146 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Tue, 28 Jul 2015 00:13:43 -0500 Subject: [PATCH] Good stuff --- include/patty/ax25.h | 2 +- include/patty/ax25/frame.h | 3 +++ src/ax25.c | 14 ++++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/patty/ax25.h b/include/patty/ax25.h index 93f7405..fc82de8 100644 --- a/include/patty/ax25.h +++ b/include/patty/ax25.h @@ -38,7 +38,7 @@ typedef struct _patty_ax25_sock { int n_maxlen; int n_retry; - int n_outstanding; + int n_window; int seq_send; int seq_recv; diff --git a/include/patty/ax25/frame.h b/include/patty/ax25/frame.h index 34b50a1..7e93bf5 100644 --- a/include/patty/ax25/frame.h +++ b/include/patty/ax25/frame.h @@ -4,6 +4,9 @@ #include #include +#define PATTY_AX25_FRAME_DEFAULT_MAXLEN 256 +#define PATTY_AX25_FRAME_DEFAULT_WINDOW 8 + enum patty_ax25_frame_type { PATTY_AX25_FRAME_UNKNOWN, PATTY_AX25_FRAME_INFO, diff --git a/src/ax25.c b/src/ax25.c index dc3d593..a7ccc71 100644 --- a/src/ax25.c +++ b/src/ax25.c @@ -73,6 +73,14 @@ error_dict_set: return -1; } +static void sock_init(patty_ax25_sock *sock) { + memset(sock, '\0', sizeof(*sock)); + + sock->status = PATTY_AX25_SOCK_OPEN; + sock->n_maxlen = PATTY_AX25_FRAME_DEFAULT_MAXLEN; + sock->n_window = PATTY_AX25_FRAME_DEFAULT_WINDOW; +} + int patty_ax25_socket(patty_ax25 *ax25) { patty_ax25_sock *sock; int fd; @@ -81,9 +89,7 @@ int patty_ax25_socket(patty_ax25 *ax25) { goto error_malloc_sock; } - memset(sock, '\0', sizeof(*sock)); - - sock->status = PATTY_AX25_SOCK_OPEN; + sock_init(sock); if ((fd = fd_store(ax25, sock)) < 0) { goto error_fd_store; @@ -105,7 +111,7 @@ int patty_ax25_open(patty_ax25 *ax25, const char *ifname) { goto error_malloc_sock; } - memset(sock, '\0', sizeof(*sock)); + sock_init(sock); if ((sock->iface = patty_ax25_get_if(ax25, ifname)) == NULL) { goto error_get_if;