📄 statusmsg.cxx
字号:
return *x;} void StatusMsg::setWarning(const SipWarning& item, int index /*Default Arguments */){ Sptr<SipHeader> x = new SipWarning(item); myHeaderList.appendHeader(SIP_WARNING_HDR, x, index);} void StatusMsg::setWarning(const Data& item, int index /*Default Arguments */){ Sptr<SipHeader> x = new SipWarning(item); myHeaderList.appendHeader(SIP_WARNING_HDR, x, index);} void StatusMsg::setNumWarning(int index){ myHeaderList.setNumHeaders(SIP_WARNING_HDR, index);}/*------------------------------ SipUnsupported ------------------------------*/int StatusMsg::getNumUnsupported() const{ return myHeaderList.getNumHeaders(SIP_UNSUPPORTED_HDR);}const SipUnsupported&StatusMsg::getUnsupported( int i /*default Arguments*/) const{ Sptr<SipUnsupported> x; myHeaderList.getParsedHeader(x, SIP_UNSUPPORTED_HDR, i); return *x;}void StatusMsg::setUnsupported(const SipUnsupported& item, int index /*Default Arguments */ ){ Sptr<SipHeader> x = new SipUnsupported(item); myHeaderList.appendHeader(SIP_UNSUPPORTED_HDR, x, index);} void StatusMsg::setUnsupported(const Data& item, int index /*Default Arguments */ ){ Sptr<SipHeader> x = new SipUnsupported(item); myHeaderList.appendHeader(SIP_UNSUPPORTED_HDR, x, index);} void StatusMsg::setNumUnsupported(int index){ myHeaderList.setNumHeaders(SIP_UNSUPPORTED_HDR, index);}/*-------------------------- SipServer --------------------------*/const SipServer&StatusMsg::getServer() const{ Sptr<SipServer> x; myHeaderList.getParsedHeader(x, SIP_SERVER_HDR); return *x;} void StatusMsg::setServer( const SipServer& newserver){ Sptr<SipServer> x; myHeaderList.getParsedHeader(x, SIP_SERVER_HDR); *x = newserver;} void StatusMsg::setServer( const Data& newserver){ Sptr<SipServer> x; myHeaderList.getParsedHeader(x, SIP_SERVER_HDR); x->decode(newserver);}/*------------------------------ SipInReplyTo ------------------------------*/int StatusMsg::getNumInReplyTo() const{ return myHeaderList.getNumHeaders(SIP_IN_REPLY_TO_HDR);}const SipInReplyTo&StatusMsg::getInReplyTo( int i /*Default Arguments */) const{ Sptr<SipInReplyTo> x; myHeaderList.getParsedHeader(x, SIP_IN_REPLY_TO_HDR, i); return *x;}void StatusMsg::setInReplyTo(const SipInReplyTo& item, int index /*Default Arguments */){ Sptr<SipHeader> x = new SipInReplyTo(item); myHeaderList.appendHeader(SIP_IN_REPLY_TO_HDR, x, index);} void StatusMsg::setInReplyTo(const Data& item, int index){ Sptr<SipHeader> x = new SipInReplyTo(item); myHeaderList.appendHeader(SIP_IN_REPLY_TO_HDR, x, index);}void StatusMsg::setNumInReplyTo(int index){ myHeaderList.setNumHeaders(SIP_IN_REPLY_TO_HDR, index);}/*-------------------------- SipProxyAuthenticate --------------------------*/const SipProxyAuthenticate&StatusMsg::getProxyAuthenticate() const{ Sptr<SipProxyAuthenticate> x; myHeaderList.getParsedHeader(x, SIP_PROXY_AUTHENTICATE_HDR); return *x;}void StatusMsg::setProxyAuthenticate( const SipProxyAuthenticate& newproxyAuth){ Sptr<SipProxyAuthenticate> x; myHeaderList.getParsedHeader(x, SIP_PROXY_AUTHENTICATE_HDR); *x = newproxyAuth;} void StatusMsg::setProxyAuthenticate( const Data& newproxyAuth){ Sptr<SipProxyAuthenticate> x; myHeaderList.getParsedHeader(x, SIP_PROXY_AUTHENTICATE_HDR); x->decode(newproxyAuth);} /*--------------------------- SipWwwAuthenticate ---------------------------*/const SipWwwAuthenticate&StatusMsg::getWwwAuthenticate() const{ Sptr<SipWwwAuthenticate> x; myHeaderList.getParsedHeader(x, SIP_WWW_AUTHENTICATE_HDR); return *x;} void StatusMsg::setWwwAuthenticate( const SipWwwAuthenticate& newAuthenticate){ Sptr<SipWwwAuthenticate> x; myHeaderList.getParsedHeader(x, SIP_WWW_AUTHENTICATE_HDR); *x = newAuthenticate;} void StatusMsg::setWwwAuthenticate( const Data& newAuthenticate){ Sptr<SipWwwAuthenticate> x; myHeaderList.getParsedHeader(x, SIP_WWW_AUTHENTICATE_HDR); x->decode(newAuthenticate);}/*------------------------------ SipSession ------------------------------*/const SipSession&StatusMsg::getSession() const{ Sptr<SipSession> x; myHeaderList.getParsedHeader(x, SIP_SESSION_HDR); return *x;}void StatusMsg::setSession(const SipSession& newSession){ Sptr<SipSession> x; myHeaderList.getParsedHeader(x, SIP_SESSION_HDR); *x = newSession;} void StatusMsg::setSession(const Data& newSession){ Sptr<SipSession> x; myHeaderList.getParsedHeader(x, SIP_SESSION_HDR); x->decode(newSession);} // -------------------- Authentication / Challenge stuff --------------------voidStatusMsg::challengeBasicProxyAuthenticate(Data realm){ SipProxyAuthenticate sipAuthHeader; // basic sipAuthHeader.setAuthScheme( AUTH_BASIC ); sipAuthHeader.setRealmValue ( realm ); setProxyAuthenticate( sipAuthHeader );}voidStatusMsg::challengeDigestProxyAuthenticate(Data realm, Data nonce){ // xxx should add "sip:" to front of host as this is a URL SipProxyAuthenticate sipAuthHeader; // set digest details in ProxyAuthentication header sipAuthHeader.setAuthTokenDetails( REALM, realm ); sipAuthHeader.setAuthTokenDetails( ALGORITHM, MD5 ); sipAuthHeader.setAuthTokenDetails( NONCE, nonce ); sipAuthHeader.setAuthTokenDetails( "domain", realm ); sipAuthHeader.setAuthScheme( AUTH_DIGEST ); setProxyAuthenticate( sipAuthHeader );}voidStatusMsg::challengeBasicWwwAuthenticate(Data realm){ SipWwwAuthenticate sipAuthHeader; // basic sipAuthHeader.setAuthScheme( AUTH_BASIC ); sipAuthHeader.setRealmValue ( realm ); setWwwAuthenticate( sipAuthHeader );}voidStatusMsg::challengeDigestWwwAuthenticate(Data realm, Data nonce){ SipWwwAuthenticate sipAuthHeader; // set digest details in ProxyAuthentication header sipAuthHeader.setAuthTokenDetails( REALM, realm ); sipAuthHeader.setAuthTokenDetails( ALGORITHM, MD5 ); sipAuthHeader.setAuthTokenDetails( NONCE, nonce ); // xxx ? // sipAuthHeader.setAuthTokenDetails( "domain", realm ); sipAuthHeader.setAuthScheme( AUTH_DIGEST ); setWwwAuthenticate( sipAuthHeader );}// ------------------ General StatusMsg stuff -----------------Data StatusMsg::encode() const{ Data status; //SK explained in Invitemsg::encode--setContentLengthValue() status = statusLine.encode(); encodeBody(&status); return status;}///Check to see if message is a candidate for retransmissionbool StatusMsg::toBeRetransmitted() const{ int statusCode = getStatusLine().getStatusCode(); if ( ( getCSeq().getMethod() == INVITE_METHOD) && ( statusCode >= 200) ) { return(true); } return false;}const SipSessionExpires& StatusMsg::getSessionExpires() const{ Sptr<SipSessionExpires> x; myHeaderList.getParsedHeader(x, SIP_SESSION_EXPIRES_HDR); return *x;}const SipMinSE& StatusMsg::getMinSE() const { Sptr<SipMinSE> x; myHeaderList.getParsedHeader(x, SIP_MIN_SE_HDR); return *x;}void StatusMsg::setSessionExpires(const SipSessionExpires& sess){ int statusCode = getStatusLine().getStatusCode(); assert((statusCode == 200) || (statusCode == 422)); Sptr<SipSessionExpires> x; myHeaderList.getParsedHeader(x, SIP_SESSION_EXPIRES_HDR); *x = sess;}void StatusMsg::setMinSE(const SipMinSE& minSe){ int statusCode = getStatusLine().getStatusCode(); assert((statusCode == 200) || (statusCode == 422)); Sptr<SipMinSE> x; myHeaderList.getParsedHeader(x, SIP_MIN_SE_HDR); *x = minSe;}/* Local Variables: *//* c-file-style: "stroustrup" *//* indent-tabs-mode: nil *//* c-file-offsets: ((access-label . -) (inclass . ++)) *//* c-basic-offset: 4 *//* End: */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -