21 using namespace basis;
30 auto_synchronizer l(*_secure_lock)
33 #define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), s);
44 class recognized_entity
54 class recognized_entity_list :
public string_hash<recognized_entity>
62 simple_entity_registry::simple_entity_registry()
63 : _secure_lock(new
mutex),
64 _entities(new recognized_entity_list)
77 recognized_entity *found = _entities->find(entity.
mangled_form());
84 recognized_entity *found = _entities->find(entity.
mangled_form());
85 if (!found)
return false;
95 recognized_entity *found = _entities->find(entity.
mangled_form());
101 if (verification.
length())
102 found->_verification = verification;
105 recognized_entity *new_one =
new recognized_entity;
106 new_one->_entity = entity;
107 new_one->_verification = verification;
123 recognized_entity *found = _entities->find(entity.
mangled_form());
124 if (!found)
return false;
125 last_active = found->_last_active;
126 verification = found->_verification;
134 *accum +=
astring(
"ent=") + info._entity.mangled_form() +
", active="
136 +
a_sprintf(
", %d veribytes", info._verification.length());
a_sprintf is a specialization of astring that provides printf style support.
int length() const
Returns the current reported length of the allocated C array.
Provides a dynamically resizable ASCII character string.
virtual void text_form(base_string &state_fill) const
Provides a text view of all the important info owned by this object.
A very common template for a dynamic array of bytes.
Provides a way of identifying users of an octopus object.
basis::astring mangled_form() const
returns the combined string form of the identifier.
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.
virtual ~simple_entity_registry()
virtual bool zap_entity(const octopus_entity &entity)
removes an "entity" if the entity can be found.
virtual bool refresh_entity(const octopus_entity &entity)
this should be used to refresh the entity's health record.
virtual bool add_entity(const octopus_entity &entity, const basis::byte_array &verification)
adds the "entity" to the list of authorized users.
virtual basis::astring text_form()
shows the contents of the registry.
virtual bool authorized(const octopus_entity &entity)
returns true if the "entity" is a registered and authorized entity.
Implements a hash table indexed on character strings.
Represents a point in time relative to the operating system startup time.
#define formal(parameter)
This macro just eats what it's passed; it marks unused formal parameters.
The guards collection helps in testing preconditions and reporting errors.
void WHACK(contents *&ptr)
deletion with clearing of the pointer.
bool text_form_applier(const octopus_entity &formal(key), entity_basket &bask, void *data_link)
const int ENTITY_HASH_BITS
A dynamic container class that holds any kind of object via pointers.