1 /*
2    BAREOS® - Backup Archiving REcovery Open Sourced
3 
4    Copyright (C) 2018-2018 Bareos GmbH & Co. KG
5 
6    This program is Free Software; you can redistribute it and/or
7    modify it under the terms of version three of the GNU Affero General Public
8    License as published by the Free Software Foundation and included
9    in the file LICENSE.
10 
11    This program is distributed in the hope that it will be useful, but
12    WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14    Affero General Public License for more details.
15 
16    You should have received a copy of the GNU Affero General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19    02110-1301, USA.
20 */
21 
22 #ifndef BAREOS_DIRD_FD_CMDS_H_
23 #define BAREOS_DIRD_FD_CMDS_H_
24 
25 namespace directordaemon {
26 
27 bool ConnectToFileDaemon(JobControlRecord* jcr,
28                          int retry_interval,
29                          int max_retry_time,
30                          bool verbose,
31                          UaContext* ua = nullptr);
32 int SendJobInfoToFileDaemon(JobControlRecord* jcr);
33 bool SendIncludeList(JobControlRecord* jcr);
34 bool SendExcludeList(JobControlRecord* jcr);
35 bool SendLevelCommand(JobControlRecord* jcr);
36 bool SendBwlimitToFd(JobControlRecord* jcr, const char* Job);
37 bool SendSecureEraseReqToFd(JobControlRecord* jcr);
38 bool SendPreviousRestoreObjects(JobControlRecord* jcr);
39 int GetAttributesAndPutInCatalog(JobControlRecord* jcr);
40 void GetAttributesAndCompareToCatalog(JobControlRecord* jcr, JobId_t JobId);
41 int put_file_into_catalog(JobControlRecord* jcr,
42                           long file_index,
43                           char* fname,
44                           char* link,
45                           char* attr,
46                           int stream);
47 int SendRunscriptsCommands(JobControlRecord* jcr);
48 bool SendPluginOptions(JobControlRecord* jcr);
49 bool SendRestoreObjects(JobControlRecord* jcr, JobId_t JobId, bool send_global);
50 bool CancelFileDaemonJob(UaContext* ua, JobControlRecord* jcr);
51 void DoNativeClientStatus(UaContext* ua, ClientResource* client, char* cmd);
52 void DoClientResolve(UaContext* ua, ClientResource* client);
53 void* HandleFiledConnection(ConnectionPool* connections,
54                             BareosSocket* fd,
55                             char* client_name,
56                             int fd_protocol_version);
57 
58 ConnectionPool* get_client_connections();
59 bool IsConnectingToClientAllowed(ClientResource* res);
60 bool IsConnectingToClientAllowed(JobControlRecord* jcr);
61 bool IsConnectFromClientAllowed(ClientResource* res);
62 bool IsConnectFromClientAllowed(JobControlRecord* jcr);
63 bool UseWaitingClient(JobControlRecord* jcr_job, int timeout);
64 
65 } /* namespace directordaemon */
66 #endif  // BAREOS_DIRD_FD_CMDS_H_
67