1 #ifndef SECURITY_INFOTON_CLASS
2 #define SECURITY_INFOTON_CLASS
4 /*****************************************************************************\
6 * Name : security_infoton *
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 <octopus/infoton.h>
22 //! Encapsulates security activities (login, logout, refresh).
24 class security_infoton : public infoton
28 LI_LOGIN, //!< the requester wants to log in as a new entity.
29 LI_LOGOUT, //!< the requester surrenders its login.
30 LI_REFRESH //!< the requester is still alive and wants to keep its login.
33 login_modes _mode; //!< what kind of request is being made here?
34 basis::outcome _success; //!< did the request succeed?
37 security_infoton(login_modes mode, const basis::outcome &success,
38 const basis::byte_array &verification);
39 security_infoton(const security_infoton &to_copy);
41 virtual ~security_infoton();
43 DEFINE_CLASS_NAME("security_infoton");
45 security_infoton &operator =(const security_infoton &to_copy);
47 // observes or modifies the verification token.
48 const basis::byte_array &verification() const;
49 basis::byte_array &verification();
51 static const structures::string_array &security_classifier();
52 //!< returns the classifier for this type of infoton.
54 virtual void pack(basis::byte_array &packed_form) const;
55 virtual bool unpack(basis::byte_array &packed_form);
57 virtual clonable *clone() const;
59 virtual int packed_size() const;
61 virtual void text_form(basis::base_string &fill) const {
62 fill.assign(basis::astring(class_name())
63 + basis::a_sprintf(": mode %d, outcome=%d", _mode, _success.value()));
67 basis::byte_array *_verification; //!< anything needed for upper-level verification.