| 1 |
/* |
| 2 |
* This File is part of Davix, The IO library for HTTP based protocols |
| 3 |
* Copyright (C) CERN 2013 |
| 4 |
* Author: Adrien Devresse <[email protected]> |
| 5 |
* |
| 6 |
* This library is free software; you can redistribute it and/or |
| 7 |
* modify it under the terms of the GNU Lesser General Public |
| 8 |
* License as published by the Free Software Foundation; either |
| 9 |
* version 2.1 of the License, or (at your option) any later version. |
| 10 |
* |
| 11 |
* This library is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
* Lesser General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU Lesser General Public |
| 17 |
* License along with this library; if not, write to the Free Software |
| 18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 |
* |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef DAVIX_TOOL_PARAMS_HPP |
| 23 |
#define DAVIX_TOOL_PARAMS_HPP |
| 24 |
|
| 25 |
|
| 26 |
#include <vector> |
| 27 |
#include <string> |
| 28 |
#include <davix.hpp> |
| 29 |
|
| 30 |
namespace Davix{ |
| 31 |
|
| 32 |
namespace Tool{ |
| 33 |
|
| 34 |
typedef std::pair<std::string, std::string> HeaderParam; |
| 35 |
typedef std::pair<std::string, std::string> LoginPasswd; |
| 36 |
typedef std::vector<HeaderParam> HeaderVec; |
| 37 |
|
| 38 |
// pres flag |
| 39 |
#define LONG_LISTING_FLAG 0x01 |
| 40 |
#define DISPLAY_HEADERS 0x02 |
| 41 |
|
| 42 |
struct OptParams{ |
| 43 |
OptParams(); |
| 44 |
RequestParams params; |
| 45 |
// vector of non-option arguments in order |
| 46 |
std::vector<std::string> vec_arg; |
| 47 |
int verbose; |
| 48 |
int debug; |
| 49 |
int s3_delete_per_request; |
| 50 |
int threadpool_size; |
| 51 |
// request command |
| 52 |
std::string req_type; |
| 53 |
// help msg |
| 54 |
std::string help_msg; |
| 55 |
// credential path |
| 56 |
std::string cred_path; |
| 57 |
// priv key path |
| 58 |
std::string priv_key; |
| 59 |
// certificate decryption password |
| 60 |
std::string cred_pass; |
| 61 |
// output file -o |
| 62 |
std::string output_file_path; |
| 63 |
// input file path |
| 64 |
std::string input_file_path; |
| 65 |
// user login/passwd |
| 66 |
LoginPasswd userlogpasswd; |
| 67 |
bool userlogpasswd_through_cmdline; |
| 68 |
// request content |
| 69 |
std::string req_content; |
| 70 |
// s3 auth |
| 71 |
std::pair<std::string, std::string> aws_auth; |
| 72 |
// s3 region |
| 73 |
std::string aws_region; |
| 74 |
// s3 security token |
| 75 |
std::string aws_token; |
| 76 |
// s3 alternate url |
| 77 |
bool aws_alternate; |
| 78 |
// azure key |
| 79 |
std::string azure_key; |
| 80 |
// gcloud credentials path |
| 81 |
std::string gcloud_creds_path; |
| 82 |
// openstack token for swift |
| 83 |
std::string os_token; |
| 84 |
// openstack project id for swift |
| 85 |
std::string os_project_id; |
| 86 |
// swift account |
| 87 |
std::string swift_account; |
| 88 |
// presentation flag |
| 89 |
int pres_flag; |
| 90 |
// shell flags |
| 91 |
int shell_flag; |
| 92 |
// input file flag |
| 93 |
bool has_input_file; |
| 94 |
// disable cap on task queue's size |
| 95 |
bool no_cap; |
| 96 |
// modules list |
| 97 |
std::vector<std::string> modules_list; |
| 98 |
}; |
| 99 |
|
| 100 |
int parse_davix_options(int argc, char** argv, OptParams & p, DavixError** err); |
| 101 |
|
| 102 |
int parse_davix_ls_options(int argc, char** argv, OptParams & p, DavixError** err); |
| 103 |
|
| 104 |
int parse_davix_get_options(int argc, char** argv, OptParams & p, DavixError** err); |
| 105 |
|
| 106 |
int parse_davix_put_options(int argc, char** argv, OptParams & p, DavixError** err); |
| 107 |
|
| 108 |
int parse_davix_copy_options(int argc, char** argv, OptParams & p, DavixError** err); |
| 109 |
|
| 110 |
int parse_davix_rm_options(int argc, char** argv, OptParams & p, DavixError** err); |
| 111 |
|
| 112 |
std::string get_common_options(); |
| 113 |
|
| 114 |
std::string get_base_description_options(); |
| 115 |
|
| 116 |
std::string get_get_description_options(); |
| 117 |
|
| 118 |
std::string get_put_description_options(); |
| 119 |
|
| 120 |
std::string get_copy_description_options(); |
| 121 |
} |
| 122 |
|
| 123 |
} |
| 124 |
|
| 125 |
#endif // DAVIX_TOOL_PARAMS_HPP |