That's slightly more valid
This commit is contained in:
parent
6adb4f098b
commit
3848388886
1 changed files with 24 additions and 15 deletions
39
src/ax25.c
39
src/ax25.c
|
@ -62,8 +62,8 @@ error_dict_get:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fd_store(patty_ax25 *ax25, void *obj) {
|
static int fd_store(patty_ax25 *ax25, patty_ax25_sock *sock) {
|
||||||
if (patty_dict_set(ax25->fd_lookup, &ax25->fd, sizeof(ax25->fd), obj) == NULL) {
|
if (patty_dict_set(ax25->fd_lookup, &ax25->fd, sizeof(ax25->fd), sock) == NULL) {
|
||||||
goto error_dict_set;
|
goto error_dict_set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,19 +73,6 @@ error_dict_set:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int patty_ax25_open(patty_ax25 *ax25, const char *ifname) {
|
|
||||||
patty_ax25_if *iface;
|
|
||||||
|
|
||||||
if ((iface = patty_ax25_get_if(ax25, ifname)) == NULL) {
|
|
||||||
goto error_get_if;
|
|
||||||
}
|
|
||||||
|
|
||||||
return fd_store(ax25, iface);
|
|
||||||
|
|
||||||
error_get_if:
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int patty_ax25_socket(patty_ax25 *ax25) {
|
int patty_ax25_socket(patty_ax25 *ax25) {
|
||||||
patty_ax25_sock *sock;
|
patty_ax25_sock *sock;
|
||||||
int fd;
|
int fd;
|
||||||
|
@ -111,6 +98,28 @@ error_malloc_sock:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int patty_ax25_open(patty_ax25 *ax25, const char *ifname) {
|
||||||
|
patty_ax25_sock *sock;
|
||||||
|
|
||||||
|
if ((sock = malloc(sizeof(*sock))) == NULL) {
|
||||||
|
goto error_malloc_sock;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(sock, '\0', sizeof(*sock));
|
||||||
|
|
||||||
|
if ((sock->iface = patty_ax25_get_if(ax25, ifname)) == NULL) {
|
||||||
|
goto error_get_if;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fd_store(ax25, sock);
|
||||||
|
|
||||||
|
error_get_if:
|
||||||
|
free(sock);
|
||||||
|
|
||||||
|
error_malloc_sock:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int patty_ax25_bind(patty_ax25 *ax25, int socket, const char *callsign, int ssid) {
|
int patty_ax25_bind(patty_ax25 *ax25, int socket, const char *callsign, int ssid) {
|
||||||
patty_ax25_sock *sock;
|
patty_ax25_sock *sock;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue