chiark / gitweb /
Rearrangement more or less sorted, back to trying to get it to compile.
[adns.git] / src / parse.c
index ad23419d78319288c30fdb73abfb55ba4fa4b15a..bf04d4d2ef089c85c90fd42d048cea1665ae6601 100644 (file)
@@ -1,4 +1,24 @@
-/**/
+/*
+ * parse.c
+ * - parsing assistance functions (mainly for domains inside datagrams)
+ */
+/*
+ *  This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson
+ *  
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software Foundation,
+ *  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
+ */
 
 #include "internal.h"
 
@@ -54,7 +74,7 @@ adns_status adns__findlabel_next(findlabel_state fls,
     if (!(lablen & 0x0c000)) break;
     if ((lablen & 0x0c000) != 0x0c000) return adns_s_unknownreply;
     if (jumped++) {
-      adns__diag(ads,serv,"compressed datagram contains loop");
+      adns__diag(ads,fls->serv,fls->qu,"compressed datagram contains loop");
       return adns_s_serverfaulty;
     }
     if (fls->dmend_r) *(fls->dmend_r)= fls->cbyte;
@@ -81,11 +101,11 @@ adns_status adns__findlabel_next(findlabel_state fls,
   return adns_s_ok;
 
  x_serverfaulty: 
-  adns__diag(ads,serv,"label in domain runs beyond end of domain");
+  adns__diag(ads,fls->serv,fls->qu,"label in domain runs beyond end of domain");
   return adns_s_serverfaulty;
 }
 
-adns_status adns__parse_domain(adns_state ads, int serv, vbuf *vb,
+adns_status adns__parse_domain(adns_state ads, int serv, vbuf *vb, int flags,
                               const byte *dgram, int dglen,
                               int *cbyte_io, int max) {
   findlabel_state fls;
@@ -102,7 +122,7 @@ adns_status adns__parse_domain(adns_state ads, int serv, vbuf *vb,
     if (!lablen) break;
     if (vb->used)
       if (!adns__vbuf_append(&qu->ans,".",1)) return adns_s_nolocalmem;
-    if (qu->flags & adns_qf_anyquote) {
+    if (flags & adns_qf_anyquote) {
       if (!vbuf__append_quoted1035(&qu->ans,dgram+labstart,lablen))
        return adns_s_nolocalmem;
     } else {
@@ -119,7 +139,7 @@ adns_status adns__parse_domain(adns_state ads, int serv, vbuf *vb,
   if (!adns__vbuf_append(&qu->ans,"",1)) return adns_s_nolocalmem;
   return adns_s_ok;
 }
-    
+       
 adns_status adns__findrr(adns_state ads, int serv,
                         const byte *dgram, int dglen, int *cbyte_io,
                         int *type_r, int *class_r, int *rdlen_r, int *rdstart_r,