• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 TRANS_CHANNEL_CALLBACK_H
17 #define TRANS_CHANNEL_CALLBACK_H
18 
19 #include "softbus_def.h"
20 #include "softbus_trans_def.h"
21 
22 #ifdef __cplusplus
23 #if __cplusplus
24 extern "C" {
25 #endif /* __cplusplus */
26 #endif /* __cplusplus */
27 
28 typedef struct {
29     int32_t (*OnChannelOpened)(const char *pkgName, int32_t pid, const char *sessionName, const ChannelInfo *channel);
30     int32_t (*OnChannelClosed)(
31         const char *pkgName, int32_t pid, int32_t channelId, int32_t channelType, int32_t messageType);
32     int32_t (*OnChannelOpenFailed)(
33         const char *pkgName, int32_t pid, int32_t channelId, int32_t channelType, int32_t errCode);
34     int32_t (*OnDataReceived)(const char *pkgName, int32_t pid, int32_t channelId, int32_t channelType,
35         TransReceiveData* receiveData);
36     int32_t (*OnQosEvent)(const char *pkgName, const QosParam *param);
37     int32_t (*GetPkgNameBySessionName)(const char *sessionName, char *pkgName, uint16_t len);
38     int32_t (*GetUidAndPidBySessionName)(const char *sessionName, int32_t *uid, int32_t *pid);
39     int32_t (*OnChannelBind)(const char *pkgName, int32_t pid, int32_t channelId, int32_t channelType);
40 } IServerChannelCallBack;
41 
42 typedef struct {
43     const char *uuid;
44     const char *udid;
45     const char *peerIp;
46     const char *networkId;
47     int32_t routeType;
48 } LinkDownInfo;
49 
50 IServerChannelCallBack *TransServerGetChannelCb(void);
51 
52 int32_t TransServerOnChannelLinkDown(const char *pkgName, int32_t pid, const LinkDownInfo *info);
53 
54 #ifdef __cplusplus
55 #if __cplusplus
56 }
57 #endif /* __cplusplus */
58 #endif /* __cplusplus */
59 #endif
60 
61