supl/locationsuplfw/gateway/inc/epos_csuplglobal.h
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 2005 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:   Global functions for the SUPL server
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CSuplGlobal_H__
       
    21 #define __CSuplGlobal_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32std.h>
       
    25 
       
    26 //#ifdef _DEBUG
       
    27 #include <e32debug.h>
       
    28 //#endif
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 *  Global functions for the server
       
    38 *  
       
    39 */
       
    40 class SuplGlobal
       
    41     {
       
    42     public: // New functions
       
    43         
       
    44         /**
       
    45         * Read and kill the client if it leaves. If the returned error code 
       
    46         * is negative, the RMessage must not be completed. Complete after 
       
    47         * client is paniced crashes the server with USER 70.
       
    48         *
       
    49         * @param aMessage Message instance
       
    50         * @param aPtr Pointer to read from
       
    51         * @param aDes Descriptor to read to
       
    52         * @param aOffset offset to start read
       
    53         * @return Error code
       
    54         */
       
    55         static TInt Read(
       
    56         /* IN  */       const RMessage2& aMessage,
       
    57         /* IN  */		const TInt aParam,
       
    58         /* OUT */       TDes8& aDes,
       
    59         /* IN  */       TInt aOffset=0
       
    60             );
       
    61 
       
    62         /**
       
    63         * Read and kill the client if it leaves. If the returned error code 
       
    64         * is negative, the RMessage must not be completed. Complete after 
       
    65         * client is paniced crashes the server with USER 70.
       
    66         *
       
    67         * @param aMessage Message instance
       
    68         * @param aPtr Pointer to read from
       
    69         * @param aDes Descriptor to read to
       
    70         * @param aOffset offset to start read
       
    71         * @return Error code
       
    72         */
       
    73         static TInt Read(
       
    74         /* IN  */       const RMessage2& aMessage,
       
    75         /* IN  */		const TInt aParam,
       
    76         /* OUT */       TDes16& aDes,
       
    77         /* IN  */       TInt aOffset=0
       
    78             );
       
    79 
       
    80         /**
       
    81         * Write and kill the client if it leaves. If the returned error code 
       
    82         * is negative, the RMessage must not be completed. Complete after 
       
    83         * client is paniced crashes the server with USER 70.
       
    84         *
       
    85         * @param aMessage Message instance
       
    86         * @param aPtr Pointer to write to
       
    87         * @param aDes Descriptor to write from
       
    88         * @param aOffset offset to start write
       
    89         * @return Error code
       
    90         */
       
    91         static TInt Write(
       
    92         /* IN  */		const RMessage2& aMessage,
       
    93         /* IN  */		const TInt aParam,
       
    94         /* IN  */		const TDesC8& aDes,
       
    95         /* IN  */		TInt aOffset=0
       
    96             );
       
    97 
       
    98         /**
       
    99         * Copies an 8-bit buffer from the address space of the client and puts 
       
   100         * the result in the returned argument. If the method leaves it the 
       
   101         * client may have been paniced and in that case it is forbidden to
       
   102         * complete the RMessage. If a client is paniced can be verified by the
       
   103         * call chain:
       
   104         * aMessage.Client().ExitType()
       
   105         *
       
   106         * @param aMessage the message from the client.
       
   107         * @param aClientBuffer a pointer to an 8-bit descriptor located in the 
       
   108         *        address space of the client.
       
   109         * @return a copy of the client buffer.
       
   110         */
       
   111         static HBufC8* CopyClientBuffer8LC(
       
   112         /* IN  */   	const RMessage2& aMessage,
       
   113         /* IN  */   	const TInt aClientBufferParam
       
   114             );
       
   115 
       
   116         /**
       
   117         * Copies a 16-bit buffer from the address space of the client and puts 
       
   118         * the result in the returned argument. If the method leaves it the  
       
   119         * client may have been paniced and in that case it is forbidden to 
       
   120         * complete the RMessage. If a client is paniced can be verified by the 
       
   121         * call chain:
       
   122         * aMessage.Client().ExitType()
       
   123         *
       
   124         * @param aMessage the message from the client.
       
   125         * @param aClientBuffer a pointer to a 16-bit descriptor located in the 
       
   126         *        address space of the client.
       
   127         * @return a copy of the client buffer.
       
   128         */
       
   129         static HBufC* CopyClientBufferLC(
       
   130         /* IN  */   	const RMessage2& aMessage,
       
   131         /* IN  */   	const TInt aClientBufferParam
       
   132             );
       
   133 
       
   134 		static void RequestComplete(
       
   135 		/* IN  */		const RMessage2& aMessage,
       
   136         /* IN  */		const TInt aError
       
   137             );
       
   138 
       
   139 
       
   140 //#ifdef _DEBUG
       
   141         static void SetupTraceL();
       
   142         static void TearDownTrace();
       
   143 
       
   144         static void Trace(
       
   145         /* IN  */ 		const TDesC& aDescription,
       
   146         /* IN  */ 		const TDesC& aFilename,
       
   147         /* IN  */ 		const TInt aLineNumber
       
   148             );
       
   149 //#endif
       
   150 
       
   151     private:
       
   152     
       
   153         // By default, prohibit copy constructor
       
   154         SuplGlobal( const SuplGlobal& );
       
   155         // Prohibit assigment operator
       
   156         SuplGlobal& operator= ( const SuplGlobal& );
       
   157         
       
   158     };
       
   159 
       
   160 //#ifdef _DEBUG
       
   161 
       
   162 #define DEBUG_TRACE(aTracePoint, aLineNum)       	\
       
   163         	{ 	_LIT(KTracePoint, aTracePoint); 	\
       
   164         		SuplGlobal::Trace(KTracePoint, KTraceFileName, aLineNum); }
       
   165 //#else
       
   166   //  #define DEBUG_TRACE(aTracePoint, aLineNum)
       
   167 //#endif
       
   168 
       
   169 #endif      // __CSuplGlobal_H__  
       
   170             
       
   171 // End of File