networkingtestandutils/networkingintegrationtest/Te_Msg/src/TeHttpPacket.h
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     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 #if (!defined __TEHTTPPACKET_H__)
       
    17 #define __TEHTTPPACKET_H__
       
    18 
       
    19 const TInt KNumberOfHTTPField = 10;
       
    20 
       
    21 class THTTPField
       
    22 	{
       
    23 public:
       
    24 	void Set(const TDesC8& aF,const TDesC8& aV){iFld=aF;iVal=aV;};
       
    25 	void Get(TDes8& aBuf);
       
    26 	void Field(TDes8& aBuf);
       
    27 	void Value(TDes8& aBuf);
       
    28 private:
       
    29 	TBuf8<64> iFld;
       
    30 	TBuf8<512> iVal;
       
    31 	};
       
    32 
       
    33 class THTTPMessage
       
    34 	{
       
    35 public:
       
    36 	THTTPMessage();
       
    37 	void Method(const TDesC8& aMet){iMeth=aMet;};
       
    38 	void URI(const TDesC8& aUri){iURI=aUri;};
       
    39 	void RespStatus( TDes8& aStat){aStat=iStat;};
       
    40 	void ReasonPhrase( TDes8& aP){aP=iPhrase;};
       
    41 	TInt ParseMessage(const TDesC8& aMes);
       
    42 public:
       
    43 	void AddHeaderField(const TDesC8& aField,const TDesC8& aVal= TPtrC8(0,0));
       
    44 	void GetHeader(TDes8& aBuf);
       
    45 	TBool FindField(const TDesC8& aTag, TDes8& aVal);
       
    46 private:
       
    47 	TInt NextMessHeader(const TDesC8& aSrc,TDes8& aField,TDes8& aVal);
       
    48 	TInt NextToken(const TDesC8& aSrc, TDes8& aTok);
       
    49 	TInt Content(const TDesC8& aSrc, TDes8& aCont);
       
    50 private:
       
    51 	const TBuf8<8> iVers;
       
    52 	TBuf8<16> iMeth;
       
    53 	TBuf8<128> iURI;
       
    54 	TBuf8<128> iPhrase;
       
    55 	TBuf8<8> iStat;
       
    56 	TInt iFieldsNumb;
       
    57 	TInt iCur;
       
    58 	THTTPField iFlds[KNumberOfHTTPField];
       
    59 	};
       
    60 
       
    61 #endif