Changeset 676 for trunk


Ignore:
Timestamp:
01/16/15 17:28:35 (10 years ago)
Author:
Kris Deugau
Message:

/trunk

Add RPC sub to handle batch updates of several reverse IP entries so
callers don't pay the time cost of "many" RPC calls.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns-rpc.cgi

    r675 r676  
    8787#sub downconvert {
    8888        'dnsdb.addOrUpdateRevRec'       => \&addOrUpdateRevRec,
     89        'dnsdb.updateRevSet'    => \&updateRevSet,
    8990        'dnsdb.delRec'          => \&delRec,
    9091        'dnsdb.delByCIDR'       => \&delByCIDR,
     
    596597    } # iterate zones within $cidr
    597598  } # done $cidr-contains-zones
    598 }
     599##fixme:  what about errors?  what about warnings?
     600} # done addOrUpdateRevRec()
     601
     602# Update rDNS on a whole batch of IP addresses.  Presented as a separate sub via RPC
     603# since RPC calls can be s...l...o...w....
     604sub updateRevSet {
     605  my %args = @_;
     606
     607  _commoncheck(\%args, 'y');
     608
     609  my @ret;
     610  # loop over passed IP/hostname pairs
     611  foreach my $key (keys %args) {
     612    next unless $key =~ /^host_([\d.]+|[\da-f:]+)$/;
     613    my $ip = $1;
     614    push @ret, addOrUpdateRevRec(cidr => $ip, name => $args{$key}, %args);
     615  }
     616##fixme:  what about errors?  what about warnings?
     617  return \@ret;
     618} # done updateRevSet()
    599619
    600620sub delRec {
Note: See TracChangeset for help on using the changeset viewer.