aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2020-07-29 08:21:59 +0300
committerAleksey Veresov <aleksey@veresov.pro>2020-07-29 08:21:59 +0300
commitacf41993d4d699ff12238e943d7112dfdd5ace12 (patch)
treefd609f72c9578f20c2c4f4a4a1b0d8055a4a48c0
parente9f1c6b518a62e3b173c8dfa396bbf18b5dc7cde (diff)
downloadvsdns-acf41993d4d699ff12238e943d7112dfdd5ace12.tar
vsdns-acf41993d4d699ff12238e943d7112dfdd5ace12.tar.xz
vsdns-acf41993d4d699ff12238e943d7112dfdd5ace12.zip
Makefile & little upgrades.
-rw-r--r--Makefile6
-rw-r--r--dns.h10
-rw-r--r--dns_example.c5
3 files changed, 13 insertions, 8 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..0cb1cbc
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,6 @@
+dns_example: dns_example.c dns.c dns.h
+ gcc dns_example.c dns.c -I. -o $@
+
+.PHONY: clean
+clean:
+ rm -f dns_example
diff --git a/dns.h b/dns.h
index 788618d..208dda0 100644
--- a/dns.h
+++ b/dns.h
@@ -1,12 +1,12 @@
-#ifndef DNS_INCLUDED
-#define DNS_INCLUDED
+#ifndef NEWBIEDNS_INCLUDED
+#define NEWBIEDNS_INCLUDED
enum { /* Some of DNS types: */
- dns_type_a = 1,
+ dns_type_a = 1,
dns_type_cname = 5,
- dns_type_mx = 15,
- dns_type_txt = 16
+ dns_type_mx = 15,
+ dns_type_txt = 16
};
struct dns_answers {
diff --git a/dns_example.c b/dns_example.c
index 27eea8d..f6efeba 100644
--- a/dns_example.c
+++ b/dns_example.c
@@ -4,10 +4,9 @@
int main()
{
- struct dns_answers *ans = dns_get("10.1.1.1",
- "veresov.pro",
- dns_type_mx);
struct dns_answers *cur;
+ const char *router = "10.1.1.1"; /* place here your one */
+ struct dns_answers *ans = dns_get(router, "veresov.pro", dns_type_a);
for (cur = ans; cur; cur = cur->next) {
if (cur->type == dns_type_a) {
unsigned char *ip = cur->data;