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_SD_CMDS_H_
23 #define BAREOS_DIRD_SD_CMDS_H_
24 
25 class JobControlRecord;
26 class dlist;
27 
28 namespace directordaemon {
29 
30 class UaContext;
31 class StorageResource;
32 
33 bool ConnectToStorageDaemon(JobControlRecord* jcr,
34                             int retry_interval,
35                             int max_retry_time,
36                             bool verbose);
37 BareosSocket* open_sd_bsock(UaContext* ua);
38 void CloseSdBsock(UaContext* ua);
39 char* get_volume_name_from_SD(UaContext* ua,
40                               slot_number_t Slot,
41                               drive_number_t drive);
42 dlist* native_get_vol_list(UaContext* ua,
43                            StorageResource* store,
44                            bool listall,
45                            bool scan);
46 slot_number_t NativeGetNumSlots(UaContext* ua, StorageResource* store);
47 drive_number_t NativeGetNumDrives(UaContext* ua, StorageResource* store);
48 bool CancelStorageDaemonJob(UaContext* ua, StorageResource* store, char* JobId);
49 bool CancelStorageDaemonJob(UaContext* ua,
50                             JobControlRecord* jcr,
51                             bool interactive = true);
52 void CancelStorageDaemonJob(JobControlRecord* jcr);
53 void DoNativeStorageStatus(UaContext* ua, StorageResource* store, char* cmd);
54 bool NativeTransferVolume(UaContext* ua,
55                           StorageResource* store,
56                           slot_number_t src_slot,
57                           slot_number_t dst_slot);
58 bool NativeAutochangerVolumeOperation(UaContext* ua,
59                                       StorageResource* store,
60                                       const char* operation,
61                                       drive_number_t drive,
62                                       slot_number_t slot);
63 bool SendBwlimitToSd(JobControlRecord* jcr, const char* Job);
64 bool SendSecureEraseReqToSd(JobControlRecord* jcr);
65 bool DoStorageResolve(UaContext* ua, StorageResource* store);
66 bool SendStoragePluginOptions(JobControlRecord* jcr);
67 
68 } /* namespace directordaemon */
69 #endif  // BAREOS_DIRD_SD_CMDS_H_
70