Net::RULI - Perl extension for RULI,


Net-RULI documentation  | view source Contained in the Net-RULI distribution.

Index


NAME

Top

Net::RULI - Perl extension for RULI, a library for easily querying DNS SRV resource records

SYNOPSIS

Top

use Net::RULI;

my $srv_list_ref = Net::RULI::ruli_sync_query($service, $domain, $fallback_port, $options);

my $srv_list_ref = Net::RULI::ruli_sync_smtp_query($domain, $options);

my $srv_list_ref = Net::RULI::ruli_sync_http_query($domain, $force_port, $options);

DESCRIPTION

Top

RULI performs DNS queries for SRV records. The result is a ready-to-use list of SRV records. The whole logic demanded by SRV standards is already performed. It's the application role to try to contact every address in the given order.

This function performs a query for a generic service:

  my $srv_list_ref = Net::RULI::ruli_sync_query($service, $domain, 
                                                $fallback_port, $options);

This function performs a query for the SMTP service:

  my $srv_list_ref = Net::RULI::ruli_sync_smtp_query($domain, $options);

This function performs a query for the HTTP service:

  my $srv_list_ref = Net::RULI::ruli_sync_http_query($domain, $force_port, $options);

The $options field is currently unused and should be set to 0 (zero).

If the query fails for any reason, undef is returned by those functions.

EXAMPLES

Top

Example 1

This example submits a generic query for FTP over TCP.

  my $srv_list_ref = Net::RULI::ruli_sync_query("_ftp._tcp", "bogus.tld", 
                                                21, 0);

Example 2

This example submits a specific query for SMTP.

  my $srv_list_ref = Net::RULI::ruli_sync_smtp_query("bogus.tld", 0);

Example 3

This example submits a specific query for HTTP.

  my $srv_list_ref = Net::RULI::ruli_sync_http_query("bogus.tld", -1, 0);

Example 4

This example scans the list of SRV records returned by successful calls to RULI functions.

  foreach (@$srv_list_ref) {
    my $target = $_->{target};
    my $priority = $_->{priority};
    my $weight = $_->{weight};
    my $port = $_->{port};
    my $addr_list_ref = $_->{addr_list};

    print "  target=$target priority=$priority weight=$weight port=$port addresses=";

    foreach (@$addr_list_ref) {
      print $_, " ";
    }
    print "\n";
  }

SEE ALSO

Top

RFC 2782 - A DNS RR for specifying the location of services (DNS SRV)

RULI Web Site: http://www.nongnu.org/ruli/

AUTHOR

Top

Everton da Silva Marques <everton.marques@gmail.com>

COPYRIGHT AND LICENSE

Top


Net-RULI documentation  | view source Contained in the Net-RULI distribution.