• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2025 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 CLIENT_TRANS_UDP_MANAGER_STRUCT_H
17 #define CLIENT_TRANS_UDP_MANAGER_STRUCT_H
18 
19 #include <stdint.h>
20 #include <stdbool.h>
21 #include "session.h"
22 #include "softbus_def.h"
23 #include "trans_type.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 typedef struct {
30     void (*OnStreamReceived)(int32_t channelId, const StreamData *data, const StreamData *ext,
31         const StreamFrameInfo *param);
32     int32_t (*OnFileGetSessionId)(int32_t channelId, int32_t *sessionId);
33     void (*OnMessageReceived)(void);
34     int32_t (*OnUdpChannelOpened)(int32_t channelId, SocketAccessInfo *accessInfo);
35     void (*OnUdpChannelClosed)(int32_t channelId, ShutdownReason reason);
36     void (*OnQosEvent)(int channelId, int eventId, int tvCount, const QosTv *tvList);
37     int32_t (*OnIdleTimeoutReset)(int32_t sessionId);
38     int32_t (*OnRawStreamEncryptDefOptGet)(const char *sessionName, bool *isEncrypt);
39     int32_t (*OnRawStreamEncryptOptGet)(int32_t sessionId, int32_t channelId, bool *isEncrypt);
40 } UdpChannelMgrCb;
41 
42 typedef struct {
43     bool isServer;
44     int32_t peerUid;
45     int32_t peerPid;
46     char mySessionName[SESSION_NAME_SIZE_MAX];
47     char peerSessionName[SESSION_NAME_SIZE_MAX];
48     char peerDeviceId[DEVICE_ID_SIZE_MAX];
49     char groupId[GROUP_ID_SIZE_MAX];
50     char myIp[IP_LEN];
51 } sessionNeed;
52 
53 typedef struct {
54     ListNode node;
55     int32_t channelId;
56     int32_t dfileId;
57     int32_t businessType;
58     sessionNeed info;
59     int32_t routeType;
60     int32_t sessionId;
61     OnRenameFileCallback onRenameFile;
62     bool isEnable;
63     bool isTosSet;
64     int32_t peerUserId;
65     int32_t tokenType;
66     uint64_t peerTokenId;
67     char peerAccountId[ACCOUNT_UID_LEN_MAX];
68     char extraAccessInfo[EXTRA_ACCESS_INFO_LEN_MAX];
69 } UdpChannel;
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 #endif // CLIENT_TRANS_UDP_MANAGER_STRUCT_H