feisty meow concerns codebase 2.140
encryption_wrapper.h
Go to the documentation of this file.
1#ifndef ENCRYPTION_WRAPPER_CLASS
2#define ENCRYPTION_WRAPPER_CLASS
3
4/*****************************************************************************\
5* *
6* Name : encryption_wrapper *
7* Author : Chris Koeritz *
8* *
9*******************************************************************************
10* Copyright (c) 2004-$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 <octopus/entity_defs.h>
19#include <octopus/infoton.h>
21
22namespace octopi {
23
25
30{
31public:
34
38
40
41 virtual ~encryption_wrapper();
42
43 DEFINE_CLASS_NAME("encryption_wrapper");
44
46
47 void text_form(basis::base_string &fill) const {
48 fill.assign(basis::astring(class_name())); // low exposure for vital held info.
49 }
50
53
54 virtual void pack(basis::byte_array &packed_form) const;
55 virtual bool unpack(basis::byte_array &packed_form);
56
57 virtual clonable *clone() const;
58
59 virtual int packed_size() const;
60};
61
63
65
70: public tentacle_helper<encryption_wrapper>
71{
72public:
74 virtual ~unwrapping_tentacle();
75
76 DEFINE_CLASS_NAME("unwrapping_tentacle");
77
79 basis::byte_array &packed_form, infoton * &reformed);
80
81 virtual basis::outcome consume(infoton &to_chow, const octopus_request_id &item_id,
82 basis::byte_array &transformed);
84};
85
86} //namespace.
87
88#endif // outer guard.
89
Provides a dynamically resizable ASCII character string.
Definition astring.h:35
Defines the base class for all string processing objects in hoople.
Definition base_string.h:28
virtual base_string & assign(const base_string &s)=0
Sets the contents of this string to "s".
A very common template for a dynamic array of bytes.
Definition byte_array.h:36
static const byte_array & empty_array()
Definition byte_array.h:57
Outcomes describe the state of completion for an operation.
Definition outcome.h:31
virtual const char * class_name() const =0
Returns the bare name of this class as a constant character pointer.
Wraps an encrypted infoton when the octopus is in an encrypted mode.
void text_form(basis::base_string &fill) const
requires derived infotons to be able to show their state as a string.
virtual clonable * clone() const
must be provided to allow creation of a copy of this object.
DEFINE_CLASS_NAME("encryption_wrapper")
encryption_wrapper & operator=(const encryption_wrapper &to_copy)
virtual bool unpack(basis::byte_array &packed_form)
restores an infoton from a packed form.
virtual int packed_size() const
reports how large the infoton will be when packed.
basis::byte_array _wrapped
the encrypted data that's held here.
virtual void pack(basis::byte_array &packed_form) const
stuffs the data in the infoton into the "packed_form".
static const structures::string_array & encryption_classifier()
returns the classifier for this type of infoton.
An infoton is an individual request parcel with accompanying information.
Definition infoton.h:32
Identifies requests made on an octopus by users.
provides prefab implementations for parts of the tentacle object.
this simple tentacle just unpacks the encryption_wrapper infoton.
virtual basis::outcome consume(infoton &to_chow, const octopus_request_id &item_id, basis::byte_array &transformed)
this should never be called.
virtual basis::outcome reconstitute(const structures::string_array &classifier, basis::byte_array &packed_form, infoton *&reformed)
this is a simple enough action that it is totally automated.
DEFINE_CLASS_NAME("unwrapping_tentacle")
An array of strings with some additional helpful methods.
Automates some common tasks for tentacle implementations. This template provides some default impleme...