patty/include/patty/ax25/if.h

64 lines
1.6 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)
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];
patty_kiss_tnc *tnc;
patty_list *addrs;
} patty_ax25_if;
patty_ax25_if *patty_ax25_if_create(int opts, void *info);
void patty_ax25_if_destroy(patty_ax25_if *iface);
int patty_ax25_if_each_addr(patty_ax25_if *iface,
int (*callback)(char *, uint8_t, void *), void *ctx);
int patty_ax25_if_add_addr(patty_ax25_if *iface,
const char *callsign, uint8_t ssid);
int patty_ax25_if_delete_addr(patty_ax25_if *iface,
const char *callsign, uint8_t ssid);
patty_ax25_if *patty_ax25_get_if(patty_ax25_server *server,
const char *name);
int patty_ax25_if_each(patty_ax25_server *server,
int (*callback)(patty_ax25_if *, void *),
void *ctx);
int patty_ax25_add_if(patty_ax25_server *server,
patty_ax25_if *iface);
int patty_ax25_delete_if(patty_ax25_server *server,
patty_ax25_if *iface);
#endif /* _PATTY_AX25_IF_H */