feisty meow concerns codebase  2.140
octopi::simple_entity_registry Class Reference

Provides a basic implementation of an entity_registry for octopus. More...

#include <simple_entity_registry.h>

Inheritance diagram for octopi::simple_entity_registry:
Collaboration diagram for octopi::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. More...
 
virtual bool locate_entity (const octopus_entity &entity, timely::time_stamp &last_active, basis::byte_array &verification)
 retrieves the "security_record" for the "entity" if it exists. More...
 
virtual bool add_entity (const octopus_entity &entity, const basis::byte_array &verification)
 adds the "entity" to the list of authorized users. More...
 
virtual bool refresh_entity (const octopus_entity &entity)
 this should be used to refresh the entity's health record. More...
 
virtual bool zap_entity (const octopus_entity &entity)
 removes an "entity" if the entity can be found. More...
 
virtual basis::astring text_form ()
 shows the contents of the registry. More...
 
- Public Member Functions inherited from octopi::entity_registry
 entity_registry ()
 
virtual ~entity_registry ()
 

Detailed Description

Provides a basic implementation of an entity_registry for octopus.

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 different 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 39 of file simple_entity_registry.h.

Constructor & Destructor Documentation

◆ simple_entity_registry()

octopi::simple_entity_registry::simple_entity_registry ( )

Definition at line 62 of file simple_entity_registry.cpp.

◆ ~simple_entity_registry()

octopi::simple_entity_registry::~simple_entity_registry ( )
virtual

Definition at line 68 of file simple_entity_registry.cpp.

References basis::WHACK().

Member Function Documentation

◆ add_entity()

bool octopi::simple_entity_registry::add_entity ( const octopus_entity entity,
const basis::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 octopi::entity_registry.

Reimplemented in cromp::cromp_security.

Definition at line 91 of file simple_entity_registry.cpp.

References GRAB_LOCK, basis::array< contents >::length(), and octopi::octopus_entity::mangled_form().

◆ authorized()

bool octopi::simple_entity_registry::authorized ( const octopus_entity entity)
virtual

returns true if the "entity" is a registered and authorized entity.

Implements octopi::entity_registry.

Definition at line 74 of file simple_entity_registry.cpp.

References GRAB_LOCK, and octopi::octopus_entity::mangled_form().

◆ locate_entity()

bool octopi::simple_entity_registry::locate_entity ( const octopus_entity entity,
timely::time_stamp last_active,
basis::byte_array verification 
)
virtual

retrieves the "security_record" for the "entity" if it exists.

true is returned on success.

Implements octopi::entity_registry.

Definition at line 119 of file simple_entity_registry.cpp.

References GRAB_LOCK, and octopi::octopus_entity::mangled_form().

◆ refresh_entity()

bool octopi::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 octopi::entity_registry.

Definition at line 81 of file simple_entity_registry.cpp.

References GRAB_LOCK, and octopi::octopus_entity::mangled_form().

◆ text_form()

astring octopi::simple_entity_registry::text_form ( )
virtual

shows the contents of the registry.

Implements octopi::entity_registry.

Definition at line 140 of file simple_entity_registry.cpp.

References GRAB_LOCK, and octopi::text_form_applier().

◆ zap_entity()

bool octopi::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 octopi::entity_registry.

Definition at line 113 of file simple_entity_registry.cpp.

References GRAB_LOCK, and octopi::octopus_entity::mangled_form().


The documentation for this class was generated from the following files: