messagingappbase/obexmtms/obexmtm/obexutil/include/obexpasswordexternaliser.h
changeset 80 8b14b30db193
parent 0 72b543305e3a
equal deleted inserted replaced
79:2981cb3aa489 80:8b14b30db193
       
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // $Workfile: obexpasswordexternaliser.h $
       
    15 // $Author: Stevep $
       
    16 // $Revision: 8 $
       
    17 // $Date: 5/02/02 13:31 $
       
    18 // 
       
    19 //
       
    20 
       
    21 #include <e32std.h> 
       
    22 #include <msvapi.h>     
       
    23 class ObexPasswordExternaliser
       
    24 /**
       
    25 Utility class for accessing the password stored in the service entry. Only contains static member functions, so not a
       
    26 C class.
       
    27 
       
    28 @internalTechnology
       
    29 @released
       
    30 */
       
    31 	{
       
    32 public:
       
    33 
       
    34 	/**
       
    35 	 * Static getter function to get the ObexPassword associated with the given entry. If the password stream doesn't exist,
       
    36 	 * a zero-length HBufC is returned. Ownership of the returned descriptor is passed to the caller, and is pushed onto the
       
    37 	 * cleanup stack.
       
    38 	 *
       
    39 	 * @param aEntry CMsvEntry whose owning service entry's password is to be set
       
    40 	 * @return HBufC containing the password (zero length if not set). Ownership is passed to the caller, and left on the cleanup stack
       
    41 	 * @leave KErrXXX system-wide error codes
       
    42 	 */
       
    43 
       
    44 	IMPORT_C static HBufC* GetPasswordLC(CMsvEntry& aEntry);
       
    45 	
       
    46 	/**
       
    47 	* Static setter function to set the ObexPassword associated with the given entry. If the length of the password is
       
    48 	* zero, then the password is cleared
       
    49 	*
       
    50 	* @param aEntry CMsvEntry whose owning service entry's password is to be set
       
    51 	* @param aPassword the password to set
       
    52 	* @leave KErrXXX system-wide error codes
       
    53 	*/
       
    54 	
       
    55 	IMPORT_C static void SetPasswordL(CMsvEntry& aEntry, const TDesC& aPassword);
       
    56 	
       
    57 	/**
       
    58 	 * Resets the password associated with the given entry. Does nothing if there is no password.
       
    59 	 *
       
    60 	 * @param aEntry CMsvEntry whose owning service entry's password is to be reset
       
    61 	 * @leave KErrXXX system-wide error codes
       
    62 	 */
       
    63 	
       
    64 	IMPORT_C static void ResetPasswordL(CMsvEntry& aEntry);
       
    65 
       
    66 	/**
       
    67 	 * Static getter function to get the ObexPassword associated with the given MTM UID. The zeroth service entry is assumed.
       
    68 	 * If the password stream doesn't exist,a zero-length HBufC is returned. Ownership of the returned descriptor is passed
       
    69 	 * to the caller, and is pushed onto the cleanup stack.
       
    70 	 *
       
    71 	 * @param aSessionObserver a session observer
       
    72 	 * @param aMtmUid UID of the MTM whose password is to be set
       
    73 	 * @return HBufC containing the password (zero length if not set). Ownership is passed to the caller, and left on the cleanup stack
       
    74 	 * @leave KErrXXX system-wide error codes
       
    75 	 */	
       
    76 	
       
    77 	IMPORT_C static HBufC* GetPasswordLC(CMsvSession& aSession, const TUid& aMtmUid);
       
    78 	
       
    79 	/**
       
    80 	 * Static setter function to set the ObexPassword associated with the given entry. If the length of the password is
       
    81 	 * zero, then the password is cleared
       
    82 	 *
       
    83 	 * @param aEntry aSessionObserver A session observer
       
    84 	 * @param aMtmUid Uid of the MTM whose password is to be set
       
    85 	 * @param aPassword the password to set
       
    86 	 * @leave KErrXXX system-wide error codes
       
    87 	 */
       
    88 		
       
    89 	IMPORT_C static void SetPasswordL(CMsvSession& aSession, const TUid& aMtmUid, const TDesC& aPassword);
       
    90 	
       
    91 	/**
       
    92 	 * Resets the password associated with the given entry. Does nothing if there is no password.
       
    93 	 *
       
    94 	 * @param aEntry aSessionObserver A session observer
       
    95 	 * @param aMtmUid Uid of the MTM whose password is to be set
       
    96 	 * @leave KErrXXX system-wide error codes
       
    97 	 */
       
    98 	
       
    99 	IMPORT_C static void ResetPasswordL(CMsvSession& aSession, const TUid& aMtmUid);
       
   100 
       
   101 	/**
       
   102 	 * Returns a CMsvEntry pointing to the zeroth service entry associated with aMtmUid. Ownership of the returned CMsvEntry
       
   103 	 * is passed to the caller, and it is left on the cleanup stack.
       
   104 	 *
       
   105 	 * @param aSession a session
       
   106 	 * @param aSessionObserver A session observer
       
   107 	 * @param aMtmUid Uid of the MTM whose service entry is to be found
       
   108 	 * @return A newly created CMsvEntry
       
   109 	 */
       
   110 	
       
   111 	IMPORT_C static CMsvEntry* GetServiceEntryLC(CMsvSession& aSession, const TUid& aMtmUid);
       
   112 	
       
   113 	/**
       
   114 	 * Static getter function to get the ObexPassword from the given service entry. If the password stream doesn't exist,
       
   115 	 * a zero-length HBufC is returned. Ownership of the returned descriptor is passed to the caller, and is pushed onto the
       
   116 	 * cleanup stack.
       
   117 	 *
       
   118 	 * @param aServiceEntry CMsvEntry set to the service entry containing the password
       
   119 	 * @return HBufC containing the password (zero length if not set of cannot be read). Ownership is passed to the caller, and left on the cleanup stack
       
   120 	 * @leave KErrXXX system-wide error codes
       
   121 	 */
       
   122 	
       
   123 	IMPORT_C static HBufC* GetPasswordFromServiceEntryLC(CMsvEntry& aServiceEntry);
       
   124 
       
   125 	/**
       
   126 	 * Static setter function to set the ObexPassword associated with the given entry. If the length of the password is
       
   127 	 * zero, then the password is cleared. Calling this function causes the entry to be changed, too, which allows the watcher
       
   128 	 * to detect the change to the password.
       
   129 	 *
       
   130 	 * @param aServiceEntry The service entry to set the password into
       
   131 	 * @param aPassword the password to set
       
   132 	 * @leave KErrXXX system-wide error codes
       
   133 	 */
       
   134 
       
   135 	IMPORT_C static void SetPasswordFromServiceEntryL(CMsvEntry& aEntry, const TDesC& aPassword);
       
   136 	};