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 <stdint.h> 20 21 #include "session.h" 22 #include "softbus_def.h" 23 #include "softbus_trans_def.h" 24 25 #ifdef __cplusplus 26 #if __cplusplus 27 extern "C" { 28 #endif 29 #endif 30 31 typedef struct { 32 int32_t (*OnChannelOpened)(const char *pkgName, const char *sessionName, const ChannelInfo *channel); 33 int32_t (*OnChannelClosed)(const char *pkgName, int32_t channelId, int32_t channelType); 34 int32_t (*OnChannelOpenFailed)(const char *pkgName, int32_t channelId, int32_t channelType, int32_t errCode); 35 int32_t (*OnDataReceived)(const char *pkgName, int32_t channelId, int32_t channelType, 36 const void *data, uint32_t len, int32_t type); 37 int32_t (*OnQosEvent)(const char *pkgName, const QosParam *param); 38 int32_t (*GetPkgNameBySessionName)(const char *sessionName, char *pkgName, uint16_t len); 39 int32_t (*GetUidAndPidBySessionName)(const char *sessionName, int32_t *uid, int32_t *pid); 40 } IServerChannelCallBack; 41 42 IServerChannelCallBack *TransServerGetChannelCb(void); 43 44 int32_t TransServerOnChannelLinkDown(const char *pkgName, const char *networkId, int32_t routeType); 45 46 #ifdef __cplusplus 47 #if __cplusplus 48 } 49 #endif /* __cplusplus */ 50 #endif /* __cplusplus */ 51 #endif 52 53