aboutsummaryrefslogtreecommitdiff
path: root/dns_example.c
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2020-08-16 15:40:25 +0300
committerAleksey Veresov <aleksey@veresov.pro>2020-08-16 15:40:25 +0300
commit6b286788c724b12da99661eec1d9a40cf82a046b (patch)
tree3f51f43d05ee58d4e2f1c12e8bcc43a397b79314 /dns_example.c
parentacf41993d4d699ff12238e943d7112dfdd5ace12 (diff)
downloadvsdns-6b286788c724b12da99661eec1d9a40cf82a046b.tar
vsdns-6b286788c724b12da99661eec1d9a40cf82a046b.tar.xz
vsdns-6b286788c724b12da99661eec1d9a40cf82a046b.zip
SRV parsing added.
Diffstat (limited to 'dns_example.c')
-rw-r--r--dns_example.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/dns_example.c b/dns_example.c
index f6efeba..9f16dc0 100644
--- a/dns_example.c
+++ b/dns_example.c
@@ -10,12 +10,18 @@ int main()
for (cur = ans; cur; cur = cur->next) {
if (cur->type == dns_type_a) {
unsigned char *ip = cur->data;
- printf("IP of %s is %d.%d.%d.%d.\n",
+ printf("IP address of %s is %d.%d.%d.%d.\n",
cur->host, ip[0], ip[1], ip[2], ip[3]);
} else if (cur->type == dns_type_cname) {
printf("Cannonical name of %s is %s.\n", cur->host, cur->data);
} else if (cur->type == dns_type_txt) {
printf("Text from %s: %s\n", cur->host, cur->data);
+ } else if (cur->type == dns_type_srv) {
+ printf("Service %s is located at %s on port %d "
+ "with priority %d and weight %d.\n",
+ cur->host,
+ dns_srv_server(cur->data), dns_srv_port(cur->data),
+ dns_srv_priority(cur->data), dns_srv_weight(cur->data));
} else if (cur->type == dns_type_mx) {
printf("Mail exchange server for %s with preference %d is %s.\n",
cur->host,