• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 } SessionParam;
39 
40 typedef struct {
41     int32_t channelId;
42     int32_t channelType;
43     int32_t eventId;
44     int32_t tvCount;
45     int32_t pid;
46     const QosTv *tvList;
47 } QosParam;
48 
49 typedef struct {
50     int32_t channelId;
51     int32_t channelType;
52 } TransInfo;
53 
54 typedef struct {
55     TransInfo transInfo;
56     int32_t ret;
57 } TransSerializer;
58 
59 typedef enum {
60     FRAME_COST_LT10MS = 0,
61     FRAME_COST_LT30MS,
62     FRAME_COST_LT50MS,
63     FRAME_COST_LT75MS,
64     FRAME_COST_LT100MS,
65     FRAME_COST_LT120MS,
66     FRAME_COST_GE120MS,
67     FRAME_COST_BUTT,
68 } StreamFrameCost;
69 
70 typedef enum {
71     FRAME_BIT_RATE_LT3M = 0,
72     FRAME_BIT_RATE_LT6M,
73     FRAME_BIT_RATE_LT10M,
74     FRAME_BIT_RATE_LT20M,
75     FRAME_BIT_RATE_LT30M,
76     FRAME_BIT_RATE_GE30M,
77     FRAME_BIT_RATE_BUTT,
78 } StreamFrameBitRate;
79 
80 typedef struct {
81     uint32_t costTimeStatsCnt[FRAME_COST_BUTT];
82     uint32_t sendBitRateStatsCnt[FRAME_BIT_RATE_BUTT];
83 } StreamSendStats;
84 
85 typedef struct {
86     unsigned char stats[TRAFFIC_LEN];
87 } TrafficStats;
88 
89 typedef struct TransReceiveData {
90     void *data;
91     uint32_t dataLen;
92     int32_t dataType;
93 } TransReceiveData;
94 
95 #ifdef __cplusplus
96 }
97 #endif // __cplusplus
98 #endif // SOFTBUS_TRANS_DEF_H
99