aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorSchanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>2018-04-10 11:27:26 +0200
committerSchanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>2018-04-10 11:27:26 +0200
commit114d46af6abd4982861b7e215a7f5b24246b2cc0 (patch)
treee867afc0509775b9e731cd9491b2bb456af3fbfa /src/include
parentb1af3dcf2ad69264883a398ab431fa99c7135f79 (diff)
parent7fa39e49b7a50ddb18e722b4ff2b32060038939d (diff)
downloadgnunet-114d46af6abd4982861b7e215a7f5b24246b2cc0.tar.gz
gnunet-114d46af6abd4982861b7e215a7f5b24246b2cc0.zip
Merge branch 'master' of git+ssh://gnunet.org/gnunet
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_common.h19
-rw-r--r--src/include/gnunet_dns_service.h9
-rw-r--r--src/include/gnunet_dnsparser_lib.h36
3 files changed, 52 insertions, 12 deletions
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index 7d23e6f9b..0fb39575c 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -160,6 +160,19 @@ extern "C"
160#endif 160#endif
161 161
162 162
163/**
164 * Macro used to avoid using 0 for the length of a variable-size
165 * array (Non-Zero-Length).
166 *
167 * Basically, C standard says that "int[n] x;" is undefined if n=0.
168 * This was supposed to prevent issues with pointer aliasing.
169 * However, C compilers may conclude that n!=0 as n=0 would be
170 * undefined, and then optimize under the assumption n!=0, which
171 * could cause actual issues. Hence, when initializing an array
172 * on the stack with a variable-length that might be zero, write
173 * "int[GNUNET_NZL(n)] x;" instead of "int[n] x".
174 */
175#define GNUNET_NZL(l) GNUNET_MAX(1,l)
163 176
164 177
165/** 178/**
@@ -988,7 +1001,7 @@ GNUNET_ntoh_double (double d);
988 * arr is important since size is the number of elements and 1001 * arr is important since size is the number of elements and
989 * not the size in bytes 1002 * not the size in bytes
990 * @param size the number of elements in the existing vector (number 1003 * @param size the number of elements in the existing vector (number
991 * of elements to copy over), will be updated with the new 1004 * of elements to copy over), will be updated with the new
992 * array size 1005 * array size
993 * @param tsize the target size for the resulting vector, use 0 to 1006 * @param tsize the target size for the resulting vector, use 0 to
994 * free the vector (then, arr will be NULL afterwards). 1007 * free the vector (then, arr will be NULL afterwards).
@@ -998,13 +1011,13 @@ GNUNET_ntoh_double (double d);
998/** 1011/**
999 * @ingroup memory 1012 * @ingroup memory
1000 * Append an element to a list (growing the list by one). 1013 * Append an element to a list (growing the list by one).
1001 * 1014 *
1002 * @param arr base-pointer of the vector, may be NULL if size is 0; 1015 * @param arr base-pointer of the vector, may be NULL if size is 0;
1003 * will be updated to reflect the new address. The TYPE of 1016 * will be updated to reflect the new address. The TYPE of
1004 * arr is important since size is the number of elements and 1017 * arr is important since size is the number of elements and
1005 * not the size in bytes 1018 * not the size in bytes
1006 * @param size the number of elements in the existing vector (number 1019 * @param size the number of elements in the existing vector (number
1007 * of elements to copy over), will be updated with the new 1020 * of elements to copy over), will be updated with the new
1008 * array size 1021 * array size
1009 * @param element the element that will be appended to the array 1022 * @param element the element that will be appended to the array
1010 */ 1023 */
diff --git a/src/include/gnunet_dns_service.h b/src/include/gnunet_dns_service.h
index 76b708dcf..017d5a039 100644
--- a/src/include/gnunet_dns_service.h
+++ b/src/include/gnunet_dns_service.h
@@ -122,10 +122,11 @@ enum GNUNET_DNS_Flags
122 * @param request_length number of bytes in request 122 * @param request_length number of bytes in request
123 * @param request udp payload of the DNS request 123 * @param request udp payload of the DNS request
124 */ 124 */
125typedef void (*GNUNET_DNS_RequestHandler)(void *cls, 125typedef void
126 struct GNUNET_DNS_RequestHandle *rh, 126(*GNUNET_DNS_RequestHandler)(void *cls,
127 size_t request_length, 127 struct GNUNET_DNS_RequestHandle *rh,
128 const char *request); 128 size_t request_length,
129 const char *request);
129 130
130 131
131/** 132/**
diff --git a/src/include/gnunet_dnsparser_lib.h b/src/include/gnunet_dnsparser_lib.h
index 9fe3491d6..3a2f785d3 100644
--- a/src/include/gnunet_dnsparser_lib.h
+++ b/src/include/gnunet_dnsparser_lib.h
@@ -49,6 +49,7 @@
49/** 49/**
50 * A few common DNS types. 50 * A few common DNS types.
51 */ 51 */
52#define GNUNET_DNSPARSER_TYPE_ANY 0
52#define GNUNET_DNSPARSER_TYPE_A 1 53#define GNUNET_DNSPARSER_TYPE_A 1
53#define GNUNET_DNSPARSER_TYPE_NS 2 54#define GNUNET_DNSPARSER_TYPE_NS 2
54#define GNUNET_DNSPARSER_TYPE_CNAME 5 55#define GNUNET_DNSPARSER_TYPE_CNAME 5
@@ -56,11 +57,36 @@
56#define GNUNET_DNSPARSER_TYPE_PTR 12 57#define GNUNET_DNSPARSER_TYPE_PTR 12
57#define GNUNET_DNSPARSER_TYPE_MX 15 58#define GNUNET_DNSPARSER_TYPE_MX 15
58#define GNUNET_DNSPARSER_TYPE_TXT 16 59#define GNUNET_DNSPARSER_TYPE_TXT 16
60#define GNUNET_DNSPARSER_TYPE_RP 17
61#define GNUNET_DNSPARSER_TYPE_AFSDB 18
62#define GNUNET_DNSPARSER_TYPE_SIG 24
63#define GNUNET_DNSPARSER_TYPE_KEY 25
59#define GNUNET_DNSPARSER_TYPE_AAAA 28 64#define GNUNET_DNSPARSER_TYPE_AAAA 28
65#define GNUNET_DNSPARSER_TYPE_LOC 29
60#define GNUNET_DNSPARSER_TYPE_SRV 33 66#define GNUNET_DNSPARSER_TYPE_SRV 33
67#define GNUNET_DNSPARSER_TYPE_NAPTR 35
68#define GNUNET_DNSPARSER_TYPE_KX 36
61#define GNUNET_DNSPARSER_TYPE_CERT 37 69#define GNUNET_DNSPARSER_TYPE_CERT 37
70#define GNUNET_DNSPARSER_TYPE_DNAME 39
71#define GNUNET_DNSPARSER_TYPE_APL 42
72#define GNUNET_DNSPARSER_TYPE_DS 43
73#define GNUNET_DNSPARSER_TYPE_SSHFP 44
74#define GNUNET_DNSPARSER_TYPE_IPSECKEY 45
75#define GNUNET_DNSPARSER_TYPE_RRSIG 46
76#define GNUNET_DNSPARSER_TYPE_NSEC 47
77#define GNUNET_DNSPARSER_TYPE_DNSKEY 48
78#define GNUNET_DNSPARSER_TYPE_DHCID 49
79#define GNUNET_DNSPARSER_TYPE_NSEC3 50
80#define GNUNET_DNSPARSER_TYPE_NSEC3PARAM 51
62#define GNUNET_DNSPARSER_TYPE_TLSA 52 81#define GNUNET_DNSPARSER_TYPE_TLSA 52
63 82#define GNUNET_DNSPARSER_TYPE_HIP 55
83#define GNUNET_DNSPARSER_TYPE_CDS 59
84#define GNUNET_DNSPARSER_TYPE_CDNSKEY 60
85#define GNUNET_DNSPARSER_TYPE_OPENPGPKEY 61
86#define GNUNET_DNSPARSER_TYPE_TKEY 249
87#define GNUNET_DNSPARSER_TYPE_TSIG 250
88#define GNUNET_DNSPARSER_TYPE_URI 256
89#define GNUNET_DNSPARSER_TYPE_TA 32768
64 90
65/** 91/**
66 * A DNS query. 92 * A DNS query.
@@ -413,10 +439,10 @@ struct GNUNET_DNSPARSER_Record
413 439
414 /** 440 /**
415 * For NS, CNAME and PTR records, this is the uncompressed 0-terminated hostname. 441 * For NS, CNAME and PTR records, this is the uncompressed 0-terminated hostname.
416 * In UTF-8 format. The library will convert from and to DNS-IDNA 442 * In UTF-8 format. The library will convert from and to DNS-IDNA
417 * as necessary. Use #GNUNET_DNSPARSER_check_label() to test if an 443 * as necessary. Use #GNUNET_DNSPARSER_check_label() to test if an
418 * individual label is well-formed. If a given name is not well-formed, 444 * individual label is well-formed. If a given name is not well-formed,
419 * creating the DNS packet will fail. 445 * creating the DNS packet will fail.
420 */ 446 */
421 char *hostname; 447 char *hostname;
422 448