Loading...
Searching...
No Matches
zapette_protocol.hpp
Go to the documentation of this file.
/*********************************************************************/
// dar - disk archive - a backup/restoration program
// Copyright (C) 2002-2026 Denis Corbin
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// to contact the author, see the AUTHOR file
/*********************************************************************/
#include "../my_config.h"
#ifndef ZAPETTE_PROTOCOL_HPP
#define ZAPETTE_PROTOCOL_HPP
extern "C"
{
} // end extern "C"
#include <string>
#include <new>
#include "integers.hpp"
#include "infinint.hpp"
#include "generic_file.hpp"
namespace libdar
{
constexpr unsigned char ANSWER_TYPE_DATA = 'D';
constexpr unsigned char ANSWER_TYPE_INFININT = 'I';
constexpr U_I REQUEST_SIZE_SPECIAL_ORDER = 0;
constexpr U_I REQUEST_OFFSET_END_TRANSMIT = 0;
constexpr U_I REQUEST_OFFSET_GET_FILESIZE = 1;
constexpr U_I REQUEST_OFFSET_CHANGE_CONTEXT_STATUS = 2;
constexpr U_I REQUEST_IS_OLD_START_END_ARCHIVE = 3;
constexpr U_I REQUEST_GET_DATA_NAME = 4;
constexpr U_I REQUEST_FIRST_SLICE_HEADER_SIZE = 5;
constexpr U_I REQUEST_OTHER_SLICE_HEADER_SIZE = 6;
struct request
{
char serial_num;
U_16 size; // size or REQUEST_SIZE_SPECIAL_ORDER
infinint offset; // offset or REQUEST_OFFSET_END_TRANSMIT or REQUEST_OFFSET_GET_FILESIZE, REQUEST_OFFSET_* ...
std::string info; // new contextual_status
void write(generic_file *f); // master side
void read(generic_file *f); // slave side
};
struct answer
{
char serial_num;
char type;
U_16 size;
infinint arg;
void write(generic_file *f, char *data); // slave side
void read(generic_file *f, char *data, U_16 max); // master side
};
} // end of namespace
#endif
generic_file.hpp
class generic_file is defined here as well as class fichier
infinint.hpp
switch module to limitint (32 ou 64 bits integers) or infinint
integers.hpp
are defined here basic integer types that tend to be portable
my_config.h
include macro defined by the configure script and some specific additional ones
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47