Click here to Skip to main content
15,885,366 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
#include "SIPParserInclude\CSIPUnSupportedParser.h"

#include "SIPParserInclude\CSIPStringDataParser.h"

namespace SIPParserFW
{
	CSIPUnSupportedParser::CSIPUnSupportedParser()
	{
		ReleaseCSIPUnSupportedParserData() ;
	}

	CSIPUnSupportedParser::CSIPUnSupportedParser( const CSIPUnSupportedParser &SIPUnSupportedParser )
		: ASIPParserListParser( SIPUnSupportedParser )
	{
		ReleaseCSIPUnSupportedParserData() ;

		CopyCSIPUnSupportedParserData( SIPUnSupportedParser ) ;
	}

	CSIPUnSupportedParser::~CSIPUnSupportedParser()
	{
		ReleaseCSIPUnSupportedParserData() ;
	}

	CSIPUnSupportedParser& CSIPUnSupportedParser::operator=( const CSIPUnSupportedParser &SIPUnSupportedParser )
	{
		ReleaseCSIPUnSupportedParserData() ;

		ASIPParserListParser::operator=( SIPUnSupportedParser ) ;

		CopyCSIPUnSupportedParserData( SIPUnSupportedParser ) ;

		return *this ;
	}

	void CSIPUnSupportedParser::ReleaseCSIPUnSupportedParserData()
	{
	}

	void CSIPUnSupportedParser::CopyCSIPUnSupportedParserData( const CSIPUnSupportedParser &SIPUnSupportedParser )
	{
	}

	CSIPUnSupportedParser* CSIPUnSupportedParser::GetAvailable()
	{
		CSIPUnSupportedParser *pSIPUnSupportedParser = CPoolObject<CSIPUnSupportedParser>::GetAvailable() ;
		return pSIPUnSupportedParser ;
	}

	void CSIPUnSupportedParser::Release()
	{
		ReleaseParameters() ;

		CPoolObject<CSIPUnSupportedParser>::Release( this ) ;
	}

	void CSIPUnSupportedParser::ReleaseParameters()
	{
		ReleaseCSIPUnSupportedParserData() ;
		
		ASIPParserListParser::ReleaseParameters() ;
	}

	ASIPParserListParser* CSIPUnSupportedParser::Copy()
	{
		CSIPUnSupportedParser *pSIPUnSupportedParser = CSIPUnSupportedParser::GetAvailable() ;
		if( pSIPUnSupportedParser == NULL )
			return NULL ;

		*pSIPUnSupportedParser = *this ;

		return pSIPUnSupportedParser ;
	}

	// Grammer
	//Require = "Require" HCOLON option-tag *(COMMA option-tag)
	//option-tag = token

	//Unsupported = "Unsupported" HCOLON option-tag *(COMMA option-tag)
	//Unsupported = "Unsupported" HCOLON token *(COMMA token)

	// Please see RFC3261, Pages 179
	// Please see RFC3261, Pages from 219 to 232 for ABNF forms
	// Please see file ..\Document\SIPUnSupported Parsing Logic.txt for parsing algorithm

	// Page 175:
		//The Proxy-Require header field is used to indicate proxy-sensitive
		//features that must be supported by the proxy. See Section 20.32 for
		//more details on the mechanics of this message and a usage example.

	// Page 176:
		//The Require header field is used by UACs to tell UASs about options
		//that the UAC expects the UAS to support in order to process the
		//request. Although an optional header field, the Require MUST NOT be
		//ignored if it is present.
		//The Require header field contains a list of option tags, described in
		//Section 19.2. Each option tag defines a SIP extension that MUST be
		//understood to process the request. Frequently, this is used to
		//indicate that a specific set of extension header fields need to be
		//understood. A UAC compliant to this specification MUST only include
		//option tags corresponding to standards-track RFCs.

	// Page 158 to 159
		//Option tags are unique identifiers used to designate new options
		//(extensions) in SIP. These tags are used in Require (Section 20.32),
		//Proxy-Require (Section 20.29), Supported (Section 20.37) and
		//Unsupported (Section 20.40) header fields. Note that these options
		//appear as parameters in those header fields in an option-tag = token
		//form (see Section 25 for the definition of token).
		//Option tags are defined in standards track RFCs. This is a change
		//from past practice, and is instituted to ensure continuing multivendor
		//interoperability (see discussion in Section 20.32 and Section
		//20.37). An IANA registry of option tags is used to ensure easy
		//reference.
	
	FW_RETURN_TYPE CSIPUnSupportedParser::QueryAvailableParser( ASIPParser **pSIPParser )
	{
		*pSIPParser = NULL ;

		CSIPStringDataParser *pSIPStringDataParser = CSIPStringDataParser::GetAvailable() ;
		if( pSIPStringDataParser == NULL )
			return SIP_PARSE_ERR_SIP_STRING_DATA_PARSER_OBJECT_NOT_CREATED ;

		*pSIPParser = pSIPStringDataParser ;

		return SIP_ERR_SUCCESS ;
	}

	std::string CSIPUnSupportedParser::GetHeaderName() const
	{
		return GetRuntimeHeaderName( SIP_HEADER_UNSUPPORTED ) ;
	}

} // End namespace

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