feisty meow concerns codebase  2.140
entity_registry.h
Go to the documentation of this file.
1 #ifndef CLIENT_REGISTRY_CLASS
2 #define CLIENT_REGISTRY_CLASS
3 
4 /*****************************************************************************\
5 * *
6 * Name : entity_registry *
7 * Author : Chris Koeritz *
8 * *
9 *******************************************************************************
10 * Copyright (c) 2002-$now By Author. This program is free software; you can *
11 * redistribute it and/or modify it under the terms of the GNU General Public *
12 * License as published by the Free Software Foundation; either version 2 of *
13 * the License or (at your option) any later version. This is online at: *
14 * http://www.fsf.org/copyleft/gpl.html *
15 * Please send any updates to: fred@gruntose.com *
16 \*****************************************************************************/
17 
18 #include <basis/astring.h>
19 #include <basis/byte_array.h>
20 #include <mathematics/chaos.h>
21 #include <timely/time_stamp.h>
22 #include <processes/safe_roller.h>
23 #include <sockets/tcpip_stack.h>
24 
25 namespace octopi {
26 
27 class octopus_entity;
28 
30 
36 {
37 public:
39  virtual ~entity_registry();
40 
41  virtual bool authorized(const octopus_entity &entity) = 0;
43 
46  virtual bool locate_entity(const octopus_entity &entity,
47  timely::time_stamp &last_active, basis::byte_array &verification) = 0;
49 
53  virtual bool add_entity(const octopus_entity &entity,
54  const basis::byte_array &verification) = 0;
56 
63  virtual bool refresh_entity(const octopus_entity &entity) = 0;
65 
68  virtual bool zap_entity(const octopus_entity &entity) = 0;
70 
72  virtual basis::astring text_form() = 0;
74 
75 private:
76  processes::safe_roller *_sequencer;
77  mathematics::chaos *_rando;
78  sockets::tcpip_stack *_stack;
79 };
80 
82 
84 
90 {
91 public:
92  bool authorized(const octopus_entity &formal(entity)) { return true; }
93  bool locate_entity(const octopus_entity &entity,
94  timely::time_stamp &last_active, basis::byte_array &verification);
95  bool add_entity(const octopus_entity &formal(entity),
96  const basis::byte_array &formal(verification)) { return true; }
97  bool refresh_entity(const octopus_entity &formal(entity)) { return true; }
98  bool zap_entity(const octopus_entity &formal(entity)) { return true; }
100 };
101 
102 } //namespace.
103 
104 #endif
105 
Provides a dynamically resizable ASCII character string.
Definition: astring.h:35
A very common template for a dynamic array of bytes.
Definition: byte_array.h:36
a platform-independent way to acquire random numbers in a specific range.
Definition: chaos.h:51
the blank_entity_registry can be used when security is not an issue.
bool authorized(const octopus_entity &formal(entity))
basis::astring text_form()
prints out the contents of the entity registry.
bool zap_entity(const octopus_entity &formal(entity))
bool add_entity(const octopus_entity &formal(entity), const basis::byte_array &formal(verification))
bool locate_entity(const octopus_entity &entity, timely::time_stamp &last_active, basis::byte_array &verification)
retrieves the security records for the "entity", if any exist.
bool refresh_entity(const octopus_entity &formal(entity))
Provides a security model for the octopus.
virtual bool authorized(const octopus_entity &entity)=0
returns true if the "entity" is a registered entity.
virtual bool add_entity(const octopus_entity &entity, const basis::byte_array &verification)=0
adds the "entity" to the list of authorized users if allowed.
virtual bool locate_entity(const octopus_entity &entity, timely::time_stamp &last_active, basis::byte_array &verification)=0
retrieves the security records for the "entity", if any exist.
virtual bool refresh_entity(const octopus_entity &entity)=0
this should be used to refresh the entity's health record.
virtual bool zap_entity(const octopus_entity &entity)=0
removes a "entity" if the entity can be found.
virtual basis::astring text_form()=0
prints out the contents of the entity registry.
Provides a way of identifying users of an octopus object.
Definition: entity_defs.h:35
Implements a thread-safe roller object.
Definition: safe_roller.h:30
Helpful functions for interacting with TCP/IP stacks.
Definition: tcpip_stack.h:38
Represents a point in time relative to the operating system startup time.
Definition: time_stamp.h:38
#define formal(parameter)
This macro just eats what it's passed; it marks unused formal parameters.
Definition: definitions.h:48