1.1 --- a/epoc32/include/sipmessageelements.h Tue Mar 16 16:12:26 2010 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,174 +0,0 @@
1.4 -/*
1.5 -* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 -* All rights reserved.
1.7 -* This component and the accompanying materials are made available
1.8 -* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.9 -* which accompanies this distribution, and is available
1.10 -* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 -*
1.12 -* Initial Contributors:
1.13 -* Nokia Corporation - initial contribution.
1.14 -*
1.15 -* Contributors:
1.16 -*
1.17 -* Description:
1.18 -* Name : sipmessageelements.h
1.19 -* Part of : SIP Client
1.20 -* Interface : SDK API, SIP API
1.21 -* Version : 1.0
1.22 -*
1.23 -*/
1.24 -
1.25 -
1.26 -
1.27 -#ifndef CSIPMESSAGEELEMENTS_H
1.28 -#define CSIPMESSAGEELEMENTS_H
1.29 -
1.30 -// INCLUDES
1.31 -#include <e32base.h>
1.32 -#include <s32strm.h>
1.33 -#include <stringpool.h>
1.34 -#include "_sipcodecdefs.h"
1.35 -
1.36 -// FORWARD DECLARATIONS
1.37 -class CSIPHeaderBase;
1.38 -class CSIPContentTypeHeader;
1.39 -class CSIPFromHeader;
1.40 -class CSIPToHeader;
1.41 -class CSIPCSeqHeader;
1.42 -class CSIPExtensionHeader;
1.43 -
1.44 -// CLASS DECLARATION
1.45 -
1.46 -/**
1.47 -* @publishedAll
1.48 -* @released
1.49 -*
1.50 -* Class for creation and manipulation optional elements in a SIP message.
1.51 -*
1.52 -* Class provides functions for setting and getting optional elements in a
1.53 -* SIP message. Optional elements include user SIP message headers,
1.54 -* content and content type.
1.55 -* Following headers are not considered to be user SIP message headers and
1.56 -* cannot be set or retrieved using functions of this class:
1.57 -* "Authentication-Info", "Call-Id", "CSeq", "From"
1.58 -* "Max-Forwards", "Min-Expires", "Record-Route",
1.59 -* "Security-Verify", "Service-Route", "To", "Via", "Security-Server" and
1.60 -* "Proxy-Authorization".
1.61 -*
1.62 -* @lib sipclient.lib
1.63 -*/
1.64 -class CSIPMessageElements : public CBase
1.65 - {
1.66 - public: // Constructors and destructor
1.67 - /**
1.68 - * Two-phased constructor.
1.69 - */
1.70 - IMPORT_C static CSIPMessageElements* NewL();
1.71 -
1.72 - /**
1.73 - * Two-phased constructor.
1.74 - */
1.75 - IMPORT_C static CSIPMessageElements* NewLC();
1.76 -
1.77 - /**
1.78 - * Destructor.
1.79 - */
1.80 - IMPORT_C ~CSIPMessageElements();
1.81 -
1.82 - public: //new functions
1.83 - /**
1.84 - * Sets an array of user headers i.e. headers that user is allowed
1.85 - * manipulate to a SIP message. An empty array resets the user headers.
1.86 - * Note that the Content-Type header must be set using SetContentL.
1.87 - *
1.88 - * @param aHeaders an array of SIP headers.
1.89 - * The ownership of objects in the array is transferred.
1.90 - */
1.91 - IMPORT_C void SetUserHeadersL(RPointerArray<CSIPHeaderBase>& aHeaders);
1.92 -
1.93 - /**
1.94 - * Gets all user SIP headers this class contains
1.95 - * @return SIP headers. Ownership is not transferred.
1.96 - */
1.97 - IMPORT_C const RPointerArray<CSIPHeaderBase>& UserHeaders() const;
1.98 -
1.99 - /**
1.100 - * Sets the SIP message content and its type.
1.101 - * A zero length content can be set by providing a pointer
1.102 - * to a zero length HBufC8 instance (the ownership is transferred).
1.103 - * @pre aContent != 0 && aContentType != 0
1.104 - * @param aContent the content of a SIP message,
1.105 - * the ownership is transferred
1.106 - * @param aContentType the SIP message content type,
1.107 - * the ownership is transferred
1.108 - * @leave KErrArgument if aContent == 0 or
1.109 - * aContentType == 0
1.110 - */
1.111 - IMPORT_C void SetContentL(HBufC8* aContent,
1.112 - CSIPContentTypeHeader* aContentType);
1.113 -
1.114 - /**
1.115 - * Gets the SIP message content
1.116 - * @return SIP message content. If content does not exist, an empty
1.117 - * descriptor is returned.
1.118 - */
1.119 - IMPORT_C const TDesC8& Content() const;
1.120 -
1.121 - /**
1.122 - * Gets the content type
1.123 - * @return Content-Type-header or a 0-pointer if not present; the ownership
1.124 - * is not transferred.
1.125 - */
1.126 - IMPORT_C const CSIPContentTypeHeader* ContentType() const;
1.127 -
1.128 - /*
1.129 - * Removes the SIP message content and destroys
1.130 - * Content-Type header as well.
1.131 - * @return SIP message content; the ownership is transferred.
1.132 - */
1.133 - IMPORT_C HBufC8* ExtractContent();
1.134 -
1.135 - public: // New functions, for internal use
1.136 -
1.137 - static CSIPMessageElements* InternalizeL(RReadStream& aReadStream);
1.138 - void ExternalizeL(RWriteStream& aWriteStream) const;
1.139 - TInt UserHeaderCount(RStringF aName) const;
1.140 - const RPointerArray<CSIPHeaderBase> UserHeadersL(RStringF aName) const;
1.141 - TInt RemoveHeaders(RStringF aName);
1.142 - void DetachUserHeader(CSIPHeaderBase* aHeader);
1.143 - void AddHeaderL(CSIPHeaderBase* aHeader);
1.144 - void SetToL(CSIPToHeader* aTo);
1.145 - const CSIPToHeader* To() const;
1.146 - void SetFromL (CSIPFromHeader* aFrom);
1.147 - const CSIPFromHeader* From() const;
1.148 - const CSIPCSeqHeader* CSeq() const;
1.149 - void SetContent(HBufC8* aContent);
1.150 - void DetachContent();
1.151 -
1.152 - private:
1.153 -
1.154 - CSIPMessageElements();
1.155 - void ConstructL();
1.156 - void DoInternalizeL(RReadStream& aReadStream);
1.157 - void CheckUserHeaderL(const CSIPHeaderBase* aHeader) const;
1.158 - void ExternalizeUserHeadersL(RWriteStream& aWriteStream) const;
1.159 - void ExternalizeL(const CSIPExtensionHeader* aHeader,
1.160 - RWriteStream& aWriteStream) const;
1.161 -
1.162 - private: // Data
1.163 -
1.164 - RPointerArray<CSIPHeaderBase> iUserHeaders;
1.165 - HBufC8* iContent;
1.166 - CSIPFromHeader* iFromHeader;
1.167 - CSIPToHeader* iToHeader;
1.168 - CSIPCSeqHeader* iCSeqHeader;
1.169 - CSIPContentTypeHeader* iContentTypeHeader;
1.170 - TBool iHeaderLookupOpen;
1.171 -
1.172 - private: // For testing purposes
1.173 -
1.174 - UNIT_TEST(CSIPMessageElementsTest)
1.175 - };
1.176 -
1.177 -#endif