Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: third_party/libevent/test/regress_dns.c

Issue 412006: posix: upgrade libevent from 1.4.7 to 1.4.13 (Closed)
Patch Set: better readme Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2003-2006 Niels Provos <provos@citi.umich.edu> 2 * Copyright (c) 2003-2006 Niels Provos <provos@citi.umich.edu>
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 24 matching lines...) Expand all
35 #endif 35 #endif
36 36
37 #include <sys/types.h> 37 #include <sys/types.h>
38 #include <sys/stat.h> 38 #include <sys/stat.h>
39 #ifdef HAVE_SYS_TIME_H 39 #ifdef HAVE_SYS_TIME_H
40 #include <sys/time.h> 40 #include <sys/time.h>
41 #endif 41 #endif
42 #include <sys/queue.h> 42 #include <sys/queue.h>
43 #ifndef WIN32 43 #ifndef WIN32
44 #include <sys/socket.h> 44 #include <sys/socket.h>
45 #include <sys/signal.h> 45 #include <signal.h>
46 #include <netinet/in.h> 46 #include <netinet/in.h>
47 #include <arpa/inet.h> 47 #include <arpa/inet.h>
48 #include <unistd.h> 48 #include <unistd.h>
49 #endif 49 #endif
50 #ifdef HAVE_NETINET_IN6_H 50 #ifdef HAVE_NETINET_IN6_H
51 #include <netinet/in6.h> 51 #include <netinet/in6.h>
52 #endif 52 #endif
53 #ifdef HAVE_NETDB_H 53 #ifdef HAVE_NETDB_H
54 #include <netdb.h> 54 #include <netdb.h>
55 #endif 55 #endif
(...skipping 26 matching lines...) Expand all
82 82
83 if (result != DNS_ERR_NONE) { 83 if (result != DNS_ERR_NONE) {
84 fprintf(stdout, "[Error code %d] ", result); 84 fprintf(stdout, "[Error code %d] ", result);
85 goto out; 85 goto out;
86 } 86 }
87 87
88 fprintf(stderr, "type: %d, count: %d, ttl: %d: ", type, count, ttl); 88 fprintf(stderr, "type: %d, count: %d, ttl: %d: ", type, count, ttl);
89 89
90 switch (type) { 90 switch (type) {
91 case DNS_IPv6_AAAA: { 91 case DNS_IPv6_AAAA: {
92 #if defined(HAVE_STRUCT_IN6_ADDR) && defined(HAVE_INET_NTOP) 92 #if defined(HAVE_STRUCT_IN6_ADDR) && defined(HAVE_INET_NTOP) && defined(INET6_AD DRSTRLEN)
93 struct in6_addr *in6_addrs = addresses; 93 struct in6_addr *in6_addrs = addresses;
94 char buf[INET6_ADDRSTRLEN+1]; 94 char buf[INET6_ADDRSTRLEN+1];
95 int i; 95 int i;
96 /* a resolution that's not valid does not help */ 96 /* a resolution that's not valid does not help */
97 if (ttl < 0) 97 if (ttl < 0)
98 goto out; 98 goto out;
99 for (i = 0; i < count; ++i) { 99 for (i = 0; i < count; ++i) {
100 const char *b = inet_ntop(AF_INET6, &in6_addrs[i], buf,s izeof(buf)); 100 const char *b = inet_ntop(AF_INET6, &in6_addrs[i], buf,s izeof(buf));
101 if (b) 101 if (b)
102 fprintf(stderr, "%s ", b); 102 fprintf(stderr, "%s ", b);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 struct in_addr *in_addrs = addresses; 251 struct in_addr *in_addrs = addresses;
252 if (in_addrs[0].s_addr != htonl(0xc0a80b0bUL) || ttl != 12345) { 252 if (in_addrs[0].s_addr != htonl(0xc0a80b0bUL) || ttl != 12345) {
253 fprintf(stdout, "Bad IPv4 response \"%s\" %d. ", 253 fprintf(stdout, "Bad IPv4 response \"%s\" %d. ",
254 inet_ntoa(in_addrs[0]), ttl); 254 inet_ntoa(in_addrs[0]), ttl);
255 dns_ok = 0; 255 dns_ok = 0;
256 goto out; 256 goto out;
257 } 257 }
258 break; 258 break;
259 } 259 }
260 case DNS_IPv6_AAAA: { 260 case DNS_IPv6_AAAA: {
261 #if defined (HAVE_STRUCT_IN6_ADDR) && defined(HAVE_INET_NTOP) 261 #if defined (HAVE_STRUCT_IN6_ADDR) && defined(HAVE_INET_NTOP) && defined(INET6_A DDRSTRLEN)
262 struct in6_addr *in6_addrs = addresses; 262 struct in6_addr *in6_addrs = addresses;
263 char buf[INET6_ADDRSTRLEN+1]; 263 char buf[INET6_ADDRSTRLEN+1];
264 if (memcmp(&in6_addrs[0].s6_addr, "abcdefghijklmnop", 16) 264 if (memcmp(&in6_addrs[0].s6_addr, "abcdefghijklmnop", 16)
265 || ttl != 123) { 265 || ttl != 123) {
266 const char *b = inet_ntop(AF_INET6, &in6_addrs[0],buf,si zeof(buf)); 266 const char *b = inet_ntop(AF_INET6, &in6_addrs[0],buf,si zeof(buf));
267 fprintf(stdout, "Bad IPv6 response \"%s\" %d. ", b, ttl) ; 267 fprintf(stdout, "Bad IPv6 response \"%s\" %d. ", b, ttl) ;
268 dns_ok = 0; 268 dns_ok = 0;
269 goto out; 269 goto out;
270 } 270 }
271 #endif 271 #endif
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 { 367 {
368 dns_server(); /* Do this before we call evdns_init. */ 368 dns_server(); /* Do this before we call evdns_init. */
369 369
370 evdns_init(); 370 evdns_init();
371 dns_gethostbyname(); 371 dns_gethostbyname();
372 dns_gethostbyname6(); 372 dns_gethostbyname6();
373 dns_gethostbyaddr(); 373 dns_gethostbyaddr();
374 374
375 evdns_shutdown(0); 375 evdns_shutdown(0);
376 } 376 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698