summaryrefslogtreecommitdiff
path: root/lib/doh.h
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-05-02 17:04:08 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-05-04 10:40:39 +0200
commited35d6590e72c23c568af1e3b8ac6e4e2d883888 (patch)
tree57555732f4f452bf84c3c7296581485be064a853 /lib/doh.h
parent00c2e8da9a9555ce6171e3f7ddc5e43fc6f9bb4b (diff)
downloadcurl-ed35d6590e72c23c568af1e3b8ac6e4e2d883888.tar.gz
dynbuf: introduce internal generic dynamic buffer functions
A common set of functions instead of many separate implementations for creating buffers that can grow when appending data to them. Existing functionality has been ported over. In my early basic testing, the total number of allocations seem at roughly the same amount as before, possibly a few less. See docs/DYNBUF.md for a description of the API. Closes #5300
Diffstat (limited to 'lib/doh.h')
-rw-r--r--lib/doh.h13
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/doh.h b/lib/doh.h
index f6154ffd4..c059e5ac9 100644
--- a/lib/doh.h
+++ b/lib/doh.h
@@ -70,12 +70,6 @@ typedef enum {
#define DOH_MAX_ADDR 24
#define DOH_MAX_CNAME 4
-struct cnamestore {
- size_t len; /* length of cname */
- char *alloc; /* allocated pointer */
- size_t allocsize; /* allocated size */
-};
-
struct dohaddr {
int type;
union {
@@ -85,11 +79,11 @@ struct dohaddr {
};
struct dohentry {
- unsigned int ttl;
- int numaddr;
+ struct dynbuf cname[DOH_MAX_CNAME];
struct dohaddr addr[DOH_MAX_ADDR];
+ int numaddr;
+ unsigned int ttl;
int numcname;
- struct cnamestore cname[DOH_MAX_CNAME];
};
@@ -103,6 +97,7 @@ DOHcode doh_decode(const unsigned char *doh,
size_t dohlen,
DNStype dnstype,
struct dohentry *d);
+void de_init(struct dohentry *d);
void de_cleanup(struct dohentry *d);
#endif