netprotocols_plat/cookie_manager_api/inc/cookiemanagerclient.h
changeset 0 b16258d2340f
child 7 2611c08ee28e
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Declaration of class RCookieManager
       
    15 *
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __COOKIEMANAGER_CLIENT_H__
       
    22 #define __COOKIEMANAGER_CLIENT_H__
       
    23 
       
    24 // INCLUDE FILES
       
    25 	// System includes
       
    26 #include <e32base.h>
       
    27 #include <http.h>
       
    28 
       
    29 	// User includes
       
    30 #include <cookie.h>
       
    31 #include <cookieipc.h>
       
    32 
       
    33 // CLASS DECLARATION
       
    34 	
       
    35 /** 
       
    36 * It is the client interface to the Cookie Server.
       
    37 */
       
    38 class RCookieManager : public RSessionBase
       
    39 	{
       
    40 	public :	// exported methods
       
    41 		/**
       
    42 		*
       
    43 		*/
       
    44 		IMPORT_C RCookieManager( RStringPool aStringPool );
       
    45 
       
    46 		/**
       
    47 		*
       
    48 		*/
       
    49 		IMPORT_C TInt Connect();
       
    50 
       
    51 		/** 
       
    52 		* Store a cookie. This will get called with each cookie that is
       
    53 		* encountered in a transaction response.
       
    54 		* @param aCookie The cookie to be stored. Ownership of aCookie is
       
    55 		* passed to this class.
       
    56 		* @param aUri The uri that sent this cookie. This is required to 
       
    57 		* complete any missing attributes of the cookie and to ensure the
       
    58 		* cookie is valid.
       
    59 		* @return Error code indicating the result of the call.
       
    60 		*/
       
    61 		IMPORT_C TInt StoreCookie( const CCookie& aCookie,
       
    62 									const TUriC8& aUri );
       
    63 
       
    64 		/** 
       
    65 		* Get the relevant cookies for a transaction
       
    66 		* @param aUri The URI of the current HTTP request.
       
    67 		* @param aCookieList An array which will be filled with the cookies
       
    68 		* for aTransaction. The array should be empty when this function is
       
    69 		* called. Ownership of the cookies remains with the manager.
       
    70 		* @param aCookie2Reqd Flag indicating whether a Cookie2 header should
       
    71 		* be added to the outgoing request headers
       
    72 		*/
       
    73 		IMPORT_C void GetCookiesL( const TDesC8& aUri,
       
    74 								   RPointerArray<CCookie>& aCookies, 
       
    75 								   TBool& aCookie2Reqd );
       
    76 
       
    77 		/**
       
    78 		* Clear all cookies.
       
    79 		* @param aDeletedCookies On return, it contains the number of deleted
       
    80 		* cookies.
       
    81 		* @return Error code indicating the result of the call.
       
    82 		*/
       
    83 		IMPORT_C TInt ClearCookies( TInt& aDeletedCookies );
       
    84 		
       
    85 		/**Sets the AppUidL
       
    86 		* @param aAppUid the application UID.
       
    87 		* @return Error code indicating the result of the call.
       
    88 		*/		
       
    89 		IMPORT_C TInt SetAppUidL(const TUint32& aAppUid );
       
    90 
       
    91 	private :	// internal methods
       
    92 		/**
       
    93 		* Gets the sum of cookie sizes for a given request URI. After this
       
    94 		* method call there will be available the set of cookies on server-side
       
    95 		* that have been collected by the URI in question.
       
    96 		* @param aRequestUri The HTTP transaction request's URI,
       
    97 		* @param aSizePkg It is an integer that will contain the overall size
       
    98 		* of all cookies that have been selected by the given URI after the
       
    99 		* method returns. It is a package : it is prepared for client-server
       
   100 		* communications.
       
   101 		* @return Error code indicating the result of the call.
       
   102 		*/
       
   103 		TInt DoGetCookieSize( const TDesC8& aRequestUri,
       
   104 							TPckg<TInt>& aPkgSize ) const;
       
   105 
       
   106 		/**
       
   107 		* Puts those cookies in the buffer that have been previously selected
       
   108 		* on server-side as a result of the GetCookieSize method.
       
   109 		* @param aBuffer Buffer to be filled with appropriate cookies.
       
   110 		* @return Error code indicating the result of the call.
       
   111 		*/
       
   112 		TInt DoGetCookies( TDes8& aBuffer ) const;
       
   113 
       
   114 		/**
       
   115 		*
       
   116 		*/
       
   117 		TInt DoStoreCookie( const TDesC8& aPackedCookie,
       
   118 							const TDesC8& aUri ) const;
       
   119 
       
   120 		/**
       
   121 		*
       
   122 		*/
       
   123 		TVersion Version() const;
       
   124 
       
   125 	private :	// data members
       
   126 		RStringPool iStringPool;
       
   127 
       
   128 		TCookiePacker iCookiePacker;
       
   129 	};
       
   130 
       
   131 #endif //__COOKIEMANAGER_CLIENT_H__