mmsharing/mmshavailability/inc/musavacapabilitycontext.h
changeset 15 ccd8e69b5392
parent 2 b31261fd4e04
child 20 e8be2c2e049d
child 22 496ad160a278
equal deleted inserted replaced
2:b31261fd4e04 15:ccd8e69b5392
     1 /*
       
     2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Swis call context
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef MUSAVACAPABILITYCONTEXT_H
       
    19 #define MUSAVACAPABILITYCONTEXT_H
       
    20 
       
    21 #include <badesca.h>
       
    22 #include "musunittesting.h"
       
    23 
       
    24 
       
    25 const TInt KMUSAVASIP200 = 200;
       
    26 const TInt KMUSAVASIPServerInternalError = 500;
       
    27 const TInt KMUSAVASIPNotImplemented = 501;
       
    28 const TInt KMUSAVASIPForbidden = 403;
       
    29 const TInt KMUSAVASIPNotFound = 404;
       
    30 const TInt KMUSAVASIPTimeout = 408;
       
    31 const TInt KMUSAVASIPUnsupportedURIScheme = 416;
       
    32 const TInt KMUSAVASIPTemporarilyUnavailable = 480;
       
    33 const TUint KMUSAVASIPDecline = 603;
       
    34 
       
    35 const TInt KMUSAVAMaxLengthOfSDPMessage = 1000;
       
    36 _LIT8( KMUSAVASIPMediaTypeApplication, "application" );
       
    37 _LIT8( KMUSAVASIPMediaSubTypeSDP, "sdp" );
       
    38 _LIT8( KMUSAVASIPHeaderUserAgent, "User-Agent" );
       
    39 _LIT8( KMUSAVASIPHeaderPAssertedIdentity, "P-Asserted-Identity" );
       
    40 _LIT8( KMUSAVASIPParamFalse, "false" );
       
    41 _LIT8( KMUSAVASemicolon, ";");
       
    42 
       
    43 
       
    44 class CSIPServerTransaction;
       
    45 class RStringF;
       
    46 class CSdpDocument;
       
    47 class CSIPMessageElements;
       
    48 class CSIPTransactionBase;
       
    49 class CSIPHeaderBase;
       
    50 class CSIPExtensionHeader;
       
    51 class CSIPAcceptContactHeader;
       
    52 class CSIPContactHeader;
       
    53 class CUri8;
       
    54 
       
    55 
       
    56 class MusAvaCapabilityContext
       
    57     {
       
    58 public: // static API
       
    59 
       
    60     /**
       
    61     * Returns SDP string from pool
       
    62     *
       
    63     * @param aStringIndex SDP string index
       
    64     * @return SDP String
       
    65     */
       
    66     static RStringF SDPStringL( TInt aStringIndex );
       
    67 
       
    68     /**
       
    69     * Creates SDP string to pool
       
    70     *
       
    71     * @param aString the string as descriptor
       
    72     * @return SDP String
       
    73     */
       
    74     static RStringF SDPStringL( const TDesC8& aString );
       
    75 
       
    76     /**
       
    77     * Creates SIP string to pool
       
    78     *
       
    79     * @param aString the string as descriptor
       
    80     * @return SIP String
       
    81     */
       
    82     static RStringF SIPStringL( const TDesC8& aString );
       
    83     
       
    84     /**
       
    85     * Resolves local host
       
    86     *
       
    87     * @param aQuery query
       
    88     * @return feature set
       
    89     */
       
    90     static void LocalHostL( const CSIPServerTransaction& aRequest,
       
    91                             TPtrC8& aLocalHost,
       
    92                             RStringF& aHostType);
       
    93 
       
    94     /**
       
    95      * Helper to create uri from descriptor
       
    96      *
       
    97      * @param aUri uri as descriptor
       
    98      * @return uri
       
    99      */
       
   100     static CUri8* ToUriL( const TDesC8& aUri );
       
   101     
       
   102     /**
       
   103      * Helper to transform SDP document to text
       
   104      *
       
   105      * @param aSdpContent SDP document
       
   106      * @return SDP document as text
       
   107      */
       
   108     static HBufC8* ToTextL( CSdpDocument& aSdpContent );
       
   109 
       
   110 
       
   111     /**
       
   112      * Returns message elemensts from request/response
       
   113      *
       
   114      * @param aTrx server/client transaction
       
   115      * @return message elemensts
       
   116      */
       
   117     static const CSIPMessageElements& MessageElementsL( 
       
   118                                 const CSIPTransactionBase& aTrx );
       
   119 
       
   120     /**
       
   121      * Creates Accept-Contact header
       
   122      *
       
   123      * @param aValue value of header
       
   124      * @return the header
       
   125      */
       
   126     static CSIPAcceptContactHeader* AcceptContactHeaderLC( RStringF aValue );
       
   127     
       
   128     /**
       
   129      * returns Accept-Contact header from request/response
       
   130      *
       
   131      * @param aTrx  request/response
       
   132      * @return the header
       
   133      */
       
   134     static const CSIPAcceptContactHeader* AcceptContactHeaderL( 
       
   135                                 const CSIPTransactionBase& aTrx );
       
   136 
       
   137     /**
       
   138      * Creates Contact header
       
   139      *
       
   140      * @param aAddress the address
       
   141      * @param aValue value of header
       
   142      * @return the header
       
   143      */
       
   144     static CSIPContactHeader* ContactHeaderLC( const CUri8& aAddress,
       
   145                                                RStringF aValue );
       
   146     
       
   147     /**
       
   148      * Returns Contact header from request/response
       
   149      *
       
   150      * @param aTrx  request/response
       
   151      * @return the header
       
   152      */
       
   153     static const CSIPContactHeader* ContactHeaderL( 
       
   154                                 const CSIPTransactionBase& aTrx );
       
   155 
       
   156 
       
   157     /**
       
   158      * Creates User-Agent header
       
   159      *
       
   160      * @param aValue value of header
       
   161      * @return the header
       
   162      */
       
   163     static CSIPExtensionHeader* UserAgentHeaderLC( const TDesC8& aValue );
       
   164     
       
   165     /**
       
   166      * returns User-Agent header from request/response
       
   167      *
       
   168      * @param aTrx  request/response
       
   169      * @return the header
       
   170      */
       
   171     static const CSIPExtensionHeader* UserAgentHeaderL( 
       
   172                                 const CSIPTransactionBase& aTrx );
       
   173 
       
   174     /**
       
   175      * Creates P-Asserted-Identity header
       
   176      *
       
   177      * @param aValue value of header
       
   178      * @return the header
       
   179      */
       
   180     static CSIPExtensionHeader* PAssertedIdentityHeaderLC( 
       
   181                                 const TDesC8& aValue );
       
   182     
       
   183     /**
       
   184      * Returns originator from request
       
   185      *
       
   186      * @param aTrx request
       
   187      * @return originator's URI
       
   188      */
       
   189     static const CUri8& MusAvaCapabilityContext::OriginatorL( 
       
   190                                 const CSIPServerTransaction& aTrx );
       
   191 
       
   192     /**
       
   193      * Finds header from user headers based on header's name
       
   194      *
       
   195      * @param aHeaderName name of the header
       
   196      * @param aMessage SIP message containg user headers
       
   197      * @param aIndex index of the header in message
       
   198      * @return the header
       
   199      */
       
   200     static const CSIPHeaderBase* Header( RStringF aHeaderName,
       
   201                                    const CSIPMessageElements& aMessage,
       
   202                                    TUint aIndex );
       
   203                                    
       
   204     /**
       
   205      * Finds header from user headers based on header's name
       
   206      *
       
   207      * @param aHeaderName name of the header
       
   208      * @param aMessage SIP message containg user headers
       
   209      * @return the header
       
   210      */
       
   211     static const CSIPHeaderBase* Header( RStringF aHeaderName,
       
   212                                    const CSIPMessageElements& aMessage );
       
   213     /**
       
   214      * Finds header count from user headers based on header's name
       
   215      *
       
   216      * @param aHeaderName name of the header
       
   217      * @param aMessage SIP message containg user headers
       
   218      * @return the count
       
   219      */
       
   220     static TUint HeaderCount( RStringF aHeaderName,
       
   221                                    const CSIPMessageElements& aMessage );
       
   222 
       
   223     /**
       
   224      * Finds and returns all P-Asserted-Identity header .
       
   225      *
       
   226      * @param aMessage SIP message header.     
       
   227      * @return array which has all P-Asserted-Identity header.
       
   228      */
       
   229     static CDesCArrayFlat* MusAvaCapabilityContext::PAssertedIdentityHeaderL(
       
   230                                     const CSIPMessageElements& aMessage );
       
   231     //MUS_UNITTEST ( UT_ )
       
   232 
       
   233     };
       
   234     
       
   235     
       
   236 #endif // MUSAVACAPABILITYCONTEXT_H