1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/sipcontactheader.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,233 @@
1.4 +/*
1.5 +* Copyright (c) 2004-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 : sipcontactheader.h
1.19 +* Part of : SIP Codec
1.20 +* Interface : SDK API, SIP Codec API
1.21 +* Version : SIP/4.0
1.22 +*
1.23 +*/
1.24 +
1.25 +
1.26 +
1.27 +
1.28 +#ifndef CSIPCONTACTHEADER_H
1.29 +#define CSIPCONTACTHEADER_H
1.30 +
1.31 +// INCLUDES
1.32 +#include "sipparameterheaderbase.h"
1.33 +#include "_sipcodecdefs.h"
1.34 +
1.35 +// FORWARD DECLARATIONS
1.36 +class CSIPAddress;
1.37 +class CSIPContactHeaderParams;
1.38 +
1.39 +// CLASS DECLARATION
1.40 +/**
1.41 +* @publishedAll
1.42 +* @released
1.43 +*
1.44 +* Class provides functions for setting and getting SIP "Contact"
1.45 +* header fields.
1.46 +*
1.47 +* @lib sipcodec.lib
1.48 +*/
1.49 +class CSIPContactHeader : public CSIPParameterHeaderBase
1.50 + {
1.51 + public: // Constructors and destructor
1.52 +
1.53 + /**
1.54 + * Constructs a CSIPContactHeader from textual representation
1.55 + * of the header's value part.
1.56 + * Note that "Contact: *" can be only created using this function.
1.57 + * @param aValue a value part of a "Contact"-header
1.58 + * @return an array containing 1..n instances of CSIPContactHeader
1.59 + */
1.60 + IMPORT_C static RPointerArray<CSIPContactHeader>
1.61 + DecodeL(const TDesC8& aValue);
1.62 +
1.63 + /**
1.64 + * Creates a new instance of CSIPContactHeader
1.65 + * @pre aSIPAddress != 0
1.66 + * @param aSIPAddress a name-address, the ownership is transferred
1.67 + * @return a new instance of CSIPContactHeader
1.68 + */
1.69 + IMPORT_C static CSIPContactHeader* NewL(CSIPAddress* aSIPAddress);
1.70 +
1.71 + /**
1.72 + * Creates a new instance of CSIPContactHeader and puts it to CleanupStack
1.73 + * @pre aSIPAddress != 0
1.74 + * @param aSIPAddress a name-address, the ownership is transferred
1.75 + * @return a new instance of CSIPContactHeader
1.76 + */
1.77 + IMPORT_C static CSIPContactHeader* NewLC(CSIPAddress* aSIPAddress);
1.78 +
1.79 + /**
1.80 + * Destructor, deletes the resources of CSIPContactHeader.
1.81 + */
1.82 + IMPORT_C ~CSIPContactHeader();
1.83 +
1.84 +
1.85 + public: // New functions
1.86 +
1.87 + /**
1.88 + * Compares this object to another instance of CSIPContactHeader
1.89 + * @param aHeader a CSIPContactHeader header to compare to
1.90 + * @return ETrue if the objects are equal otherwise EFalse
1.91 + */
1.92 + IMPORT_C TBool operator==(const CSIPContactHeader& aHeader) const;
1.93 +
1.94 + /**
1.95 + * Checks if the address is set to a STAR ("*")
1.96 + * @return ETrue, if the address is a "*" otherwise EFalse
1.97 + */
1.98 + IMPORT_C TBool Star() const;
1.99 +
1.100 + /**
1.101 + * Gets the value of the "expires"-parameter
1.102 + * @return the "expires"-parameter, or
1.103 + * KErrNotFound if the parameter is not present.
1.104 + */
1.105 + IMPORT_C TInt ExpiresParameter() const;
1.106 +
1.107 + /**
1.108 + * Sets the "expires"-parameter
1.109 + * @pre aExpiresParam >= 0
1.110 + * @param aExpiresParam a "expires"-parameter value to set
1.111 + */
1.112 + IMPORT_C void SetExpiresParameterL(TInt aExpiresParam);
1.113 +
1.114 + /**
1.115 + * Gets the value of "q"-parameter
1.116 + * @pre Star() == EFalse
1.117 + * @return the "q"-parameter value,
1.118 + * or zero if the parameter is not present.
1.119 + */
1.120 + IMPORT_C TReal QParameter() const;
1.121 +
1.122 + /**
1.123 + * Sets the "q"-parameter value in the "Contact" header
1.124 + * @pre Star() == EFalse
1.125 + * @param aQValue a "q"-parameter value to set
1.126 + */
1.127 + IMPORT_C void SetQParameterL(TReal aQValue);
1.128 +
1.129 + /**
1.130 + * Gets the name-address as const
1.131 + * @return name-address or 0 if not present
1.132 + * The ownership is NOT transferred.
1.133 + */
1.134 + IMPORT_C const CSIPAddress* SIPAddress() const;
1.135 +
1.136 + /**
1.137 + * Gets the name-address
1.138 + * @return name-address or 0 if not present
1.139 + * The ownership is NOT transferred.
1.140 + */
1.141 + IMPORT_C CSIPAddress* SIPAddress();
1.142 +
1.143 + /**
1.144 + * Sets the name-address
1.145 + * @pre Star() == EFalse
1.146 + * @pre aSIPAddress != 0
1.147 + * @param aSIPAddress a name-address to set, the ownership is transferred
1.148 + */
1.149 + IMPORT_C void SetSIPAddressL(CSIPAddress* aSIPAddress);
1.150 +
1.151 + /**
1.152 + * Constructs an instance of a CSIPContactHeader from a RReadStream
1.153 + * @param aReadStream a stream containing the value of the
1.154 + * externalized object (header name not included).
1.155 + * @return an instance of a CSIPContactHeader
1.156 + */
1.157 + IMPORT_C static CSIPHeaderBase*
1.158 + InternalizeValueL(RReadStream& aReadStream);
1.159 +
1.160 +
1.161 + public: // From CSIPHeaderBase
1.162 +
1.163 + /**
1.164 + * From CSIPHeaderBase CloneL
1.165 + */
1.166 + IMPORT_C CSIPHeaderBase* CloneL() const;
1.167 +
1.168 + /**
1.169 + * From CSIPHeaderBase Name
1.170 + */
1.171 + IMPORT_C RStringF Name() const;
1.172 +
1.173 +
1.174 + public: // From CSIPHeaderBase, for internal use
1.175 +
1.176 + /**
1.177 + * @internalComponent
1.178 + */
1.179 + TBool MoreThanOneAllowed() const;
1.180 +
1.181 + /**
1.182 + * @internalComponent
1.183 + */
1.184 + TBool HasCompactName() const;
1.185 +
1.186 + /**
1.187 + * @internalComponent
1.188 + */
1.189 + RStringF CompactName() const;
1.190 +
1.191 + /**
1.192 + * @internalComponent
1.193 + */
1.194 + TPreferredPlace PreferredPlaceInMessage() const;
1.195 +
1.196 + public: // New functions, for internal use
1.197 +
1.198 + static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
1.199 +
1.200 + private: // From CSIPHeaderBase
1.201 +
1.202 + void ExternalizeValueL(RWriteStream& aWriteStream) const;
1.203 +
1.204 + private: // From CSIPParameterHeaderBase
1.205 +
1.206 + TBool ParamInsertionAllowed() const;
1.207 + HBufC8* ToTextMandatoryPartLC() const;
1.208 + void ParseMandatoryPartL(const TDesC8& aMandatoryPart);
1.209 + const CSIPParamContainerBase& Params() const;
1.210 + CSIPParamContainerBase& Params();
1.211 +
1.212 + private: // Constructors
1.213 +
1.214 + CSIPContactHeader(TBool aIsStar=EFalse);
1.215 + void ConstructL();
1.216 + void ConstructL(CSIPAddress* aSIPAddress);
1.217 + void ConstructL(const CSIPContactHeader& aContactHeader);
1.218 +
1.219 + private: // New functions
1.220 +
1.221 + void DoInternalizeValueL(RReadStream& aReadStream);
1.222 +
1.223 + private: // Data
1.224 +
1.225 + CSIPAddress* iSIPAddress;
1.226 + CSIPContactHeaderParams* iParams;
1.227 + TBool iIsStar;
1.228 +
1.229 + private: // For testing purposes
1.230 +
1.231 + UNIT_TEST(CSIPContactHeaderTest)
1.232 + };
1.233 +
1.234 +#endif // CSIPCONTACTHEADER_H
1.235 +
1.236 +// End of File