📄 communicator.h
字号:
/*
* Openmysee
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _COMMUNICATOR_H_
#define _COMMUNICATOR_H_
#include "BufferMgr.h"
#include "TryClient.h"
#include "CSClient.h"
#include "P2PMgr.h"
#include "LogMgr.h"
#include "BaseResource.h"
#include "LiveResource.h"
#include "CriticalSection.h"
#include "LocalPeerFinder.h"
namespace NPLayer1 {
#define POST_LOG_URL_LEN 512
class Communicator {
public:
// 构造函数
Communicator();
// 析构函数
virtual ~Communicator();
// 初始化
P2P_RETURN_TYPE Init(string trackerURL);
// 开始下载资源
P2P_RETURN_TYPE Request(
const char* resname, // 资源名
const char* hashcode, // 资源的Hash码
const char* strSPList, // SuperPeer列表的IP地址
float bitRate // 频道的码率
);
// 停止下载当前资源
void StopCurrentRes();
// 发送错误消息给外部程序
void PostErrMessage(P2P_NOTIFY_TYPE type, LPARAM lParam, bool shouldStop);
LiveResource* currRes; // 当前资源
TryClient tryClient; // 尝试连接的线程
CSClient csClient; // 与TrackerServer通信
P2PMgr p2pMgr; // 管理下载
BufferMgr g_bufferMgr; // 缓冲区管理
LogMgr logFile; // 日志文件
LocalPeerFinder localPeerFinder; // 局域网Peer发现模块
OSVERSIONINFOEX osvi; // 操作系统版本信息
ConfigData cfgData; // 配置数据
randctx ctx; // 随机数生成器
NormalAddress trackerIP; // TrackServer的IP地址
HWND noitfyWindow; // 接受错误消息的目标窗口
UINT notifyCode; // 错误消息的代码
UINT16 channelID; // 目标频道的ID,将和错误码拼合到wparam上
UINT userID; // 登录到TS的用户名
char userPass[MD5_LEN+1];// 登录到TS的密码
P2PAddress localAddress; // 本机地址
CriticalSection mainThreadLock; // 主线程的锁
};
}
#endif //_COMMUNICATOR_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -