sipvoipprovider/inc/svpuriparser.h
branchRCL_3
changeset 22 d38647835c2e
parent 0 a4daefaec16c
equal deleted inserted replaced
21:f742655b05bf 22:d38647835c2e
       
     1 /*
       
     2 * Copyright (c) 2006-2008 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:  provides uri parser methods for SVP
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef SVPURIPARSER_H
       
    21 #define SVPURIPARSER_H
       
    22 
       
    23 #include <escapeutils.h>
       
    24 #include "svputdefs.h"
       
    25 
       
    26  /**
       
    27  *  Uri parser methods for SVP
       
    28  *
       
    29  *  @lib 
       
    30  *  @since S60 3.2
       
    31  */
       
    32 class CSVPUriParser : public CBase
       
    33     {
       
    34 
       
    35 public: 
       
    36     
       
    37     /**
       
    38     * Two-phased constructor.
       
    39     */
       
    40     static CSVPUriParser* NewL();
       
    41     
       
    42     /**
       
    43     * Two-phased constructor.
       
    44     */
       
    45     static CSVPUriParser* NewLC();
       
    46     
       
    47     /**
       
    48     * Destructor.
       
    49     */
       
    50     virtual ~CSVPUriParser();
       
    51 
       
    52 
       
    53 public: // new methods
       
    54 
       
    55     
       
    56     /**
       
    57     * Method for setting user=phone parameter to invite
       
    58     * @sinceSeries 60 3.2
       
    59     * @param aValue ETrue or EFalse
       
    60     */
       
    61     void SetUserEqualsPhoneRequiredL( TBool aValue );
       
    62 
       
    63     /**
       
    64     * Method for checking if uri is valid for user=phone parameter
       
    65     * @since Series 60 3.2
       
    66     * @param aUri Uri to be checked
       
    67     * @return TBool URI ETrue if valid, EFalse otherwise
       
    68     */
       
    69     static TBool IsUriValidForUserEqualsPhoneL( const TDesC8& aUri );
       
    70     
       
    71     /**
       
    72     * Method for checking whether user=phone is needed
       
    73     * @since Series 60 3.2
       
    74     * @return TBool ETrue if valid, EFalse otherwise
       
    75     */
       
    76     TBool UserEqualsPhoneRequiredL() const;
       
    77 
       
    78     /**
       
    79     * Adds user=phone if neccessary
       
    80     * @since Series 60 3.2
       
    81     * @param aUri URI where the user=phone parameter is added
       
    82     */
       
    83     void AddUserEqualsPhoneL( HBufC8*& aUri ) const;
       
    84 
       
    85    
       
    86     /**
       
    87     * Completes the recipients SIP Uri. 
       
    88     * Adds "sip:", if it's missing.
       
    89     * Adds "@", if it's missing.
       
    90     * Adds the domain from own registered SIP Profile to the
       
    91     * domain part of address if it's missing.
       
    92     * Leaves on error.
       
    93     * @since Series 60 3.2
       
    94     * @param aUri The URI to be completed, non-modifiable descriptor.
       
    95     * @param aAOR the address-of-record containing the domain part
       
    96     * @param aIsEmergency Indicates emergency call
       
    97     * @return Pointer to the altered URI
       
    98     */
       
    99     HBufC8* CompleteSipUriL( 
       
   100         const TDesC8& aUri, 
       
   101         const TDesC8& aAOR, 
       
   102         TBool aIsEmergency = EFalse ) const;
       
   103     
       
   104     /**
       
   105     * Completes the recipients SIP Uri. 
       
   106     * Adds "sips:", if it's missing.
       
   107     * Adds "@", if it's missing.
       
   108     * Adds the domain from own registered SIP Profile to the
       
   109     * domain part of address if it's missing.
       
   110     * Leaves on error.
       
   111     * @since Series 60 3.2
       
   112     * @param aUri The URI to be completed, non-modifiable descriptor.
       
   113     * @param aAOR the address of record containing the domain part
       
   114     * @return Pointer to the altered URI
       
   115     */
       
   116     HBufC8* CompleteSecureSipUriL( const TDesC8& aUri, 
       
   117                                    const TDesC8& aAOR ) const;
       
   118     
       
   119     /**
       
   120     * Completes the recipients SIP Uri for SIP events. 
       
   121     * Adds "sip:", if it's missing.
       
   122     * Leaves on error.
       
   123     * @since Series 60 3.2
       
   124     * @param aUri The URI to be completed, non-modifiable descriptor.
       
   125     * @return Pointer to the altered URI
       
   126     */
       
   127     HBufC8* CompleteEventSipUriL( const TDesC8& aUri ) const;
       
   128 
       
   129     /**
       
   130     * Parses aUri and returns its domain part
       
   131     * @sinceSeries 60 3.2
       
   132     * @param aUri URI for extracting domain
       
   133     * @return Pointer to a newly allocated domain part
       
   134     */
       
   135     static HBufC8* DomainL( const TDesC8& aUri );
       
   136     
       
   137     /**
       
   138     * Escape decodes the characters which are not acceptable in SIP URI  
       
   139     * @since Series 60 3.2
       
   140     * @param aSipUri SIP Uri to decode
       
   141     * @return None
       
   142     */  
       
   143     static void EscapeDecodeSipUriL( HBufC8*& aSipUri );
       
   144     
       
   145     /**
       
   146     * Escape encodes the characters which are not acceptable in SIP URI  
       
   147     * @since Series 60 3.2
       
   148     * @param aSipUri SIP Uri to encode
       
   149     * @param aMode Defines the escaping mode
       
   150     * @return None
       
   151     */
       
   152     static void EscapeEncodeSipUriL( HBufC8*& aSipUri, EscapeUtils::TEscapeMode aMode );
       
   153 
       
   154     /**
       
   155     * Parses and returns display name of the given remote party address  
       
   156     * @since Series 60 3.2
       
   157     * @param aAddress Remote party address
       
   158     * @return Display name
       
   159     */
       
   160     static HBufC* ParseDisplayNameL( const TDesC8& aAddress );
       
   161 
       
   162     /**
       
   163     * Parses and returns URI of the given remote party address  
       
   164     * @since Series 60 3.2
       
   165     * @param aAddress Remote party address
       
   166     * @return URI
       
   167     */
       
   168     static HBufC* ParseRemotePartyUriL( const TDesC8& aAddress );
       
   169     
       
   170 private: // new methods
       
   171     
       
   172     /**
       
   173     * Checks, if the URI given as parameter has
       
   174     * "sips:" prefix.
       
   175     * @since Series 60 3.2
       
   176     * @param aUri The URI to be checked, non-modifiable descriptor.
       
   177     * @return TBool ETrue, if the prefix is there,
       
   178     *         EFalse, if not.
       
   179     */
       
   180     TBool CheckSipsPrefix( const TDesC8& aUri ) const;     
       
   181     
       
   182     
       
   183     /**
       
   184     * Checks, if the URI given as parameter has
       
   185     * "sip:" prefix.
       
   186     * @since Series 60 3.2
       
   187     * @param aUri The URI to be checked, non-modifiable descriptor.
       
   188     * @return TBool ETrue, if the prefix is there,
       
   189     *         EFalse, if not.
       
   190     */
       
   191     TBool CheckSipPrefix( const TDesC8& aUri ) const;
       
   192 
       
   193     /**
       
   194     * Checks, if the URI given as parameter has
       
   195     * the "@" character.
       
   196     * @since Series 60 3.2
       
   197     * @param aUri The URI to be checked, non-modifiable descriptor.
       
   198     * @return TBool ETrue, if the chareacter is there,
       
   199     *         EFalse, if not.
       
   200     */
       
   201     TBool CheckAt( const TDesC8& aUri ) const;
       
   202     
       
   203     /**
       
   204     * Checks, if the URI given as parameter has
       
   205     * the domain part.
       
   206     * @since Series 60 3.2
       
   207     * @param aUri The URI to be checked,non-modifiable descriptor.
       
   208     * @return TBool ETrue, if the domain is there,
       
   209     * EFalse, if not.
       
   210     */
       
   211     TBool CheckDomain( const TDesC8& aUri ) const;
       
   212 
       
   213     /**
       
   214     * Adds the "sip:" prefix to the URI given as parameter.
       
   215     * Leaves if the adding failes.
       
   216     * @since Series 60 3.2
       
   217     * @param aUri The URI to be altered, modifiable descriptor.
       
   218     * @return None
       
   219     */
       
   220     void AddSipPrefixL( HBufC8*& aUri ) const;
       
   221     
       
   222      /**
       
   223     * Adds the "sips:" prefix to the URI given as parameter.
       
   224     * Leaves if the adding failes.
       
   225     * @since Series 60 3.2
       
   226     * @param aUri The URI to be altered, modifiable descriptor.
       
   227     * @return None
       
   228     */
       
   229     void AddSipsPrefixL( HBufC8*& aUri ) const;
       
   230     
       
   231     /**
       
   232     * Removes the "sip:" prefix from the URI given as parameter.
       
   233     * Leaves if the adding failes.
       
   234     * @since Series 60 3.2
       
   235     * @param aUri The URI to be altered, modifiable descriptor.
       
   236     * @return None
       
   237     */
       
   238     void RemoveSipPrefixL( HBufC8*& aUri ) const;
       
   239     
       
   240     /**
       
   241     * Removes the "sips:" prefix from the URI given as parameter.
       
   242     * Leaves if the adding failes.
       
   243     * @since Series 60 3.2
       
   244     * @param aUri The URI to be altered, modifiable descriptor.
       
   245     * @return None
       
   246     */
       
   247     void RemoveSipsPrefixL( HBufC8*& aUri ) const;
       
   248 
       
   249     /**
       
   250     * Checks, if the URI given as parameter has
       
   251     * the "<" character.
       
   252     * @since Series 60 3.2
       
   253     * @param aUri The URI to be checked, non-modifiable descriptor.
       
   254     * @return TBool ETrue, if the chareacter is there,
       
   255     *         EFalse, if not.
       
   256     */
       
   257     TBool CheckLeftBracket( const TDesC8& aUri ) const;
       
   258 
       
   259     /**
       
   260     * Removes the "<" character from the URI given as parameter.
       
   261     * @since Series 60 3.2
       
   262     * @param aUri The URI to be altered, modifiable descriptor.
       
   263     * @return None
       
   264     */
       
   265     void RemoveLeftBracket( HBufC8*& aUri ) const;
       
   266 
       
   267     /**
       
   268     * Checks, if the URI given as parameter has
       
   269     * the ">" character.
       
   270     * @since Series 60 3.2
       
   271     * @param aUri The URI to be checked, non-modifiable descriptor.
       
   272     * @return TBool ETrue, if the chareacter is there,
       
   273     *         EFalse, if not.
       
   274     */
       
   275     TBool CheckRightBracket( const TDesC8& aUri ) const;
       
   276 
       
   277     /**
       
   278     * Removes the ">" character from the URI given as parameter.
       
   279     * @since Series 60 3.2
       
   280     * @param aUri The URI to be altered, modifiable descriptor.
       
   281     * @return None
       
   282     */
       
   283     void RemoveRightBracket( HBufC8*& aUri ) const;
       
   284 
       
   285     /**
       
   286     * Adds the "@" character to the URI given as parameter.
       
   287     * Leaves if the adding failes.
       
   288     * @since Series 60 3.2
       
   289     * @param aUri The URI to be altered, modifiable descriptor.
       
   290     * @return None
       
   291     */
       
   292     void AddAtL( HBufC8*& aUri ) const;
       
   293 
       
   294     /**
       
   295     * Adds the domain part to the URI
       
   296     * Leaves if the adding failes.
       
   297     * @since Series 60 3.2
       
   298     * @param aUri The URI to be altered, modifiable descriptor.
       
   299     * @return None
       
   300     */
       
   301     void AddDomainL( HBufC8*& aUri, const TDesC8& aAOR ) const;
       
   302         
       
   303 private: // methods
       
   304     
       
   305     /**
       
   306     * C++ default constructor.
       
   307     */
       
   308     CSVPUriParser();
       
   309     
       
   310 private: // data
       
   311     
       
   312     /**
       
   313     * Variable for to check user=phone setting
       
   314     */    
       
   315     TBool iUserEqualsPhoneRequired;
       
   316 
       
   317 
       
   318 private:
       
   319 
       
   320     // For testing
       
   321     SVP_UT_DEFS
       
   322 		
       
   323     };
       
   324 
       
   325 
       
   326 #endif // SVPUTILITY_H
       
   327