NAME

Net::ISC::DHCPd - Interacts with ISC DHCPd


VERSION

0.08


SYNOPSIS

 my $dhcpd = Net::ISC::DHCPd->new(
                 config => { file => "path/to/config" },
                 leases => { file => "path/to/leases" },
                 omapi => { ... },
             );

See tests for more documentation.


ATTRIBUTES

config

 $config_obj = $self->config
 $bool = $self->has_config;

Instance of the Net::ISC::DHCPd::Config manpage class.

leases

 $leases_obj = $self->leases
 $bool = $self->has_leases;

Instance of the Net::ISC::DHCPd::Leases manpage class.

omapi

 $omapi_obj = $self->omapi;
 $bool = $self->has_omapi;

Instance of the Net::ISC::DHCPd::OMAPI manpage class.

binary

 $path_to_binary = $self->binary;

Default: "dhcpd3"

pidfile

 $path_class_object = $self->pidfile;

Default: /var/run/dhcp3-server/dhcpd.pid

process

 $proc_obj = $self->process;
 $self->process($proc_obj);
 $self->process(\%args);
 $self->has_process;
 $self->clear_process;

The object holding the dhcpd process.

errstr

 $string = $self->errstr;

Holds the last know error.


METHODS

start

 $bool = $self->start($args);

Will start the dhcpd server, as long as there is no existing process.

$args:

 {
   user       || getpwuid $<
   group      || getgrgid $<
   interfaces || ""
 }

Returns:

 1     => OK
 0     => Already running
 undef => Failed. Check errstr()

TODO: Enable it to start the server as a differnet user/group.

stop

 $bool = $self->stop;

Return:

 1:     OK
 undef: Failed. Check errstr()

restart

 $bool = $self->restart;

Return:

 1     => OK
 undef => Failed. Check errstr()

status

 $string = $self->status;

Returns the status of the DHCPd server:

 stopped
 running

test

 $bool = $self->test("config");
 $bool = $self->test("leases");

Will test either config or leases file.

 1:     OK
 undef: Failed. Check errstr()


BUGS

Please report any bugs or feature requests to bug-net-isc-dhcpd at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


COPYRIGHT & LICENSE

Copyright 2007 Jan Henning Thorsen, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


AUTHOR

Jan Henning Thorsen, <jhthorsen at cpan.org>


CONTRIBUTORS

Nito Martinez

Alexey Illarionov

Patrick

napetrov