1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/siprequestelements.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,179 @@
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 : siprequestelements.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 CSIPREQUESTELEMENTS_H
1.28 +#define CSIPREQUESTELEMENTS_H
1.29 +
1.30 +// INCLUDES
1.31 +#include <e32base.h>
1.32 +#include <s32strm.h>
1.33 +#include <stringpool.h>
1.34 +#include <uri8.h>
1.35 +#include "_sipcodecdefs.h"
1.36 +
1.37 +// FORWARD DECLARATIONS
1.38 +class CSIPMessageElements;
1.39 +class CSIPFromHeader;
1.40 +class CSIPToHeader;
1.41 +class CSIPCSeqHeader;
1.42 +class CURIContainer;
1.43 +
1.44 +// CLASS DECLARATION
1.45 +
1.46 +/**
1.47 +* @publishedAll
1.48 +* @released
1.49 +*
1.50 +* Class provides functions for creation and manipulation of originator's and
1.51 +* recipient's addresses in a SIP request. It also provide functions for
1.52 +* manipulation of SIP method for unknown SIP requests.
1.53 +* @lib sipclient.lib
1.54 +*/
1.55 +class CSIPRequestElements : public CBase
1.56 + {
1.57 + public: // Constructors and destructor
1.58 + /**
1.59 + * Two-phased constructor.
1.60 + * If the URI is SIP URI, no SIP URI headers are allowed.
1.61 + * @pre aRemoteURi != 0
1.62 + * @param aRemoteUri Remote target URI that identifies a resource that
1.63 + * the request is addressed to. The ownership is transferred.
1.64 + */
1.65 + IMPORT_C static CSIPRequestElements* NewL(CUri8* aRemoteUri);
1.66 +
1.67 + /**
1.68 + * Two-phased constructor.
1.69 + * If the URI is SIP URI, no SIP URI headers are allowed.
1.70 + * @pre aRemoteURi != 0
1.71 + * @param aRemoteUri Remote target URI that identifies a resource that
1.72 + * the request is addressed to. The ownership is transferred.
1.73 + */
1.74 + IMPORT_C static CSIPRequestElements* NewLC(CUri8* aRemoteUri);
1.75 +
1.76 + /**
1.77 + * Destructor.
1.78 + */
1.79 + IMPORT_C ~CSIPRequestElements();
1.80 +
1.81 + public: // New functions
1.82 + /**
1.83 + * Sets/resets the recipient's To-header
1.84 + * To-header must not contain tag-parameter.
1.85 + * @pre aTo != 0
1.86 + * @param aTo a To-header to be set, the ownership is transferred.
1.87 + */
1.88 + IMPORT_C void SetToHeaderL(CSIPToHeader* aTo);
1.89 +
1.90 + /**
1.91 + * Gets the recipient's To-header
1.92 + * @return To-header or a 0-pointer if not present. Ownership is not
1.93 + * transferred.
1.94 + */
1.95 + IMPORT_C const CSIPToHeader* ToHeader() const;
1.96 +
1.97 + /**
1.98 + * Sets/resets the originator's From-header.
1.99 + * From-header must not contain tag-parameter.
1.100 + * @pre aFrom != 0
1.101 + * @param aFrom a From-header to be set, the ownership is transferred.
1.102 + * @leave KErrArgument if aFrom == 0
1.103 + */
1.104 + IMPORT_C void SetFromHeaderL(CSIPFromHeader* aFrom);
1.105 +
1.106 + /**
1.107 + * Gets the originator's From-header
1.108 + * @return From-header or a 0-pointer if not present. Ownership is not
1.109 + * transferred.
1.110 + */
1.111 + IMPORT_C const CSIPFromHeader* FromHeader() const;
1.112 +
1.113 + /**
1.114 + * Gets CSeq-header. Available for only incoming requests.
1.115 + * @return a CSeq-header or a 0-pointer if not present.
1.116 + * Ownership is not transferred.
1.117 + */
1.118 + IMPORT_C const CSIPCSeqHeader* CSeqHeader() const;
1.119 +
1.120 + /**
1.121 + * Sets the remote URI.
1.122 + * If the URI is a SIP URI, no SIP URI headers are allowed.
1.123 + * @pre aRemoteUri != 0
1.124 + * @param aRemoteUri
1.125 + * @leave KErrArgument if aRemoteUri==0
1.126 + */
1.127 + IMPORT_C void SetRemoteUriL(CUri8* aRemoteUri);
1.128 +
1.129 + /**
1.130 + * Gets the remote target URI
1.131 + * @return remote target URI
1.132 + */
1.133 + IMPORT_C const CUri8& RemoteUri() const;
1.134 +
1.135 + /**
1.136 + * Sets the SIP request method
1.137 + * @param aMethod a SIP method name.
1.138 + * @leave KErrArgument if method name given is syntactically
1.139 + * incorrect
1.140 + */
1.141 + IMPORT_C void SetMethodL(RStringF aMethod);
1.142 +
1.143 + /**
1.144 + * Gets the SIP Method for a request
1.145 + * @return a SIP method name or a an empty string if the method
1.146 + * is not defined
1.147 + */
1.148 + IMPORT_C RStringF Method() const;
1.149 +
1.150 + /**
1.151 + * Gets message elements (contains all SIP user headers and content)
1.152 + * @return message elements
1.153 + */
1.154 + IMPORT_C const CSIPMessageElements& MessageElements() const;
1.155 +
1.156 + /**
1.157 + * Gets message elements (contains all SIP user headers and content)
1.158 + * The response elements can be populated with SIP user headers
1.159 + * and content using returned reference to the message elements.
1.160 + * @return message elements
1.161 + */
1.162 + IMPORT_C CSIPMessageElements& MessageElements();
1.163 +
1.164 + public: // New functions, for internal use
1.165 + static CSIPRequestElements* InternalizeL (RReadStream& aReadStream);
1.166 + void ExternalizeL (RWriteStream& aWriteStream) const;
1.167 +
1.168 + private:
1.169 + CSIPRequestElements();
1.170 + void ConstructL(CUri8* aRemoteUri);
1.171 + void DoInternalizeL(RReadStream& aReadStream);
1.172 +
1.173 + private: // Data
1.174 + RStringF iMethod;
1.175 + CURIContainer* iRemoteURI;
1.176 + CSIPMessageElements* iMessageElements;
1.177 +
1.178 + private: // For testing purposes
1.179 + UNIT_TEST(CSIPRequestElementsTest)
1.180 + };
1.181 +
1.182 +#endif