⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 control.h

📁 udt.sdk.4.1.tar.gz更新包
💻 H
字号:
/*****************************************************************************Copyright (c) 2001 - 2007, The Board of Trustees of the University of Illinois.All rights reserved.Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions aremet:* Redistributions of source code must retain the above  copyright notice, this list of conditions and the  following disclaimer.* Redistributions in binary form must reproduce the  above copyright notice, this list of conditions  and the following disclaimer in the documentation  and/or other materials provided with the distribution.* Neither the name of the University of Illinois  nor the names of its contributors may be used to  endorse or promote products derived from this  software without specific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "ASIS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULARPURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER ORCONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, ORPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OFLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDINGNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THISSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*****************************************************************************//*****************************************************************************written by   Yunhong Gu, last updated 07/22/2007*****************************************************************************/#ifndef _UDT_CONTROL_H_#define _UDT_CONTROL_H_#include "udt.h"#include "common.h"#include <set>#include <map>class CUDT;struct CHistoryBlock{   uint32_t m_IP[4];   int m_iIPversion;   uint64_t m_ullTimeStamp;   int m_iRTT;   int m_iBandwidth;   int m_iLossRate;   int m_iReorderDistance;};struct CIPComp{   bool operator()(const CHistoryBlock* hb1, const CHistoryBlock* hb2) const;};struct CTSComp{   bool operator()(const CHistoryBlock* hb1, const CHistoryBlock* hb2) const;};class CHistory{public:   CHistory();   CHistory(const unsigned int& size);   ~CHistory();public:   void update(const sockaddr* addr, const int& ver, const int& rtt, const int& bw);   void update(const CHistoryBlock* hb);   int lookup(const sockaddr* addr, const int& ver, CHistoryBlock* hb);private:   void convert(const sockaddr* addr, const int& ver, uint32_t* ip);private:   unsigned int m_uiSize;   std::set<CHistoryBlock*, CIPComp> m_sIPIndex;   std::set<CHistoryBlock*, CTSComp> m_sTSIndex;   pthread_mutex_t m_Lock;};struct CUDTComp{   bool operator()(const CUDT* u1, const CUDT* u2) const;};class CControl{public:   CControl();   ~CControl();public:   int join(CUDT* udt, const sockaddr* addr, const int& ver, int& rtt, int& bw);   void leave(CUDT* udt, const int& rtt, const int& bw);private:   CHistory* m_pHistoryRecord;   std::map<CHistoryBlock*, std::set<CUDT*, CUDTComp>, CIPComp> m_mControlBlock;   std::map<CUDT*, CHistoryBlock*, CUDTComp> m_mUDTIndex;   pthread_mutex_t m_Lock;};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -