21 using namespace basis;
27 file_transfer_infoton::file_transfer_infoton()
28 :
infoton(file_transfer_classifier()),
31 _command(TREE_COMPARISON),
41 :
infoton(file_transfer_classifier()),
44 _command(
abyte(command)),
46 _dest_root(destination),
47 _packed_data(packed_data)
95 if (!
detach(packed_form, temp_o))
return false;
98 if (!
detach(packed_form, temp))
return false;
void reset(int number=0, const contents *initial_contents=NULL_POINTER)
Resizes this array and sets the contents from an array of contents.
int length() const
Returns the current reported length of the allocated C array.
Provides a dynamically resizable ASCII character string.
void pack(byte_array &target) const
stores this string in the "target". it can later be unpacked again.
int length() const
Returns the current length of the string.
bool unpack(byte_array &source)
retrieves a string (packed with pack()) from "source" into this string.
Defines the base class for all string processing objects in hoople.
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.
the "common" class defines our common_outcomes.
Outcomes describe the state of completion for an operation.
virtual const char * class_name() const =0
Returns the bare name of this class as a constant character pointer.
An object that traverses directory trees and provides a view of all files.
virtual void pack(basis::byte_array &packed_form) const
packs the directory_tree into a byte_array.
commands
the commands specify what this package is intended to do.
basis::abyte _command
one of the commands above.
basis::outcome _success
reports what kind of result occurred.
static const structures::string_array & file_transfer_classifier()
returns the classifier for this type of infoton.
virtual ~file_transfer_infoton()
basis::astring _src_root
the top-level directory of the source.
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.
virtual basis::astring text_form() const
local version just makes text_form() more functional.
An array of strings with some additional helpful methods.
virtual void pack(basis::byte_array &packed_form) const
Packs this string array into the "packed_form" byte array.
The guards collection helps in testing preconditions and reporting errors.
unsigned char abyte
A fairly important unit which is seldom defined...
void attach(byte_array &packed_form, const char *to_attach)
Packs a character string "to_attach" into "packed_form".
bool detach(byte_array &packed_form, astring &to_detach)
Unpacks a character string "to_attach" from "packed_form".
A platform independent way to obtain the timestamp of a file.
const char * file_transfer_constant
SAFE_STATIC_CONST(string_array, identity_infoton::identity_classifier,(1, identity_classifier_strings)) int identity_infoton
A dynamic container class that holds any kind of object via pointers.