diff options
-rw-r--r-- | socket/http.c | 2 | ||||
-rw-r--r-- | socket/pseudossl.c | 1 | ||||
-rw-r--r-- | socket/socket.h | 14 | ||||
-rw-r--r-- | socket/socks5.c | 1 | ||||
-rw-r--r-- | socket/tcp-bsd.c | 1 | ||||
-rw-r--r-- | socket/tcp-turn.c | 1 | ||||
-rw-r--r-- | socket/turn.c | 5 | ||||
-rw-r--r-- | socket/udp-bsd.c | 1 |
8 files changed, 24 insertions, 2 deletions
diff --git a/socket/http.c b/socket/http.c index b5c44f1..59f56ff 100644 --- a/socket/http.c +++ b/socket/http.c @@ -123,7 +123,7 @@ nice_http_socket_new (NiceSocket *base_socket, priv->recv_buf_fill = 0; priv->content_length = 0; - + sock->type = NICE_SOCKET_TYPE_HTTP; sock->fileno = priv->base_socket->fileno; sock->addr = priv->base_socket->addr; sock->send_messages = socket_send_messages; diff --git a/socket/pseudossl.c b/socket/pseudossl.c index 4b3f7ef..0d26205 100644 --- a/socket/pseudossl.c +++ b/socket/pseudossl.c @@ -111,6 +111,7 @@ nice_pseudossl_socket_new (NiceSocket *base_socket) priv->handshaken = FALSE; priv->base_socket = base_socket; + sock->type = NICE_SOCKET_TYPE_PSEUDOSSL; sock->fileno = priv->base_socket->fileno; sock->addr = priv->base_socket->addr; sock->send_messages = socket_send_messages; diff --git a/socket/socket.h b/socket/socket.h index 54c542e..18e5fb5 100644 --- a/socket/socket.h +++ b/socket/socket.h @@ -55,9 +55,23 @@ G_BEGIN_DECLS typedef struct _NiceSocket NiceSocket; +typedef enum { + NICE_SOCKET_TYPE_UDP_BSD, + NICE_SOCKET_TYPE_TCP_BSD, + NICE_SOCKET_TYPE_PSEUDOSSL, + NICE_SOCKET_TYPE_HTTP, + NICE_SOCKET_TYPE_SOCKS5, + NICE_SOCKET_TYPE_TURN, + NICE_SOCKET_TYPE_TCP_TURN, + NICE_SOCKET_TYPE_TCP_ACTIVE, + NICE_SOCKET_TYPE_TCP_PASSIVE, + NICE_SOCKET_TYPE_TCP_SO +} NiceSocketType; + struct _NiceSocket { NiceAddress addr; + NiceSocketType type; GSocket *fileno; /* Implementations must handle any value of n_recv_messages, including 0. Iff * n_recv_messages is 0, recv_messages may be NULL. */ diff --git a/socket/socks5.c b/socket/socks5.c index 3ecc04a..59d233b 100644 --- a/socket/socks5.c +++ b/socket/socks5.c @@ -104,6 +104,7 @@ nice_socks5_socket_new (NiceSocket *base_socket, priv->username = g_strdup (username); priv->password = g_strdup (password); + sock->type = NICE_SOCKET_TYPE_SOCKS5; sock->fileno = priv->base_socket->fileno; sock->addr = priv->base_socket->addr; sock->send_messages = socket_send_messages; diff --git a/socket/tcp-bsd.c b/socket/tcp-bsd.c index 79a0918..474251f 100644 --- a/socket/tcp-bsd.c +++ b/socket/tcp-bsd.c @@ -172,6 +172,7 @@ nice_tcp_bsd_socket_new (GMainContext *ctx, NiceAddress *addr) priv->server_addr = *addr; priv->error = FALSE; + sock->type = NICE_SOCKET_TYPE_TCP_BSD; sock->fileno = gsock; sock->send_messages = socket_send_messages; sock->recv_messages = socket_recv_messages; diff --git a/socket/tcp-turn.c b/socket/tcp-turn.c index c83372f..8028d21 100644 --- a/socket/tcp-turn.c +++ b/socket/tcp-turn.c @@ -84,6 +84,7 @@ nice_tcp_turn_socket_new (NiceSocket *base_socket, priv->compatibility = compatibility; priv->base_socket = base_socket; + sock->type = NICE_SOCKET_TYPE_TCP_TURN; sock->fileno = priv->base_socket->fileno; sock->addr = priv->base_socket->addr; sock->send_messages = socket_send_messages; diff --git a/socket/turn.c b/socket/turn.c index 39c1aaf..b0ad351 100644 --- a/socket/turn.c +++ b/socket/turn.c @@ -227,13 +227,16 @@ nice_turn_socket_new (GMainContext *ctx, NiceAddress *addr, (GEqualFunc) nice_address_equal, (GDestroyNotify) nice_address_free, priv_send_data_queue_destroy); - sock->addr = *addr; + + sock->type = NICE_SOCKET_TYPE_TURN; sock->fileno = base_socket->fileno; + sock->addr = *addr; sock->send_messages = socket_send_messages; sock->recv_messages = socket_recv_messages; sock->is_reliable = socket_is_reliable; sock->close = socket_close; sock->priv = (void *) priv; + return sock; } diff --git a/socket/udp-bsd.c b/socket/udp-bsd.c index 27191f8..9262ae4 100644 --- a/socket/udp-bsd.c +++ b/socket/udp-bsd.c @@ -141,6 +141,7 @@ nice_udp_bsd_socket_new (NiceAddress *addr) priv = sock->priv = g_slice_new0 (struct UdpBsdSocketPrivate); nice_address_init (&priv->niceaddr); + sock->type = NICE_SOCKET_TYPE_UDP_BSD; sock->fileno = gsock; sock->send_messages = socket_send_messages; sock->recv_messages = socket_recv_messages; |