1 /* 2 BAREOS® - Backup Archiving REcovery Open Sourced 3 4 Copyright (C) 2018-2020 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 #ifndef BAREOS_LIB_EDIT_H_ 22 #define BAREOS_LIB_EDIT_H_ 23 24 #include <vector> 25 26 uint64_t str_to_uint64(const char* str); 27 #define str_to_uint16(str) ((uint16_t)str_to_uint64(str)) 28 #define str_to_uint32(str) ((uint32_t)str_to_uint64(str)) 29 int64_t str_to_int64(const char* str); 30 #define str_to_int16(str) ((int16_t)str_to_int64(str)) 31 #define str_to_int32(str) ((int32_t)str_to_int64(str)) 32 char* edit_uint64_with_commas(uint64_t val, char* buf); 33 char* edit_uint64_with_suffix(uint64_t val, char* buf); 34 char* add_commas(char* val, char* buf); 35 char* edit_uint64(uint64_t val, char* buf); 36 char* edit_int64(int64_t val, char* buf); 37 char* edit_int64_with_commas(int64_t val, char* buf); 38 bool DurationToUtime(char* str, utime_t* value); 39 bool size_to_uint64(char* str, uint64_t* value); 40 bool speed_to_uint64(char* str, uint64_t* value); 41 char* edit_utime(utime_t val, char* buf, int buf_len); 42 char* edit_pthread(pthread_t val, char* buf, int buf_len); 43 bool Is_a_number(const char* num); 44 bool Is_a_number_list(const char* n); 45 bool IsAnInteger(const char* n); 46 bool IsNameValid(const char* name, POOLMEM*& msg); 47 bool IsNameValid(const char* name); 48 bool IsAclEntryValid(const char* acl, std::vector<char>& msg); 49 bool IsAclEntryValid(const char* acl); 50 bool size_to_uint64(char* str, uint64_t* value); 51 std::string SizeAsSiPrefixFormat(uint64_t value_in); 52 53 #endif // BAREOS_LIB_EDIT_H_ 54