CRtmpServer中BaseProtocol 简单介绍
2015-08-18 16:04
337 查看
class DLLEXP BaseProtocol {
private:
static uint32_t _idGenerator;
uint32_t_id;
//协议ID
BaseClientApplication*_pApplication; //上层应用 该协议将被注册到应用中
protected:
uint64_t_type;
//协议类型
BaseProtocol*_pFarProtocol;
//协议链中前一个协议。
BaseProtocol*_pNearProtocol;
//协议链中后一个协议
bool _deleteFar;
//是否删除前一个协议
bool _deleteNear;
//是否删除后一个协议
bool _enqueueForDelete;
//出队并删除
bool _gracefullyEnqueueForDelete;
//出队并删除
Variant_customParameters;
//自定义参数
double _creationTimestamp;
public:
BaseProtocol(uint64_ttype);
virtual ~BaseProtocol();
…
/*!
@briefThis is called by the framework when data is available for processing, directlyfrom the network i/o layer
@briefrecvAmount
@parampPeerAddress
*/
virtual
boolSignalInputData(int32_t recvAmount, sockaddr_in *pPeerAddress); //有i/o层调用,将数据交由逻辑协议层处理
};
#endif
/*_BASEPROTOCOL_H */
该类是所有协议类的基类。每个协议都是以协议链存在,最底层协议是I/0协议(TCP,UDP,STDIO),并关联i/o句柄,GetFarEndpoint()获取的就是最底层的I/0协议,只有这一层
才与i/0打交道。
协议越高,其逻辑处理越接近上层应用。I/0的数据都会按照协议链从i/0协议->p1->p2->pN来处理。
比如配置文件中:
{
ip="0.0.0.0",
port=1935,
protocol="inboundRtmp"
},
其inboundRtmp协议链是PT_TCP->PT_INBOUND_RTMP。
private:
static uint32_t _idGenerator;
uint32_t_id;
//协议ID
BaseClientApplication*_pApplication; //上层应用 该协议将被注册到应用中
protected:
uint64_t_type;
//协议类型
BaseProtocol*_pFarProtocol;
//协议链中前一个协议。
BaseProtocol*_pNearProtocol;
//协议链中后一个协议
bool _deleteFar;
//是否删除前一个协议
bool _deleteNear;
//是否删除后一个协议
bool _enqueueForDelete;
//出队并删除
bool _gracefullyEnqueueForDelete;
//出队并删除
Variant_customParameters;
//自定义参数
double _creationTimestamp;
public:
BaseProtocol(uint64_ttype);
virtual ~BaseProtocol();
…
/*!
@briefThis is called by the framework when data is available for processing, directlyfrom the network i/o layer
@briefrecvAmount
@parampPeerAddress
*/
virtual
boolSignalInputData(int32_t recvAmount, sockaddr_in *pPeerAddress); //有i/o层调用,将数据交由逻辑协议层处理
};
#endif
/*_BASEPROTOCOL_H */
该类是所有协议类的基类。每个协议都是以协议链存在,最底层协议是I/0协议(TCP,UDP,STDIO),并关联i/o句柄,GetFarEndpoint()获取的就是最底层的I/0协议,只有这一层
才与i/0打交道。
协议越高,其逻辑处理越接近上层应用。I/0的数据都会按照协议链从i/0协议->p1->p2->pN来处理。
比如配置文件中:
{
ip="0.0.0.0",
port=1935,
protocol="inboundRtmp"
},
其inboundRtmp协议链是PT_TCP->PT_INBOUND_RTMP。
相关文章推荐
- 15OJ——爱你多少年呢
- redis命令
- 华为OJ(记正负)
- ubuntu下手动创建应用的快捷方式
- sudo使用技巧
- ZOJ-2734-Exchange Cards(DFS全排列+去重)
- MVP模式
- jdbc数据库连接
- 排序检索B - List of Conquests
- 转:Spring使用静态工厂方法创建Bean
- C++实现系统服务暂停、停止、启动
- lambda表达式不使用委托(delegate) 用FUNC
- in查询和两个二维数组的拼接
- dev控件用法总结网址
- 机房收费之数据库时间
- Notepad++中F3直接搜索选中文字
- 1 Two Sum
- 职场上该如何善待自尊心
- jquery相册图片来回选择
- Guava学习笔记:EventBus