#ifndef _PATTY_AX25_IF_H #define _PATTY_AX25_IF_H #include #include #include #define PATTY_AX25_IF_OPT_TYPE_MASK 0x1f #define PATTY_AX25_IF_OPT_TYPE(n) \ ((n) & PATTY_AX25_IF_OPT_TYPE_MASK) #define PATTY_AX25_IF_BUFSZ 4096 enum patty_ax25_if_type { PATTY_AX25_IF_UNKNOWN, PATTY_AX25_IF_KISS_TNC, PATTY_AX25_IF_HDLC }; typedef struct _patty_ax25_if_stats { size_t rx_frames, tx_frames, rx_bytes, tx_bytes, dropped; } patty_ax25_if_stats; typedef struct _patty_ax25_if { enum patty_ax25_if_type type; patty_ax25_if_stats stats; char name[8]; void *rx_buf, *tx_buf; size_t rx_bufsz, tx_bufsz; patty_kiss_tnc *tnc; patty_ax25_addr addr; patty_list *aliases; patty_dict *promisc_fds; } patty_ax25_if; typedef struct _patty_ax25_if_info { patty_ax25_addr addr; } patty_ax25_if_info; enum patty_ax25_if_kiss_tnc_info_type { PATTY_AX25_IF_KISS_TNC_INFO_NONE, PATTY_AX25_IF_KISS_TNC_INFO_FD, PATTY_AX25_IF_KISS_TNC_INFO_PATH }; typedef struct _patty_ax25_if_kiss_tnc_info { patty_ax25_addr addr; enum patty_ax25_if_kiss_tnc_info_type type; int fd; char path[256]; } patty_ax25_if_kiss_tnc_info; patty_ax25_if *patty_ax25_if_new(int opts, patty_ax25_if_info *info); void patty_ax25_if_destroy(patty_ax25_if *iface); int patty_ax25_if_addr_each(patty_ax25_if *iface, int (*callback)(char *, uint8_t, void *), void *ctx); int patty_ax25_if_addr_add(patty_ax25_if *iface, const char *callsign, uint8_t ssid); int patty_ax25_if_addr_delete(patty_ax25_if *iface, const char *callsign, uint8_t ssid); int patty_ax25_if_promisc_add(patty_ax25_if *iface, int fd); int patty_ax25_if_promisc_delete(patty_ax25_if *iface, int fd); ssize_t patty_ax25_if_pending(patty_ax25_if *iface); ssize_t patty_ax25_if_recv(patty_ax25_if *iface, void **buf); ssize_t patty_ax25_if_send(patty_ax25_if *iface, const void *buf, size_t len); #endif /* _PATTY_AX25_IF_H */