diff --git a/services/backup/src/Tools.h b/services/backup/src/Tools.h --- a/services/backup/src/Tools.h +++ b/services/backup/src/Tools.h @@ -6,6 +6,12 @@ namespace network { namespace tools { +enum class BlobPutField { + HOLDER = 0, + HASH = 1, + DATA_CHUNK = 2, +}; + std::string generateRandomString(std::size_t length = 20); std::string generateHolder( @@ -15,6 +21,10 @@ std::string validateAttachmentHolders(const std::string &holders); +int charPtrToInt(const char *str); + +size_t getBlobPutField(BlobPutField field); + } // namespace tools } // namespace network } // namespace comm diff --git a/services/backup/src/Tools.cpp b/services/backup/src/Tools.cpp --- a/services/backup/src/Tools.cpp +++ b/services/backup/src/Tools.cpp @@ -52,6 +52,20 @@ return result; } +int charPtrToInt(const char *str) { + unsigned int intValue; + std::stringstream strValue; + + strValue << str; + strValue >> intValue; + + return intValue; +} + +size_t getBlobPutField(BlobPutField field) { + return static_cast(field); +} + } // namespace tools } // namespace network } // namespace comm