Rename patty_ax25_sock member 'status' to 'state'
This commit is contained in:
parent
b2182618ab
commit
ca06f34eed
5 changed files with 31 additions and 31 deletions
|
@ -61,7 +61,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
strncpy(ifreq.name, "kiss0", sizeof(ifreq.name));
|
||||
|
||||
ifreq.status = PATTY_AX25_SOCK_PROMISC;
|
||||
ifreq.state = PATTY_AX25_SOCK_PROMISC;
|
||||
|
||||
if (patty_client_setsockopt(client, fd, PATTY_AX25_SOCK_IF, &ifreq, sizeof(ifreq)) < 0) {
|
||||
fprintf(stderr, "%s: %s: %s\n",
|
||||
|
|
|
@ -42,7 +42,7 @@ enum patty_ax25_sock_type {
|
|||
PATTY_AX25_SOCK_RAW
|
||||
};
|
||||
|
||||
enum patty_ax25_sock_status {
|
||||
enum patty_ax25_sock_state {
|
||||
PATTY_AX25_SOCK_CLOSED,
|
||||
PATTY_AX25_SOCK_LISTENING,
|
||||
PATTY_AX25_SOCK_PENDING_ACCEPT,
|
||||
|
@ -72,7 +72,7 @@ typedef struct _patty_ax25_sock {
|
|||
enum patty_ax25_proto proto;
|
||||
enum patty_ax25_sock_type type;
|
||||
enum patty_ax25_version version;
|
||||
enum patty_ax25_sock_status status;
|
||||
enum patty_ax25_sock_state state;
|
||||
enum patty_ax25_sock_mode mode;
|
||||
enum patty_ax25_sock_flow flow;
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ typedef struct _patty_client_setsockopt_params {
|
|||
|
||||
typedef struct _patty_client_setsockopt_if {
|
||||
char name[8];
|
||||
int status;
|
||||
int state;
|
||||
} patty_client_setsockopt_if;
|
||||
|
||||
typedef struct _patty_client_setsockopt_response {
|
||||
|
|
40
src/server.c
40
src/server.c
|
@ -296,11 +296,11 @@ static int sock_shutdown(patty_ax25_server *server,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (sock->status != PATTY_AX25_SOCK_ESTABLISHED) {
|
||||
if (sock->state != PATTY_AX25_SOCK_ESTABLISHED) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
sock->status = PATTY_AX25_SOCK_PENDING_DISCONNECT;
|
||||
sock->state = PATTY_AX25_SOCK_PENDING_DISCONNECT;
|
||||
|
||||
return patty_ax25_sock_send_disc(sock, PATTY_AX25_FRAME_POLL);
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ static int sock_save(patty_ax25_server *server,
|
|||
patty_ax25_sock *sock) {
|
||||
patty_dict *socks;
|
||||
|
||||
switch (sock->status) {
|
||||
switch (sock->state) {
|
||||
case PATTY_AX25_SOCK_LISTENING:
|
||||
if (sock_save_local(server, sock) < 0) {
|
||||
goto error_sock_save_local;
|
||||
|
@ -360,7 +360,7 @@ static int sock_close(patty_ax25_server *server,
|
|||
int client;
|
||||
patty_dict *socks;
|
||||
|
||||
switch (sock->status) {
|
||||
switch (sock->state) {
|
||||
case PATTY_AX25_SOCK_LISTENING:
|
||||
if (sock_delete_local(server, sock) < 0) {
|
||||
goto error_sock_delete_local;
|
||||
|
@ -626,8 +626,8 @@ static int server_setsockopt(patty_ax25_server *server,
|
|||
goto error_read;
|
||||
}
|
||||
|
||||
if (data.status == PATTY_AX25_SOCK_PROMISC) {
|
||||
sock->status = PATTY_AX25_SOCK_PROMISC;
|
||||
if (data.state == PATTY_AX25_SOCK_PROMISC) {
|
||||
sock->state = PATTY_AX25_SOCK_PROMISC;
|
||||
}
|
||||
|
||||
if ((iface = patty_ax25_server_get_if(server, data.name)) == NULL) {
|
||||
|
@ -735,7 +735,7 @@ static int server_listen(patty_ax25_server *server,
|
|||
goto error_invalid_fd;
|
||||
}
|
||||
|
||||
sock->status = PATTY_AX25_SOCK_LISTENING;
|
||||
sock->state = PATTY_AX25_SOCK_LISTENING;
|
||||
|
||||
if (sock_save_local(server, sock) < 0) {
|
||||
goto error_sock_save_local;
|
||||
|
@ -791,7 +791,7 @@ static int server_connect(patty_ax25_server *server,
|
|||
return respond_connect(client, -1, EBADF);
|
||||
}
|
||||
|
||||
switch (sock->status) {
|
||||
switch (sock->state) {
|
||||
case PATTY_AX25_SOCK_LISTENING:
|
||||
return respond_connect(client, -1, EINVAL);
|
||||
|
||||
|
@ -838,7 +838,7 @@ static int server_connect(patty_ax25_server *server,
|
|||
*/
|
||||
memcpy(&sock->remote, &request.peer, sizeof(request.peer));
|
||||
|
||||
sock->status = PATTY_AX25_SOCK_PENDING_CONNECT;
|
||||
sock->state = PATTY_AX25_SOCK_PENDING_CONNECT;
|
||||
|
||||
if (sock_save_remote(server, sock) < 0) {
|
||||
goto error_sock_save_remote;
|
||||
|
@ -1186,7 +1186,7 @@ static int handle_frmr(patty_ax25_server *server,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (sock->status == PATTY_AX25_SOCK_PENDING_CONNECT) {
|
||||
if (sock->state == PATTY_AX25_SOCK_PENDING_CONNECT) {
|
||||
int ret = patty_ax25_sock_send_sabm(sock, PATTY_AX25_FRAME_POLL);
|
||||
|
||||
patty_timer_start(&sock->timer_t1, sock->n_ack);
|
||||
|
@ -1234,7 +1234,7 @@ static int handle_sabm(patty_ax25_server *server,
|
|||
created = 1;
|
||||
}
|
||||
|
||||
remote->status = PATTY_AX25_SOCK_ESTABLISHED;
|
||||
remote->state = PATTY_AX25_SOCK_ESTABLISHED;
|
||||
|
||||
if (frame->type == PATTY_AX25_FRAME_SABME) {
|
||||
patty_ax25_sock_params_upgrade(remote);
|
||||
|
@ -1292,7 +1292,7 @@ static int handle_ua(patty_ax25_server *server,
|
|||
return reply_dm(iface, frame, PATTY_AX25_FRAME_FINAL);
|
||||
}
|
||||
|
||||
switch (sock->status) {
|
||||
switch (sock->state) {
|
||||
case PATTY_AX25_SOCK_PENDING_CONNECT:
|
||||
break;
|
||||
|
||||
|
@ -1314,7 +1314,7 @@ static int handle_ua(patty_ax25_server *server,
|
|||
|
||||
patty_timer_start(&sock->timer_t3, PATTY_AX25_SOCK_DEFAULT_KEEPALIVE);
|
||||
|
||||
sock->status = PATTY_AX25_SOCK_ESTABLISHED;
|
||||
sock->state = PATTY_AX25_SOCK_ESTABLISHED;
|
||||
|
||||
if ((client = client_by_sock(server, sock)) < 0) {
|
||||
goto error_client_by_sock;
|
||||
|
@ -1340,7 +1340,7 @@ static int handle_dm(patty_ax25_server *server,
|
|||
patty_ax25_frame *frame) {
|
||||
int client;
|
||||
|
||||
if (sock == NULL || sock->status != PATTY_AX25_SOCK_PENDING_CONNECT) {
|
||||
if (sock == NULL || sock->state != PATTY_AX25_SOCK_PENDING_CONNECT) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1360,7 +1360,7 @@ static int handle_i(patty_ax25_server *server,
|
|||
patty_ax25_if *iface,
|
||||
patty_ax25_sock *sock,
|
||||
patty_ax25_frame *frame) {
|
||||
if (sock == NULL || sock->status != PATTY_AX25_SOCK_ESTABLISHED) {
|
||||
if (sock == NULL || sock->state != PATTY_AX25_SOCK_ESTABLISHED) {
|
||||
return frame->pf? reply_dm(iface, frame, PATTY_AX25_FRAME_FINAL): 0;
|
||||
}
|
||||
|
||||
|
@ -1400,7 +1400,7 @@ static int handle_disc(patty_ax25_server *server,
|
|||
goto reply_dm;
|
||||
}
|
||||
|
||||
switch (sock->status) {
|
||||
switch (sock->state) {
|
||||
case PATTY_AX25_SOCK_ESTABLISHED:
|
||||
(void)sock_close(server, sock);
|
||||
|
||||
|
@ -1560,7 +1560,7 @@ static int handle_xid(patty_ax25_server *server,
|
|||
if ((remote = sock_by_addrpair(server->socks_remote,
|
||||
&frame->dest,
|
||||
&frame->src)) != NULL) {
|
||||
if (remote->status != PATTY_AX25_SOCK_PENDING_CONNECT) {
|
||||
if (remote->state != PATTY_AX25_SOCK_PENDING_CONNECT) {
|
||||
goto reply_dm;
|
||||
}
|
||||
|
||||
|
@ -1605,7 +1605,7 @@ static int handle_xid(patty_ax25_server *server,
|
|||
&frame->dest)) != NULL) {
|
||||
int client;
|
||||
|
||||
if (local->status != PATTY_AX25_SOCK_LISTENING) {
|
||||
if (local->state != PATTY_AX25_SOCK_LISTENING) {
|
||||
goto reply_dm;
|
||||
}
|
||||
|
||||
|
@ -1617,7 +1617,7 @@ static int handle_xid(patty_ax25_server *server,
|
|||
goto error_sock_new;
|
||||
}
|
||||
|
||||
remote->status = PATTY_AX25_SOCK_PENDING_ACCEPT;
|
||||
remote->state = PATTY_AX25_SOCK_PENDING_ACCEPT;
|
||||
|
||||
if (params.hdlc & PATTY_AX25_PARAM_HDLC_MODULO_128) {
|
||||
remote->mode = PATTY_AX25_SOCK_SABME;
|
||||
|
@ -1801,7 +1801,7 @@ static int handle_sock(uint32_t key,
|
|||
return handle_sock_raw(server, sock);
|
||||
}
|
||||
|
||||
switch (sock->status) {
|
||||
switch (sock->state) {
|
||||
case PATTY_AX25_SOCK_PENDING_CONNECT:
|
||||
patty_timer_tick(&sock->timer_t1, &server->elapsed);
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ void patty_ax25_sock_destroy(patty_ax25_sock *sock) {
|
|||
}
|
||||
|
||||
void patty_ax25_sock_init(patty_ax25_sock *sock) {
|
||||
sock->status = PATTY_AX25_SOCK_CLOSED;
|
||||
sock->state = PATTY_AX25_SOCK_CLOSED;
|
||||
sock->mode = PATTY_AX25_SOCK_DM;
|
||||
sock->flow = PATTY_AX25_SOCK_WAIT;
|
||||
sock->n_maxlen_tx = PATTY_AX25_SOCK_DEFAULT_I_LEN;
|
||||
|
@ -366,7 +366,7 @@ int patty_ax25_sock_bind_if(patty_ax25_sock *sock,
|
|||
sock->iface = iface;
|
||||
sock->flags_classes |= iface->flags_classes;
|
||||
|
||||
if (sock->status == PATTY_AX25_SOCK_PROMISC) {
|
||||
if (sock->state == PATTY_AX25_SOCK_PROMISC) {
|
||||
if (patty_ax25_if_promisc_add(iface, sock->fd) < 0) {
|
||||
goto error_if_promisc_add;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue