您的位置:首页 > 其它

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

2015-05-22 15:37 295 查看
请声明出处:

这是一个关于自定义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;
};
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: