wapstack/wapmessageapi/sws/CLWSPPduHandler.h
changeset 49 f50f4094acd7
equal deleted inserted replaced
48:14460bf2a402 49:f50f4094acd7
       
     1 // Copyright (c) 2003-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 //
       
    15 
       
    16 #ifndef __CLWSPPDUHANDLER_H__
       
    17 #define __CLWSPPDUHANDLER_H__
       
    18 #include <e32std.h>
       
    19 #include <wapmessage.h>
       
    20 
       
    21 
       
    22 /** 
       
    23 The connectionless WSP PDU type definition.
       
    24 @internalComponent
       
    25 */
       
    26 enum TWSPPduType
       
    27 	{
       
    28 	/** the Reply PDU type assignment 
       
    29 	*/
       
    30 	EReply			=0x04,
       
    31 	/** the Push PDU type assignment 
       
    32 	*/
       
    33 	EPush			=0x06,
       
    34 	/** the Get PDU type assignment 
       
    35 	*/
       
    36 	EGet			=0x40,
       
    37 	/** the GetOption PDU type assignment 
       
    38 	*/
       
    39 	EGetOptions		=0x41,
       
    40 	/** the Gethead PDU type assignment 
       
    41 	*/
       
    42 	EGetHead		=0x42,
       
    43 	/** the GetDelete PDU type assignment 
       
    44 	*/
       
    45 	EGetDelete		=0x43,
       
    46 	/** the GetTrace PDU type assignment 
       
    47 	*/
       
    48 	EGetTrace		=0x44,
       
    49 	/** the Post PDU type assignment 
       
    50 	*/
       
    51 	EPost			=0x60,
       
    52 	/** the PostPut PDU type assignment 
       
    53 	*/
       
    54 	EPostPut		=0x61
       
    55 	};
       
    56 
       
    57 
       
    58 	/** 
       
    59 	The offset of the transactionID field in WSP PDU.
       
    60 	@internalComponent
       
    61 	 */
       
    62 	const TUint KPDUHeaderTransactionIDOffSet	=0;
       
    63 	/** 
       
    64 	The offset of the WSP PDU type field in WSP PDU.
       
    65 	@internalComponent
       
    66 	 */
       
    67 	const TUint KPDUHeaderWSPPDUTypeOffSet		=1;
       
    68 	/** 
       
    69 	The offset of WSP field.
       
    70 	@internalComponent
       
    71 	*/
       
    72 	const TUint KPDUFieldOffset					=2;
       
    73 
       
    74 	/** 
       
    75 	The length of transactionID+PDUType
       
    76 	@internalComponent
       
    77 	*/
       
    78 	const TUint8 KPDUTransactionIDAndPDUTypeLength	=2;
       
    79 	/** 
       
    80 	The length of WSP status
       
    81 	@internalComponent
       
    82 	*/
       
    83 	const TUint8 KWSPStatusLength					=1;
       
    84 
       
    85 	/**
       
    86 	The mask of top 3 bits in varible length Unsigned integer
       
    87 	@internalComponent
       
    88 	*/
       
    89 	const TUint8 KTop3BitSet		= 0x70;
       
    90 
       
    91 	/**
       
    92 	The mask to valide each byte in varible length Unsigned integer
       
    93 	@internalComponent
       
    94 	*/
       
    95 	const TUint8 KWapQuote			= 0x7F;
       
    96 
       
    97 	/**
       
    98 	The mask of carry bit in each byte in varible length Unsigned integer
       
    99 	@internalComponent
       
   100 	*/
       
   101 	const TUint8 KCarryBitMask		= 0x80;
       
   102 
       
   103 	/**
       
   104 	Maximum length for varible length Unsigned integer
       
   105 	@internalComponent
       
   106 	*/
       
   107 	const TUint8 KMaxUintVarLength	= 5;
       
   108 
       
   109 	/**
       
   110 	shift 7 bits for each byte in Uint32
       
   111 	@internalComponent
       
   112 	*/
       
   113 	const TUint8 KUIntVarOctetShift	= 7;
       
   114 
       
   115 
       
   116 
       
   117 class CCLWSPPduHandler
       
   118 /** 
       
   119 The Connectionless WSP PDU Handler. This class provides a set of static interfaces 
       
   120 for WAP message APIs to pack and unpack the WSP PDU.   
       
   121 For error codes returned by methods in this class, see <wapmsgerr.h>.  Most methods can 
       
   122 return a set of general errors, with some returning additional specific errors.
       
   123 */
       
   124 	{
       
   125 public: 
       
   126 
       
   127 
       
   128 
       
   129 public: // Public Interfaces
       
   130 	static void UnpackWSPPduL(HBufC8* aWSPPdu, TWSPPduType& aType, HBufC8*& aWSPHeader, HBufC8*& aBody, TUint8& aId, TWSPStatus& aStatus);
       
   131 	static void PackWSPPduL(HBufC8*& aWSPPdu, TWSPPduType aType, const TDesC& aURI, const TDesC8& aWSPHeader, const TDesC8& aBody, const TUint8 aId);
       
   132 
       
   133 private: // private methods
       
   134 	static void UnpackPushPduL(HBufC8* aWSPPdu, HBufC8*& aWSPHeader, HBufC8*& aBody);
       
   135 	static void UnpackReplyPduL(HBufC8* aWSPPdu, HBufC8*& aWSPHeader, HBufC8*& aBody, TWSPStatus& aStatus);
       
   136 	static void PackPostPduL(HBufC8*& aWSPPdu, TWSPPduType aType, const TDesC& aURI, const TDesC8& aWSPHeader, const TDesC8& aBody, const TUint8 aId);
       
   137 	static void PackGetPduL(HBufC8*& aWSPPdu, TWSPPduType aType, const TDesC& aURI, const TDesC8& aWSPHeader, const TUint8 aId);
       
   138 	static TInt UintVar(TUint32& aVal, TPtrC8& aBuffer, TUint aOffset);
       
   139 	static HBufC8* UintVarL(const TUint32 aInt);
       
   140 	};
       
   141 #endif // __CLWSPPDUHANDLER_H__