feisty meow concerns codebase  2.140
security_infoton.h
Go to the documentation of this file.
1 #ifndef SECURITY_INFOTON_CLASS
2 #define SECURITY_INFOTON_CLASS
3 
4 /*****************************************************************************\
5 * *
6 * Name : security_infoton *
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 <octopus/infoton.h>
19 
20 namespace octopi {
21 
23 
24 class security_infoton : public infoton
25 {
26 public:
27  enum login_modes {
30  LI_REFRESH
31  };
32 
35 
37  security_infoton(login_modes mode, const basis::outcome &success,
39  security_infoton(const security_infoton &to_copy);
40 
41  virtual ~security_infoton();
42 
43  DEFINE_CLASS_NAME("security_infoton");
44 
46 
47  // observes or modifies the verification token.
48  const basis::byte_array &verification() const;
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  virtual void text_form(basis::base_string &fill) const {
63  + basis::a_sprintf(": mode %d, outcome=%d", _mode, _success.value()));
64  }
65 
66 private:
67  basis::byte_array *_verification;
68 };
69 
70 } //namespace.
71 
72 #endif
73 
a_sprintf is a specialization of astring that provides printf style support.
Definition: astring.h:440
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
Outcomes describe the state of completion for an operation.
Definition: outcome.h:31
int value() const
Definition: outcome.h:51
virtual const char * class_name() const =0
Returns the bare name of this class as a constant character pointer.
An infoton is an individual request parcel with accompanying information.
Definition: infoton.h:32
Encapsulates security activities (login, logout, refresh).
virtual void text_form(basis::base_string &fill) const
requires derived infotons to be able to show their state as a string.
@ LI_REFRESH
the requester is still alive and wants to keep its login.
@ LI_LOGIN
the requester wants to log in as a new entity.
@ LI_LOGOUT
the requester surrenders its login.
basis::outcome _success
did the request succeed?
DEFINE_CLASS_NAME("security_infoton")
virtual void pack(basis::byte_array &packed_form) const
stuffs the data in the infoton into the "packed_form".
virtual int packed_size() const
reports how large the infoton will be when packed.
const basis::byte_array & verification() const
virtual clonable * clone() const
must be provided to allow creation of a copy of this object.
login_modes _mode
what kind of request is being made here?
virtual bool unpack(basis::byte_array &packed_form)
restores an infoton from a packed form.
static const structures::string_array & security_classifier()
returns the classifier for this type of infoton.
security_infoton & operator=(const security_infoton &to_copy)
An array of strings with some additional helpful methods.
Definition: string_array.h:32