feisty meow concerns codebase  2.140
cromp_security.cpp
Go to the documentation of this file.
1 /*****************************************************************************\
2 * *
3 * Name : cromp_security *
4 * Author : Chris Koeritz *
5 * *
6 *******************************************************************************
7 * Copyright (c) 2002-$now By Author. This program is free software; you can *
8 * redistribute it and/or modify it under the terms of the GNU General Public *
9 * License as published by the Free Software Foundation; either version 2 of *
10 * the License or (at your option) any later version. This is online at: *
11 * http://www.fsf.org/copyleft/gpl.html *
12 * Please send any updates to: fred@gruntose.com *
13 \*****************************************************************************/
14 
15 #include "cromp_security.h"
16 #include "cromp_server.h"
17 
18 #include <basis/functions.h>
19 #include <octopus/entity_defs.h>
21 #include <sockets/machine_uid.h>
22 #include <sockets/tcpip_stack.h>
23 
24 using namespace basis;
25 using namespace octopi;
26 using namespace sockets;
27 //using namespace basis;
28 
29 namespace cromp {
30 
31 //#define DEBUG_CROMP_SECURITY
32  // uncomment if you want the noisier version.
33 
34 #undef LOG
35 #define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), s)
36 
37 cromp_security::cromp_security()
38 : _stack(new tcpip_stack)
39 {
40 }
41 
43 {
44  WHACK(_stack);
45 }
46 
48  const byte_array &verification)
49 {
50 #ifdef DEBUG_CROMP_SECURITY
51  FUNCDEF("add_entity");
52  LOG(astring("adding ") + client.mangled_form());
53 #endif
54  return simple_entity_registry::add_entity(client, verification);
55 }
56 
57 } //namespace.
58 
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
virtual bool add_entity(const octopi::octopus_entity &client, const basis::byte_array &verification)
adds the "entity" to the list of authorized users.
Provides a way of identifying users of an octopus object.
Definition: entity_defs.h:35
basis::astring mangled_form() const
returns the combined string form of the identifier.
Helpful functions for interacting with TCP/IP stacks.
Definition: tcpip_stack.h:38
#define LOG(s)
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
Definition: enhance_cpp.h:57
The guards collection helps in testing preconditions and reporting errors.
Definition: array.h:30
void WHACK(contents *&ptr)
deletion with clearing of the pointer.
Definition: functions.h:121
Provides access to the operating system's socket methods.
Definition: base_address.h:26