diff --git a/src/ax25.c b/src/ax25.c index ba4aab7..9f5a6ce 100644 --- a/src/ax25.c +++ b/src/ax25.c @@ -92,6 +92,16 @@ patty_ax25_if *patty_ax25_create_if(patty_ax25 *ax25, int opts, void *info) { return NULL; } +static uint32_t address_hash(patty_ax25_address *address) { + char key[10]; + + if (snprintf(key, sizeof(key), "%s/%d", callsign, ssid) < 0) { + goto error_snprintf_key; + } + + return patty_hash(key, strlen(key)); +} + patty_ax25_port *patty_ax25_listen(patty_ax25 *ax25, patty_ax25_if *iface, const char *callsign, int ssid) { patty_ax25_port *port; char key[10]; @@ -107,10 +117,6 @@ patty_ax25_port *patty_ax25_listen(patty_ax25 *ax25, patty_ax25_if *iface, const port->ssid = ssid; port->repeated = 0; - if (snprintf(key, sizeof(key), "%s/%d", callsign, ssid) < 0) { - goto error_snprintf_key; - } - if (patty_dict_set(iface->ports, (void *)key, strlen(key), port) == NULL) { goto error_dict_set_port; } @@ -129,3 +135,17 @@ error_snprintf_key: error_malloc_port: return NULL; } + +int patty_ax25_shutdown(patty_ax25 *ax25, patty_ax25_port *port) { + int ret = 0; + + if (patty_dict_delete(iface->ports, (void *)key, strlen(key)) == NULL) { + ret = -1; + } + + if (patty_dict_delete(ax25->ports, (void *)key, strlen(key)) == NULL) { + ret = -1; + } + + return ret; +}