[sr-dev] git:master: ipops: new function dns_query(hostname, pvid)

Daniel-Constantin Mierla miconda at gmail.com
Mon Jul 15 23:46:32 CEST 2013


Module: sip-router
Branch: master
Commit: 20f3846d6d39e8fd599464d1e5ce48bfec326586
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=20f3846d6d39e8fd599464d1e5ce48bfec326586

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Jul 15 23:32:33 2013 +0200

ipops: new function dns_query(hostname, pvid)

- store the result of dns query in a variable $dns(pvid=>key)
- dns query is using getaddrinfo()
- $dns(pvid=>key) - new pv allowing to navigate through the result of a dns query
- key can be:
	- count - number of addresses
	- ipv4 - set to 1 if at least one ipv4 address (otherwise 0)
	- ipv6 - set to 1 if at least one ipv6 address (otherwise 0)
	- addr[index] - the address as string from position index in the list (0 based indexing)
	- type[index] - the type of address from position index in the list (0 based indexing), the value is 4 for ipv4 and 6 for ipv6
- example:

	if(dns_query("test.com", "xyz"))
	{
		xlog("===== number of addresses: $dns(xyz=>count)\n");
		xlog("===== ipv4 address found: $dns(xyz=>ipv4)\n");
		xlog("===== ipv6 address found: $dns(xyz=>ipv6)\n");
		$var(i) = 0;
		while($var(i)<$dns(xyz=>count)) {
			xlog("===== #[$var(i)] type ($dns(xyz=>addr[$var(i)])) addr [$dns(xyz=>addr[$var(i)])]\n");
			$var(i) = $var(i) + 1;
		}
	}

---

 modules/ipops/ipops_mod.c |   42 +++++-
 modules/ipops/ipops_pv.c  |  428 +++++++++++++++++++++++++++++++++++++++++++++
 modules/ipops/ipops_pv.h  |   39 ++++
 3 files changed, 508 insertions(+), 1 deletions(-)

Diff:   http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=20f3846d6d39e8fd599464d1e5ce48bfec326586



More information about the sr-dev mailing list