yate学习--yatesip.h--class YSIP_API SIPParty : public RefObjec

请声明出处:

这是一个关于自定义SIP的Party类:

class YSIP_API SIPParty : public RefObject
{
public:
    SIPParty(Mutex* mutex = 0);
    SIPParty(bool reliable, Mutex* mutex = 0);
    virtual ~SIPParty();
    /**
     * Transmit an event
	 * 传输一个事件
     * @param event Evend to send
	 * @参数even,要发送的事件
     * @return False on fatal failure (subsequent send would fail again)
	 * @返回false,严重失败(随后发送可能会再一次失败)
     */
    virtual bool transmit(SIPEvent* event) = 0;
    virtual const char* getProtoName() const = 0;
    virtual bool setParty(const URI& uri) = 0;
    virtual void* getTransport() = 0;
    void setAddr(const String& addr, int port, bool local);
    void getAddr(String& addr, int& port, bool local);
    inline void appendAddr(String& buf, bool local, bool unsafe = true) {
	    Lock lock(unsafe ? m_mutex : 0);
	    if (local)
		SocketAddr::appendTo(buf,m_local,m_localPort);
	    else
		SocketAddr::appendTo(buf,m_party,m_partyPort);
	}
    inline Mutex* mutex()
	{ return m_mutex; }
    inline const String& getLocalAddr() const
	{ return m_local; }
    inline const String& getPartyAddr() const
	{ return m_party; }
    inline int getLocalPort() const
	{ return m_localPort; }
    inline int getPartyPort() const
	{ return m_partyPort; }
    inline bool isReliable() const
	{ return m_reliable; }
protected:
    Mutex* m_mutex;
    bool m_reliable;
    String m_local;
    String m_party;
    int m_localPort;
    int m_partyPort;
};


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值