Apache HTTPD
testsock.c
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "testutil.h"
18#include "testsock.h"
19#include "apr_thread_proc.h"
20#include "apr_network_io.h"
21#include "apr_errno.h"
22#include "apr_general.h"
23#include "apr_lib.h"
24#include "apr_strings.h"
25#include "apr_poll.h"
26#define APR_WANT_BYTEFUNC
27#include "apr_want.h"
28
29#define UNIX_SOCKET_NAME "/tmp/apr-socket"
30#define IPV4_SOCKET_NAME "127.0.0.1"
31static char *socket_name = NULL;
32static int socket_type = APR_INET;
33
34static void launch_child(abts_case *tc, apr_proc_t *proc, const char *arg1, apr_pool_t *p)
35{
36 apr_procattr_t *procattr;
37 const char *args[4];
38 apr_status_t rv;
39
40 rv = apr_procattr_create(&procattr, p);
41 APR_ASSERT_SUCCESS(tc, "Couldn't create procattr", rv);
42
45 APR_ASSERT_SUCCESS(tc, "Couldn't set io in procattr", rv);
46
47 rv = apr_procattr_error_check_set(procattr, 1);
48 APR_ASSERT_SUCCESS(tc, "Couldn't set error check in procattr", rv);
49
51 APR_ASSERT_SUCCESS(tc, "Couldn't set copy environment", rv);
52
53 args[0] = "sockchild" EXTENSION;
54 args[1] = arg1;
55 args[2] = socket_name;
56 args[3] = NULL;
58 procattr, p);
59 APR_ASSERT_SUCCESS(tc, "Couldn't launch program", rv);
60}
61
63{
64 int exitcode;
66
67 ABTS_ASSERT(tc, "Error waiting for child process",
69
70 ABTS_ASSERT(tc, "child terminated normally", why == APR_PROC_EXIT);
71 return exitcode;
72}
73
74static void test_addr_info(abts_case *tc, void *data)
75{
76 apr_status_t rv;
78 int rc;
79
80 rv = apr_sockaddr_info_get(&sa, NULL, APR_UNSPEC, 80, 0, p);
81 APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
82
84 ABTS_INT_NEQUAL(tc, 0, rc);
85
86 rv = apr_sockaddr_info_get(&sa, "127.0.0.1", APR_UNSPEC, 80, 0, p);
87 APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
88 ABTS_STR_EQUAL(tc, "127.0.0.1", sa->hostname);
89
91 ABTS_INT_EQUAL(tc, 0, rc);
92
93 rv = apr_sockaddr_info_get(&sa, "127.0.0.1", APR_UNSPEC, 0, 0, p);
94 APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
95 ABTS_STR_EQUAL(tc, "127.0.0.1", sa->hostname);
96 ABTS_INT_EQUAL(tc, 0, sa->port);
97 ABTS_INT_EQUAL(tc, 0, ntohs(sa->sa.sin.sin_port));
98}
99
100static void test_addr_copy(abts_case *tc, void *data)
101{
102 apr_status_t rv;
104 int rc;
105 const char *hosts[] = {
106 "127.0.0.1",
107#if APR_HAVE_IPV6
108 "::1",
109#endif
110 NULL
111 }, **host = hosts;
112
113 /* Loop up to and including NULL */
114 do {
115 rv = apr_sockaddr_info_get(&sa1, *host, APR_UNSPEC, 80, 0, p);
116 APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
117
119 APR_ASSERT_SUCCESS(tc, "Problem copying sockaddr", rv);
120
122 do {
124
126 ABTS_INT_NEQUAL(tc, 0, rc);
127 ABTS_INT_EQUAL(tc, 80, sa1->port);
128 ABTS_INT_EQUAL(tc, sa2->port, sa1->port);
129 ABTS_INT_EQUAL(tc, 80, ntohs(sa1->sa.sin.sin_port));
130 ABTS_INT_EQUAL(tc, ntohs(sa2->sa.sin.sin_port), ntohs(sa1->sa.sin.sin_port));
131
132 if (*host) {
133 ABTS_PTR_NOTNULL(tc, sa1->hostname);
134 ABTS_PTR_NOTNULL(tc, sa2->hostname);
135 ABTS_STR_EQUAL(tc, *host, sa1->hostname);
136 ABTS_STR_EQUAL(tc, sa1->hostname, sa2->hostname);
137 ABTS_TRUE(tc, sa1->hostname != sa2->hostname);
138 }
139 else {
140 ABTS_PTR_EQUAL(tc, NULL, sa1->hostname);
141 ABTS_PTR_EQUAL(tc, NULL, sa2->hostname);
142 }
143
144 } while ((sa2 = sa2->next, sa1 = sa1->next));
145 ABTS_PTR_EQUAL(tc, NULL, sa2);
146
147 } while (*host++);
148}
149
150static void test_serv_by_name(abts_case *tc, void *data)
151{
152 apr_status_t rv;
154
155 rv = apr_sockaddr_info_get(&sa, NULL, APR_UNSPEC, 0, 0, p);
156 APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
157
158 rv = apr_getservbyname(sa, "ftp");
159 APR_ASSERT_SUCCESS(tc, "Problem getting ftp service", rv);
160 ABTS_INT_EQUAL(tc, 21, sa->port);
161
162 rv = apr_getservbyname(sa, "complete_and_utter_rubbish");
163 APR_ASSERT_SUCCESS(tc, "Problem getting non-existent service", !rv);
164
165 rv = apr_getservbyname(sa, "telnet");
166 APR_ASSERT_SUCCESS(tc, "Problem getting telnet service", rv);
167 ABTS_INT_EQUAL(tc, 23, sa->port);
168}
169
171{
172 apr_status_t rv;
175
177 APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
178
180 APR_ASSERT_SUCCESS(tc, "Problem creating socket", rv);
181
183 APR_ASSERT_SUCCESS(tc, "Could not set REUSEADDR on socket", rv);
184
185 rv = apr_socket_bind(sock, sa);
186 APR_ASSERT_SUCCESS(tc, "Problem binding to port", rv);
187 if (rv) return NULL;
188
189 rv = apr_socket_listen(sock, 5);
190 APR_ASSERT_SUCCESS(tc, "Problem listening on socket", rv);
191
192 return sock;
193}
194
196{
197 apr_status_t rv;
199
200 if (!sock) return;
201
203 APR_ASSERT_SUCCESS(tc, "Problem closing socket", rv);
204}
205
206static void test_send(abts_case *tc, void *data)
207{
208 apr_status_t rv;
212 int protocol;
214
215 sock = setup_socket(tc);
216 if (!sock) return;
217
218 launch_child(tc, &proc, "read", p);
219
220 rv = apr_socket_accept(&sock2, sock, p);
221 APR_ASSERT_SUCCESS(tc, "Problem with receiving connection", rv);
222
225
226 length = strlen(DATASTR);
228
229 /* Make sure that the client received the data we sent */
230 ABTS_SIZE_EQUAL(tc, strlen(DATASTR), wait_child(tc, &proc));
231
233 APR_ASSERT_SUCCESS(tc, "Problem closing connected socket", rv);
235 APR_ASSERT_SUCCESS(tc, "Problem closing socket", rv);
236}
237
238static void test_recv(abts_case *tc, void *data)
239{
240 apr_status_t rv;
244 int protocol;
246 char datastr[STRLEN];
247
248 sock = setup_socket(tc);
249 if (!sock) return;
250
251 launch_child(tc, &proc, "write", p);
252
253 rv = apr_socket_accept(&sock2, sock, p);
254 APR_ASSERT_SUCCESS(tc, "Problem with receiving connection", rv);
255
258
259 memset(datastr, 0, STRLEN);
261
262 /* Make sure that the server received the data we sent */
264 ABTS_SIZE_EQUAL(tc, strlen(datastr), wait_child(tc, &proc));
265
267 APR_ASSERT_SUCCESS(tc, "Problem closing connected socket", rv);
269 APR_ASSERT_SUCCESS(tc, "Problem closing socket", rv);
270}
271
272static void test_atreadeof(abts_case *tc, void *data)
273{
274 apr_status_t rv;
279 char datastr[STRLEN];
280 int atreadeof = -1;
281
282 sock = setup_socket(tc);
283 if (!sock) return;
284
285 launch_child(tc, &proc, "write", p);
286
287 rv = apr_socket_accept(&sock2, sock, p);
288 APR_ASSERT_SUCCESS(tc, "Problem with receiving connection", rv);
289
290 /* Check that the remote socket is still open */
292 APR_ASSERT_SUCCESS(tc, "Determine whether at EOF, #1", rv);
294
295 memset(datastr, 0, STRLEN);
297
298 /* Make sure that the server received the data we sent */
300 ABTS_SIZE_EQUAL(tc, strlen(datastr), wait_child(tc, &proc));
301
302 /* The child is dead, so should be the remote socket */
304 APR_ASSERT_SUCCESS(tc, "Determine whether at EOF, #2", rv);
306
308 APR_ASSERT_SUCCESS(tc, "Problem closing connected socket", rv);
309
310 launch_child(tc, &proc, "close", p);
311
312 rv = apr_socket_accept(&sock2, sock, p);
313 APR_ASSERT_SUCCESS(tc, "Problem with receiving connection", rv);
314
315 /* The child closed the socket as soon as it could... */
317 APR_ASSERT_SUCCESS(tc, "Determine whether at EOF, #3", rv);
318 if (!atreadeof) { /* ... but perhaps not yet; wait a moment */
321 APR_ASSERT_SUCCESS(tc, "Determine whether at EOF, #4", rv);
322 }
324 wait_child(tc, &proc);
325
327 APR_ASSERT_SUCCESS(tc, "Problem closing connected socket", rv);
328
330 APR_ASSERT_SUCCESS(tc, "Problem closing socket", rv);
331}
332
333static void test_timeout(abts_case *tc, void *data)
334{
335 apr_status_t rv;
339 int protocol;
340 int exit;
341
342 sock = setup_socket(tc);
343 if (!sock) return;
344
345 launch_child(tc, &proc, "read", p);
346
347 rv = apr_socket_accept(&sock2, sock, p);
348 APR_ASSERT_SUCCESS(tc, "Problem with receiving connection", rv);
349
352
353 exit = wait_child(tc, &proc);
355
356 /* We didn't write any data, so make sure the child program returns
357 * an error.
358 */
360 APR_ASSERT_SUCCESS(tc, "Problem closing connected socket", rv);
362 APR_ASSERT_SUCCESS(tc, "Problem closing socket", rv);
363}
364
365static void test_print_addr(abts_case *tc, void *data)
366{
368 apr_status_t rv;
369 char *s;
370
371 rv = apr_sockaddr_info_get(&sa, "0.0.0.0", APR_INET, 80, 0, p);
372 APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
373
374 s = apr_psprintf(p, "foo %pI bar", sa);
375
376 ABTS_STR_EQUAL(tc, "foo 0.0.0.0:80 bar", s);
377
378#if APR_HAVE_IPV6
379 rv = apr_sockaddr_info_get(&sa, "::ffff:0.0.0.0", APR_INET6, 80, 0, p);
380 APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
381 if (rv == APR_SUCCESS)
382 ABTS_TRUE(tc, sa != NULL);
383 if (rv == APR_SUCCESS && sa) {
384 /* sa should now be a v4-mapped IPv6 address. */
385 char buf[128];
386 int rc;
387
389 ABTS_INT_NEQUAL(tc, 0, rc);
390
391 memset(buf, 'z', sizeof buf);
392
393 APR_ASSERT_SUCCESS(tc, "could not get IP address",
395
396 ABTS_STR_EQUAL(tc, "0.0.0.0", buf);
397 }
398#endif
399}
400
401static void test_get_addr(abts_case *tc, void *data)
402{
403 apr_status_t rv;
404 apr_socket_t *ld, *sd, *cd;
407 char *a, *b;
408
409 APR_ASSERT_SUCCESS(tc, "create subpool", apr_pool_create(&subp, p));
410
411 ld = setup_socket(tc);
412 if (!ld) return;
413
415 "get local address of bound socket",
417
420 APR_ASSERT_SUCCESS(tc, "create client socket", rv);
421
422 APR_ASSERT_SUCCESS(tc, "enable non-block mode",
424
425 /* It is valid for a connect() on a non-blocking socket to succeed
426 * (if the connection can be established synchronously), but if it
427 * does, this test cannot proceed. */
428 rv = apr_socket_connect(cd, sa);
429 if (rv == APR_SUCCESS) {
432 ABTS_SKIP(tc, data, "Cannot test if connect() completes "
433 "synchronously");
434 return;
435 }
436
437 if (!APR_STATUS_IS_EINPROGRESS(rv)) {
440 APR_ASSERT_SUCCESS(tc, "connect to listener", rv);
441 return;
442 }
443
444 APR_ASSERT_SUCCESS(tc, "accept connection",
445 apr_socket_accept(&sd, ld, subp));
446
447 {
448 /* wait for writability */
449 apr_pollfd_t pfd;
450 int n;
451
452 pfd.p = p;
455 pfd.desc.s = cd;
456 pfd.client_data = NULL;
457
458 APR_ASSERT_SUCCESS(tc, "poll for connect completion",
459 apr_poll(&pfd, 1, &n, 5 * APR_USEC_PER_SEC));
460
461 }
462
463 APR_ASSERT_SUCCESS(tc, "get local address of server socket",
465 APR_ASSERT_SUCCESS(tc, "get remote address of client socket",
467
468 /* Test that the pool of the returned sockaddr objects exactly
469 * match the socket. */
470 ABTS_PTR_EQUAL(tc, subp, sa->pool);
471 ABTS_PTR_EQUAL(tc, subp, ca->pool);
472
473 /* Check equivalence. */
474 a = apr_psprintf(p, "%pI fam=%d", sa, sa->family);
475 b = apr_psprintf(p, "%pI fam=%d", ca, ca->family);
476 ABTS_STR_EQUAL(tc, a, b);
477
478 /* Check pool of returned sockaddr, as above. */
479 APR_ASSERT_SUCCESS(tc, "get local address of client socket",
481 APR_ASSERT_SUCCESS(tc, "get remote address of server socket",
483
484 /* Check equivalence. */
485 a = apr_psprintf(p, "%pI fam=%d", sa, sa->family);
486 b = apr_psprintf(p, "%pI fam=%d", ca, ca->family);
487 ABTS_STR_EQUAL(tc, a, b);
488
489 ABTS_PTR_EQUAL(tc, subp, sa->pool);
490 ABTS_PTR_EQUAL(tc, subp, ca->pool);
491
495
497}
498
499/* Make sure that setting a connected socket non-blocking works
500 * when the listening socket was non-blocking.
501 * If APR thinks that non-blocking is inherited but it really
502 * isn't, this testcase will fail.
503 */
505{
506 apr_status_t rv;
510 char buffer[10];
512 int tries;
513
514 sock = setup_socket(tc);
515 if (!sock) return;
516
518 APR_ASSERT_SUCCESS(tc, "Could not make listening socket nonblocking", rv);
519
520 launch_child(tc, &proc, "write_after_delay", p);
521
522 tries = 10;
523 while (tries--) {
524 rv = apr_socket_accept(&sock2, sock, p);
525 if (!APR_STATUS_IS_EAGAIN(rv)) {
526 break;
527 }
529 }
530 APR_ASSERT_SUCCESS(tc, "Problem with receiving connection", rv);
531
533 APR_ASSERT_SUCCESS(tc, "Could not make connected socket nonblocking", rv);
534
535 length = sizeof buffer;
537 ABTS_ASSERT(tc, "should have gotten EAGAIN", APR_STATUS_IS_EAGAIN(rv));
538
539 wait_child(tc, &proc);
540
542 APR_ASSERT_SUCCESS(tc, "Problem closing connected socket", rv);
544 APR_ASSERT_SUCCESS(tc, "Problem closing socket", rv);
545}
546
547static void test_freebind(abts_case *tc, void *data)
548{
549#ifdef IP_FREEBIND
550 apr_status_t rv;
554
555 /* RFC 5737 address */
556 rv = apr_sockaddr_info_get(&sa, "192.0.2.1", APR_INET, 8080, 0, p);
557 APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
558
560 APR_ASSERT_SUCCESS(tc, "Problem creating socket", rv);
561
563 APR_ASSERT_SUCCESS(tc, "Could not set REUSEADDR on socket", rv);
564
566 APR_ASSERT_SUCCESS(tc, "Could not enable FREEBIND option", rv);
567
569 APR_ASSERT_SUCCESS(tc, "Could not retrieve FREEBIND option", rv);
570 ABTS_INT_EQUAL(tc, 1, on);
571
572 rv = apr_socket_bind(sock, sa);
573 APR_ASSERT_SUCCESS(tc, "Problem binding to port with FREEBIND", rv);
574
576 APR_ASSERT_SUCCESS(tc, "Problem closing socket", rv);
577#endif
578}
579
580#define TEST_ZONE_ADDR "fe80::1"
581
582#ifdef __linux__
583/* Reasonable bet that "lo" will exist. */
584#define TEST_ZONE_NAME "lo"
585/* ... fill in other platforms here */
586#endif
587
588#ifdef TEST_ZONE_NAME
589#define TEST_ZONE_FULLADDR TEST_ZONE_ADDR "%" TEST_ZONE_NAME
590#endif
591
592static void test_zone(abts_case *tc, void *data)
593{
594#if APR_HAVE_IPV6
596 apr_status_t rv;
597 const char *name = NULL;
598 apr_uint32_t id = 0;
599
600 rv = apr_sockaddr_info_get(&sa, "127.0.0.1", APR_INET, 8080, 0, p);
601 APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
602
603 /* Fail for an IPv4 address! */
607 apr_sockaddr_zone_get(sa, &name, &id, p));
608
609 rv = apr_sockaddr_info_get(&sa, "::1", APR_INET6, 8080, 0, p);
610 APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
611
612 /* Fail for an address which isn't link-local */
614
616 APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
617
619
620#ifdef TEST_ZONE_NAME
621 {
623 char buf[50];
624
625 APR_ASSERT_SUCCESS(tc, "Set zone to " TEST_ZONE_NAME,
627
628 APR_ASSERT_SUCCESS(tc, "Get zone",
630
631 APR_ASSERT_SUCCESS(tc, "Get zone",
632 apr_sockaddr_zone_get(sa, &name, &id, p));
634 ABTS_INT_NEQUAL(tc, 0, id); /* Only guarantee is that it should be non-zero */
635
636 /* Check string translation. */
637 APR_ASSERT_SUCCESS(tc, "get IP address",
640
641 memset(buf, 'A', sizeof buf);
644
645 APR_ASSERT_SUCCESS(tc, "get IP address",
647 /* Check for overflow. */
648 ABTS_INT_EQUAL(tc, 'A', buf[strlen(buf) + 1]);
649
651 APR_ASSERT_SUCCESS(tc, "Problem copying sockaddr", rv);
652
653 /* Copy copied zone matches */
654 APR_ASSERT_SUCCESS(tc, "Get zone",
657 ABTS_INT_NEQUAL(tc, 0, id); /* Only guarantee is that it should be non-zero */
658
659 /* Should match self and copy */
663
664 /* Should not match against copy without zone set. */
666 APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
667
669 }
670#endif /* TEST_ZONE_NAME */
671#endif /* APR_HAVE_IPV6 */
672}
673
702
int n
Definition ap_regex.h:278
void abts_run_test(abts_suite *ts, test_func f, void *value)
Definition abts.c:175
#define ABTS_SIZE_EQUAL(a, b, c)
Definition abts.h:121
#define ABTS_PTR_EQUAL(a, b, c)
Definition abts.h:126
#define ABTS_TRUE(a, b)
Definition abts.h:127
#define ADD_SUITE(suite)
Definition abts.h:67
#define ABTS_PTR_NOTNULL(a, b)
Definition abts.h:125
#define ABTS_INT_NEQUAL(a, b, c)
Definition abts.h:110
#define ABTS_STR_EQUAL(a, b, c)
Definition abts.h:123
#define ABTS_SKIP(tc, data, msg)
Definition abts.h:135
#define ABTS_ASSERT(a, b, c)
Definition abts.h:130
#define ABTS_INT_EQUAL(a, b, c)
Definition abts.h:109
#define EXTENSION
Definition testutil.h:43
#define TESTBINPATH
Definition testutil.h:35
#define APR_ASSERT_SUCCESS(tc, ctxt, rv)
Definition testutil.h:58
APR Error Codes.
APR Miscellaneous library routines.
APR general purpose library routines.
APR Network library.
APR Poll interface.
APR Strings library.
APR Thread and Process Library.
APR Standard Headers Support.
const unsigned char * buf
Definition util_md5.h:50
const char * host
Definition http_vhost.h:124
#define APR_ENOSPC
Definition apr_errno.h:676
#define APR_CHILD_DONE
Definition apr_errno.h:446
#define APR_EBADIP
Definition apr_errno.h:317
#define APR_STATUS_IS_EINPROGRESS(s)
Definition apr_errno.h:1287
#define APR_STATUS_IS_EAGAIN(s)
Definition apr_errno.h:1272
apr_bucket apr_bucket_brigade * a
int apr_off_t * length
apr_redis_t * rc
Definition apr_redis.h:173
#define APR_PROTO_TCP
apr_size_t size
#define APR_SUCCESS
Definition apr_errno.h:225
int apr_status_t
Definition apr_errno.h:44
void * data
char * buffer
apr_socket_t * sock
apr_sockaddr_t * sa
#define APR_UNIX
#define APR_UNSPEC
#define APR_INET
int int int protocol
apr_int32_t apr_int32_t on
int * atreadeof
@ APR_LOCAL
@ APR_REMOTE
@ APR_POLL_SOCKET
Definition apr_poll.h:93
apr_pool_t * b
Definition apr_pools.h:529
#define apr_pool_create(newpool, parent)
Definition apr_pools.h:322
#define APR_SO_FREEBIND
#define APR_SO_REUSEADDR
#define APR_SO_NONBLOCK
const char * s
Definition apr_strings.h:95
apr_proc_t * proc
const char const char *const * args
#define APR_NO_PIPE
apr_exit_why_e
int * exitcode
@ APR_WAIT
@ APR_PROC_EXIT
@ APR_PROGRAM_ENV
#define apr_time_from_msec(msec)
Definition apr_time.h:75
#define APR_USEC_PER_SEC
Definition apr_time.h:60
#define APR_POLLOUT
Definition apr_poll.h:51
#define APR_POLLHUP
Definition apr_poll.h:53
apr_pool_t * p
Definition md_event.c:32
return NULL
Definition mod_so.c:359
char * name
void * client_data
Definition apr_poll.h:114
apr_int16_t reqevents
Definition apr_poll.h:111
apr_datatype_e desc_type
Definition apr_poll.h:110
apr_descriptor desc
Definition apr_poll.h:113
apr_pool_t * p
Definition apr_poll.h:109
union apr_sockaddr_t::@55 sa
apr_pool_t * pool
struct sockaddr_in sin
apr_int32_t family
#define IPV4_SOCKET_NAME
Definition testsock.c:30
static void test_freebind(abts_case *tc, void *data)
Definition testsock.c:547
abts_suite * testsock(abts_suite *suite)
Definition testsock.c:674
static void test_timeout(abts_case *tc, void *data)
Definition testsock.c:333
static void test_addr_copy(abts_case *tc, void *data)
Definition testsock.c:100
static void test_recv(abts_case *tc, void *data)
Definition testsock.c:238
static void test_addr_info(abts_case *tc, void *data)
Definition testsock.c:74
static void test_send(abts_case *tc, void *data)
Definition testsock.c:206
static void test_create_bind_listen(abts_case *tc, void *data)
Definition testsock.c:195
static int socket_type
Definition testsock.c:32
static void test_zone(abts_case *tc, void *data)
Definition testsock.c:592
static void test_atreadeof(abts_case *tc, void *data)
Definition testsock.c:272
static char * socket_name
Definition testsock.c:31
#define UNIX_SOCKET_NAME
Definition testsock.c:29
static void test_get_addr(abts_case *tc, void *data)
Definition testsock.c:401
static void launch_child(abts_case *tc, apr_proc_t *proc, const char *arg1, apr_pool_t *p)
Definition testsock.c:34
static void test_print_addr(abts_case *tc, void *data)
Definition testsock.c:365
#define TEST_ZONE_ADDR
Definition testsock.c:580
static void test_nonblock_inheritance(abts_case *tc, void *data)
Definition testsock.c:504
static int wait_child(abts_case *tc, apr_proc_t *proc)
Definition testsock.c:62
static apr_socket_t * setup_socket(abts_case *tc)
Definition testsock.c:170
static void test_serv_by_name(abts_case *tc, void *data)
Definition testsock.c:150
#define STRLEN
Definition testsock.h:21
#define DATASTR
Definition testsock.h:20
#define SOCKET_TIMEOUT
Definition testsock.h:31
apr_socket_t * s
Definition apr_poll.h:101
apr_status_t apr_socket_send(apr_socket_t *sock, const char *buf, apr_size_t *len)
Definition sendrecv.c:30
apr_status_t apr_socket_recv(apr_socket_t *sock, char *buf, apr_size_t *len)
Definition sendrecv.c:70
apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, apr_pool_t *connection_context)
Definition sockets.c:247
apr_status_t apr_socket_listen(apr_socket_t *sock, apr_int32_t backlog)
Definition sockets.c:239
apr_status_t apr_socket_bind(apr_socket_t *sock, apr_sockaddr_t *sa)
Definition sockets.c:216
apr_status_t apr_socket_close(apr_socket_t *thesocket)
Definition sockets.c:211
apr_status_t apr_socket_connect(apr_socket_t *sock, apr_sockaddr_t *sa)
Definition sockets.c:388
apr_status_t apr_socket_protocol_get(apr_socket_t *sock, int *protocol)
Definition sockets.c:110
apr_status_t apr_socket_create(apr_socket_t **new, int ofamily, int type, int protocol, apr_pool_t *cont)
Definition sockets.c:116
apr_status_t apr_socket_opt_set(apr_socket_t *sock, apr_int32_t opt, apr_int32_t on)
Definition sockopt.c:113
apr_status_t apr_socket_opt_get(apr_socket_t *sock, apr_int32_t opt, apr_int32_t *on)
Definition sockopt.c:362
apr_status_t apr_socket_timeout_set(apr_socket_t *sock, apr_interval_time_t t)
Definition sockopt.c:75