[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22179 - in gnunet/src: dns include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22179 - in gnunet/src: dns include |
Date: |
Thu, 21 Jun 2012 09:32:50 +0200 |
Author: grothoff
Date: 2012-06-21 09:32:50 +0200 (Thu, 21 Jun 2012)
New Revision: 22179
Modified:
gnunet/src/dns/dnsparser.c
gnunet/src/include/gnunet_dnsparser_lib.h
Log:
-improving comments, towards implementing #2268
Modified: gnunet/src/dns/dnsparser.c
===================================================================
--- gnunet/src/dns/dnsparser.c 2012-06-20 23:22:32 UTC (rev 22178)
+++ gnunet/src/dns/dnsparser.c 2012-06-21 07:32:50 UTC (rev 22179)
@@ -29,42 +29,153 @@
#include "gnunet_dnsparser_lib.h"
-// DNS-Stuff
GNUNET_NETWORK_STRUCT_BEGIN
-/* FIXME: replace this one with the one from tcpip_tun.h! */
+
+/* FIXME: replace this one with the one from tcpip_tun.h!? */
+/**
+ * Head of a any DNS message.
+ */
struct GNUNET_TUN_DnsHeader
{
+ /**
+ * Request/response ID. (NBO)
+ */
uint16_t id GNUNET_PACKED;
+
+ /**
+ * Flags for the operation.
+ */
struct GNUNET_DNSPARSER_Flags flags;
- uint16_t query_count GNUNET_PACKED; // number of questions
- uint16_t answer_rcount GNUNET_PACKED; // number of answers
- uint16_t authority_rcount GNUNET_PACKED; // number of authority-records
- uint16_t additional_rcount GNUNET_PACKED; // number of additional
records
+
+ /**
+ * number of questions (NBO)
+ */
+ uint16_t query_count GNUNET_PACKED;
+
+ /**
+ * number of answers (NBO)
+ */
+ uint16_t answer_rcount GNUNET_PACKED;
+
+ /**
+ * number of authority-records (NBO)
+ */
+ uint16_t authority_rcount GNUNET_PACKED;
+
+ /**
+ * number of additional records (NBO)
+ */
+ uint16_t additional_rcount GNUNET_PACKED;
};
+
+/**
+ * DNS query prefix.
+ */
struct query_line
{
+ /**
+ * Desired type (GNUNET_DNSPARSER_TYPE_XXX). (NBO)
+ */
uint16_t type GNUNET_PACKED;
+
+ /**
+ * Desired class (usually GNUNET_DNSPARSER_CLASS_INTERNET). (NBO)
+ */
uint16_t class GNUNET_PACKED;
};
+
+/**
+ * General DNS record prefix.
+ */
struct record_line
{
+ /**
+ * Record type (GNUNET_DNSPARSER_TYPE_XXX). (NBO)
+ */
uint16_t type GNUNET_PACKED;
+
+ /**
+ * Record class (usually GNUNET_DNSPARSER_CLASS_INTERNET). (NBO)
+ */
uint16_t class GNUNET_PACKED;
+
+ /**
+ * Expiration for the record (in seconds). (NBO)
+ */
uint32_t ttl GNUNET_PACKED;
+
+ /**
+ * Number of bytes of data that follow. (NBO)
+ */
uint16_t data_len GNUNET_PACKED;
};
+
+/**
+ * Payload of DNS SOA record (header).
+ */
struct soa_data
{
+ /**
+ * The version number of the original copy of the zone. (NBO)
+ */
uint32_t serial GNUNET_PACKED;
+
+ /**
+ * Time interval before the zone should be refreshed. (NBO)
+ */
uint32_t refresh GNUNET_PACKED;
+
+ /**
+ * Time interval that should elapse before a failed refresh should
+ * be retried. (NBO)
+ */
uint32_t retry GNUNET_PACKED;
+
+ /**
+ * Time value that specifies the upper limit on the time interval
+ * that can elapse before the zone is no longer authoritative. (NBO)
+ */
uint32_t expire GNUNET_PACKED;
+
+ /**
+ * The bit minimum TTL field that should be exported with any RR
+ * from this zone. (NBO)
+ */
uint32_t minimum GNUNET_PACKED;
};
+
+/**
+ * Payload of DNS SRV record (header).
+ */
+struct srv_data
+{
+
+ /**
+ * Preference for this entry (lower value is higher preference). Clients
+ * will contact hosts from the lowest-priority group first and fall back
+ * to higher priorities if the low-priority entries are unavailable. (NBO)
+ */
+ uint16_t prio GNUNET_PACKED;
+
+ /**
+ * Relative weight for records with the same priority. Clients will use
+ * the hosts of the same (lowest) priority with a probability proportional
+ * to the weight given. (NBO)
+ */
+ uint16_t weight GNUNET_PACKED;
+
+ /**
+ * TCP or UDP port of the service. (NBO)
+ */
+ uint16_t port GNUNET_PACKED;
+
+ /* followed by 'target' name */
+};
+
GNUNET_NETWORK_STRUCT_END
Modified: gnunet/src/include/gnunet_dnsparser_lib.h
===================================================================
--- gnunet/src/include/gnunet_dnsparser_lib.h 2012-06-20 23:22:32 UTC (rev
22178)
+++ gnunet/src/include/gnunet_dnsparser_lib.h 2012-06-21 07:32:50 UTC (rev
22179)
@@ -41,6 +41,7 @@
#define GNUNET_DNSPARSER_TYPE_MX 15
#define GNUNET_DNSPARSER_TYPE_TXT 16
#define GNUNET_DNSPARSER_TYPE_AAAA 28
+#define GNUNET_DNSPARSER_TYPE_SRV 33
/**
* A few common DNS classes (ok, only one is common, but I list a
@@ -173,7 +174,66 @@
};
+
+/**
+ * Information from SRV records (RFC 2782). The 'service', 'proto'
+ * and 'domain_name' fields together give the DNS-name which for SRV
+ * records is of the form "_$SERVICE._$PROTO.$DOMAIN_NAME". The DNS
+ * parser provides the full name in 'struct DNSPARSER_Record' and the
+ * individual components in the respective fields of this struct.
+ * When serializing, you CAN set the 'name' field of 'struct
+ * GNUNET_DNSPARSER_Record' to NULL, in which case the DNSPARSER code
+ * will populate 'name' from the 'service', 'proto' and 'domain_name'
+ * fields in this struct.
+ */
+struct GNUNET_DNSPARSER_SrvRecord
+{
+ /**
+ * Preference for this entry (lower value is higher preference).
+ * Without the underscore (!). Note that RFC 6335 clarifies the
+ * set of legal characters for service names.
+ */
+ char *service;
+
+ /**
+ * Transport protocol (typcially "tcp" or "udp", but others might be
allowed).
+ * Without the underscore (!).
+ */
+ char *proto;
+
+ /**
+ * Domain name for which the record is valid
+ */
+ char *domain_name;
+
+ /**
+ * Hostname offering the service.
+ */
+ char *target;
+
+ /**
+ * Preference for this entry (lower value is higher preference). Clients
+ * will contact hosts from the lowest-priority group first and fall back
+ * to higher priorities if the low-priority entries are unavailable.
+ */
+ uint16_t priority;
+
+ /**
+ * Relative weight for records with the same priority. Clients will use
+ * the hosts of the same (lowest) priority with a probability proportional
+ * to the weight given.
+ */
+ uint16_t weight;
+
+ /**
+ * TCP or UDP port of the service.
+ */
+ uint16_t port;
+
+};
+
+
/**
* Information from SOA records (RFC 1035).
*/
@@ -252,6 +312,9 @@
*/
char *name;
+ /**
+ * Payload of the record (which one of these is valid depends on the 'type').
+ */
union
{
@@ -271,6 +334,11 @@
struct GNUNET_DNSPARSER_MxRecord *mx;
/**
+ * SRV data for SRV records.
+ */
+ struct GNUNET_DNSPARSER_SrvRecord *srv;
+
+ /**
* Raw data for all other types.
*/
struct GNUNET_DNSPARSER_RawRecord raw;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22179 - in gnunet/src: dns include,
gnunet <=