blob: ff9a3eb7f22f310d8aec21805dc4c2e69929d3d7 [file] [log] [blame]
bigbiffce8f83c2015-12-12 18:30:21 -05001/*
bigbiff bigbiff19fb79c2016-09-05 21:04:51 -04002 Copyright 2013 to 2017 TeamWin
bigbiffce8f83c2015-12-12 18:30:21 -05003 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*/
bigbiff bigbiff19fb79c2016-09-05 21:04:51 -040016#ifndef _LIBTWADBBU_HPP
17#define _LIBTWADBBU_HPP
bigbiffce8f83c2015-12-12 18:30:21 -050018
19#include <stdio.h>
20#include <stdlib.h>
21#include <string.h>
22#include <unistd.h>
23#include <string.h>
24#include <fcntl.h>
25#include <errno.h>
26#include <sys/types.h>
27#include <sys/stat.h>
28#include <sys/select.h>
29#include <sys/time.h>
30#include <string>
bigbiff bigbiff19fb79c2016-09-05 21:04:51 -040031#include <vector>
bigbiffce8f83c2015-12-12 18:30:21 -050032#include <fstream>
33#include <sstream>
34
35#include "twadbstream.h"
36#include "twrpback.hpp"
37
38class twadbbu {
39public:
bigbiff bigbiff19fb79c2016-09-05 21:04:51 -040040 static bool Check_ADB_Backup_File(std::string fname); //Check if file is ADB Backup file
41 static std::vector<std::string> Get_ADB_Backup_Files(std::string fname); //List ADB Files in String Vector
bigbiffce8f83c2015-12-12 18:30:21 -050042 static bool Write_ADB_Stream_Header(uint64_t partition_count); //Write ADB Stream Header to stream
43 static bool Write_ADB_Stream_Trailer(); //Write ADB Stream Trailer to stream
44 static bool Write_TWFN(std::string Backup_FileName, uint64_t file_size, bool use_compression); //Write a tar image to stream
45 static bool Write_TWIMG(std::string Backup_FileName, uint64_t file_size); //Write a partition image to stream
46 static bool Write_TWEOF(); //Write ADB End-Of-File marker to stream
47 static bool Write_TWERROR(); //Write error message occurred to stream
48 static bool Write_TWENDADB(); //Write ADB End-Of-Stream command to stream
49};
bigbiff bigbiff19fb79c2016-09-05 21:04:51 -040050
51#endif //__LIBTWADBBU_HPP