Commit Diff
Diff:
b6dc64dc1db61d755de1808df54a715167eb0c92
be7ae884e8e7c8f64dfffc0cbdbf5daefc8d1264
Commit:
be7ae884e8e7c8f64dfffc0cbdbf5daefc8d1264
Tree:
915dfbbbaab8994d5c354473be64bfa57602364a
Author:
pbug <pbug@delphinusdns.org>
Committer:
pbug <pbug@delphinusdns.org>
Date:
Wed May 26 18:42:25 2010 UTC
Message:
* some planning on the code execution path, (drawn a map in comments) * additional struct
blob - 61ea6cc18a27329ed53a000053adc02eb51e9588
blob + b5ae8478413f101a8fd683a07440abb9391cccbc
--- recurse.c
+++ recurse.c
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2010 Peter J. Philipp
* All rights reserved.
*
@@ -47,9 +47,31 @@ struct recurseentry {
SLIST_ENTRY(recurseentry) entries;
} *rn1, *rn2, *rnp;
+SLIST_HEAD(listhead2, recurses) recurseshead;
-static const char rcsid[] = "$Id: recurse.c,v 1.1 2010/04/15 17:56:39 pbug Exp $";
+struct recurses {
+ char query[512]; /* the query we received */
+ int len; /* length of query */
+ int af; /* address family */
+ int proto; /* protocol UDP/TCP */
+ struct sockaddr_storage source; /* source + port */
+ struct sockaddr_storage dest; /* dest + port */
+
+ time_t received; /* received request time */
+ time_t sent_last_query; /* the last time we did a lookup */
+
+ char upperlower[32]; /* uppercase / lowercase bitmap */
+ int so; /* the socket we did a lookup with */
+ u_int16_t id; /* last id used */
+
+ struct question *question; /* question struct */
+ SLIST_ENTRY(recurses) entries;
+};
+
+
+static const char rcsid[] = "$Id: recurse.c,v 1.2 2010/05/26 18:42:25 pbug Exp $";
+
/*
* INIT_RECURSE - initialize the recurse singly linked list
*/
@@ -192,6 +214,8 @@ recurseloop(int sp, int *raw, DB *db)
struct srecurseheader rh;
+ SLIST_INIT(&recurseshead);
+
for (;;) {
FD_ZERO(&rset);
@@ -225,6 +249,43 @@ recurseloop(int sp, int *raw, DB *db)
} else {
reply_raw(rh);
}
+
+/*
+ I drew this on a notepad one night, I think that's supposed to how
+ it shoudl go...
+
+ +----------------+ +--------------------------+
+ | | | |
+ | v v |
+ | -------------------- select ------------------- |
+ | || || |
+ | || || |
+ | +----+ +----+ |
+ | | | take request | | parse reply |
+ | +----+ from authoritative +----+ and insert |
+ | || side / new record |
+ | || / |
+ | || / |
+ | || +---------------+ |
+ | || / |
+ | || / bad or expired |
+ | +----+=====================>+----+ lookup record |
+ | | | lookup name in db | | on the net |
+ | +----+ +----+-------------------+
+ | ||
+ | || good
+ | ||
+ | +----+
+ | | | reply
+ | +----+
+ | ||
+ | ||
+ | ||
+ | +----+
+ +--------| | cleanup
+ +----+
+
+*/
#endif
repomaster@centroid.eu