Rework socket calls to use patty_ax25_addr
This commit is contained in:
parent
34afdba9e4
commit
548c7149fb
2 changed files with 6 additions and 18 deletions
|
@ -106,16 +106,14 @@ int patty_ax25_socket(patty_ax25 *ax25);
|
|||
|
||||
int patty_ax25_bind(patty_ax25 *ax25,
|
||||
int socket,
|
||||
const char *callsign,
|
||||
uint8_t ssid);
|
||||
patty_ax25_addr *addr);
|
||||
|
||||
int patty_ax25_listen(patty_ax25 *ax25,
|
||||
int socket);
|
||||
|
||||
int patty_ax25_connect(patty_ax25 *ax25,
|
||||
int socket,
|
||||
const char *callsign,
|
||||
uint8_t ssid);
|
||||
patty_ax25_addr *addr);
|
||||
|
||||
int patty_ax25_accept(patty_ax25 *ax25, int socket);
|
||||
|
||||
|
|
18
src/ax25.c
18
src/ax25.c
|
@ -294,8 +294,7 @@ error_malloc_sock:
|
|||
|
||||
int patty_ax25_bind(patty_ax25 *ax25,
|
||||
int socket,
|
||||
const char *callsign,
|
||||
uint8_t ssid) {
|
||||
patty_ax25_addr *addr) {
|
||||
patty_ax25_sock *sock;
|
||||
|
||||
if ((sock = sock_get_fd(ax25, socket)) == NULL) {
|
||||
|
@ -312,13 +311,10 @@ int patty_ax25_bind(patty_ax25 *ax25,
|
|||
goto error_exists;
|
||||
}
|
||||
|
||||
if (patty_ax25_pton(callsign, ssid, &sock->local) < 0) {
|
||||
goto error_pton;
|
||||
}
|
||||
memcpy(&sock->local, addr, sizeof(*addr));
|
||||
|
||||
return 0;
|
||||
|
||||
error_pton:
|
||||
error_exists:
|
||||
error_sock_get_fd:
|
||||
return -1;
|
||||
|
@ -349,8 +345,7 @@ error_sock_get_fd:
|
|||
|
||||
int patty_ax25_connect(patty_ax25 *ax25,
|
||||
int socket,
|
||||
const char *callsign,
|
||||
uint8_t ssid) {
|
||||
patty_ax25_addr *addr) {
|
||||
patty_ax25_sock *sock;
|
||||
|
||||
if ((sock = sock_get_fd(ax25, socket)) == NULL) {
|
||||
|
@ -363,15 +358,10 @@ int patty_ax25_connect(patty_ax25 *ax25,
|
|||
goto error_exists;
|
||||
}
|
||||
|
||||
if (patty_ax25_pton(callsign, ssid, &sock->remote) < 0) {
|
||||
errno = EINVAL;
|
||||
|
||||
goto error_pton;
|
||||
}
|
||||
memcpy(&sock->remote, addr, sizeof(*addr));
|
||||
|
||||
return 0;
|
||||
|
||||
error_pton:
|
||||
error_exists:
|
||||
error_sock_get_fd:
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Reference in a new issue