From ffe8599db1416cd624f21aa3828f75a5e7a2d02f Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Fri, 17 Jul 2020 00:32:04 -0400 Subject: [PATCH] Rename tx, rx_bufsz to mtu, mru in src/if.c --- include/patty/ax25/if.h | 19 +++++++++++++++---- src/if.c | 10 +++++----- src/server.c | 2 +- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/include/patty/ax25/if.h b/include/patty/ax25/if.h index e8313d7..e4f4592 100644 --- a/include/patty/ax25/if.h +++ b/include/patty/ax25/if.h @@ -11,7 +11,8 @@ #define PATTY_AX25_IF_OPT_TYPE(n) \ ((n) & PATTY_AX25_IF_OPT_TYPE_MASK) -#define PATTY_AX25_IF_BUFSZ 4096 +#define PATTY_AX25_IF_DEFAULT_MTU 4096 +#define PATTY_AX25_IF_DEFAULT_MRU 4096 enum patty_ax25_if_type { PATTY_AX25_IF_UNKNOWN, @@ -19,6 +20,13 @@ enum patty_ax25_if_type { PATTY_AX25_IF_HDLC }; +enum patty_ax25_if_flags { + PATTY_AX25_IF_HALF_DUPLEX = (1 << 0), + PATTY_AX25_IF_FULL_DUPLEX = (1 << 1), + PATTY_AX25_IF_SYNC_TX = (1 << 6), + PATTY_AX25_IF_SEGMENTER = (1 << 7) +}; + typedef struct _patty_ax25_if_stats { size_t rx_frames, tx_frames, @@ -36,8 +44,8 @@ typedef struct _patty_ax25_if { void *rx_buf, *tx_buf; - size_t rx_bufsz, - tx_bufsz; + size_t mru, + mtu; patty_kiss_tnc *tnc; patty_ax25_addr addr; @@ -47,6 +55,7 @@ typedef struct _patty_ax25_if { typedef struct _patty_ax25_if_info { patty_ax25_addr addr; + unsigned int flags; } patty_ax25_if_info; enum patty_ax25_if_kiss_tnc_info_type { @@ -56,7 +65,9 @@ enum patty_ax25_if_kiss_tnc_info_type { }; typedef struct _patty_ax25_if_kiss_tnc_info { - patty_ax25_addr addr; + patty_ax25_addr addr; + unsigned int flags; + enum patty_ax25_if_kiss_tnc_info_type type; int fd; diff --git a/src/if.c b/src/if.c index 61e56c0..8e63f9a 100644 --- a/src/if.c +++ b/src/if.c @@ -48,16 +48,16 @@ patty_ax25_if *patty_ax25_if_new(int opts, patty_ax25_if_info *info) { goto error_invalid_address; } - if ((iface->rx_buf = malloc(PATTY_AX25_IF_BUFSZ)) == NULL) { + if ((iface->rx_buf = malloc(PATTY_AX25_IF_DEFAULT_MRU)) == NULL) { goto error_malloc_rx_buf; } else { - iface->rx_bufsz = PATTY_AX25_IF_BUFSZ; + iface->mru = PATTY_AX25_IF_DEFAULT_MRU; } - if ((iface->tx_buf = malloc(PATTY_AX25_IF_BUFSZ)) == NULL) { + if ((iface->tx_buf = malloc(PATTY_AX25_IF_DEFAULT_MTU)) == NULL) { goto error_malloc_tx_buf; } else { - iface->tx_bufsz = PATTY_AX25_IF_BUFSZ; + iface->mtu = PATTY_AX25_IF_DEFAULT_MTU; } if ((iface->aliases = patty_list_new()) == NULL) { @@ -348,7 +348,7 @@ ssize_t patty_ax25_if_recv(patty_ax25_if *iface, if ((readlen = patty_kiss_tnc_recv(iface->tnc, iface->rx_buf, - iface->rx_bufsz, + iface->mru, &port)) < 0) { goto error_kiss_tnc_recv; } else if (readlen == 0) { diff --git a/src/server.c b/src/server.c index f5bb650..8279c99 100644 --- a/src/server.c +++ b/src/server.c @@ -999,7 +999,7 @@ static int reply_to(patty_ax25_if *iface, reply, PATTY_AX25_FRAME_NORMAL, iface->tx_buf, - iface->tx_bufsz)) < 0) { + iface->mtu)) < 0) { goto error_toobig; }