]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
tutorial line and -4/-6 option in walker
authorJelte Jansen <jeltejan@NLnetLabs.nl>
Thu, 6 Jul 2006 13:05:26 +0000 (13:05 +0000)
committerJelte Jansen <jeltejan@NLnetLabs.nl>
Thu, 6 Jul 2006 13:05:26 +0000 (13:05 +0000)
doc/header.html
doc/tutorial1_mx.dox
examples/ldns-mx.c
examples/ldns-walk.c

index 962531c6ba027b830319226365addc5f570303e0..66b91e1ebceaa2b790192734b94b025e102dafb8 100644 (file)
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html><head><meta http-equiv="Content-Type"
 content="text/html;charset=iso-8859-1">
-<title>ldns: File Index</title>
+<title>ldns documentation</title>
 <link href="libdns.css" rel="stylesheet" type="text/css">
 </head><body>
 <div class="logo">
index 137886baab0c070207e30b4a71584e5292ef09cb..01acbe4aac95c8cf6d000a62d759a0690e6ff7f6 100644 (file)
    \skip include
    \until dns.h
 
+   In this case we have used a configure script to generate a config.h file
+   that does all our inclusions for us, so that it can be compiled on
+   multiple platforms. If your platform supports the include files \c
+   stdlib.h and \c unistd.h, you can include these instead of using a
+   configure script.
+
    The first included files are prerequisites that ldns needs to function.
    The last one, of course, includes the functions of ldns itself.
  
index fc9d8304df37276e8a16c07e1fd6bf8b748a0f33..8b319870dbd8ced80e54748c06970c480347fd83 100644 (file)
@@ -6,8 +6,6 @@
  */
 
 #include "config.h"
-#include <unistd.h>
-#include <stdlib.h>
 
 #include <ldns/ldns.h>
 
index 9911b08de990da03c4bcd06edea954e930bab1f7..258c248111d7fccf03f24d8b646ee8b3c66a1f8a 100644 (file)
 #include <ldns/ldns.h>
 
 int verbosity = 0;
+int fam = LDNS_RESOLV_INETANY;
 
 int
 usage(FILE *fp, char *prog) {
        fprintf(fp, "%s [options] domain\n", prog);
        fprintf(fp, "  print out the owner names for domain and the record types for those names\n");
        fprintf(fp, "OPTIONS:\n");
+       fprintf(fp, "-4\t\tonly use IPv4\n");
+       fprintf(fp, "-6\t\tonly use IPv6\n");
        fprintf(fp, "-s <name>\t\tStart from this name\n");
        fprintf(fp, "-v <verbosity>\t\tVerbosity level [1-5]\n");
        fprintf(fp, "-version\tShow version and exit\n");
@@ -115,13 +118,24 @@ main(int argc, char *argv[])
        soa = NULL;
        domain = NULL;
        
-       
        if (argc < 2) {
                usage(stdout, argv[0]);
                exit(EXIT_FAILURE);
        } else {
                for (i = 1; i < argc; i++) {
-                       if (strncmp(argv[i], "-s", 3) == 0) {
+                       if (strncmp(argv[i], "-4", 3) == 0) {
+                               if (fam != LDNS_RESOLV_INETANY) {
+                                       fprintf(stderr, "You can only specify one of -4 or -6\n");
+                                       exit(1);
+                               }
+                               fam = LDNS_RESOLV_INET;
+                       } else if (strncmp(argv[i], "-6", 3) == 0) {
+                               if (fam != LDNS_RESOLV_INETANY) {
+                                       fprintf(stderr, "You can only specify one of -4 or -6\n");
+                                       exit(1);
+                               }
+                               fam = LDNS_RESOLV_INET6;
+                       } else if (strncmp(argv[i], "-s", 3) == 0) {
                                if (i + 1 < argc) {
                                        if (!ldns_str2rdf_dname(&startpoint, argv[i + 1]) == LDNS_STATUS_OK) {
                                                printf("Bad start point name: %s\n", argv[i + 1]);
@@ -255,6 +269,7 @@ main(int argc, char *argv[])
 
        ldns_resolver_set_dnssec(res, true);
        ldns_resolver_set_dnssec_cd(res, true);
+       ldns_resolver_set_ip6(res, fam);        
 
        if (!res) {
                exit(2);