Support encrypted backup files

Also includes features merged from:

Update twrpTar by kokotas

Revised function entryExists().
Added function to get archive's uncompressed size.
Added option to exclude item(s) from the archive.
Revised forks()

http://review.teamw.in/#/c/590/

Change-Id: I01fa2c81643161984eff2625247af75990684bd9
diff --git a/twrpTar.hpp b/twrpTar.hpp
index 3ee6028..e270d90 100644
--- a/twrpTar.hpp
+++ b/twrpTar.hpp
@@ -30,24 +30,43 @@
 
 using namespace std;
 
+struct TarListStruct {
+	std::string fn;
+	unsigned thread_id;
+};
+
+struct thread_data_struct {
+	std::vector<TarListStruct> *TarList;
+	unsigned thread_id;
+};
+
 class twrpTar {
 	public:
-		int extract();
-		int compress(string fn);
-		int uncompress(string fn);
-                int addFilesToExistingTar(vector <string> files, string tarFile);
-		int createTar();
-		int addFile(string fn, bool include_root);
-		int entryExists(string entry);
-		int closeTar(bool gzip);
-		int createTarGZFork();
+		twrpTar();
+		virtual ~twrpTar();
 		int createTarFork();
 		int extractTarFork();
 		int splitArchiveFork();
-                void setfn(string fn);
-                void setdir(string dir);
+		void setexcl(string exclude);
+		void setfn(string fn);
+		void setdir(string dir);
+		unsigned long long uncompressedSize();
+		
+	public:
+		int use_encryption;
+		int userdata_encryption;
+		int use_compression;
+		int split_archives;
+		int has_data_media;
+		string backup_name;
+
 	private:
-		int createTGZ();
+		int extract();
+		int addFilesToExistingTar(vector <string> files, string tarFile);
+		int createTar();
+		int addFile(string fn, bool include_root);
+		int entryExists(string entry);
+		int closeTar();
 		int create();
 		int Split_Archive();
 		int removeEOT(string tarFile);
@@ -55,16 +74,26 @@
 		int tarDirs(bool include_root);
 		int Generate_Multiple_Archives(string Path);
 		string Strip_Root_Dir(string Path);
-		int extractTGZ();
-		int openTar(bool gzip);
-		int has_data_media;
+		int openTar();
 		int Archive_File_Count;
+		int Archive_Current_Type;
 		unsigned long long Archive_Current_Size;
-		int getArchiveType(); // 1 for compressed - 0 for uncompressed
 		TAR *t;
-		FILE* p;
 		int fd;
+		pid_t pigz_pid;
+		pid_t oaes_pid;
+
 		string tardir;
 		string tarfn;
 		string basefn;
+		string tarexclude;
+
+		vector<string> split;
+
+		int Generate_TarList(string Path, std::vector<TarListStruct> *TarList, unsigned long long *Target_Size, unsigned *thread_id);
+		static void* createList(void *cookie);
+		static void* extractMulti(void *cookie);
+		int tarList(bool include_root, std::vector<TarListStruct> *TarList, unsigned thread_id);
+		std::vector<TarListStruct> *ItemList;
+		int thread_id;
 };