1 /* 2 * steghide 0.5.1 - a steganography program 3 * Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at> 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 */ 20 21 #ifndef SH_ARGUMENTS_H 22 #define SH_ARGUMENTS_H 23 24 #include <string> 25 #include <vector> 26 27 #include "Arg.h" 28 29 // to include DEBUG if defined 30 #ifdef HAVE_CONFIG_H 31 #include "config.h" 32 #endif 33 34 /** 35 * \class Arguments 36 * \brief parsing and data representation of command-line arguments 37 **/ 38 class Arguments { 39 public: Arguments(void)40 Arguments (void) {} ; 41 42 /** 43 * initialize this Arguments object with argc and argv 44 **/ 45 Arguments (int argc, char *argv[]) ; 46 47 /** 48 * parse Argc and Argv filling the Arg* member variable for later access 49 **/ 50 void parse (void) ; 51 52 /** 53 * is standard input used ? - according to the given arguments 54 **/ 55 bool stdin_isused (void) const ; 56 57 /// the command to be executed in this session 58 ArgCommand Command ; 59 /// the name of the command to be executed in this session (as supplied by the user) 60 std::string CommandString ; 61 62 /// the embed file name, "" if stdin 63 ArgString EmbFn ; 64 /// the extract file name, "" if stdout 65 ArgString ExtFn ; 66 /// the cover file name, "" if stdin 67 ArgString CvrFn ; 68 /// the stego file name, "" if stdout/stdin 69 ArgString StgFn ; 70 ArgString Passphrase ; 71 ArgBool Checksum ; 72 ArgInt Compression ; 73 ArgBool EmbedEmbFn ; 74 ArgEncAlgo EncAlgo ; 75 ArgEncMode EncMode ; 76 ArgULong Radius ; 77 ArgFloat Goal ; 78 ArgBool Force ; 79 ArgVerbosity Verbosity ; 80 ArgDebugCommand DebugCommand ; 81 ArgBool Check ; 82 ArgStringList FileList ; 83 ArgUInt DebugLevel ; 84 ArgUInt GmlGraphRecDepth ; 85 ArgUInt GmlStartVertex ; 86 87 std::string getPassphrase (bool doublecheck = false) ; 88 89 private: 90 typedef std::vector<std::string>::const_iterator ArgIt ; 91 92 static const int NoCompression = 0 ; 93 94 static const EncryptionAlgorithm Default_EncAlgo ; 95 static const EncryptionMode Default_EncMode ; 96 static const bool Default_Checksum = true ; 97 static const int Default_Compression = 9 ; // slowest, but smallest 98 static const bool Default_EmbedEmbFn = true ; 99 static const bool Default_Force = false ; 100 static const VERBOSITY Default_Verbosity = NORMAL ; 101 static const unsigned long Default_Radius = 0 ; // there is no default radius for all file formats 102 static const unsigned int Max_Algorithm = 3 ; 103 static const float Default_Goal = 100.0 ; 104 static const DEBUGCOMMAND Default_DebugCommand = NONE ; 105 static const bool Default_Check = false ; 106 static const unsigned int Default_DebugLevel = 0 ; 107 static const unsigned int Default_GmlGraphRecDepth = 0 ; 108 static const unsigned int Default_GmlStartVertex = 0 ; 109 110 /** 111 * parse the command 112 * 113 * Note: parse_Command is the only parse_* function that requires curarg to be a command. 114 * (because the command is the only argument with a fixed position). 115 **/ 116 void parse_Command (ArgIt& curarg) ; 117 118 /** 119 * test if curarg points to an emb filename argument and if yes: parse it 120 * \return true iff one or more arguments have been parsed 121 **/ 122 bool parse_EmbFn (ArgIt& curarg) ; 123 124 bool parse_ExtFn (ArgIt& curarg) ; 125 bool parse_CvrFn (ArgIt& curarg) ; 126 bool parse_StgFn (ArgIt& curarg) ; 127 bool parse_Passphrase (ArgIt& curarg) ; 128 bool parse_Checksum (ArgIt& curarg) ; 129 bool parse_Compression (ArgIt& curarg) ; 130 bool parse_EmbedEmbFn (ArgIt& curarg) ; 131 bool parse_Encryption (ArgIt& curarg) ; 132 bool parse_Radius (ArgIt& curarg) ; 133 bool parse_Goal (ArgIt& curarg) ; 134 bool parse_Force (ArgIt& curarg) ; 135 bool parse_Verbosity (ArgIt& curarg) ; 136 bool parse_Debug (ArgIt& curarg) ; 137 138 void setDefaults (void) ; 139 140 std::vector<std::string> TheArguments ; 141 } ; 142 143 // gcc does not support the export keyword 144 #include "Arg.cc" 145 146 #endif /* ndef SH_ARGUMENTS_H */ 147