summaryrefslogtreecommitdiff
path: root/ares_private.h
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-05-13 20:48:48 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-05-13 20:48:48 +0000
commit46dbd9461af66b9aa11a7f9e776979df6be028ac (patch)
tree3bfc49e25d58aec0342727b02ba904c7ea6c7e0e /ares_private.h
parent76d91c21ad6248518e37eb6dd6b52fb7ab8a7fbd (diff)
downloadc-ares-46dbd9461af66b9aa11a7f9e776979df6be028ac.tar.gz
c-ares-46dbd9461af66b9aa11a7f9e776979df6be028ac.tar.bz2
c-ares-46dbd9461af66b9aa11a7f9e776979df6be028ac.zip
- Introducing millisecond resolution support for the timeout option. See
ares_init_options()'s ARES_OPT_TIMEOUTMS.
Diffstat (limited to 'ares_private.h')
-rw-r--r--ares_private.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/ares_private.h b/ares_private.h
index 9354e63..6ec4dc4 100644
--- a/ares_private.h
+++ b/ares_private.h
@@ -4,6 +4,7 @@
/* $Id$ */
/* Copyright 1998 by the Massachusetts Institute of Technology.
+ * Copyright (C) 2004-2008 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
@@ -48,7 +49,7 @@
#include <time.h>
#endif
-#define DEFAULT_TIMEOUT 5
+#define DEFAULT_TIMEOUT 5000 /* milliseconds */
#define DEFAULT_TRIES 4
#ifndef INADDR_NONE
#define INADDR_NONE 0xffffffff
@@ -149,7 +150,7 @@ struct server_state {
struct query {
/* Query ID from qbuf, for faster lookup, and current timeout */
unsigned short qid;
- time_t timeout;
+ struct timeval timeout;
/*
* Links for the doubly-linked lists in which we insert a query.
@@ -217,7 +218,7 @@ typedef struct rc4_key
struct ares_channeldata {
/* Configuration data */
int flags;
- int timeout;
+ int timeout; /* in milliseconds */
int tries;
int ndots;
int udp_port;
@@ -242,7 +243,8 @@ struct ares_channeldata {
/* Generation number to use for the next TCP socket open/close */
int tcp_connection_generation;
- /* The time at which we last called process_timeouts() */
+ /* The time at which we last called process_timeouts(). Uses integer seconds
+ just to draw the line somewhere. */
time_t last_timeout_processed;
/* Circular, doubly-linked list of queries, bucketed various ways.... */
@@ -259,8 +261,18 @@ struct ares_channeldata {
void *sock_state_cb_data;
};
+/* return true if now is exactly check time or later */
+int ares__timedout(struct timeval *now,
+ struct timeval *check);
+/* add the specific number of milliseconds to the time in the first argument */
+int ares__timeadd(struct timeval *now,
+ int millisecs);
+/* return time offset between now and (future) check, in milliseconds */
+int ares__timeoffset(struct timeval *now,
+ struct timeval *check);
void ares__rc4(rc4_key* key,unsigned char *buffer_ptr, int buffer_len);
-void ares__send_query(ares_channel channel, struct query *query, time_t now);
+void ares__send_query(ares_channel channel, struct query *query,
+ struct timeval *now);
void ares__close_sockets(ares_channel channel, struct server_state *server);
int ares__get_hostent(FILE *fp, int family, struct hostent **host);
int ares__read_line(FILE *fp, char **buf, int *bufsize);