bigbiff | ce8f83c | 2015-12-12 18:30:21 -0500 | [diff] [blame] | 1 | /* |
bigbiff bigbiff | 19fb79c | 2016-09-05 21:04:51 -0400 | [diff] [blame] | 2 | Copyright 2013 to 2017 TeamWin |
bigbiff | ce8f83c | 2015-12-12 18:30:21 -0500 | [diff] [blame] | 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 | */ |
bigbiff bigbiff | 19fb79c | 2016-09-05 21:04:51 -0400 | [diff] [blame] | 16 | #ifndef _LIBTWADBBU_HPP |
| 17 | #define _LIBTWADBBU_HPP |
bigbiff | ce8f83c | 2015-12-12 18:30:21 -0500 | [diff] [blame] | 18 | |
| 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 bigbiff | 19fb79c | 2016-09-05 21:04:51 -0400 | [diff] [blame] | 31 | #include <vector> |
bigbiff | ce8f83c | 2015-12-12 18:30:21 -0500 | [diff] [blame] | 32 | #include <fstream> |
| 33 | #include <sstream> |
| 34 | |
| 35 | #include "twadbstream.h" |
bigbiff | ce8f83c | 2015-12-12 18:30:21 -0500 | [diff] [blame] | 36 | |
| 37 | class twadbbu { |
| 38 | public: |
bigbiff bigbiff | 19fb79c | 2016-09-05 21:04:51 -0400 | [diff] [blame] | 39 | static bool Check_ADB_Backup_File(std::string fname); //Check if file is ADB Backup file |
| 40 | static std::vector<std::string> Get_ADB_Backup_Files(std::string fname); //List ADB Files in String Vector |
bigbiff | ce8f83c | 2015-12-12 18:30:21 -0500 | [diff] [blame] | 41 | static bool Write_ADB_Stream_Header(uint64_t partition_count); //Write ADB Stream Header to stream |
| 42 | static bool Write_ADB_Stream_Trailer(); //Write ADB Stream Trailer to stream |
| 43 | static bool Write_TWFN(std::string Backup_FileName, uint64_t file_size, bool use_compression); //Write a tar image to stream |
| 44 | static bool Write_TWIMG(std::string Backup_FileName, uint64_t file_size); //Write a partition image to stream |
| 45 | static bool Write_TWEOF(); //Write ADB End-Of-File marker to stream |
| 46 | static bool Write_TWERROR(); //Write error message occurred to stream |
| 47 | static bool Write_TWENDADB(); //Write ADB End-Of-Stream command to stream |
bigbiff bigbiff | adcb4d8 | 2017-09-25 10:51:56 -0400 | [diff] [blame^] | 48 | static bool Write_TWDATA(FILE* adbd_fp); //Write TWDATA separator |
bigbiff | ce8f83c | 2015-12-12 18:30:21 -0500 | [diff] [blame] | 49 | }; |
bigbiff bigbiff | 19fb79c | 2016-09-05 21:04:51 -0400 | [diff] [blame] | 50 | |
| 51 | #endif //__LIBTWADBBU_HPP |