mmsharing/mmshavailability/inc/musavacapability.h
changeset 0 f0cf47e981f9
child 22 73a1feb507fb
equal deleted inserted replaced
-1:000000000000 0:f0cf47e981f9
       
     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:  Capability
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMUSAVACAPABILITY_H
       
    20 #define CMUSAVACAPABILITY_H
       
    21 
       
    22 
       
    23 #include <e32base.h>    // CBase
       
    24 #include <sdpcodecstringconstants.h>
       
    25 #include <sdpcodecstringpool.h>
       
    26 #include <badesca.h>
       
    27 #include "musunittesting.h"
       
    28 
       
    29 
       
    30 class CMusAvaCapabilityExchange;
       
    31 class CSIPServerTransaction;
       
    32 class CSIPHeaderBase;
       
    33 class CSdpDocument;
       
    34 class CSIPAcceptContactHeader;
       
    35 class CSdpFmtAttributeField;
       
    36 class CSdpAttributeField;
       
    37 class CSdpOriginField;
       
    38 class CSdpMediaField;
       
    39 class RStringF;
       
    40 
       
    41 #define CAPABILITY_CONTAINS( tagSet, tag ) ( tagSet.Find( tag ) >= KErrNone )
       
    42 _LIT8( KCapabilitySwisFeature, "+g.3gpp.cs-voice");
       
    43 _LIT8( KCapabilitySwisApplication, "com.gsma.rts");
       
    44 _LIT8( KCapabilitySDPAttributeNameType, "type");
       
    45 _LIT8( KCapabilitySDPAttributeType, "videolive");
       
    46 _LIT8( KCapabilitySDPAttributeCodecH263, "H263-2000" );
       
    47 _LIT8( KCapabilitySwisFormatList, "98 96" );
       
    48 _LIT8( KCapabilitySwisFormatListH263Only, "96" );
       
    49 _LIT8( KCapabilitySDPAttributeCodecH264, "H264" );
       
    50 
       
    51 const TUint64 KCapabilitySDPAttributeClockrate = 90000;
       
    52 const TUint64 KCapabilitySDPAttributePayloadType = 96;
       
    53 const TUint64 KCapabilitySDPAttributePayloadTypeH264 = 98;
       
    54 
       
    55 
       
    56 /**
       
    57  * Capability
       
    58  *
       
    59  * @lib musavailabilityplugin.dll
       
    60  */
       
    61 class CMusAvaCapability : public CBase
       
    62     {
       
    63 
       
    64 public: // constructors and destructor
       
    65 
       
    66     static CMusAvaCapability* NewL( CMusAvaCapabilityExchange& aExchange );
       
    67     virtual ~CMusAvaCapability();
       
    68 
       
    69 
       
    70 protected: // constructors
       
    71 
       
    72     CMusAvaCapability( CMusAvaCapabilityExchange& aExchange );
       
    73 
       
    74     void ConstructL( );
       
    75 
       
    76 public: // new functions
       
    77 
       
    78     /**
       
    79     * Returns exchance
       
    80     *
       
    81     * @return exchance
       
    82     */
       
    83     CMusAvaCapabilityExchange& Exchange() const;
       
    84 
       
    85     /**
       
    86     * Returns feature this capability represents
       
    87     *
       
    88     * @return feature this capability represents
       
    89     */
       
    90     const RStringF& Feature() const;
       
    91 
       
    92     /**
       
    93     * Checks if capability supports feature, found
       
    94     * in Accept-Contact header
       
    95     *
       
    96     * @param acceptContact accept contact
       
    97     * @return ETrue, if there is a match
       
    98     */
       
    99     virtual TBool Supports( const CSIPAcceptContactHeader& acceptContact );
       
   100 
       
   101     /**
       
   102     * Uses for conrolling capability 
       
   103     *
       
   104     * @return ETrue, if capability is enabled
       
   105     */
       
   106     TBool& Enabled();
       
   107 
       
   108     /**
       
   109     * Populates response to query
       
   110     *
       
   111     * @param aQuery query as SIP server transaction
       
   112     * @param aResponseHeaders SIP headers container for response
       
   113     * @param aResponseContent SDP document container for response
       
   114     */
       
   115     virtual void PopulateResponseL( 
       
   116             CSIPServerTransaction& aQuery,
       
   117             RPointerArray<CSIPHeaderBase>& aResponseHeaders,
       
   118             CSdpDocument& aResponseContent );
       
   119             
       
   120 
       
   121 private: 
       
   122 
       
   123     /**
       
   124     * Populates response to query
       
   125     *
       
   126     * @param aResponseContent SDP document container for response
       
   127     */
       
   128     void DoPopulateResponseL( CSdpDocument& aResponseContent );
       
   129 
       
   130 
       
   131 
       
   132 public: //static API
       
   133 
       
   134                        
       
   135     /**
       
   136      * Creates SDP document
       
   137      *
       
   138      * @param aQuery received query
       
   139      * @return SDP document
       
   140      */
       
   141     static CSdpDocument* ResponseContentLC( 
       
   142                                      const CSIPServerTransaction& aQuery );
       
   143 
       
   144     /**
       
   145      * Finds and resolves the codecs from SDP document
       
   146      *
       
   147      * @return the supported media types
       
   148      */
       
   149     static CDesCArrayFlat* ResolveCodecsL( CSdpDocument& aSDP );
       
   150 
       
   151     /**
       
   152      * Finds attribute field from SDP document
       
   153      *
       
   154      * @param aAttribute attribute name
       
   155      * @param aSDP SDP document
       
   156      * @return the attribute
       
   157      */
       
   158     static const CSdpAttributeField* Attribute( const RStringF& aAttribute,
       
   159                                                    CSdpDocument& aSDP );
       
   160 
       
   161     /**
       
   162      * Finds attribute field from media part in SDP document
       
   163      *
       
   164      * @param aMedia name of the media
       
   165      * @param aAttribute attribute name
       
   166      * @param aSDP SDP document
       
   167      * @return the attribute
       
   168      */
       
   169     static const CSdpAttributeField* Attribute( const RStringF& aMedia,
       
   170                                         const RStringF& aAttribute,
       
   171                                         CSdpDocument& aSDP );
       
   172 public://new functions
       
   173 
       
   174     /**
       
   175     * Adds contact header to response of query
       
   176     *
       
   177     * @param aQuery query as SIP server transaction
       
   178     * @param aResponseHeaders SIP headers container for response
       
   179     */
       
   180     virtual void AddContactHeaderL(
       
   181             CSIPServerTransaction& aQuery,
       
   182             RPointerArray<CSIPHeaderBase>& aResponseHeaders );
       
   183             
       
   184     /**
       
   185      * Creates origin field for sdp
       
   186      *
       
   187      * @param aNetType net type
       
   188      * @param aLocalHost local host
       
   189      * @param aHostType host type
       
   190      * @return origin field 
       
   191      */
       
   192     static CSdpOriginField* OriginFieldL( const RStringF& aNetType,
       
   193                                           const TDesC8& aLocalHost,
       
   194                                           const RStringF& aHostType );
       
   195                                           
       
   196     /**
       
   197      * Creates media line 
       
   198      *
       
   199      * @param aMedia name of the media
       
   200      * @param aFormatList format list
       
   201      * @return media line
       
   202      */
       
   203     CSdpMediaField* MediaLineLC( const RStringF& aMedia, 
       
   204                                  const TDesC8& aFormatList ) const;
       
   205     
       
   206     
       
   207     /**
       
   208      * Creates rtpmap line
       
   209      *
       
   210      * @param aCodec name of coded
       
   211      * @param aPayloadType payload type
       
   212      * @param aClockRate clockrate
       
   213      * @param aParams optional params
       
   214      * @return rtpmap line
       
   215      */
       
   216     static CSdpFmtAttributeField* RtpMapLineLC( const TDesC8& aCodec,
       
   217                                  const TUint64 aPayloadType,
       
   218                                  const TUint64 aClockRate,
       
   219                                  const TDesC8& aParams = KNullDesC8 );
       
   220     
       
   221                                    
       
   222 private:
       
   223 
       
   224     CMusAvaCapabilityExchange& iExchange;
       
   225     RStringF iFeature;
       
   226     TBool iIsEnabled;
       
   227 
       
   228     //for unit testing
       
   229     //MUS_UNITTEST ( UT_ )
       
   230 
       
   231     };
       
   232 
       
   233 #endif // CMUSAVACAPABILITY_H