Commit f6f71768 authored by Olivier Crête's avatar Olivier Crête 👻

pseudotcp: Rename state enums to not clash with system ones

parent fe55ca06
This diff is collapsed.
......@@ -141,24 +141,24 @@ typedef enum {
/**
* PseudoTcpState:
* @TCP_LISTEN: The socket's initial state. The socket isn't connected and is
* @PSEUDO_TCP_LISTEN: The socket's initial state. The socket isn't connected and is
* listening for an incoming connection
* @TCP_SYN_SENT: The socket has sent a connection request (SYN) packet and is
* @PSEUDO_TCP_SYN_SENT: The socket has sent a connection request (SYN) packet and is
* waiting for an answer
* @TCP_SYN_RECEIVED: The socket has received a connection request (SYN) packet.
* @TCP_ESTABLISHED: The socket is connected
* @TCP_CLOSED: The socket has been closed
* @TCP_FIN_WAIT_1: The socket has been closed locally but not remotely
* @PSEUDO_TCP_SYN_RECEIVED: The socket has received a connection request (SYN) packet.
* @PSEUDO_TCP_ESTABLISHED: The socket is connected
* @PSEUDO_TCP_CLOSED: The socket has been closed
* @PSEUDO_TCP_FIN_WAIT_1: The socket has been closed locally but not remotely
* (Since: 0.1.8)
* @TCP_FIN_WAIT_2: The socket has been closed locally but not remotely
* @PSEUDO_TCP_FIN_WAIT_2: The socket has been closed locally but not remotely
* (Since: 0.1.8)
* @TCP_CLOSING: The socket has been closed locally and remotely
* @PSEUDO_TCP_CLOSING: The socket has been closed locally and remotely
* (Since: 0.1.8)
* @TCP_TIME_WAIT: The socket has been closed locally and remotely
* @PSEUDO_TCP_TIME_WAIT: The socket has been closed locally and remotely
* (Since: 0.1.8)
* @TCP_CLOSE_WAIT: The socket has been closed remotely but not locally
* @PSEUDO_TCP_CLOSE_WAIT: The socket has been closed remotely but not locally
* (Since: 0.1.8)
* @TCP_LAST_ACK: The socket has been closed locally and remotely
* @PSEUDO_TCP_LAST_ACK: The socket has been closed locally and remotely
* (Since: 0.1.8)
*
* An enum representing the state of the #PseudoTcpSocket. These states
......@@ -168,17 +168,17 @@ typedef enum {
* Since: 0.0.11
*/
typedef enum {
TCP_LISTEN,
TCP_SYN_SENT,
TCP_SYN_RECEIVED,
TCP_ESTABLISHED,
TCP_CLOSED,
TCP_FIN_WAIT_1,
TCP_FIN_WAIT_2,
TCP_CLOSING,
TCP_TIME_WAIT,
TCP_CLOSE_WAIT,
TCP_LAST_ACK,
PSEUDO_TCP_LISTEN,
PSEUDO_TCP_SYN_SENT,
PSEUDO_TCP_SYN_RECEIVED,
PSEUDO_TCP_ESTABLISHED,
PSEUDO_TCP_CLOSED,
PSEUDO_TCP_FIN_WAIT_1,
PSEUDO_TCP_FIN_WAIT_2,
PSEUDO_TCP_CLOSING,
PSEUDO_TCP_TIME_WAIT,
PSEUDO_TCP_CLOSE_WAIT,
PSEUDO_TCP_LAST_ACK,
} PseudoTcpState;
/**
......
......@@ -367,8 +367,8 @@ expect_socket_state (PseudoTcpSocket *socket, PseudoTcpState expected_state)
static void
expect_sockets_connected (Data *data)
{
expect_socket_state (data->left, TCP_ESTABLISHED);
expect_socket_state (data->right, TCP_ESTABLISHED);
expect_socket_state (data->left, PSEUDO_TCP_ESTABLISHED);
expect_socket_state (data->right, PSEUDO_TCP_ESTABLISHED);
}
static void
......@@ -376,8 +376,8 @@ expect_sockets_closed (Data *data)
{
guint8 buf[100];
expect_socket_state (data->left, TCP_CLOSED);
expect_socket_state (data->right, TCP_CLOSED);
expect_socket_state (data->left, PSEUDO_TCP_CLOSED);
expect_socket_state (data->right, PSEUDO_TCP_CLOSED);
g_assert_cmpint (pseudo_tcp_socket_send (data->left, "foo", 3), ==, -1);
g_assert_cmpint (pseudo_tcp_socket_get_error (data->left), ==, EPIPE);
......@@ -784,46 +784,46 @@ pseudotcp_close_normal_recovery_data (void)
g_assert_cmpint (pseudo_tcp_socket_get_available_bytes (data.right), ==, 0);
close_socket (data.left);
expect_socket_state (data.left, TCP_FIN_WAIT_1);
expect_socket_state (data.left, PSEUDO_TCP_FIN_WAIT_1);
expect_fin (data.left, data.left_sent, 10, 7);
forward_segment_ltr (&data);
expect_socket_state (data.right, TCP_ESTABLISHED);
expect_socket_state (data.right, PSEUDO_TCP_ESTABLISHED);
expect_ack (data.right, data.right_sent, 7, 7);
forward_segment_rtl (&data);
expect_socket_state (data.left, TCP_FIN_WAIT_1);
expect_socket_state (data.left, PSEUDO_TCP_FIN_WAIT_1);
assert_empty_queues(&data);
/* Close the RHS. */
close_socket (data.right);
expect_socket_state (data.right, TCP_FIN_WAIT_1);
expect_socket_state (data.right, PSEUDO_TCP_FIN_WAIT_1);
expect_fin (data.right, data.right_sent, 7, 7);
forward_segment_rtl (&data);
expect_socket_state (data.left, TCP_CLOSING);
expect_socket_state (data.left, PSEUDO_TCP_CLOSING);
expect_ack (data.left, data.left_sent, 11, 8);
forward_segment_ltr (&data);
expect_socket_state (data.right, TCP_FIN_WAIT_2);
expect_socket_state (data.right, PSEUDO_TCP_FIN_WAIT_2);
expect_data (data.right, data.right_sent, 8, 7, 0);
forward_segment_rtl (&data);
expect_socket_state (data.left, TCP_CLOSING);
expect_socket_state (data.left, PSEUDO_TCP_CLOSING);
expect_data (data.left, data.left_sent, 7, 8, 3);
forward_segment_ltr (&data);
expect_socket_state (data.right, TCP_TIME_WAIT);
expect_socket_state (data.right, PSEUDO_TCP_TIME_WAIT);
increment_time_both (&data, 100); /* Delayed ACK */
expect_ack (data.right, data.right_sent, 8, 11);
forward_segment_rtl (&data);
expect_socket_state (data.left, TCP_TIME_WAIT);
expect_socket_state (data.left, PSEUDO_TCP_TIME_WAIT);
increment_time_both (&data, 10); /* TIME-WAIT */
......@@ -1171,8 +1171,8 @@ pseudotcp_close_recv_queued (void)
expect_fin (data.left, data.left_sent, 10, 7);
forward_segment_ltr (&data);
expect_socket_state (data.left, TCP_FIN_WAIT_1);
expect_socket_state (data.right, TCP_CLOSE_WAIT);
expect_socket_state (data.left, PSEUDO_TCP_FIN_WAIT_1);
expect_socket_state (data.right, PSEUDO_TCP_CLOSE_WAIT);
g_assert_cmpint (pseudo_tcp_socket_get_available_bytes (data.left), ==, 0);
g_assert_cmpint (pseudo_tcp_socket_get_available_send_space (data.left), ==,
......@@ -1181,7 +1181,7 @@ pseudotcp_close_recv_queued (void)
expect_ack (data.right, data.right_sent, 7, 11);
forward_segment_rtl (&data);
expect_socket_state (data.left, TCP_FIN_WAIT_2);
expect_socket_state (data.left, PSEUDO_TCP_FIN_WAIT_2);
g_assert_cmpint (pseudo_tcp_socket_get_available_bytes (data.right), ==, 3);
......
......@@ -32,9 +32,6 @@
# include "config.h"
#endif
// With _GNU_SOURCE, enumeration in netinet/tcp.h and PseudoTcpState clash
#undef _GNU_SOURCE
#define _POSIX_SOURCE 1
#include <gio/gnetworking.h>
#include "agent-priv.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment