summaryrefslogtreecommitdiffstats
path: root/rfc1035/rfc1035.h
diff options
context:
space:
mode:
Diffstat (limited to 'rfc1035/rfc1035.h')
-rw-r--r--rfc1035/rfc1035.h98
1 files changed, 87 insertions, 11 deletions
diff --git a/rfc1035/rfc1035.h b/rfc1035/rfc1035.h
index 7b9c4e7..9a92c1b 100644
--- a/rfc1035/rfc1035.h
+++ b/rfc1035/rfc1035.h
@@ -228,6 +228,22 @@ int rfc1035_resolve_cname(
#define RFC1035_X_RANDOMIZE 1 /* Randomize query results */
+/*
+** rfc1035_resolve_cname_multiple is a version of rfc1035_resolve_cname
+** that accepts an array of qtypes, and issues a query for each qtype.
+**
+** qtypes points to a 0-terminated list of RRs.
+*/
+int rfc1035_resolve_cname_multiple(struct rfc1035_res *res,
+ char *namebuf,
+ /* RFC1035_MAXNAMESIZE buffer with
+ ** the name to query */
+ unsigned char *qtypes,
+ unsigned qclass,
+ struct rfc1035_reply **ptr,
+ int x_flags);
+
+
/*
** Always call replyfree when done.
*/
@@ -363,17 +379,6 @@ int rfc1035_wait_query(int, /* File descriptor from rfc1035_open */
unsigned); /* Number of seconds to wait, use 0 for default */
/* Like reply, but we select for writing */
-char *rfc1035_recv_udp(int, /* File descriptor from rfc1035_open */
- const struct sockaddr *, int,
- /* Expecting reply from this IP address */
- int *, /* * will be set to point to # of bytes received */
- const char *); /* Original query, used to validate id # */
- /* Returns ptr to dynamically allocated memory containing the reply,
- ** or NULL if error. Errno will be set EAGAIN if we should try
- ** again, because the message received was not in response
- ** to the query.
- */
-
char *rfc1035_query_udp(struct rfc1035_res *,
int, /* file descriptor */
const struct sockaddr *, int, /* Attempt number */
@@ -623,6 +628,77 @@ struct rfc1035_ifconf {
struct rfc1035_ifconf *rfc1035_ifconf(int *errflag);
void rfc1035_ifconf_free(struct rfc1035_ifconf *ifconf_list);
+/*
+** Outstanding UDP queries.
+*/
+
+ /* common query buffer */
+
+struct querybuf {
+ char qbuf[512];
+ unsigned qbuflen;
+ } ;
+
+struct rfc1035_udp_query_response;
+
+ /* How many queries, and the queries */
+
+struct rfc1035_udp_query_responses {
+ int n_queries;
+ struct rfc1035_udp_query_response *queries;
+};
+
+ /* Each query, and response already receives so far, if any. */
+
+struct rfc1035_udp_query_response {
+ const char *query;
+ unsigned querylen;
+ char *response;
+ unsigned resplen;
+};
+
+/*
+** Allocate a new rfc1035_udp_query_responses.
+** Copies each query into the rfc1035_udp_query_response, each response is
+** initialized to null.
+*/
+
+struct rfc1035_udp_query_responses *
+rfc1035_udp_query_response_alloc(const char **queries,
+ const unsigned *querylens,
+ int n_queries);
+
+struct rfc1035_udp_query_responses *
+rfc1035_udp_query_response_alloc_bis(struct querybuf *queries,
+ int n_queries);
+
+/*
+** Send all queries via UDPs, wait for responses.
+**
+** Returns non-0 if all queries are received, 0 if not. EAGAIN indicates
+** a timeout, and this can be called again with the same
+** rfc1035_udp_query_responses object; this resends all queries for which
+** no response was received, and this will wait for the remaining responses.
+*/
+int rfc1035_udp_query_multi(struct rfc1035_res *res,
+ /* Socket: */
+ int fd,
+ /* Where to send it to */
+ const struct sockaddr *sin, int sin_len,
+ /* The queries */
+ struct rfc1035_udp_query_responses *qr,
+
+ /* How long to wait for responses, in seconds. */
+ unsigned w);
+
+/*
+** Deallocate rfc1035_udp_query_responses. Each non-NULL response pointer
+** gets free()d.
+*/
+
+void rfc1035_udp_query_response_free(struct rfc1035_udp_query_responses *);
+
+
#ifdef __cplusplus
}
#endif