Ring Daemon 16.0.0
Loading...
Searching...
No Matches
datatransfer_interface.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2004-2025 Savoir-faire Linux Inc.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#ifndef LIBJAMI_DATATRANSFERI_H
19#define LIBJAMI_DATATRANSFERI_H
20
21#include "def.h"
22
23#include "jami.h"
24
25#include <string>
26#include <map>
27#include <vector>
28#include <memory>
29#include <bitset>
30
31namespace libjami {
32
33[[deprecated("Replaced by registerSignalHandlers")]] LIBJAMI_PUBLIC void registerDataXferHandlers(
34 const std::map<std::string, std::shared_ptr<CallbackWrapperBase>>&);
35
36using DataTransferId = uint64_t;
37
39 invalid = 0,
51};
52
53enum class LIBJAMI_PUBLIC DataTransferError : uint32_t {
54 success = 0,
58};
59
61enum class LIBJAMI_PUBLIC DataTransferFlags {
63};
64
66{
67 std::string accountId;
69 DataTransferEventCode::invalid};
70 uint32_t flags {0};
71 int64_t totalSize {0};
72 int64_t bytesProgress {0};
73 std::string author;
74 std::string peer;
75 std::string conversationId;
76 std::string displayName;
77 std::string path;
78 std::string mimetype;
80};
81
108
109LIBJAMI_PUBLIC void sendFile(const std::string& accountId,
110 const std::string& conversationId,
111 const std::string& path,
112 const std::string& displayName,
113 const std::string& replyTo) noexcept;
114
123LIBJAMI_PUBLIC bool downloadFile(const std::string& accountId,
124 const std::string& conversationId,
125 const std::string& interactionId,
126 const std::string& fileId,
127 const std::string& path) noexcept;
128
141DataTransferError cancelDataTransfer(const std::string& accountId,
142 const std::string& conversationId,
143 const std::string& fileId) noexcept LIBJAMI_PUBLIC;
144
154LIBJAMI_PUBLIC DataTransferError fileTransferInfo(const std::string& accountId,
155 const std::string& conversationId,
156 const std::string& fileId,
157 std::string& path,
158 int64_t& total,
159 int64_t& progress) noexcept;
160
161// Signals
163{
165 {
166 constexpr static const char* name = "DataTransferEvent";
167 using cb_type = void(const std::string& accountId,
168 const std::string& conversationId,
169 const std::string& interactionId,
170 const std::string& fileId,
171 int eventCode);
172 };
173};
174
175} // namespace libjami
176
177#endif // LIBJAMI_DATATRANSFERI_H
direction
0: outgoing, 1: incoming
#define LIBJAMI_PUBLIC
Definition def.h:42
enum LIBJAMI_PUBLIC enum LIBJAMI_PUBLIC DataTransferError
DataTransferError cancelDataTransfer(const std::string &accountId, const std::string &conversationId, const std::string &fileId) noexcept
Refuse or abort an outgoing or an incoming file transfer.
enum LIBJAMI_PUBLIC wait_host_acceptance
enum LIBJAMI_PUBLIC finished
enum LIBJAMI_PUBLIC enum LIBJAMI_PUBLIC invalid_argument
DataTransferError fileTransferInfo(const std::string &accountId, const std::string &conversationId, const std::string &fileId, std::string &path, int64_t &total, int64_t &progress) noexcept
Return the amount of sent/received bytes of an existing data transfer.
enum LIBJAMI_PUBLIC unsupported
void sendFile(const std::string &accountId, const std::string &conversationId, const std::string &path, const std::string &displayName, const std::string &replyTo) noexcept
Asynchronously send a file to a peer using given account connection.
bool downloadFile(const std::string &accountId, const std::string &conversationId, const std::string &interactionId, const std::string &fileId, const std::string &path) noexcept
Asks for retransferring a file.
enum LIBJAMI_PUBLIC created
enum LIBJAMI_PUBLIC wait_peer_acceptance
enum LIBJAMI_PUBLIC closed_by_host
enum LIBJAMI_PUBLIC closed_by_peer
enum LIBJAMI_PUBLIC enum LIBJAMI_PUBLIC io
enum LIBJAMI_PUBLIC unjoinable_peer
enum LIBJAMI_PUBLIC timeout_expired
void registerDataXferHandlers(const std::map< std::string, std::shared_ptr< CallbackWrapperBase > > &handlers)
enum LIBJAMI_PUBLIC enum LIBJAMI_PUBLIC unknown
enum LIBJAMI_PUBLIC ongoing
enum LIBJAMI_PUBLIC DataTransferEventCode
uint64_t DataTransferId
enum LIBJAMI_PUBLIC invalid_pathname
std::string accountId
Identifier of the emiter/receiver account.
std::string mimetype
MimeType of transferred data (https://www.iana.org/assignments/media-types/media-types....
std::string peer
Identifier of the remote peer (in the semantic of the associated account)
std::string displayName
Human oriented transfer name.
std::string path
associated local file path if supported (empty, if not)
void(const std::string &accountId, const std::string &conversationId, const std::string &interactionId, const std::string &fileId, int eventCode) cb_type