Rename tx, rx_bufsz to mtu, mru in src/if.c

This commit is contained in:
XANTRONIX Development 2020-07-17 00:32:04 -04:00 committed by XANTRONIX Industrial
parent a638966486
commit ffe8599db1
3 changed files with 21 additions and 10 deletions

View file

@ -11,7 +11,8 @@
#define PATTY_AX25_IF_OPT_TYPE(n) \ #define PATTY_AX25_IF_OPT_TYPE(n) \
((n) & PATTY_AX25_IF_OPT_TYPE_MASK) ((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 { enum patty_ax25_if_type {
PATTY_AX25_IF_UNKNOWN, PATTY_AX25_IF_UNKNOWN,
@ -19,6 +20,13 @@ enum patty_ax25_if_type {
PATTY_AX25_IF_HDLC 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 { typedef struct _patty_ax25_if_stats {
size_t rx_frames, size_t rx_frames,
tx_frames, tx_frames,
@ -36,8 +44,8 @@ typedef struct _patty_ax25_if {
void *rx_buf, void *rx_buf,
*tx_buf; *tx_buf;
size_t rx_bufsz, size_t mru,
tx_bufsz; mtu;
patty_kiss_tnc *tnc; patty_kiss_tnc *tnc;
patty_ax25_addr addr; patty_ax25_addr addr;
@ -47,6 +55,7 @@ typedef struct _patty_ax25_if {
typedef struct _patty_ax25_if_info { typedef struct _patty_ax25_if_info {
patty_ax25_addr addr; patty_ax25_addr addr;
unsigned int flags;
} patty_ax25_if_info; } patty_ax25_if_info;
enum patty_ax25_if_kiss_tnc_info_type { enum patty_ax25_if_kiss_tnc_info_type {
@ -57,6 +66,8 @@ enum patty_ax25_if_kiss_tnc_info_type {
typedef struct _patty_ax25_if_kiss_tnc_info { 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; enum patty_ax25_if_kiss_tnc_info_type type;
int fd; int fd;

View file

@ -48,16 +48,16 @@ patty_ax25_if *patty_ax25_if_new(int opts, patty_ax25_if_info *info) {
goto error_invalid_address; 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; goto error_malloc_rx_buf;
} else { } 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; goto error_malloc_tx_buf;
} else { } else {
iface->tx_bufsz = PATTY_AX25_IF_BUFSZ; iface->mtu = PATTY_AX25_IF_DEFAULT_MTU;
} }
if ((iface->aliases = patty_list_new()) == NULL) { 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, if ((readlen = patty_kiss_tnc_recv(iface->tnc,
iface->rx_buf, iface->rx_buf,
iface->rx_bufsz, iface->mru,
&port)) < 0) { &port)) < 0) {
goto error_kiss_tnc_recv; goto error_kiss_tnc_recv;
} else if (readlen == 0) { } else if (readlen == 0) {

View file

@ -999,7 +999,7 @@ static int reply_to(patty_ax25_if *iface,
reply, reply,
PATTY_AX25_FRAME_NORMAL, PATTY_AX25_FRAME_NORMAL,
iface->tx_buf, iface->tx_buf,
iface->tx_bufsz)) < 0) { iface->mtu)) < 0) {
goto error_toobig; goto error_toobig;
} }