chiark / gitweb /
More reply stuff.
[adns.git] / src / internal.h
index 5b5097b7ed6b21abd81872621f67f254d5e24721..cd58d7a2d46135f9069919ed70f9cda76df65948 100644 (file)
@@ -17,13 +17,16 @@ typedef unsigned char byte;
 /* Configuration and constants */
 
 #define MAXSERVERS 5
 /* Configuration and constants */
 
 #define MAXSERVERS 5
-#define MAXUDPRETRIES /*15*/5
+#define UDPMAXRETRIES /*15*/5
 #define UDPRETRYMS 2000
 #define TCPMS 30000
 #define LOCALRESOURCEMS 20
 #define UDPRETRYMS 2000
 #define TCPMS 30000
 #define LOCALRESOURCEMS 20
-#define MAXUDPDGRAM 512
-#define NSPORT 53
-#define MAXDNAME 255
+
+#define DNS_UDPPORT 53
+#define DNS_MAXUDP 512
+#define DNS_MAXDOMAIN 255
+#define DNS_HDRSIZE 12
+#define DNS_CLASS_IN 1
 
 /* Shared data structures */
 
 
 /* Shared data structures */
 
@@ -46,14 +49,20 @@ typedef union {
   int dmaddr_index;
 } qcontext;
 
   int dmaddr_index;
 } qcontext;
 
+typedef struct {
+  unsigned long searchkey; /* flags and typecode swapped */
+  adns_rrtype type;
+} typeinfo;
+
 struct adns__query {
   /* FIXME: make sure this is all init'd properly */
   enum { query_udp, query_tcpwait, query_tcpsent, query_child, query_done } state;
   adns_query back, next, parent;
   struct { adns_query head, tail; } children;
   struct { adns_query back, next; } siblings;
 struct adns__query {
   /* FIXME: make sure this is all init'd properly */
   enum { query_udp, query_tcpwait, query_tcpsent, query_child, query_done } state;
   adns_query back, next, parent;
   struct { adns_query head, tail; } children;
   struct { adns_query back, next; } siblings;
-  adns_rrtype type;
-  vbuf answer;
+  
+  const typeinfo *typei;
+  vbuf ans;
   int id, flags, udpretries;
   int udpnextserver;
   unsigned long udpsent, tcpfailed; /* bitmap indexed by server */
   int id, flags, udpretries;
   int udpnextserver;
   unsigned long udpsent, tcpfailed; /* bitmap indexed by server */