1 #ifndef UNHANDLED_REQUEST_CLASS
2 #define UNHANDLED_REQUEST_CLASS
4 /*****************************************************************************\
6 * Name : unhandled_request *
7 * Author : Chris Koeritz *
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 \*****************************************************************************/
18 #include "entity_defs.h"
20 #include "tentacle_helper.h"
22 #include <structures/string_array.h>
27 class octopus_request_id;
29 //! Informs the caller that a request type was unknown to the server octopus.
31 The accompanying octopus_request_id specifies the particular request that
32 failed. The classifier of the original request is also included for
33 reference. This allows the client to get an immediate response from the
34 server when we have no idea what they are asking for, rather than the client
35 needing to timeout on the failed request. Note: this is a heavy-weight
36 header that should not be included in other headers.
39 class unhandled_request : public infoton
42 // these members are informational so they're exposed out in public.
43 octopus_request_id _original_id; //!< the failed request's identifier.
44 structures::string_array _original_classifier; //!< the original name of the request.
45 basis::outcome _reason; //!< the reason why this request was provided.
47 unhandled_request(const octopus_request_id &id = octopus_request_id(),
48 const structures::string_array &original_classifier = structures::string_array(),
49 const basis::outcome &reason = basis::common::NO_HANDLER);
51 DEFINE_CLASS_NAME("unhandled_request");
53 static structures::string_array the_classifier();
54 //!< the classifier for unknown infotons makes unhandled requests unique.
55 /*!< __Unhandled__ is now a reserved word for classifiers. That's the
56 classifier for all unhandled_request objects as returned by
59 virtual void text_form(basis::base_string &fill) const;
60 virtual void pack(basis::byte_array &packed_form) const;
61 virtual bool unpack(basis::byte_array &packed_form);
62 virtual clonable *clone() const;
63 virtual int packed_size() const;
68 class unhandled_request_tentacle
69 : public tentacle_helper<unhandled_request>
72 unhandled_request_tentacle(bool backgrounded = false)
73 : tentacle_helper<unhandled_request>(unhandled_request::the_classifier(),