summaryrefslogtreecommitdiff
path: root/src/rexmpp_dns.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/rexmpp_dns.h')
-rw-r--r--src/rexmpp_dns.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/rexmpp_dns.h b/src/rexmpp_dns.h
new file mode 100644
index 0000000..f9c8b81
--- /dev/null
+++ b/src/rexmpp_dns.h
@@ -0,0 +1,31 @@
+/**
+ @file rexmpp_dns.h
+ @brief DNS helper functions
+ @author defanor <defanor@uberspace.net>
+ @date 2020
+ @copyright MIT license.
+*/
+
+
+#ifndef REXMPP_DNS_H
+#define REXMPP_DNS_H
+
+#include <stdint.h>
+
+struct rexmpp_dns_srv {
+ uint16_t priority;
+ uint16_t weight;
+ uint16_t port;
+ char target[256];
+};
+
+/**
+ @brief Parses an SRV DNS RR's RDATA.
+ @param[in] in SRV record's RDATA.
+ @param[in] in_len Length of the input data in octets.
+ @param[out] out A structure to fill with data.
+ @returns 0 on success, non-zero on parsing failure.
+*/
+int rexmpp_parse_srv (char *in, int in_len, struct rexmpp_dns_srv *out);
+
+#endif