aboutsummaryrefslogtreecommitdiff
path: root/dns.h
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2020-08-28 07:20:36 +0300
committerAleksey Veresov <aleksey@veresov.pro>2020-08-28 07:20:36 +0300
commit346b8f6105519a223e7f67029eeac59a5e420f5c (patch)
treebb04fde0d30b63d3049f39f3d9f5ff949adece24 /dns.h
parentca69aa0dea509d6f3360f85ad5211d8f8c2f94c1 (diff)
downloadvsdns-346b8f6105519a223e7f67029eeac59a5e420f5c.tar
vsdns-346b8f6105519a223e7f67029eeac59a5e420f5c.tar.xz
vsdns-346b8f6105519a223e7f67029eeac59a5e420f5c.zip
More descriptions added.
Diffstat (limited to 'dns.h')
-rw-r--r--dns.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/dns.h b/dns.h
index 61478ae..ae69394 100644
--- a/dns.h
+++ b/dns.h
@@ -8,18 +8,23 @@ enum { /* Some of DNS types: */
dns_type_mx = 15,
dns_type_txt = 16,
dns_type_srv = 33
+ /* If you need other one -- add it here. */
};
+/* Answers as linked list. */
struct dns_answers {
struct dns_answers *next;
- char *host;
- int type;
- unsigned int size;
+ char *host; /* for which answer is provided */
+ int type; /* type of current answer */
+ unsigned int size; /* size of data */
void *data;
};
-/* For CNAME & TXT data is just 'char *',
- * For A data is 'unsigned char *' of size 4. */
+
+/* For CNAME & TXT data is just human-readable null-terminated 'char *',
+ * for A data is 'unsigned char *' of size 4,
+ * other answers are more complex,
+ * so functions to access their data are provided: */
char *dns_mx_server(void *data);
int dns_mx_preference(void *data);
@@ -29,7 +34,8 @@ int dns_srv_port(void *data);
int dns_srv_priority(void *data);
int dns_srv_weight(void *data);
-/* In case of error result is 0. */
+
+/* In case of error result is 0, as if server don't know host. */
struct dns_answers *dns_get(const char *server, const char *host, int query);
void dns_free(struct dns_answers *answers);