blob: bcd8b6aa3cf8f1ddd981a5fa7ebc126f5ed546ce [file] [log] [blame]
bigbiffce8f83c2015-12-12 18:30:21 -05001/*
2 Copyright 2013 to 2016 TeamWin
3 TWRP is free software: you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation, either version 3 of the License, or
6 (at your option) any later version.
7
8 TWRP is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with TWRP. If not, see <http://www.gnu.org/licenses/>.
15*/
16
17#include <stdio.h>
18#include <stdlib.h>
19#include <string.h>
20#include <unistd.h>
21#include <string.h>
22#include <fcntl.h>
23#include <errno.h>
24#include <sys/types.h>
25#include <sys/stat.h>
26#include <sys/select.h>
27#include <sys/time.h>
28#include <string>
29#include <fstream>
30#include <sstream>
31
32#include "twadbstream.h"
33#include "twrpback.hpp"
34
35class twadbbu {
36public:
37 static bool Write_ADB_Stream_Header(uint64_t partition_count); //Write ADB Stream Header to stream
38 static bool Write_ADB_Stream_Trailer(); //Write ADB Stream Trailer to stream
39 static bool Write_TWFN(std::string Backup_FileName, uint64_t file_size, bool use_compression); //Write a tar image to stream
40 static bool Write_TWIMG(std::string Backup_FileName, uint64_t file_size); //Write a partition image to stream
41 static bool Write_TWEOF(); //Write ADB End-Of-File marker to stream
42 static bool Write_TWERROR(); //Write error message occurred to stream
43 static bool Write_TWENDADB(); //Write ADB End-Of-Stream command to stream
44};