aboutsummaryrefslogtreecommitdiff
path: root/dns_example.c
diff options
context:
space:
mode:
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,