CRtmpServer中BaseProtocol 简单介绍

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。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值