Click here to Skip to main content
15,886,362 members
Articles / Programming Languages / Visual C++ 10.0

SIP Stack (1 of 3)

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
20 Aug 2012CPOL3 min read 30K   1.7K   4  
SIP Stack Implementation on the basis of RFC SIP 3261 Specification
#pragma once

#ifndef CSIPAuthorizationParser_h
	#define CSIPAuthorizationParser_h
	
	#include "HHCoreInclude\CMessageData.h"

	#include "ASIPParser.h"
	#include "CSIPParamListParser.h"
	#include "CSIPWWWAuthenticateParser.h"

	namespace SIPParserFW
	{
		class SIP_PARSER_DLL_DECLARATION_SPECIFIER CSIPAuthorizationParser : public ASIPParser 
		{
			friend class CPoolObject<CSIPAuthorizationParser> ;
			
		protected:
			CSIPAuthorizationParser() ;
			CSIPAuthorizationParser( const CSIPAuthorizationParser &SIPAuthorizationParser ) ;
			virtual ~CSIPAuthorizationParser() ;

			CSIPAuthorizationParser& operator=( const CSIPAuthorizationParser &SIPAuthorizationParser ) ;
	
		public:
			CSIPAuthorizationParser( const CSIPWWWAuthenticateParser &SIPWWWAuthenticateParser ) ;
			CSIPAuthorizationParser& operator=( const CSIPWWWAuthenticateParser &SIPWWWAuthenticateParser ) ;

		public:
			void Release() ;
			ASIPParser* Copy() ;

			FW_RETURN_TYPE Parse( const std::string &strStringToParse ) ;
			std::string ToString() const ;

			std::string GetHeaderName() const ;

		public:
			void SetAuthorizationType( const std::string &strAuthorizationType ) ;
			const std::string& GetAuthorizationType() const ;

			void SetUserName( const std::string &strUserName ) ;
			std::string GetUserName() const ;

			void SetRealm( const std::string &strRealm ) ;
			std::string GetRealm() const ;

			void SetNonce( const std::string &strNonce ) ;
			std::string GetNonce() const ;

			void SetURI( const std::string &strURI ) ;
			std::string GetURI() const ;

			void SetResponse( const std::string &strResponse ) ;
			std::string GetResponse() const ;

			void SetDigest( const std::string &strDigest ) ;
			std::string GetDigest() const ;

			void SetAlgorithm( const std::string &strAlgorithm ) ;
			std::string GetAlgorithm() const ;

			void SetCNonce( const std::string &strCNonce ) ;
			std::string GetCNonce() const ;

			void SetOpaque( const std::string &strOpaque ) ;
			std::string GetOpaque() const ;

			void SetMessageQOP( const std::string &strMessageQOP ) ;
			std::string GetMessageQOP() const ;

			void SetNonceCount( const std::string &strNonceCount ) ;
			std::string GetNonceCount() const ;

			FW_RETURN_TYPE QuerySIPOtherCredentialParameters( CSIPParamListParser **pOtherSIPCredentialParameters ) ;

			CSIPParamListParser* GetSIPOtherCredentialParameters() ;
		
		public:
			static CSIPAuthorizationParser* GetAvailable() ;

		protected:
			void ReleaseParameters() ;

		private:
			void ReleaseCSIPAuthorizationParserData() ;
			void CopyCSIPAuthorizationParserData( const CSIPAuthorizationParser &SIPAuthorizationParser ) ;
			void CopyCSIPAuthorizationParserData( const CSIPWWWAuthenticateParser &SIPWWWAuthenticateParser ) ;

			FW_RETURN_TYPE ParseSIPAuthorizationCredentialStringList( const std::string &strStringToParse ) ;
			std::string SIPAuthorizationCredentialListToString() const ;
				
		private:
			static std::string m_strSIPCredentialStringDelimiter ;
			static std::string m_strSIPCredentialNameAndValueDelimiter ;

		private:
			std::string m_strAuthorizationType ;
			CMessageData *m_pUserNameData ;
			CMessageData *m_pRealmData ;
			CMessageData *m_pNonceData ;
			CMessageData *m_pURIData ;
			CMessageData *m_pResponseData ;
			CMessageData *m_pDigestData ;
			CMessageData *m_pAlgorithmData ;
			CMessageData *m_pCNonceData ;
			CMessageData *m_pOpaqueData ;
			CMessageData *m_pMessageQOPData ;
			CMessageData *m_pNonceCountData ;
			CSIPParamListParser *m_pSIPOtherCredentialParameters ;
		} ;

		inline CSIPParamListParser* CSIPAuthorizationParser::GetSIPOtherCredentialParameters()
		{
			return m_pSIPOtherCredentialParameters ;
		}

		inline void CSIPAuthorizationParser::SetAuthorizationType( const std::string &strAuthorizationType )
		{
			m_strAuthorizationType = strAuthorizationType ;
		}

		inline const std::string& CSIPAuthorizationParser::GetAuthorizationType() const
		{
			return m_strAuthorizationType ;
		}
		
	} // End namespace

#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
India India
Hatim Haidry

VC++, Technical Architect

India

haidryhatim@gmail.com

Comments and Discussions