1 #ifndef LOGIN_TENTACLE_CLASS
2 #define LOGIN_TENTACLE_CLASS
4 /*****************************************************************************\
6 * Name : login_tentacle *
7 * Author : Chris Koeritz *
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 \*****************************************************************************/
18 #include "security_infoton.h"
20 #include <octopus/tentacle_helper.h>
25 class entity_registry;
26 class octopus_request_id;
28 //! Provides rudimentary login services.
30 This is a way for entities to become logged into an octopus system,
31 should that be required by the application.
35 : public tentacle_helper<security_infoton>
38 login_tentacle(entity_registry &security,
39 int dormancy_period = 7 * basis::MINUTE_ms);
40 //!< constructs a login manager based on "security".
41 /*!< this will allow an entity to persist for "dormancy_period"
42 milliseconds without a refresh. after that time, the entities we haven't
43 heard from are whacked. the "security" object will provide our login
46 virtual ~login_tentacle();
48 DEFINE_CLASS_NAME("login_tentacle");
50 virtual basis::outcome reconstitute(const structures::string_array &classifier,
51 basis::byte_array &packed_form, infoton * &reformed);
52 //!< recreates a "reformed" infoton from the packed data.
53 /*!< this uses the "classifier" and packed infoton data in "packed_form".
54 this will only succeed if the classifier's first name is understood here.
57 virtual basis::outcome consume(infoton &to_chow, const octopus_request_id &item_id,
58 basis::byte_array &transformed);
59 //!< the base login_tentacle allows anyone to log in.
60 /*!< this permits any entity that tries to log in to become a verified
61 entity. derived login_tentacles can force the entity to prove that it's
62 worthy in an application specific manner. */
64 virtual void expunge(const octopus_entity &to_remove);
65 //!< trashes the records we were keeping for the entity.
68 entity_registry &_security; //!< allows or disallows entity access.
69 int _dormancy_period; //!< time allowed before an entity is dropped.