Perl module provides convenient interface to OMAPI library
Mark Jason Dominus
mjd at isc.upenn.edu
Mon Apr 26 16:00:16 UTC 2004
Attached please find the initial release of Net::DHCP::Control, a suite
of Perl modules for querying and controlling the ISC DHCP server. It
consists of two parts.
Part 1: Net::DHCP::Control itself is a thin layer over the DHCPCTL
library, with Perl functions whose names match the corresponding
functions in DHCPCTL. For example, where DHCPCTL has
/* I'm C code */
dhcp_status stat = dhcpctl_get_value(value, object, "name");
if (stat != ISC_R_SUCCESS) {
fprintf(stderr, "Couldn't get name: %s\n", isc_result_totext(stat));
}
Net::DHCP::Control has:
# I'm Perl code
my $value = Net::DHCP::Control::get_value($object, "name")
or warn "Couldn't get name: $STATUS\n";
Part 2: A series of object classes that encapsulate common OMAPI
objects and the operations one usually want to perform on them. For
example, there is a Net::DHCP::Control::Lease class for manipulating
lease objects. If $Lease is one of these objects, you can use
$Lease->set_value('ends', time() + 3600);
to set the lease end time to be one hour hence, and
if ($Lease->is_active) {
...
}
to ask if the lease is presently active. The package includes some
small example programs and tests. The tests require a configuration
file, which I have not included, because it contains our host names and
secret keys. The build process will prompt you for the desired
configuration values, but the prompts are not too clear. The
documentation is very thin. Not all of the necessary object classes
are written yet; we needed Lease and Failover::State, so those were the
ones I wrote first. It should be very easy to add more classes,
however. Not all necessary features are implemented. To avoid
disappointment, assume that it doesn't work at all.
Patches will be welcome.
-- Binary/unsupported file stripped by Ecartis --
-- Type: application/x-gzip
-- File: Net-DHCP-Control-0.09.tar.gz
More information about the dhcp-hackers
mailing list