rbb 99/04/23 06:34:51
Modified: docs networkio.txt
include apr_network_io.h
apr/test ab_apr.c
apr/network_io/unix sockets.c
Log:
Add a new network IO function. apr_valid_socket. Same as apr_valid_file,
but it works on sockets.
Submitted by: David Reid
Revision Changes Path
1.14 +10 -4 apache-apr/docs/networkio.txt
Index: networkio.txt
===================================================================
RCS file: /home/cvs/apache-apr/docs/networkio.txt,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- networkio.txt 1999/04/22 14:54:42 1.13
+++ networkio.txt 1999/04/23 13:34:48 1.14
@@ -148,11 +148,17 @@
return) name of remote machine.
apr_status_t apr_gethostname(char *, int)
- Get the host name for the machine
+ Get the host name for the machine
Arguments:
- arg 1) Buffer to write name to.
- arg 2) Size of buffer.
- return) APR_SUCCESS or APR_FAILURE
+ arg 1) Buffer to write name to.
+ arg 2) Size of buffer.
+ return) APR_SUCCESS or APR_FAILURE
+
+ apr_status_t apr_socket_valid(apr_socket_t *)
+ is the socket that was created valid?
+ Arguments:
+ arg 1) The socket to check
+ return) APR_SUCCESS or APR_FAILURE
APRStatus apr_familyinet(APRInt16)
Get the value of the address family for IP
1.12 +3 -0 apache-apr/include/apr_network_io.h
Index: apr_network_io.h
===================================================================
RCS file: /home/cvs/apache-apr/include/apr_network_io.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- apr_network_io.h 1999/04/22 14:54:44 1.11
+++ apr_network_io.h 1999/04/23 13:34:49 1.12
@@ -106,5 +106,8 @@
apr_status_t apr_sd_isset(apr_socket_t *, apr_sd_set_t *);
void apr_sd_zero(apr_sd_set_t *);
+/* accessor functions */
+apr_status_t apr_valid_socket(apr_socket_t *);
+
#endif /* ! APR_FILE_IO_H */
1.3 +2 -0 apache-apr/apr/test/ab_apr.c
Index: ab_apr.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/test/ab_apr.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ab_apr.c 1999/04/23 11:46:11 1.2
+++ ab_apr.c 1999/04/23 13:34:49 1.3
@@ -478,6 +478,8 @@
c->gotheader = 0;
c->aprsock = apr_create_tcp_socket();
+ if (apr_valid_socket(c->aprsock) == APR_FAILURE)
+ err("Socket:");
nonblock(c->aprsock);
gettimeofday(&c->start, 0);
if (apr_connect(c->aprsock, hostname, port) == APR_FAILURE){
1.9 +7 -1 apache-apr/apr/network_io/unix/sockets.c
Index: sockets.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/network_io/unix/sockets.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- sockets.c 1999/04/22 14:54:46 1.8
+++ sockets.c 1999/04/23 13:34:50 1.9
@@ -180,4 +180,10 @@
}
}
-
+apr_status_t apr_valid_socket(apr_socket_t *sock)
+{
+ if (sock->socketdes < 0)
+ return APR_FAILURE;
+ return APR_SUCCESS;
+}
+