messagingfw/wappushfw/tpush/DummyStack/dummycapcodec.h
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 2000-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 __DUMMYCAPCODEC_H__
       
    17 #define __DUMMYCAPCODEC_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 
       
    21 class TAliasAddress;
       
    22 
       
    23 /**
       
    24  *  WAP client application capabilities interface class
       
    25  */
       
    26 class CCapCodec : public CBase
       
    27 	{
       
    28 public:
       
    29 
       
    30 	typedef enum
       
    31 		{
       
    32 		EAckHeaders =                  0x10,
       
    33 		ESessionResume =               0x20,
       
    34 		EPush =                        0x40,
       
    35 		EConfPush =                    0x80,
       
    36 		EAll =                         0xF0
       
    37 		}EProtOptions;
       
    38 
       
    39 	IMPORT_C ~CCapCodec();
       
    40 	IMPORT_C void Reset();
       
    41 	IMPORT_C static  CCapCodec* NewL();
       
    42 	IMPORT_C static  CCapCodec* NewL(const TDesC8& aEncodeBuf);
       
    43 	IMPORT_C void SetProtocolOptions(const TUint32 aProtOptions);
       
    44 	IMPORT_C void GetProtocolOptions(TUint32& aProtOptions);
       
    45     
       
    46 	IMPORT_C void SetClientSDUSize(const TUint32 aSize);
       
    47 	IMPORT_C void ClientSDUSize(TUint32& aSize) const;
       
    48 	IMPORT_C void SetServerSDUSize(const TUint32 aSize);
       
    49 	IMPORT_C void GetServerSDUSize(TUint32& aSize) const;
       
    50 
       
    51 	IMPORT_C void SetMethodMOR(const TUint8 aVal);
       
    52 	IMPORT_C void MethodMOR(TUint8& aVal) const;
       
    53 	IMPORT_C void SetPushMOR(const TUint8 aVal);
       
    54 	IMPORT_C void GetPushMOR(TUint8& aVal) const;
       
    55 
       
    56 	IMPORT_C TInt AddExtendedMethod(TDes8& aMethod,const TUint8 aVal);
       
    57 	IMPORT_C TInt GetExtendedMethod(const TInt aIndex,TDes8& aMethod,TUint8& aVal) const;
       
    58 	IMPORT_C void NumExtendedMethods(TInt& aNumExtendedMethods) const;
       
    59 
       
    60 	IMPORT_C TInt AddCodePage(TDes8& aCodePage,const TUint8 aVal);
       
    61 	IMPORT_C TInt GetCodePage(const TInt aIndex,TDes8& aCodePage,TUint8& aVal) const;
       
    62 	IMPORT_C void NumCodePages(TInt& aNumCodePages) const;
       
    63 	
       
    64 	IMPORT_C TInt AddUnknownCap(TDes8& aName,const TDesC8& aValue);
       
    65 	IMPORT_C TInt GetUnknownCap(const TInt aIndex,TDes8& aName,TDes8& aValue) const;
       
    66 	IMPORT_C void NumUnknownCap(TInt& aNumUnknown) const;
       
    67 	
       
    68 	IMPORT_C TInt AddAliasAddress(const TAliasAddress& aAddress);
       
    69 	IMPORT_C TInt GetAliasAddress(const TInt aIndex, TAliasAddress& aAddress) const;
       
    70 	IMPORT_C void NumAliasAddress(TInt& aNumAddresses) const;
       
    71 	
       
    72 protected:
       
    73 private:
       
    74 	IMPORT_C TInt CapEncodeSize(void) const;
       
    75 	IMPORT_C TInt Encode(TDes8& aDestCapSet) const;
       
    76 	IMPORT_C TInt Decode(const TDesC8& aSrcCapSet);
       
    77 	IMPORT_C void ConstructL();
       
    78 	IMPORT_C void ConstructL(const TDesC8& aDecodeBuf);
       
    79 private:
       
    80 	TUint32 iProtOptions;
       
    81 	TUint32 iClientSDUSize;
       
    82 	TUint32 iServerSDUSize;
       
    83 	TUint8 iMethodMOR;
       
    84 	TUint8 iPushMOR;
       
    85 	//code page
       
    86 	//unknown cap
       
    87 	//alias address
       
    88 	};
       
    89 
       
    90 
       
    91 
       
    92 
       
    93 
       
    94 /**
       
    95  * For get and set of alias addresses information
       
    96  *
       
    97  */
       
    98 class TAliasAddress
       
    99 {
       
   100 public:
       
   101 	IMPORT_C ~TAliasAddress();
       
   102 	IMPORT_C TAliasAddress();
       
   103     
       
   104     // Set the port value
       
   105 	IMPORT_C void SetPort(const TUint16 aPort);
       
   106 	// Set the bearer value
       
   107 	IMPORT_C void SetBearer(const TUint8 aBearer);
       
   108 	// Set the address array
       
   109 	IMPORT_C TInt SetAddress(const TDesC8& aAddress);
       
   110 	// Bool's, use uchar to avoid conflict with Nokia BOOL (uchar) and Epoc TBool (Uint32) 
       
   111 	IMPORT_C TUint8 HasBearer(void) const;
       
   112 	IMPORT_C TUint8 HasPort(void) const;
       
   113 	// Get Bearer value
       
   114 	IMPORT_C TUint8 Bearer(void) const;
       
   115 	// Get Port value
       
   116 	IMPORT_C TUint16 Port(void) const;
       
   117 	// Get the stored address
       
   118 	IMPORT_C const TDesC8& Address() const;
       
   119 	// Restore to constructed state
       
   120 	IMPORT_C void Reset(void);
       
   121 
       
   122 protected:
       
   123 private:
       
   124 
       
   125 	TBuf8<64> iAddress;
       
   126 	TUint8 iBearer;
       
   127 	TUint16 iPort;
       
   128 	TUint8 iHasPort;
       
   129 	TUint8 iHasBearer;
       
   130 };
       
   131 #endif