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

📄 structdefine.h

📁 mysee网络直播源代码Mysee Lite是Mysee独立研发的网络视频流媒体播放系统。在应有了P2P技术和一系列先进流媒体技术之后
💻 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
 *
 */
				 
// 系统通用的数据结构以及部分常量的定义, 最近修改时间为2004.10.09 23:34

#ifndef __STRUCT_DEFINE_H__
#define __STRUCT_DEFINE_H__

enum {
    SP4CS_PORT = 20, 
    CM4SP_PORT = 24168, 
};

enum {
    MD5_LEN = 32,          // MD5值的长度
};

// 普通网络的IP地址信息,精简版,大小8字节
// 不能直接当做sockaddr使用,只能赋值给一个sockaddr
struct NormalAddress {
    short sin_family;
    unsigned short sin_port;
    struct  in_addr sin_addr;
};

// P2P网络的Peer地址信息, 精简版,大小16字节
struct P2PAddress {
    // 外网用户的本机IP和发送段口,内网用户的出口网关IP和发送段口
    struct NormalAddress    outerIP;
    // 外网用户为"255.255.255.255"和监听段口,内网用户的内网IP和监听端口
    struct NormalAddress    subnetIP;
};

// NP的统计信息
struct StatInfo {
    unsigned int	playingBlock;	// 当前播放的文件块编号
    unsigned short	currBufferTime; // 当前累计缓冲时间(秒)
    unsigned short	bufferCount;	// 累计缓冲次数
    unsigned short	bufferTime;	// 累计缓冲时间(秒),不包括当前正在缓冲的时间
    unsigned short	connFailCount;	// 累计连接失败次数
    unsigned short	inConnections;	// 累计连入连接数
    unsigned short 	outConnections;	// 累计连出连接数
    unsigned short	avgInConnTime;	// 累计连入时间
    unsigned short	avgOutConnTime;	// 累计连出时间
    float		messagePercent;	// 控制信息流比例
};

// 数据传输的相关信息,目前大小32字节
struct TransferInfo {
    long long totalDownBytes;  // 总共下载字节
    long long totalUpBytes;    // 总共上传字节
    float    currDownSpeed;    // 当前下载速度
    float    currUpSpeed;      // 当前上传速度
    float    avgDownSpeed;     // 平均下载速度
    float    avgUpSpeed;       // 平均上传速度
};

// 这是P2P网络中最需要交流的信息,将来还可能进行扩充,目前大小12字节
struct CorePeerInfo {
//    unsigned int     minBlockID;    // 拥有块的最小编号
 //   unsigned int     maxBlockID;    // 拥有块的最大编号
    unsigned layer:8;       // 在P2P网络中位于第几层(最大256)
    unsigned int isMaxIn:1;         // 是否达到最大连入的连接数
    unsigned int isMaxOut:1;        // 是否达到最大连出的连接数
    unsigned int isMaxFreeIn:1;     // 是否达到最大连入的连接数(作贡献)
    unsigned int isMaxFreeOut:1;    // 是否达到最大连出的连接数(作贡献)
    unsigned int isCachePeer:1;     // 是CachePeer还是NormalPeer
    unsigned int padding:19;           // 空位域,留作以后使用
};

// 加上Peer地址的PeerInfo, 目前大小28字节
struct PeerInfoWithAddr
{
	struct CorePeerInfo a;
	struct P2PAddress b;
};

enum CP_TYPE {
    CT_GENERAL=0, // no param
    CT_EDGE=1,  // number of IP heads, first IP Head.....
    CT_SPECIFIED_RES=2, // resource name(md5, MD5_LEN bytes)
};


#endif

⌨️ 快捷键说明

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