1 /*
2  * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FILEMANAGEMENT_DFS_SERVICE_SOFTBUS_FILE_RECEIVE_LISTENER_H
17 #define FILEMANAGEMENT_DFS_SERVICE_SOFTBUS_FILE_RECEIVE_LISTENER_H
18 
19 #include "network/softbus/softbus_session_pool.h"
20 #include <cstdint>
21 #include "transport/socket.h"
22 #include "transport/trans_type.h"
23 
24 namespace OHOS {
25 namespace Storage {
26 namespace DistributedFile {
27 class SoftBusFileReceiveListener {
28 public:
29     static void OnCopyReceiveBind(int32_t socketId, PeerSocketInfo info);
30     static void OnFile(int32_t socket, FileEvent *event);
31     static void OnReceiveFileStarted(int32_t sessionId, int32_t fileCnt);
32     static void OnReceiveFileProcess(int32_t sessionId, uint64_t bytesUpload, uint64_t bytesTotal);
33     static void OnReceiveFileFinished(int32_t sessionId, int32_t fileCnt);
34     static void OnFileTransError(int32_t sessionId, int32_t errorCode);
35     static void OnReceiveFileReport(int32_t sessionId, FileStatusList statusList, int32_t errorCode);
36     static void OnReceiveFileShutdown(int32_t sessionId, ShutdownReason reason);
37     static std::string GetLocalSessionName(int32_t socket);
38     static void SetRecvPath(const std::string &physicalPath);
39     static const char* GetRecvPath();
40 
41 private:
42     static inline const std::string SERVICE_NAME{"ohos.storage.distributedfile.daemon"};
43     static std::string path_;
44 };
45 } // namespace DistributedFile
46 } // namespace Storage
47 } // namespace OHOS
48 #endif // FILEMANAGEMENT_DFS_SERVICE_SOFTBUS_FILE_RECEIVE_LISTENER_H