1 /* 2 * Copyright (C) 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 FILLP_COMMON_H 17 #define FILLP_COMMON_H 18 19 #include "spunge_stack.h" 20 #include "socket_common.h" 21 #include "hmac.h" 22 #include "res.h" 23 #include "fillp_buf_item.h" 24 #include "spunge_message.h" 25 #include "fillp_flow_control.h" 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 31 #define FILLP_GET_CONN(pcb) ((struct FtNetconn*) ((struct SpungePcb*) ((pcb)->spcb))->conn) 32 #define FILLP_GET_SOCKET(pcb) ((struct FtSocket*)(FILLP_GET_CONN(pcb)->sock)) 33 #define FILLP_GET_CONN_STATE(pcb) NETCONN_GET_STATE(FILLP_GET_CONN(pcb)) 34 35 #define FILLP_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) 36 37 #define FILLP_UNACKLIST_HASHINDEX(seqNum, pcb) \ 38 (((seqNum) / FILLP_UNACK_HASH_MOD) & (pcb)->send.unackList.hashModSize) 39 40 #define FILLP_INTERVAL_THRESHOLD 5000 41 #define FILLP_INTERVAL_DEFAULT 1000 42 void InsertUnrecvListFail(struct FillpPcb *pcb, struct FillpPcbItem *item); 43 void FillpAjustTlpParameterByRtt(struct FillpPcb *pcb, FILLP_LLONG rtt); 44 void FillpFreeItemAndEvent(struct FillpPcb *pcb, struct FillpPcbItem *item); 45 void FillpAdjustFcParamsByRtt(struct FillpPcb *pcb); 46 IGNORE_OVERFLOW void FillpAckSendPcb(struct FillpPcb *pcb, FILLP_INT seqNum); 47 IGNORE_OVERFLOW void FillpUploadRecvBox(struct FillpPcb *pcb); 48 void FillpSendNack(struct FillpPcb *pcb, FILLP_UINT32 startPktNum, FILLP_UINT32 endPktNum); 49 void FillpBuildAndSendPack(struct FillpPcb *pcb, struct FtSocket *ftSock, struct FillpPktPack *pack, 50 FILLP_UINT16 dataLen); 51 void FillpMoveUnackToUnrecv(FILLP_UINT32 last_seq, FILLP_UINT32 cur_seq, struct FillpPcb *pcb, 52 FILLP_BOOL isFromPack); 53 void FillpMoveUnackToUnrecvAll(FILLP_UINT32 ackSeq, FILLP_UINT32 lostSeq, struct FillpPcb *pcb, 54 FILLP_BOOL isFromPack, FILLP_BOOL onePktOnly); 55 void FillpDataToStack(struct FillpPcb *pcb, struct FillpPcbItem *buf); 56 #ifdef __cplusplus 57 } 58 #endif 59 60 #endif /* FILLP_COMMON_H */