1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license that can
* be found in the License.html file in the root of the source tree.
*/
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// JSON functions
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------------------------------
#ifndef DaemonClientH
#define DaemonClientH
//---------------------------------------------------------------------------
#include <string>
#include <map>
#include <bitset>
#include "MediaConchLib.h"
//---------------------------------------------------------------------------
namespace MediaConch
{
class Http;
class CheckerReport;
//***************************************************************************
// Class DaemonClient
//***************************************************************************
class DaemonClient
{
public:
//Constructor/Destructor
DaemonClient(MediaConchLib* m);
~DaemonClient();
// General
int init(std::string& err);
int close();
void reset();
bool is_init(std::string& err);
//***************************************************************************
// MediaConch General
//***************************************************************************
// Plugins
int mediaconch_get_plugins(std::vector<std::string>& plugins, std::string& error);
int mediaconch_list_watch_folders(std::vector<std::string>& folders, std::string& error);
int mediaconch_watch_folder(const std::string& folder, const std::string& folder_reports,
const std::vector<std::string>& plugins, const std::vector<std::string>& policies,
long *in_user, bool recursive,
const std::vector<std::pair<std::string,std::string> >& options,
long& user_id, std::string& error);
int mediaconch_edit_watch_folder(const std::string& folder, const std::string& folder_reports,
std::string& error);
int mediaconch_remove_watch_folder(const std::string& folder, std::string& error);
//***************************************************************************
// Checker
//***************************************************************************
// List
int checker_list(int user, std::vector<std::string>& vec, std::string& error);
// filename_from_id
int checker_file_from_id(int user, long id, std::string& filename, std::string& error);
long checker_id_from_filename(int user, const std::string& filename,
const std::vector<std::pair<std::string,std::string> >& options, std::string& error);
int checker_file_information(int user, long id, MediaConchLib::Checker_FileInfo& info, std::string& error);
// list_mediainfo_outputs
int checker_list_mediainfo_outputs(std::string& outputs, std::string& error);
// default_values_for_type
int default_values_for_type(const std::string& type, std::vector<std::string>& values, std::string& error);
// Analyze
int checker_analyze(int user, const std::string& file, const std::vector<std::string>& plugins,
const std::vector<std::pair<std::string,std::string> >& options,
bool& registered, bool force_analyze, bool mil_analyze, long& file_id, std::string& error);
// Status
int checker_status(int user, long file_id, MediaConchLib::Checker_StatusRes& res, std::string& error);
// Clear
int checker_clear(int user, const std::vector<long>& files, std::string& error);
// Stop
int checker_stop(int user, const std::vector<long>& files, std::string& error);
// Report
int checker_get_report(CheckerReport& c_report, MediaConchLib::Checker_ReportRes* result, std::string& error);
int checker_validate(int user, MediaConchLib::report report, const std::vector<long>& files,
const std::vector<size_t>& policies_ids,
const std::vector<std::string>& policies_contents,
const std::map<std::string, std::string>& options,
std::vector<MediaConchLib::Checker_ValidateRes*>& result, std::string& error);
//***************************************************************************
// Policy
//***************************************************************************
// create XSLT
int xslt_policy_create(int user, const std::string& type, int parent_id, std::string& err);
// import
int policy_import(int user, const std::string& memory, std::string& err);
// remove
int policy_remove(int user, int id, std::string& err);
// remove
int policy_dump(int user, int id, bool must_be_public, std::string& memory, std::string& err);
// save
int policy_save(int user, int pos, std::string& err);
// duplicate
int policy_duplicate(int user, int id, int dst_policy_id, int *dst_user, bool must_be_public, std::string& err);
// policy move
int policy_move(int user, int id, int dst_policy_id, std::string& err);
// change name && description
int policy_change_info(int user, int id, const std::string& name, const std::string& description,
const std::vector<std::string>& tags, const std::string& level, const std::string& license, std::string& err);
// change type
int policy_change_type(int user, int id, const std::string& type, std::string& err);
// change is_public
int policy_change_is_public(int user, int id, bool is_public, std::string& err);
// get policy
int policy_get(int user, int id, const std::string& format, bool must_be_public,
MediaConchLib::Get_Policy& policy, std::string& err);
// get policy name
int policy_get_name(int user, int id, std::string& name, std::string& err);
// get the number of policies
size_t policy_get_policies_count(int user, std::string& error);
// clear policies
int policy_clear_policies(int user, std::string& err);
// get all policies
int policy_get_policies(int user, const std::vector<int>&, const std::string& format, MediaConchLib::Get_Policies&,
std::string& error);
// get all public policies
int policy_get_public_policies(std::vector<MediaConchLib::Policy_Public_Policy*>& policies, std::string& err);
// get all policies with ID && name
int policy_get_policies_names_list(int user, std::vector<std::pair<int, std::string> >&, std::string& err);
// policy_create_from_file
int xslt_policy_create_from_file(int user, long id, std::string& err);
// create XSLT rule
int xslt_policy_rule_create(int user, int policy_id, std::string& err);
// get XSLT rule
XsltPolicyRule *xslt_policy_rule_get(int user, int policy_id, int id, std::string& err);
// edit XSLT rule
int xslt_policy_rule_edit(int user, int policy_id, int rule_id, const XsltPolicyRule *rule, std::string& err);
// duplicate XSLT rule
int xslt_policy_rule_duplicate(int user, int policy_id, int rule_id, int dst_policy_id, std::string& err);
// move XSLT rule
int xslt_policy_rule_move(int user, int policy_id, int rule_id, int dst_policy_id, std::string& err);
// delete XSLT rule
int xslt_policy_rule_delete(int user, int policy_id, int rule_id, std::string& err);
private:
MediaConchLib *mcl;
Http *http_client;
DaemonClient(const DaemonClient&);
DaemonClient& operator=(const DaemonClient&);
};
}
#endif // !DaemonClientH
|