Skip to content
Snippets Groups Projects
Select Git revision
  • ed0b28050d1c4cbd5ad3382383ceba675fbb83db
  • master default protected
  • release/202005
  • release/202001
  • release/201912
  • release/201911
  • release/201910
  • release/201908
  • release/201906
  • release/201905
  • release/201904
  • release/201903
  • release/201902
  • release/201901
  • release/201812
  • release/201811
  • release/201808
  • releases/beta1
  • packaging
  • native
  • release-0.2.x
  • 1.0.0
  • 0.2.0
  • 0.1.1
  • 0.1.0
25 results

navwidget.h

  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    archiver.h 2.36 KiB
    /*
     *  Copyright (C) 2016-2019 Savoir-faire Linux Inc.
     *
     *  Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
     *
     *  This program is free software; you can redistribute it and/or modify
     *  it under the terms of the GNU General Public License as published by
     *  the Free Software Foundation; either version 3 of the License, or
     *  (at your option) any later version.
     *
     *  This program is distributed in the hope that it will be useful,
     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     *  GNU General Public License for more details.
     *
     *  You should have received a copy of the GNU General Public License
     *  along with this program; if not, write to the Free Software
     *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
     */
    
    #pragma once
    
    #include "noncopyable.h"
    
    #include <string>
    #include <vector>
    #include <map>
    
    namespace jami {
    
    /**
     * Archiver is used to generate/read encrypted archives
     */
    namespace archiver {
    
    /**
     * Create a protected archive containing a list of accounts
     * @param accountIDs The accounts to exports
     * @param filepath The filepath where to put the resulting archive
     * @param password The mandatory password to set on the archive
     * @returns 0 for OK, error code otherwise
     */
    int exportAccounts(const std::vector<std::string>& accountIDs,
                        const std::string& filepath,
                        const std::string& password);
    
    /**
     * Read a protected archive and add accounts found in it
     * Warning: this function must be called from a registered pjsip thread
     * @param archivePath The path to the archive file
     * @param password The password to read the archive
     * @returns 0 for OK, error code otherwise
     */
    int importAccounts(const std::string& archivePath, const std::string& password);
    
    /**
     * Compress a STL string using zlib with given compression level and return
     * the binary data.
     */
    std::vector<uint8_t> compress(const std::string& str);
    
    /**
     * Decompress an STL string using zlib and return the original data.
     */
    std::vector<uint8_t> decompress(const std::vector<uint8_t>& dat);
    
    /**
     * Compress string to a Gzip file
     */
    void compressGzip(const std::string& str, const std::string& path);
    
    /**
     * Decompress Gzip file to bytes
     */
    std::vector<uint8_t> decompressGzip(const std::string& path);
    
    }
    
    } // namespace jami