• 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 SOFTBUS_SEQUENCE_VERIFICATION_H
17 #define SOFTBUS_SEQUENCE_VERIFICATION_H
18 
19 #include "softbus_def.h"
20 
21 #ifdef __cplusplus
22 #if __cplusplus
23 extern "C" {
24 #endif
25 #endif
26 
27 /* when receive seq < minSeq, the package is duplicated.
28    when receive seq == minSeq, update minSeq.
29    when minSeq < receive seq < maxSeq, Check whether duplicate package exist, record the package in bitmap.
30    when receive seq >= maxSeq, update maxSeq, record the package in bitmap.
31 */
32 typedef struct {
33     int32_t maxSeq;
34     int32_t minSeq;
35     uint64_t recvBitmap;
36 } SeqVerifyInfo;
37 
38 /* When the received package is an ACK packet, this function does not need to be called for verification. */
39 bool IsPassSeqCheck(SeqVerifyInfo *seqVerifyInfo, int32_t recvSeq);
40 
41 #ifdef __cplusplus
42 #if __cplusplus
43 }
44 #endif /* __cplusplus */
45 #endif /* __cplusplus */
46 
47 #endif // !SOFTBUS_SEQUENCE_VERIFICATION_H
48