You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2003/11/30 17:47:29 UTC
cvs commit: apr/test testsockets.c
trawick 2003/11/30 08:47:29
Modified: . CHANGES
include apr_network_io.h
network_io/os2 sockets.c
network_io/unix sockets.c
network_io/win32 sockets.c
test testsockets.c
Log:
Add apr_socket_type_get() for retrieving the type (e.g., stream)
of the socket.
Submitted by: Philippe M. Chiasson <gozer cpan.org>
Reviewed by: trawick
Revision Changes Path
1.443 +3 -0 apr/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.442
retrieving revision 1.443
diff -u -r1.442 -r1.443
--- CHANGES 20 Nov 2003 17:48:08 -0000 1.442
+++ CHANGES 30 Nov 2003 16:47:28 -0000 1.443
@@ -7,6 +7,9 @@
Changes with APR 1.0
+ *) Add apr_socket_type_get() for retrieving the type (e.g., stream)
+ of the socket. [Philippe M. Chiasson gozer cpan.org]
+
*) Removed deprecated interface apr_proc_other_child_check()
that behaved differently between win32 and unix.
The unix behavor is now accomplished with
1.149 +8 -1 apr/include/apr_network_io.h
Index: apr_network_io.h
===================================================================
RCS file: /home/cvs/apr/include/apr_network_io.h,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -r1.148 -r1.149
--- apr_network_io.h 20 Nov 2003 17:40:16 -0000 1.148
+++ apr_network_io.h 30 Nov 2003 16:47:29 -0000 1.149
@@ -727,7 +727,14 @@
APR_DECLARE(int) apr_sockaddr_equal(const apr_sockaddr_t *addr1,
const apr_sockaddr_t *addr2);
-
+/**
+* Return the type of the socket.
+* @param sock The socket to query.
+* @param type The returned type (e.g., SOCK_STREAM).
+*/
+APR_DECLARE(apr_status_t) apr_socket_type_get(apr_socket_t *sock,
+ int *type);
+
/**
* Given an apr_sockaddr_t and a service name, set the port for the service
* @param sockaddr The apr_sockaddr_t that will have its port set
1.68 +5 -0 apr/network_io/os2/sockets.c
Index: sockets.c
===================================================================
RCS file: /home/cvs/apr/network_io/os2/sockets.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- sockets.c 17 Nov 2003 01:41:18 -0000 1.67
+++ sockets.c 30 Nov 2003 16:47:29 -0000 1.68
@@ -240,6 +240,11 @@
}
}
+APR_DECLARE(apr_status_t) apr_socket_type_get(apr_socket_t *sock, int *type)
+{
+ *type = sock->type;
+ return APR_SUCCESS;
+}
APR_DECLARE(apr_status_t) apr_socket_data_get(void **data, const char *key,
apr_socket_t *sock)
1.117 +6 -0 apr/network_io/unix/sockets.c
Index: sockets.c
===================================================================
RCS file: /home/cvs/apr/network_io/unix/sockets.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -r1.116 -r1.117
--- sockets.c 24 Nov 2003 00:17:24 -0000 1.116
+++ sockets.c 30 Nov 2003 16:47:29 -0000 1.117
@@ -317,6 +317,12 @@
return APR_SUCCESS;
}
+apr_status_t apr_socket_type_get(apr_socket_t *sock, int *type)
+{
+ *type = sock->type;
+ return APR_SUCCESS;
+}
+
apr_status_t apr_socket_data_get(void **data, const char *key, apr_socket_t *sock)
{
sock_userdata_t *cur = sock->userdata;
1.103 +6 -0 apr/network_io/win32/sockets.c
Index: sockets.c
===================================================================
RCS file: /home/cvs/apr/network_io/win32/sockets.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -r1.102 -r1.103
--- sockets.c 17 Nov 2003 19:54:08 -0000 1.102
+++ sockets.c 30 Nov 2003 16:47:29 -0000 1.103
@@ -401,6 +401,12 @@
return APR_SUCCESS;
}
+APR_DECLARE(apr_status_t) apr_socket_type_get(apr_socket_t *sock, int *type)
+{
+ *type = sock->type;
+ return APR_SUCCESS;
+}
+
APR_DECLARE(apr_status_t) apr_socket_data_get(void **data, const char *key,
apr_socket_t *sock)
{
1.11 +12 -0 apr/test/testsockets.c
Index: testsockets.c
===================================================================
RCS file: /home/cvs/apr/test/testsockets.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- testsockets.c 3 Sep 2003 14:43:53 -0000 1.10
+++ testsockets.c 30 Nov 2003 16:47:29 -0000 1.11
@@ -72,10 +72,16 @@
{
apr_status_t rv;
apr_socket_t *sock = NULL;
+ int type;
rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, 0, p);
CuAssertIntEquals(tc, APR_SUCCESS, rv);
CuAssertPtrNotNull(tc, sock);
+
+ rv = apr_socket_type_get(sock, &type);
+ CuAssertIntEquals(tc, APR_SUCCESS, rv);
+ CuAssertIntEquals(tc, SOCK_STREAM, type);
+
apr_socket_close(sock);
}
@@ -83,10 +89,16 @@
{
apr_status_t rv;
apr_socket_t *sock = NULL;
+ int type;
rv = apr_socket_create(&sock, APR_INET, SOCK_DGRAM, 0, p);
CuAssertIntEquals(tc, APR_SUCCESS, rv);
CuAssertPtrNotNull(tc, sock);
+
+ rv = apr_socket_type_get(sock, &type);
+ CuAssertIntEquals(tc, APR_SUCCESS, rv);
+ CuAssertIntEquals(tc, SOCK_DGRAM, type);
+
apr_socket_close(sock);
}
Re: cvs commit: apr/test testsockets.c
Posted by Jeff Trawick <tr...@attglobal.net>.
Philippe M. Chiasson wrote:
> Don't know what happened to my e-mail address, but in any case,
> it can be completely removed (see below)
Whoops! I had intended to put "[Philippe M. Chiasson <gozer cpan.org>]"
following the recent convention with httpd. I've removed it altogether, as you
suggested.