Disk ARchive: zapette_protocol.hpp Source File

| Disk ARchive 2.8.3 Full featured and portable backup and archiving tool

Loading...
Searching...
No Matches
zapette_protocol.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2026 Denis Corbin
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18//
19// to contact the author, see the AUTHOR file
20/*********************************************************************/
21
25
26#include "../my_config.h"
27
28#ifndef ZAPETTE_PROTOCOL_HPP
29#define ZAPETTE_PROTOCOL_HPP
30
31extern "C"
32{
33} // end extern "C"
34
35#include <string>
36#include <new>
37#include "integers.hpp"
38#include "infinint.hpp"
39#include "generic_file.hpp"
40
41namespace libdar
42{
43
46
47 constexpr unsigned char ANSWER_TYPE_DATA = 'D';
48 constexpr unsigned char ANSWER_TYPE_INFININT = 'I';
49
50 constexpr U_I REQUEST_SIZE_SPECIAL_ORDER = 0;
51 constexpr U_I REQUEST_OFFSET_END_TRANSMIT = 0;
52 constexpr U_I REQUEST_OFFSET_GET_FILESIZE = 1;
53 constexpr U_I REQUEST_OFFSET_CHANGE_CONTEXT_STATUS = 2;
54 constexpr U_I REQUEST_IS_OLD_START_END_ARCHIVE = 3;
55 constexpr U_I REQUEST_GET_DATA_NAME = 4;
56 constexpr U_I REQUEST_FIRST_SLICE_HEADER_SIZE = 5;
57 constexpr U_I REQUEST_OTHER_SLICE_HEADER_SIZE = 6;
58
59 struct request
60 {
61 char serial_num;
62 U_16 size; // size or REQUEST_SIZE_SPECIAL_ORDER
63 infinint offset; // offset or REQUEST_OFFSET_END_TRANSMIT or REQUEST_OFFSET_GET_FILESIZE, REQUEST_OFFSET_* ...
64 std::string info; // new contextual_status
65
66 void write(generic_file *f); // master side
67 void read(generic_file *f); // slave side
68 };
69
70 struct answer
71 {
72 char serial_num;
73 char type;
74 U_16 size;
75 infinint arg;
76
77 void write(generic_file *f, char *data); // slave side
78 void read(generic_file *f, char *data, U_16 max); // master side
79 };
80
82
83} // end of namespace
84
85
86#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