The objects maintains a list of network objects created by the user, these objects may contain any number of IP addresses and CIDR blocks.
Its interface is very simple. The
EBox::ObjectsObserver
class has two abstract
methods that should be implemented by modules that make use of the
objects module:
usesObject
Receives an object name as an argument and returns
true
if the module is making use of the
given object in its configuration and false
otherwise.
freeObject
Receives an object name as an argument too. This method
tells the module that the user has requested the removal of
the given object (even if it was being used by other modules).
The module should delete all references to the object in its
configuration when freeObject
is
called.
As an example, here's the implementation of both of these methods in the firewall module:
Example 4.1. EBox::ObjectsObserver
subclass
implementation
sub usesObject # (object) { my ($self, $object) = @_; defined($object) or return undef; ($object ne "") or return undef; return $self->dir_exists("objects/$object"); } sub freeObject # (object) { my ($self, $object) = @_; defined($object) or return; ($object ne "") or return; $self->delete_dir("objects/$object"); }