ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/evdns.c
(Generate patch)

Comparing libev/evdns.c (file contents):
Revision 1.1 by root, Thu Nov 1 15:46:43 2007 UTC vs.
Revision 1.5 by root, Sat Nov 3 09:19:58 2007 UTC

1/* $Id: evdns.c,v 1.1 2007/11/01 15:46:43 root Exp $ */ 1#define DNS_USE_GETTIMEOFDAY_FOR_ID 1
2#define HAVE_STRUCT_IN6_ADDR 1
2 3
3/* The original version of this module was written by Adam Langley; for 4/* The original version of this module was written by Adam Langley; for
4 * a history of modifications, check out the subversion logs. 5 * a history of modifications, check out the subversion logs.
5 * 6 *
6 * When editing this module, try to keep it re-mergeable by Adam. Don't 7 * When editing this module, try to keep it re-mergeable by Adam. Don't
38#ifdef HAVE_CONFIG_H 39#ifdef HAVE_CONFIG_H
39#include "config.h" 40#include "config.h"
40#endif 41#endif
41 42
42#ifdef WIN32 43#ifdef WIN32
43#include "misc.h"
44#endif 44#endif
45 45
46/* #define NDEBUG */ 46/* #define NDEBUG */
47 47
48#ifndef DNS_USE_CPU_CLOCK_FOR_ID 48#ifndef DNS_USE_CPU_CLOCK_FOR_ID
92#include <ctype.h> 92#include <ctype.h>
93#include <stdio.h> 93#include <stdio.h>
94#include <stdarg.h> 94#include <stdarg.h>
95 95
96#include "evdns.h" 96#include "evdns.h"
97/*#include "log.h"*/
98#ifdef WIN32 97#ifdef WIN32
99#include <windows.h> 98#include <windows.h>
100#include <winsock2.h> 99#include <winsock2.h>
101#include <iphlpapi.h> 100#include <iphlpapi.h>
102#else 101#else
2265 request_submit(req); 2264 request_submit(req);
2266 return 0; 2265 return 0;
2267} 2266}
2268 2267
2269int evdns_resolve_reverse_ipv6(struct in6_addr *in, int flags, evdns_callback_type callback, void *ptr) { 2268int evdns_resolve_reverse_ipv6(struct in6_addr *in, int flags, evdns_callback_type callback, void *ptr) {
2270 char buf[64]; 2269 char buf[96];
2271 char *cp; 2270 char *cp;
2272 struct request *req; 2271 struct request *req;
2273 int i; 2272 int i;
2274 assert(in); 2273 assert(in);
2275 cp = buf; 2274 cp = buf;
2545 if (flags & DNS_OPTION_NAMESERVERS) evdns_nameserver_ip_add("127.0.0.1"); 2544 if (flags & DNS_OPTION_NAMESERVERS) evdns_nameserver_ip_add("127.0.0.1");
2546} 2545}
2547 2546
2548#ifndef HAVE_STRTOK_R 2547#ifndef HAVE_STRTOK_R
2549static char * 2548static char *
2550strtok_r(char *s, const char *delim, char **state) { 2549fake_strtok_r(char *s, const char *delim, char **state) {
2551 return strtok(s, delim); 2550 return strtok(s, delim);
2552} 2551}
2553#endif 2552#endif
2554 2553
2555/* helper version of atoi which returns -1 on error */ 2554/* helper version of atoi which returns -1 on error */
2621 2620
2622static void 2621static void
2623resolv_conf_parse_line(char *const start, int flags) { 2622resolv_conf_parse_line(char *const start, int flags) {
2624 char *strtok_state; 2623 char *strtok_state;
2625 static const char *const delims = " \t"; 2624 static const char *const delims = " \t";
2626#define NEXT_TOKEN strtok_r(NULL, delims, &strtok_state) 2625#define NEXT_TOKEN fake_strtok_r(NULL, delims, &strtok_state)
2627 2626
2628 char *const first_token = strtok_r(start, delims, &strtok_state); 2627 char *const first_token = fake_strtok_r(start, delims, &strtok_state);
2629 if (!first_token) return; 2628 if (!first_token) return;
2630 2629
2631 if (!strcmp(first_token, "nameserver") && (flags & DNS_OPTION_NAMESERVERS)) { 2630 if (!strcmp(first_token, "nameserver") && (flags & DNS_OPTION_NAMESERVERS)) {
2632 const char *const nameserver = NEXT_TOKEN; 2631 const char *const nameserver = NEXT_TOKEN;
2633 struct in_addr ina; 2632 struct in_addr ina;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines