1 /* 2 * Copyright (c) 2021-2022 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 SOFTBUS_TRANS_DEF_H 17 #define SOFTBUS_TRANS_DEF_H 18 19 #include <stdbool.h> 20 #include "session.h" 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif // __cplusplus 25 26 #define DISABLE_FD (-1) 27 28 #define MSG_FLAG_REQUEST 0 29 #define MES_FLAG_REPLY 1 30 #define TRAFFIC_LEN 32 31 32 typedef struct { 33 const char *sessionName; 34 const char *peerSessionName; 35 const char *peerDeviceId; 36 const char *groupId; 37 const SessionAttribute *attr; 38 bool isQosLane; 39 QosTV qos[QOS_TYPE_BUTT]; 40 uint32_t qosCount; 41 } SessionParam; 42 43 typedef struct { 44 int32_t channelId; 45 int32_t channelType; 46 int32_t eventId; 47 int32_t tvCount; 48 int32_t pid; 49 const QosTv *tvList; 50 } QosParam; 51 52 typedef struct { 53 int32_t channelId; 54 int32_t channelType; 55 } TransInfo; 56 57 typedef struct { 58 TransInfo transInfo; 59 int32_t ret; 60 } TransSerializer; 61 62 typedef enum { 63 FRAME_COST_LT10MS = 0, 64 FRAME_COST_LT30MS, 65 FRAME_COST_LT50MS, 66 FRAME_COST_LT75MS, 67 FRAME_COST_LT100MS, 68 FRAME_COST_LT120MS, 69 FRAME_COST_GE120MS, 70 FRAME_COST_BUTT, 71 } StreamFrameCost; 72 73 typedef enum { 74 FRAME_BIT_RATE_LT3M = 0, 75 FRAME_BIT_RATE_LT6M, 76 FRAME_BIT_RATE_LT10M, 77 FRAME_BIT_RATE_LT20M, 78 FRAME_BIT_RATE_LT30M, 79 FRAME_BIT_RATE_GE30M, 80 FRAME_BIT_RATE_BUTT, 81 } StreamFrameBitRate; 82 83 typedef struct { 84 uint32_t costTimeStatsCnt[FRAME_COST_BUTT]; 85 uint32_t sendBitRateStatsCnt[FRAME_BIT_RATE_BUTT]; 86 } StreamSendStats; 87 88 typedef struct { 89 unsigned char stats[TRAFFIC_LEN]; 90 } TrafficStats; 91 92 typedef struct TransReceiveData { 93 void *data; 94 uint32_t dataLen; 95 int32_t dataType; 96 } TransReceiveData; 97 98 #ifdef __cplusplus 99 } 100 #endif // __cplusplus 101 #endif // SOFTBUS_TRANS_DEF_H 102