feisty meow concerns codebase 2.140
file_transfer_infoton.h
Go to the documentation of this file.
1#ifndef FILE_TRANSFER_INFOTON_CLASS
2#define FILE_TRANSFER_INFOTON_CLASS
3
4/*****************************************************************************\
5* *
6* Name : file_transfer_infoton *
7* Author : Chris Koeritz *
8* *
9*******************************************************************************
10* Copyright (c) 2005-$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 <basis/byte_array.h>
20#include <octopus/infoton.h>
21
22namespace octopi {
23
25
30{
31public:
33 enum commands {
36
40
47
56
59 };
60
62 bool _request;
67
69
70 file_transfer_infoton(const basis::outcome &success, bool request, commands command,
71 const basis::astring &source, const basis::astring &destination,
72 const basis::byte_array &packed_data);
73
74 virtual ~file_transfer_infoton();
75
76 virtual void pack(basis::byte_array &packed_form) const;
77 virtual bool unpack(basis::byte_array &packed_form);
78
80 const structures::string_array &includes);
82
83 virtual basis::clonable *clone() const { return cloner<file_transfer_infoton>(*this); }
84
85 virtual void text_form(basis::base_string &fill) const;
86
87 virtual int packed_size() const;
88
91};
92
93} //namespace.
94
95#endif
96
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
A very common template for a dynamic array of bytes.
Definition byte_array.h:36
A clonable object knows how to make copy of itself.
Definition contracts.h:109
Outcomes describe the state of completion for an operation.
Definition outcome.h:31
An object that traverses directory trees and provides a view of all files.
Base objects used by the file transfer tentacle to schedule transfers.
commands
the commands specify what this package is intended to do.
@ BUILD_TARGET_TREE
asks the target side to build the directory tree from the source.
@ CONCLUDE_TRANSFER_MARKER
this infoton marks the end of the transfer process.
@ PLACE_FILE_CHUNKS
the destination side requests a new set of chunks.
@ TREE_COMPARISON
the destination root will be compared with the source root.
basis::abyte _command
one of the commands above.
basis::outcome _success
reports what kind of result occurred.
virtual basis::clonable * clone() const
must be provided to allow creation of a copy of this object.
basis::astring _src_root
the top-level directory of the source.
static const structures::string_array & file_transfer_classifier()
returns the classifier for this type of infoton.
bool _request
if it's not a request, then it's a response.
basis::astring _dest_root
the top-level directory of the destination.
virtual int packed_size() const
reports how large the infoton will be when packed.
void package_tree_info(const filesystem::directory_tree &tree, const structures::string_array &includes)
prepares the packed data from the "tree" and "includes" list.
basis::byte_array _packed_data
the packed headers and file chunks.
virtual bool unpack(basis::byte_array &packed_form)
restores an infoton from a packed form.
virtual void pack(basis::byte_array &packed_form) const
stuffs the data in the infoton into the "packed_form".
An infoton is an individual request parcel with accompanying information.
Definition infoton.h:32
virtual basis::astring text_form() const
local version just makes text_form() more functional.
Definition infoton.h:108
An array of strings with some additional helpful methods.
unsigned char abyte
A fairly important unit which is seldom defined...
Definition definitions.h:51