1 /*
2  * Copyright (C) 2021 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 NSTACKX_DFILE_DFX_H
17 #define NSTACKX_DFILE_DFX_H
18 #include <limits.h>
19 #include "nstackx_dfile.h"
20 #include "nstackx_list.h"
21 #include "nstackx_dfile_session.h"
22 typedef struct DFileSessionNode {
23     List list;
24     uint16_t sessionId;
25     DFileSession *session;
26 } DFileSessionNode;
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 #ifdef DFILE_ENABLE_HIDUMP
32 
33 DFileSessionNode *GetDFileSessionNodeById(uint16_t sessionId);
34 #define DUMP_INFO_MAX 1000
35 #define DUMP_DECIMAL 10
36 
37 extern pthread_mutex_t g_dFileSessionChainMutex;
38 extern List g_dFileSessionChain;
39 
40 int32_t HidumpHelp(char *message, size_t *size);
41 int32_t HidumpList(char *message, size_t *size);
42 int32_t HidumpInformation(char *message, size_t *size, char *opt);
43 int32_t HidumpMessage(char *message, size_t *size, char *opt);
44 
45 bool GetDfileHiDumpStatus();
46 #endif
47 
48 void WaitFileHeaderTimeoutEvent(DFileTransErrorCode errorCode);
49 void DFileServerCreateEvent(void);
50 void DFileClientCreateEvent(void);
51 void DFileSendFileBeginEvent(void);
52 void PeerShuttedEvent(void);
53 void TransferCompleteEvent(const double rate);
54 void AcceptSocketEvent(void);
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 #endif
60