This package is the public YaST2 API to configure the ISC DHCP server
$ret = AddDeclaration ($config, $type, $id, $parent_type, $parent_id);
$ret = SetDeclarationParent ($config, $type, $id, $new_parent_type, $new_parent_id);
$ret = SetDeclarationOptions ({}, $config, $type, $id, $options);
$directives = GetDeclarationDirectives ($config, $type, $id);
$ret = SetDeclarationDirectives ($config, $type, $id, $directives);
Immediatelly stops the DHCP service. Returns nonzero if operation succeeded, zero if operation failed.
Example 85.
my $status = StopDhcpService ({});
if ($status == 0)
{
print "Stopping DHCP server failed";
}
else
{
print "Stopping DHCP server succeeded";
}Immediatelly starts the DHCP service. Returns nonzero if operation succeeded, zero if operation failed.
Example 86.
my $status = StartDhcpService ({});
if ($status == 0)
{
print "Starting DHCP server failed";
}
else
{
print "Starting DHCP server succeeded";
}Check if DHCP service is running. Returns nonzero if service is running, zero otherwise.
Example 87.
my $status = GetDhcpServiceStatus ({});
if ($status == 0)
{
print "DHCP server is not running";
}
else
{
print "DHCP server is running";
}Add a new empty DHCP declaration. $type is one of subnet, host, group, pool, shared-network. $id is identification of the declaration (eg. host name for the host, $address netmask $netmask for subnet declaration. $parent_type and $parent_id specify the declaration within that the new declaration shall be created.
Example 88.
my $type = "host";
my $id = "client";
my $ret = AddDeclaration ({}, $type, $id, "", "");
Deletes specified declaration including its whole subtree.
Returns the parent of specified declaration. It is returned as a hash with keys "type" and "id".
Example 90.
my $type = "host";
my $id = "client";
my $parent = GetDeclarationParent ({}, $type, $id);
if (! defined ($parent))
{
print "Specified declaration not found"
}
else
{
my $par_type = $parent->{"type"};
my $par_id = $parent->{"id"};
print "Parent type: $par_type";
print "Parent id: $par_id;
}Sets specified parent to the specified declaration (moves it in the tree). The declaration is moved with its complete subtree.
Example 91.
my $type = "host";
my $id = "client";
my $ret = SetDeclarationParent ({}, $type, $id, "", "");Get all children of a declaration.
Example 92.
my $children = GetChildrenOfDeclaration ({}, "subnet", "192.168.0.0 netmask 255.255.255.0");
if (! defined ($children))
{
print "Specified declaration not found";
}
else
{
foreach my $child (@{$children}) {
my $type = $child->{"type"};
my $id = $child->{"id"};
print "Have child $type $id";
}
}Get all options of the specified declaration.
Example 93.
my $options = GetDeclarationOptions ({}, "subnet", "192.168.0.0 netmask 255.255.255.0");
if (! defined ($options))
{
print "Specified declaration not found";
}
else
{
foreach my $option (@{$options}) {
my $key = $option->{"key"};
my $value = $option->{"value"};
print "Have option $key with value $value";
}
}Sets all options of specified declaration. The options argument has the same structure as return value of the GetDeclarationOptions function.
Example 94.
my $options = [
{
"key" => "domain-name-servers",
"value" => "ns1.internal.example.org ns2.internal.example.org",
},
{
"key" => "domain-name",
"value" => "\"internal.example.org\"",
},
]
$success = SetDeclarationOptions ("host", "client", $options);Get all directives of the specified declaration.
Example 95.
my $directives = GetDeclarationDirectives ({}, "subnet", "192.168.0.0 netmask 255.255.255.0");
if (! defined ($directives))
{
print "Specified declaration not found";
}
else
{
foreach my $directive (@{$directives}) {
my $key = $option->{"key"};
my $value = $option->{"value"};
print "Have directive $key with value $value";
}
}Sets all directives of specified declaration. The directives argument has the same structure as return value of the GetDeclarationDirectives function.
Example 96.
my $directives = [
{
"key" => "default-lease-time",
"value" => "600",
},
{
"key" => "max-lease-time",
"value" => "7200",
},
]
$success = SetDeclarationDirectives ({}, "host", "client", $directives);