diff --git a/include/patty/ax25.h b/include/patty/ax25.h index ef681dc..d03caf4 100644 --- a/include/patty/ax25.h +++ b/include/patty/ax25.h @@ -20,7 +20,7 @@ enum patty_ax25_obj_type { PATTY_AX25_OBJ_UNKNOWN, - PATTY_AX25_OBJ_IFACE, + PATTY_AX25_OBJ_IF, PATTY_AX25_OBJ_PORT, PATTY_AX25_OBJ_LINK }; @@ -40,17 +40,24 @@ typedef struct _patty_ax25_stats { size_t frame_drop; } patty_ax25_stats; -typedef struct _patty_ax25_address patty_ax25_port; +typedef struct _patty_ax25_port { + enum patty_ax25_obj_type type; + + char callsign[7]; + int ssid; +} patty_ax25_port; typedef struct _patty_ax25_if { enum patty_ax25_if_type type; - patty_kiss_tnc * tnc; - patty_ax25_stats stats; - patty_list * addresses; + + patty_kiss_tnc * tnc; + patty_ax25_stats stats; + patty_list * ports; } patty_ax25_if; typedef struct _patty_ax25_link { enum patty_ax25_if_type type; + patty_ax25_if * iface; patty_ax25_port * local; patty_ax25_port * remote; @@ -60,15 +67,15 @@ typedef struct _patty_ax25_link { typedef struct _patty_ax25 { patty_list * ifaces; patty_list * ports; - patty_dict * iface_table; /* address => iface */ - patty_dict * links; /* remote => local */ + patty_dict * objs; + int fd; } patty_ax25; int patty_ax25_init(patty_ax25 *ax25); void patty_ax25_stop(patty_ax25 *ax25); -patty_ax25_if *patty_ax25_create_if(patty_ax25 *ax25, int opts, void *info); +int patty_ax25_create_if(patty_ax25 *ax25, int opts, void *info); int patty_ax25_each_if(patty_ax25 *ax25, int (*callback)(patty_ax25_if *, void *), void *ctx); @@ -80,8 +87,6 @@ int patty_ax25_destroy_if(patty_ax25 *ax25, patty_ax25_if *iface); patty_ax25_port *patty_ax25_listen(patty_ax25 *ax25, patty_ax25_if *iface, const char *callsign, int ssid); -int patty_ax25_shutdown(patty_ax25 *ax25, patty_ax25_port *port); - patty_ax25_link *patty_ax25_connect(patty_ax25 *ax25, patty_ax25_port *port, const char *callsign, int ssid);