epoc32/include/mw/siprequestelements.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 epoc32/include/siprequestelements.h@2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* 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
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:
williamr@2
    15
* Name        : siprequestelements.h
williamr@2
    16
* Part of     : SIP Client
williamr@2
    17
* Interface   : SDK API, SIP API
williamr@2
    18
* Version     : 1.0
williamr@2
    19
*
williamr@2
    20
*/
williamr@2
    21
williamr@2
    22
williamr@2
    23
williamr@2
    24
#ifndef CSIPREQUESTELEMENTS_H
williamr@2
    25
#define CSIPREQUESTELEMENTS_H
williamr@2
    26
williamr@2
    27
//  INCLUDES
williamr@2
    28
#include <e32base.h>
williamr@2
    29
#include <s32strm.h>
williamr@2
    30
#include <stringpool.h>
williamr@2
    31
#include <uri8.h>
williamr@2
    32
#include "_sipcodecdefs.h"
williamr@2
    33
williamr@2
    34
// FORWARD DECLARATIONS
williamr@2
    35
class CSIPMessageElements;
williamr@2
    36
class CSIPFromHeader;
williamr@2
    37
class CSIPToHeader;
williamr@2
    38
class CSIPCSeqHeader;
williamr@2
    39
class CURIContainer;
williamr@2
    40
williamr@2
    41
// CLASS DECLARATION
williamr@2
    42
williamr@2
    43
/**
williamr@2
    44
*  @publishedAll
williamr@2
    45
*  @released
williamr@2
    46
*
williamr@2
    47
*  Class provides functions for creation and manipulation of originator's and
williamr@2
    48
*  recipient's addresses in a SIP request. It also provide functions for
williamr@2
    49
*  manipulation of SIP method for unknown SIP requests.
williamr@2
    50
*  @lib sipclient.lib
williamr@2
    51
*/
williamr@2
    52
class CSIPRequestElements : public CBase
williamr@2
    53
    {
williamr@2
    54
    public:  // Constructors and destructor      
williamr@2
    55
        /**
williamr@2
    56
        * Two-phased constructor.
williamr@2
    57
        * If the URI is SIP URI, no SIP URI headers are allowed.
williamr@2
    58
        * @pre aRemoteURi != 0
williamr@2
    59
        * @param aRemoteUri Remote target URI that identifies a resource that
williamr@2
    60
        *        the request is addressed to. The ownership is transferred.
williamr@2
    61
        */
williamr@2
    62
        IMPORT_C static CSIPRequestElements* NewL(CUri8* aRemoteUri);
williamr@2
    63
williamr@2
    64
        /**
williamr@2
    65
        * Two-phased constructor.
williamr@2
    66
        * If the URI is SIP URI, no SIP URI headers are allowed.
williamr@2
    67
        * @pre aRemoteURi != 0
williamr@2
    68
        * @param aRemoteUri Remote target URI that identifies a resource that
williamr@2
    69
        *        the request is addressed to. The ownership is transferred.
williamr@2
    70
        */
williamr@2
    71
        IMPORT_C static CSIPRequestElements* NewLC(CUri8* aRemoteUri);
williamr@2
    72
williamr@2
    73
        /**
williamr@2
    74
        * Destructor.
williamr@2
    75
        */
williamr@2
    76
        IMPORT_C ~CSIPRequestElements();
williamr@2
    77
williamr@2
    78
    public: // New functions
williamr@2
    79
        /**
williamr@2
    80
        * Sets/resets the recipient's To-header
williamr@2
    81
        * To-header must not contain tag-parameter.
williamr@2
    82
        * @pre aTo != 0
williamr@2
    83
        * @param aTo a To-header to be set, the ownership is transferred.
williamr@2
    84
        */
williamr@2
    85
        IMPORT_C void SetToHeaderL(CSIPToHeader* aTo);
williamr@2
    86
            
williamr@2
    87
        /**
williamr@2
    88
        * Gets the recipient's To-header 
williamr@2
    89
        * @return To-header or a 0-pointer if not present. Ownership is not
williamr@2
    90
        *   transferred.
williamr@2
    91
        */
williamr@2
    92
        IMPORT_C const CSIPToHeader* ToHeader() const;
williamr@2
    93
williamr@2
    94
        /**
williamr@2
    95
        * Sets/resets the originator's From-header.
williamr@2
    96
        * From-header must not contain tag-parameter.
williamr@2
    97
        * @pre aFrom != 0
williamr@2
    98
         * @param aFrom a From-header to be set, the ownership is transferred.
williamr@2
    99
        * @leave KErrArgument if aFrom == 0 
williamr@2
   100
        */
williamr@2
   101
        IMPORT_C void SetFromHeaderL(CSIPFromHeader* aFrom);
williamr@2
   102
            
williamr@2
   103
        /**
williamr@2
   104
        * Gets the originator's From-header 
williamr@2
   105
        * @return From-header or a 0-pointer if not present. Ownership is not
williamr@2
   106
        *   transferred.
williamr@2
   107
        */
williamr@2
   108
        IMPORT_C const CSIPFromHeader* FromHeader() const;
williamr@2
   109
williamr@2
   110
        /**
williamr@2
   111
        * Gets CSeq-header. Available for only incoming requests.
williamr@2
   112
        * @return a CSeq-header or a 0-pointer if not present. 
williamr@2
   113
        *         Ownership is not transferred.
williamr@2
   114
        */        
williamr@2
   115
        IMPORT_C const CSIPCSeqHeader* CSeqHeader() const;
williamr@2
   116
williamr@2
   117
        /**
williamr@2
   118
        * Sets the remote URI.
williamr@2
   119
        * If the URI is a SIP URI, no SIP URI headers are allowed.
williamr@2
   120
        * @pre aRemoteUri != 0
williamr@2
   121
         * @param aRemoteUri
williamr@2
   122
        * @leave KErrArgument if aRemoteUri==0
williamr@2
   123
        */
williamr@2
   124
        IMPORT_C void SetRemoteUriL(CUri8* aRemoteUri);
williamr@2
   125
williamr@2
   126
        /**
williamr@2
   127
        * Gets the remote target URI
williamr@2
   128
        * @return remote target URI
williamr@2
   129
        */
williamr@2
   130
        IMPORT_C const CUri8& RemoteUri() const; 
williamr@2
   131
williamr@2
   132
        /**
williamr@2
   133
        * Sets the SIP request method
williamr@2
   134
        * @param aMethod a SIP method name.
williamr@2
   135
        * @leave KErrArgument if method name given is syntactically
williamr@2
   136
        *        incorrect
williamr@2
   137
        */
williamr@2
   138
        IMPORT_C void SetMethodL(RStringF aMethod);
williamr@2
   139
williamr@2
   140
        /**
williamr@2
   141
        * Gets the SIP Method for a request
williamr@2
   142
        * @return a SIP method name or a an empty string if the method
williamr@2
   143
        *         is not defined
williamr@2
   144
        */
williamr@2
   145
        IMPORT_C RStringF Method() const;
williamr@2
   146
williamr@2
   147
        /**
williamr@2
   148
        * Gets message elements (contains all SIP user headers and content)
williamr@2
   149
        * @return message elements
williamr@2
   150
        */
williamr@2
   151
        IMPORT_C const CSIPMessageElements& MessageElements() const;
williamr@2
   152
williamr@2
   153
        /**
williamr@2
   154
        * Gets message elements (contains all SIP user headers and content)
williamr@2
   155
        * The response elements can be populated with SIP user headers
williamr@2
   156
        * and content using returned reference to the message elements.
williamr@2
   157
        * @return message elements
williamr@2
   158
        */
williamr@2
   159
        IMPORT_C CSIPMessageElements& MessageElements();
williamr@2
   160
williamr@2
   161
    public: // New functions, for internal use
williamr@2
   162
        static CSIPRequestElements* InternalizeL (RReadStream& aReadStream);
williamr@2
   163
        void ExternalizeL (RWriteStream& aWriteStream) const;
williamr@2
   164
williamr@2
   165
    private:
williamr@2
   166
        CSIPRequestElements();
williamr@2
   167
        void ConstructL(CUri8* aRemoteUri);
williamr@2
   168
        void DoInternalizeL(RReadStream& aReadStream);
williamr@2
   169
williamr@2
   170
    private: // Data
williamr@2
   171
        RStringF iMethod;
williamr@2
   172
        CURIContainer* iRemoteURI;
williamr@2
   173
        CSIPMessageElements* iMessageElements;
williamr@2
   174
williamr@2
   175
    private: // For testing purposes
williamr@2
   176
        UNIT_TEST(CSIPRequestElementsTest)
williamr@2
   177
    };
williamr@2
   178
williamr@2
   179
#endif