103 lines
2.4 KiB
C
103 lines
2.4 KiB
C
#ifndef _PATTY_AX25_IF_H
|
|
#define _PATTY_AX25_IF_H
|
|
|
|
#include <stdint.h>
|
|
#include <sys/types.h>
|
|
|
|
#include <patty/list.h>
|
|
|
|
#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_DEFAULT_MTU 4096
|
|
#define PATTY_AX25_IF_DEFAULT_MRU 4096
|
|
|
|
enum patty_ax25_if_type {
|
|
PATTY_AX25_IF_UNKNOWN,
|
|
PATTY_AX25_IF_KISS_TNC,
|
|
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,
|
|
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 mru,
|
|
mtu;
|
|
|
|
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;
|
|
unsigned int flags;
|
|
} 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;
|
|
unsigned int flags;
|
|
|
|
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 *, void *), void *ctx);
|
|
|
|
int patty_ax25_if_addr_add(patty_ax25_if *iface, const char *callsign);
|
|
|
|
int patty_ax25_if_addr_delete(patty_ax25_if *iface, const char *callsign);
|
|
|
|
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 */
|