]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
more lua stuff
authorMiek Gieben <miekg@NLnetLabs.nl>
Tue, 23 Aug 2005 19:15:56 +0000 (19:15 +0000)
committerMiek Gieben <miekg@NLnetLabs.nl>
Tue, 23 Aug 2005 19:15:56 +0000 (19:15 +0000)
dig now says (when I ancount++ in a pkt):
dig @localhost -p 5353 any miek.nl
;; Warning: Message parser reports malformed message packet.

lua/Makefile.in
lua/lua-rns.c
lua/rns.lua

index b482008bc9d9f8c711328aa1630593dd522a7e30..f7d6edf4a1c1d3b983de84e50fe9492ebd8940e8 100644 (file)
@@ -14,6 +14,9 @@ CFLAGS = @CFLAGS@
 LDFLAGS = @LDFLAGS@
 LIBS = @LIBS@
 
+LINT            = splint
+LINTFLAGS       = +quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t
+
 COMPILE         = $(CC) $(CPPFLAGS) $(CFLAGS)
 LINK            = $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS)
 
@@ -44,3 +47,6 @@ realclean: clean
        rm -f config.log config.status aclocal.m4 config.h.in configure Makefile
        rm -f config.h
 
+lint:
+       $(LINT) $(LINTFLAGS) -I$(srcdir)/.. lua-rns.c ; \
+       if [ $$? -ne 0 ] ; then exit 1 ; fi
index 78e41ec66b5f1bc8ebed522f742a13893b698eac..cd058b191d428dcb0e016d84e06c61204f8daa6d 100644 (file)
@@ -379,8 +379,11 @@ l_pkt_arcount(lua_State *L)
 }
 
 static int
-l_pkt_set_qdcount(lua_State *L)
+l_pkt_set_ancount(lua_State *L)
 {
+       ldns_pkt *p  = (ldns_pkt*)lua_touserdata(L, 1);
+       uint16_t count = (uint16_t) lua_tonumber(L, 2);
+       (void)ldns_pkt_set_ancount(p, count);
        return 0;
 }
 
@@ -555,9 +558,9 @@ register_ldns_functions(void)
                 {"ancount",     l_pkt_ancount},
                 {"nscount",     l_pkt_nscount},
                 {"arcount",     l_pkt_arcount},
+                {"set_ancount", l_pkt_set_ancount},
 #if 0
                 {"set_qdcount", l_pkt_set_qdcount},
-                {"set_ancount", l_pkt_set_ancount},
                 {"set_nscount", l_pkt_set_nscount},
                 {"set_arcount", l_pkt_set_arcount},
 #endif
index fc8e5951f6cec8728ffdea21b236b1e9492f5a08..2547cce8fc8d859909aa65250196a749fcef144b 100644 (file)
@@ -22,6 +22,7 @@ socket = udp.open(rdf_ip, 5353)
 wirebuf, sockaddr_from, fromlen  = udp_read(socket) -- this works
 --wirebuf, sockaddr_from, fromlen  = udp.read(socket) -- this doesn't
 
+-- wrap this in new functions
 if wirebuf == nil then
        lua_debug("nothing received")
 else
@@ -35,6 +36,8 @@ else
 
        -- set the id on the outgoing packet
        packet.set_id(pkt, id)
+       packet.set_ancount(pkt,
+                       packet.ancount(pkt) + 1)
        wirebuf2 = packet.to_buf(pkt)
 
        rdf_listen, port_listen = rdf.sockaddr_to_rdf(sockaddr_from)