first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / octopi / library / octopus / identity_tentacle.h
1 #ifndef IDENTITY_TENTACLE_CLASS
2 #define IDENTITY_TENTACLE_CLASS
3
4 /*****************************************************************************\
5 *                                                                             *
6 *  Name   : identity_tentacle                                                 *
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 "identity_infoton.h"
19 #include "tentacle_helper.h"
20
21 #include <basis/byte_array.h>
22 #include <basis/outcome.h>
23 #include <structures/string_array.h>
24
25 namespace octopi {
26
27 //! Supports an early step in using octopus services: getting an identity.
28
29 class identity_tentacle
30 : public tentacle_helper<identity_infoton>
31 {
32 public:
33   identity_tentacle(octopus &parent);
34     //!< the "parent" will provide the real identity services.
35
36   virtual ~identity_tentacle();
37
38   DEFINE_CLASS_NAME("identity_tentacle");
39
40   virtual basis::outcome reconstitute(const structures::string_array &classifier,
41           basis::byte_array &packed_form, infoton * &reformed);
42     //!< reinflates an infoton given that we know the type in "classifier".
43     /*!< recreates a "reformed" infoton from the "classifier" and packed
44     infoton data in "packed_form".  this will only succeed if the classifier's
45     first name is understood here. */
46
47   virtual basis::outcome consume(infoton &to_chow, const octopus_request_id &item_id,
48           basis::byte_array &transformed);
49     //!< chews on the "to_chow" infoton to perform the requested action.
50     /*!< if it's an identity_infoton, then a new identity is provided.
51     otherwise, the identity is given rudimentary checks for validity and
52     the infoton is passed along. */
53
54 private:
55   octopus &_parent;  //!< provides the real identification service.
56 };
57
58 } //namespace.
59
60 #endif
61