networkprotocolmodules/common/test/suplspoofserver/inc/suplspoofserver.h
changeset 0 9cfd9a3ee49c
equal deleted inserted replaced
-1:000000000000 0:9cfd9a3ee49c
       
     1 // Copyright (c) 2008-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 /**
       
    17  @file
       
    18  @internalTechnology
       
    19  
       
    20 */
       
    21 #ifndef LBS_SUPL_SPOOF_SERVER_H
       
    22 #define LBS_SUPL_SPOOF_SERVER_H
       
    23 
       
    24 #include <e32base.h>
       
    25 
       
    26 class ASN1T_ULP_PDU;
       
    27 class ASN1C_ULP_PDU;
       
    28 class ASN1T_PDU;
       
    29 class ASN1C_PDU;
       
    30 class ASN1PEREncodeBuffer;
       
    31 class OSCTXT;
       
    32 
       
    33 enum ESuplMessageType
       
    34 	{
       
    35 	ESuplInit,
       
    36 	ESuplResponse,
       
    37 	ESuplPosInit,
       
    38 	ESuplPos,
       
    39 	ESuplEnd,
       
    40 	ESuplAuthReq,
       
    41 	ESuplAuthResp
       
    42 	};
       
    43 	
       
    44 /**
       
    45 SUPL Spoof Server
       
    46 
       
    47 Generates ASN1 encoded SUPL messages.
       
    48 Decodes and checks content of ASN1 encoded SUPL messages.
       
    49 
       
    50 Required for testing of the SUPL Protocol Controller ASN1 library.
       
    51 Messages generated by the spoof server are used for testing the
       
    52 decoding of received messages. Encoding of sent messages is checked
       
    53 by the decode and check methods.
       
    54 
       
    55 @internalTechnology
       
    56 */
       
    57 class CSuplSpoofServer : public CBase
       
    58 	{
       
    59 public:
       
    60 	IMPORT_C static CSuplSpoofServer* NewL();
       
    61 		
       
    62 public:
       
    63 	virtual ~CSuplSpoofServer();
       
    64 	
       
    65 public:
       
    66 
       
    67 	// encoded supl message generators
       
    68 	IMPORT_C TInt GenerateSuplInitL(TPtr8& aBufPtr);
       
    69 	IMPORT_C TInt GenerateSuplResponseL(TPtr8& aBufPtr);
       
    70 	IMPORT_C TInt GenerateSuplPosRrlpAssistanceDataL(TPtr8& aBufPtr);
       
    71 	IMPORT_C TInt GenerateSuplPosRrlpMeasurePositionRequestL(TPtr8& aBufPtr);
       
    72 	IMPORT_C TInt GenerateSuplPosRrlpProtocolErrorL(TPtr8& aBufPtr);
       
    73 	IMPORT_C TInt GenerateSuplEndL(TPtr8& aBufPtr);
       
    74 	
       
    75 	// test decoder
       
    76 	IMPORT_C TInt DecodeL(const TPtrC8* aBuf);
       
    77 	
       
    78 private:
       
    79 	/** Constructor */
       
    80 	CSuplSpoofServer();
       
    81 	
       
    82 	/** second stage constructor */
       
    83 	void ConstructL();
       
    84 	
       
    85 private:
       
    86 	// encoded rrlp payload generators
       
    87 	TInt genRrlpAssistanceDataL(TPtr8& aPayloadPtr);
       
    88 	TInt genRrlpMeasurePositionRequestL(TPtr8& aPayloadPtr);
       
    89 	TInt genRrlpProtocolErrorL(TPtr8& aPayloadPtr);
       
    90 
       
    91 	// SUPL content generators
       
    92 	ASN1T_ULP_PDU* genSuplCommonContent(OSCTXT *pctxt);
       
    93 	ASN1T_ULP_PDU* genSuplResponseContent(OSCTXT *pctxt);
       
    94 	ASN1T_ULP_PDU* genSuplPosContent(OSCTXT *pctxt, TPtr8& aPayloadPtr);
       
    95 	ASN1T_ULP_PDU* genSuplEndContent(OSCTXT *pctxt);
       
    96 	ASN1T_ULP_PDU* genSuplInitContent(OSCTXT *pctxt);
       
    97 	
       
    98 	// RRLP content generators
       
    99 	ASN1T_PDU* genRrlpAssistanceDataContent(OSCTXT *pctxt);
       
   100 	ASN1T_PDU* genRrlpMeasurePositionRequestContent(OSCTXT *pctxt);
       
   101 	ASN1T_PDU* genRrlpProtocolErrorContent(OSCTXT *pctxt);
       
   102 
       
   103 	// received content checkers	
       
   104 	TInt CheckSuplCommonContent(ASN1T_ULP_PDU& decodeData);
       
   105 	TInt CheckSuplStartContent(ASN1T_ULP_PDU& decodeData);
       
   106 	TInt CheckSuplPosInitContent(ASN1T_ULP_PDU& decodeData);
       
   107 	TInt CheckSuplEndContent(ASN1T_ULP_PDU& decodeData);
       
   108 	TInt CheckSuplPosContent(ASN1T_ULP_PDU& decodeData);
       
   109 	TInt CheckRrlpMsrPosResponseContent(ASN1T_PDU& decodeData);
       
   110 	TInt CheckRrlpProtocolErrorContent(ASN1T_PDU& decodeData);
       
   111 	
       
   112 	// utils
       
   113 	TUint CSuplSpoofServer::CovertStringToUintL(const TDesC8& aString, TUint8 aNum);
       
   114 
       
   115 private: 
       
   116 	ASN1PEREncodeBuffer* iEncodeBuffer;
       
   117     ASN1T_ULP_PDU* iData;
       
   118     ASN1C_ULP_PDU* iUlpPdu;
       
   119     
       
   120     ASN1PEREncodeBuffer* iRrlpEncodeBuffer;
       
   121     ASN1T_PDU* iRrlpData;
       
   122     ASN1C_PDU* iRrlpPdu;
       
   123 	};
       
   124 
       
   125 #endif // LBS_SUPL_SPOOF_SERVER_H
       
   126