From c013ea31649c63804599cc16253fa34d160e818d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 6 Apr 2011 07:46:10 +0000 Subject: [PATCH] going less bitfield crazy --- src/datacache/plugin_datacache_sqlite.c | 1 + src/include/gnunet_datastore_plugin.h | 2 +- src/vpn/gnunet-service-dns.c | 12 ++++++------ src/vpn/gnunet-vpn-packet.h | 10 +++++----- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c index 0341c76dc..4c429c1b4 100644 --- a/src/datacache/plugin_datacache_sqlite.c +++ b/src/datacache/plugin_datacache_sqlite.c @@ -440,6 +440,7 @@ libgnunet_plugin_datacache_sqlite_init (void *cls) "sqlite", _("Sqlite datacache running\n")); return api; } +// explain SELECT type FROM gn090 WHERE NOT EXISTS (SELECT 1 from gn090 WHERE expire < 42 LIMIT 1) OR expire < 42 ORDER BY repl DESC, Random() LIMIT 1; /** diff --git a/src/include/gnunet_datastore_plugin.h b/src/include/gnunet_datastore_plugin.h index 372ed633c..f499cb827 100644 --- a/src/include/gnunet_datastore_plugin.h +++ b/src/include/gnunet_datastore_plugin.h @@ -169,7 +169,7 @@ typedef int (*PluginPut) (void *cls, * in the datastore. * * @param cls closure - * @param key maybe NULL (to match all entries) + * @param key key to match, never NULL * @param vhash hash of the value, maybe NULL (to * match all values that have the right key). * Note that for DBlocks there is no difference diff --git a/src/vpn/gnunet-service-dns.c b/src/vpn/gnunet-service-dns.c index 944b7ed46..d4ef371e7 100644 --- a/src/vpn/gnunet-service-dns.c +++ b/src/vpn/gnunet-service-dns.c @@ -75,7 +75,7 @@ static struct answer_packet_list *head; static struct answer_packet_list *tail; /** - * A structure containing a mapping from network-byte-ordered DNS-id to + * A structure containing a mapping from network-byte-ordered DNS-id (16 bit) to * some information needed to handle this query * * It currently allocates at least @@ -86,12 +86,12 @@ static struct answer_packet_list *tail; static struct { unsigned valid:1; struct GNUNET_SERVER_Client* client; - unsigned local_ip:32; - unsigned remote_ip:32; - unsigned local_port:16; + uint32_t local_ip; + uint32_t remote_ip; + uint16_t local_port; char* name; - unsigned namelen:8; -} query_states[65536]; + uint8_t namelen; +} query_states[UINT16_MAX]; /** * A struct used to give more than one value as diff --git a/src/vpn/gnunet-vpn-packet.h b/src/vpn/gnunet-vpn-packet.h index 51cf4c4e8..87b12cb69 100644 --- a/src/vpn/gnunet-vpn-packet.h +++ b/src/vpn/gnunet-vpn-packet.h @@ -71,7 +71,7 @@ struct icmp_hdr { // DNS-Stuff struct dns_static { - unsigned short id GNUNET_PACKED; + uint16_t id GNUNET_PACKED; unsigned rd:1 GNUNET_PACKED; // recursion desired (client -> server) unsigned tc:1 GNUNET_PACKED; // message is truncated @@ -88,10 +88,10 @@ struct dns_static { unsigned z:3 GNUNET_PACKED; // reserved unsigned ra:1 GNUNET_PACKED; // recursion available (server -> client) - unsigned short qdcount GNUNET_PACKED; // number of questions - unsigned short ancount GNUNET_PACKED; // number of answers - unsigned short nscount GNUNET_PACKED; // number of authority-records - unsigned short arcount GNUNET_PACKED; // number of additional records + uint16_t qdcount GNUNET_PACKED; // number of questions + uint16_t ancount GNUNET_PACKED; // number of answers + uint16_t nscount GNUNET_PACKED; // number of authority-records + uint16_t arcount GNUNET_PACKED; // number of additional records }; struct dns_pkt { -- 2.25.1