#include <simple_entity_registry.h>
Inheritance diagram for simple_entity_registry:


Public Member Functions | |
| simple_entity_registry () | |
| virtual | ~simple_entity_registry () |
| virtual bool | authorized (const octopus_entity &entity) |
| returns true if the "entity" is a registered and authorized entity. | |
| virtual bool | locate_entity (const octopus_entity &entity, time_stamp &last_active, byte_array &verification) |
| retrieves the "security_record" for the "entity" if it exists. | |
| virtual bool | add_entity (const octopus_entity &entity, const byte_array &verification) |
| adds the "entity" to the list of authorized users. | |
| virtual bool | refresh_entity (const octopus_entity &entity) |
| this should be used to refresh the entity's health record. | |
| virtual bool | zap_entity (const octopus_entity &entity) |
| removes an "entity" if the entity can be found. | |
| virtual istring | text_form () |
| shows the contents of the registry. | |
Requests to add an entity are always permitted; the registration is a formality that allows us to establish a record for the entity. This base class just implements authorized() by invoking locate_entity() to check if the entity exists. Thus, using it as a security model really just requires calling add_entity() whenever a new entity is seen. A better security model can be implemented in a derived class by over- riding the authorized() method and making it perform an application- specific security check.
Definition at line 37 of file simple_entity_registry.h.
| simple_entity_registry::simple_entity_registry | ( | ) |
Definition at line 58 of file simple_entity_registry.cpp.
| simple_entity_registry::~simple_entity_registry | ( | ) | [virtual] |
| bool simple_entity_registry::authorized | ( | const octopus_entity & | entity | ) | [virtual] |
returns true if the "entity" is a registered and authorized entity.
Implements entity_registry.
Definition at line 70 of file simple_entity_registry.cpp.
References GRAB_LOCK, and octopus_entity::mangled_form().
| bool simple_entity_registry::locate_entity | ( | const octopus_entity & | entity, | |
| time_stamp & | last_active, | |||
| byte_array & | verification | |||
| ) | [virtual] |
retrieves the "security_record" for the "entity" if it exists.
true is returned on success.
Implements entity_registry.
Definition at line 115 of file simple_entity_registry.cpp.
References GRAB_LOCK, and octopus_entity::mangled_form().
| bool simple_entity_registry::add_entity | ( | const octopus_entity & | entity, | |
| const byte_array & | verification | |||
| ) | [virtual] |
adds the "entity" to the list of authorized users.
note that this will still succeed if the entity is already present, allowing it to serve as an entity refresh method. if the "verification" has any length, it will be stored in the record for the "entity".
Implements entity_registry.
Reimplemented in cromp_security.
Definition at line 87 of file simple_entity_registry.cpp.
References GRAB_LOCK, array< contents >::length(), and octopus_entity::mangled_form().
Referenced by cromp_security::add_entity().
| bool simple_entity_registry::refresh_entity | ( | const octopus_entity & | entity | ) | [virtual] |
this should be used to refresh the entity's health record.
it indicates that this entity is still functioning and should not be removed due to inactivity.
Implements entity_registry.
Definition at line 77 of file simple_entity_registry.cpp.
References GRAB_LOCK, and octopus_entity::mangled_form().
| bool simple_entity_registry::zap_entity | ( | const octopus_entity & | entity | ) | [virtual] |
removes an "entity" if the entity can be found.
true is returned if that "entity" existed.
Implements entity_registry.
Definition at line 109 of file simple_entity_registry.cpp.
References GRAB_LOCK, and octopus_entity::mangled_form().
| istring simple_entity_registry::text_form | ( | ) | [virtual] |
shows the contents of the registry.
Implements entity_registry.
Definition at line 136 of file simple_entity_registry.cpp.
References GRAB_LOCK, and text_form_applier().
1.5.1