From 4ce6d1e38e69ca4cb080a85b44c02bfe7ccfb165 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Mon, 20 Jul 2015 21:27:35 +0000 Subject: [PATCH] Sure, why not --- include/patty/ax25.h | 54 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/include/patty/ax25.h b/include/patty/ax25.h index 2ed9515..5c3844e 100644 --- a/include/patty/ax25.h +++ b/include/patty/ax25.h @@ -11,6 +11,17 @@ #include #include +#define PATTY_AX25_IF_OPT_TYPE_MASK 0x1f + +enum patty_ax25_if_type { + PATTY_AX25_IF_UNKNOWN = 0x00, + PATTY_AX25_IF_KISS_TNC_TTY = 0x01, + PATTY_AX25_IF_KISS_TNC_PORT = 0x02, + PATTY_AX25_IF_KISS_TNC_I2C = 0x04, + PATTY_AX25_IF_KISS_TNC_SPI = 0x08, + PATTY_AX25_IF_SOFT_TNC = 0x10 +}; + typedef struct _patty_ax25_stats { size_t frame_tx; size_t frame_rx; @@ -19,21 +30,48 @@ typedef struct _patty_ax25_stats { typedef struct _patty_ax25_address patty_ax25_port; -typedef struct _patty_ax25_if { - patty_kiss_tnc * tnc; - patty_ax25_stats stats; -} patty_ax25_if; - typedef struct _patty_ax25_link { patty_ax25_port local; patty_ax25_port remote; patty_ax25_stats stats; } patty_ax25_link; +typedef struct _patty_ax25_if { + patty_kiss_tnc * tnc; + patty_ax25_stats stats; + patty_dict * ports; + + char name[8]; +} patty_ax25_if; + typedef struct _patty_ax25 { - patty_dict * ax25_ifs; - patty_dict * ports; - patty_dict * + patty_dict * ax25_ifs; /* Key: AX.25 interface name */ + patty_dict * ports; /* Key: Integer port descriptor */ + patty_dict * links; /* Key: Integer link descriptor */ } patty_ax25; +void patty_ax25_init(patty_ax25 *ax25); + +int patty_ax25_create_if(patty_ax25 *ax25, const char *name, + int opts, void *info); + +int patty_ax25_get_if(patty_ax25 *ax25, const char *name); + +int patty_ax25_destroy_if(patty_ax25 *ax25, int iface); + +int patty_ax25_listen(patty_ax25 *ax25, int iface, + const char *callsign, int ssid); + +int patty_ax25_shutdown(patty_ax25 *ax25, int port); + +int patty_ax25_connect(patty_ax25 *ax25, int port, + const char *callsign, int ssid); + +int patty_ax25_close(patty_ax25 *ax25, int link); + +int patty_ax25_recv(patty_ax25 *ax25, int iface, patty_ax25_frame *frame); + +int patty_ax25_send(patty_ax25 *ax25, int iface, + const patty_ax25_frame *frame); + #endif /* _PATTY_AX25_IF */