epoc32/include/mw/http/framework/cheadercodec.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 epoc32/include/http/framework/cheadercodec.h@2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
williamr@2
     1
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@2
     4
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
williamr@2
    17
williamr@2
    18
/**
williamr@2
    19
 @file CHeaderCodec.h
williamr@2
    20
 @warning : This file contains Rose Model ID comments - please do not delete
williamr@2
    21
*/
williamr@2
    22
williamr@2
    23
#ifndef __CHEADERCODEC_H__
williamr@2
    24
#define __CHEADERCODEC_H__
williamr@2
    25
williamr@2
    26
// System includes
williamr@2
    27
#include <e32base.h>
williamr@2
    28
#include <http/framework/rheaderfield.h>
williamr@2
    29
williamr@2
    30
// Forward declarations
williamr@2
    31
class CHeaderWriter;
williamr@2
    32
class CHeaderReader;
williamr@2
    33
williamr@2
    34
williamr@2
    35
//##ModelId=3C4C18850126
williamr@2
    36
class CHeaderCodec : public CBase
williamr@2
    37
/**
williamr@2
    38
An abstract HTTP header codec.  
williamr@2
    39
williamr@2
    40
Each instance of a concrete subclass of CHeaderCodec is associated with, and owned
williamr@2
    41
by, a specific	CProtocolHandler.  It provides on-demand encoding/decoding of
williamr@2
    42
HTTP header data, between the generic format used by clients/filters to formulate
williamr@2
    43
requests and interpret responses, and the raw format used by
williamr@2
    44
the transport handlers (and origin servers/gateways/etc.)
williamr@2
    45
williamr@2
    46
The CHeaderCodec has an associated instance of a sub-class of each of
williamr@2
    47
CHeaderReader and CHeaderWriter.  It delegates the actual encoding and
williamr@2
    48
decoding function to these instances.
williamr@2
    49
williamr@2
    50
Header codecs provide a mechanism for extensibility whereby if one codec can't
williamr@2
    51
decode (or encode) a given header, it locates a codec that can, and then delegates
williamr@2
    52
the task to that codec instead.
williamr@2
    53
@publishedAll
williamr@2
    54
@released
williamr@2
    55
*/
williamr@2
    56
	{
williamr@2
    57
public: // methods
williamr@2
    58
williamr@2
    59
/** 
williamr@2
    60
	Intended Usage:	Destructor - cleans up and releases resources to the system.
williamr@2
    61
*/
williamr@2
    62
	//##ModelId=3C4C18850194
williamr@2
    63
	IMPORT_C virtual ~CHeaderCodec();
williamr@2
    64
williamr@2
    65
/**
williamr@2
    66
	Encode the supplied header field.  This method uses the associated
williamr@2
    67
	concrete CHeaderWriter object to do a conversion of the field into
williamr@2
    68
	raw form from the generic internal representation.
williamr@2
    69
williamr@2
    70
	@param aHeader (in) A proxy for the header field to be encoded
williamr@2
    71
	@leave KErrNotSupported if a codec that supports encoding this header
williamr@2
    72
		   cannot be found
williamr@2
    73
*/
williamr@2
    74
	//##ModelId=3C4C1885018C
williamr@2
    75
	IMPORT_C void EncodeHeaderL(RHeaderField& aHeader) const;
williamr@2
    76
williamr@2
    77
/**
williamr@2
    78
	Decode the supplied header field.  This method uses the associated
williamr@2
    79
	concrete CHeaderReader object to do a conversion of the field into
williamr@2
    80
	the generic internal representation from the raw form.
williamr@2
    81
williamr@2
    82
	@param aHeader (in) A proxy for the header field to be decoded
williamr@2
    83
	
williamr@2
    84
	@leave KErrNotSupported if a codec that supports decoding this header
williamr@2
    85
   		   cannot be found
williamr@2
    86
williamr@2
    87
*/
williamr@2
    88
	//##ModelId=3C4C1885018A
williamr@2
    89
	IMPORT_C void DecodeHeaderL(RHeaderField& aHeader) const;
williamr@2
    90
williamr@2
    91
/**
williamr@2
    92
	Intended Usage: Concrete header codec classes must implement this method to
williamr@2
    93
	indicate to the framework whether their concrete CHeaderWriter is
williamr@2
    94
	capable of encoding the named header field.
williamr@2
    95
	@param aHeaderField	(in) A proxy for the header field to be encoded
williamr@2
    96
	@return A flag indicating ETrue if the field can be encoded.
williamr@2
    97
*/
williamr@2
    98
	//##ModelId=3C4C18850181
williamr@2
    99
	virtual TBool CanEncode(RStringF aHeaderField) const = 0;
williamr@2
   100
williamr@2
   101
/**
williamr@2
   102
	Intended Usage: Concrete header codec classes must implement this method to
williamr@2
   103
					indicate to the framework whether their concrete CHeaderReader is
williamr@2
   104
					capable of decoding the named header field.
williamr@2
   105
	@param			aHeaderField		(in) A proxy for the header field to be encoded
williamr@2
   106
	@return			A flag indicating ETrue if the field can be decoded.
williamr@2
   107
 */
williamr@2
   108
	//##ModelId=3C4C18850178
williamr@2
   109
	virtual TBool CanDecode(RStringF aHeaderField) const = 0;
williamr@2
   110
williamr@2
   111
/**
williamr@2
   112
	Intended Usage: Concrete header codecs must be implement this method if they wish to
williamr@2
   113
					delegate the encoding/decoding of particular header fields to a
williamr@2
   114
					different codec.  
williamr@2
   115
					This would be done if the codec doesn't have the ability itself to
williamr@2
   116
					do the encode/decode but can locate an alternative that does. This 
williamr@2
   117
					function may leave with a Standard Symbian OS error code. eg. KErrNoMemory
williamr@2
   118
williamr@2
   119
					The caller takes ownership of the returned codec.
williamr@2
   120
	@param aHeaderField (in) A proxy for the header field to be encoded
williamr@2
   121
	@return A pointer to the new CHeaderCodec, or NULL if one couldn't be found.
williamr@2
   122
	@leave KErrNoMemory, Not enough memory to create object.	
williamr@2
   123
*/
williamr@2
   124
	//##ModelId=3C4C18850176
williamr@2
   125
	virtual CHeaderCodec* FindDelegateCodecL(RStringF aHeaderField) const = 0;
williamr@2
   126
williamr@2
   127
protected: // methods
williamr@2
   128
williamr@2
   129
/**
williamr@2
   130
	Default constructor.
williamr@2
   131
 */
williamr@2
   132
	//##ModelId=3A914DF20273
williamr@2
   133
	IMPORT_C CHeaderCodec();
williamr@2
   134
williamr@2
   135
/**
williamr@2
   136
	Second phase construction in which any necessary allocation is done
williamr@2
   137
	Implementations of this interface may leave with standard erros like KErrNoMemory if there is
williamr@2
   138
	insufficient memory for allocation in the second phase.
williamr@2
   139
 */
williamr@2
   140
	//##ModelId=3C4C1885016E
williamr@2
   141
	IMPORT_C void ConstructL();
williamr@2
   142
williamr@2
   143
protected: // attributes
williamr@2
   144
williamr@2
   145
	/** The owned header writer object that does actual encoding of header fields.
williamr@2
   146
	*/
williamr@2
   147
	//##ModelId=3C4C18850164
williamr@2
   148
	CHeaderWriter* iWriter;
williamr@2
   149
williamr@2
   150
	/** The owned header reader object that does actual decoding of header fields.
williamr@2
   151
	*/
williamr@2
   152
	//##ModelId=3C4C1885015A
williamr@2
   153
	CHeaderReader* iReader;
williamr@2
   154
williamr@2
   155
private: // methods
williamr@2
   156
williamr@2
   157
/**	
williamr@2
   158
	Intended Usage:	Reserve a slot in the v-table to preserve future BC
williamr@2
   159
 */
williamr@2
   160
	//##ModelId=3C4C1885016D
williamr@2
   161
	inline virtual void Reserved1();
williamr@2
   162
williamr@2
   163
/**	
williamr@2
   164
	Intended Usage:	Reserve a slot in the v-table to preserve future BC
williamr@2
   165
 */
williamr@2
   166
	//##ModelId=3C4C1885016C
williamr@2
   167
	inline virtual void Reserved2();
williamr@2
   168
williamr@2
   169
private: // attributes
williamr@2
   170
williamr@2
   171
	/** The most recently-obtained delegate codec
williamr@2
   172
	*/
williamr@2
   173
	//##ModelId=3C4C18850150
williamr@2
   174
	mutable CHeaderCodec* iDelegateCodec;
williamr@2
   175
	};
williamr@2
   176
williamr@2
   177
williamr@2
   178
//##ModelId=3C4C188601D1
williamr@2
   179
class CHeaderWriter : public CBase
williamr@2
   180
/**
williamr@2
   181
An abstract HTTP header encoder.  CHeaderWriter provides an interface used by its
williamr@2
   182
owning codec to do conversion of header data from the generic internal header
williamr@2
   183
representation to the raw representation used for a particular protocol/transport.
williamr@2
   184
Specific sub-classes of CHeaderWriter are associated with specific protocol handlers.
williamr@2
   185
@publishedAll
williamr@2
   186
@released
williamr@2
   187
*/
williamr@2
   188
	{
williamr@2
   189
public: // methods
williamr@2
   190
williamr@2
   191
/** 
williamr@2
   192
	Intended Usage:	Destructor - cleans up and release resources to the system.
williamr@2
   193
*/
williamr@2
   194
	//##ModelId=3C4C188601FC
williamr@2
   195
	IMPORT_C virtual ~CHeaderWriter();
williamr@2
   196
williamr@2
   197
/**
williamr@2
   198
	Intended Usage:	Encodes the supplied header field.  This method does a conversion
williamr@2
   199
					of the field into raw form from the generic internal representation.
williamr@2
   200
williamr@2
   201
					Implementations of this interface may leave with any of KErrNotSupported, KErrHttpEncodeDoWWWAuthenticate,
williamr@2
   202
					KErrHttpEncodeAuthorization, KErrHttpEncodeDoAge, KErrHttpEncodeDoVary, KErrHttpEncodeDoContentLanguage.
williamr@2
   203
williamr@2
   204
					Specific header writer sub-classes must implement this method.
williamr@2
   205
	@param			aHeader		(in) A proxy for the header field to be encoded
williamr@2
   206
 */
williamr@2
   207
	//##ModelId=3C4C188601FA
williamr@2
   208
	virtual void EncodeHeaderL(RHeaderField& aHeader) = 0;
williamr@2
   209
williamr@2
   210
protected: // methods
williamr@2
   211
williamr@2
   212
/**
williamr@2
   213
	Default constructor.
williamr@2
   214
 */
williamr@2
   215
	IMPORT_C CHeaderWriter();
williamr@2
   216
williamr@2
   217
/**
williamr@2
   218
	Second phase construction in which any necessary allocation is done
williamr@2
   219
	Implementations of this interface may leave with standard errors like KErrNoMemory.
williamr@2
   220
 */
williamr@2
   221
	//##ModelId=3C4C188601F9
williamr@2
   222
	IMPORT_C void ConstructL();
williamr@2
   223
williamr@2
   224
private: // methods
williamr@2
   225
williamr@2
   226
/**	
williamr@2
   227
	Intended Usage:	Reserve a slot in the v-table to preserve future BC
williamr@2
   228
 */
williamr@2
   229
	//##ModelId=3C4C188601F1
williamr@2
   230
	inline virtual void Reserved1();
williamr@2
   231
williamr@2
   232
/**	
williamr@2
   233
	Intended Usage:	Reserve a slot in the v-table to preserve future BC
williamr@2
   234
 */
williamr@2
   235
	//##ModelId=3C4C188601F0
williamr@2
   236
	inline virtual void Reserved2();
williamr@2
   237
	};
williamr@2
   238
williamr@2
   239
williamr@2
   240
//##ModelId=3C4C188602FE
williamr@2
   241
class CHeaderReader : public CBase
williamr@2
   242
/**
williamr@2
   243
An abstract HTTP header decoder.  CHeaderReader provides an interface used by its
williamr@2
   244
owning codec to do conversion of header data from the raw representation used for
williamr@2
   245
a particular protocol/transport to the generic internal header representation.
williamr@2
   246
Specific sub-classes of CHeaderWriter are associated with specific protocol
williamr@2
   247
handlers.
williamr@2
   248
@publishedAll
williamr@2
   249
@released
williamr@2
   250
*/
williamr@2
   251
	{
williamr@2
   252
public: // methods
williamr@2
   253
williamr@2
   254
/** 
williamr@2
   255
	Intended Usage:	Destructor - cleans up and release resources to the system.
williamr@2
   256
*/
williamr@2
   257
	//##ModelId=3C4C1886031E
williamr@2
   258
	IMPORT_C virtual ~CHeaderReader();
williamr@2
   259
williamr@2
   260
/**
williamr@2
   261
	Intended Usage:	Decodes the supplied header field.  This method does a conversion
williamr@2
   262
	of the field from the generic internal representation into raw form.
williamr@2
   263
williamr@2
   264
	Specific header reader sub-classes must implement this method.
williamr@2
   265
williamr@2
   266
	Implementations of this interface may leave with any of KErrHttpDecodeAccept, KErrHttpDecodeAcceptCharset, 
williamr@2
   267
	KErrHttpDecodeAcceptLanguage, KErrHttpDecodeAcceptEncoding, KErrNotSupported.
williamr@2
   268
williamr@2
   269
	@param aHeader (in) A proxy for the header field to be decoded
williamr@2
   270
	
williamr@2
   271
*/
williamr@2
   272
	//##ModelId=3C4C1886031C
williamr@2
   273
	virtual void DecodeHeaderL(RHeaderField& aHeader) = 0;
williamr@2
   274
williamr@2
   275
protected: // methods
williamr@2
   276
williamr@2
   277
/**
williamr@2
   278
	Default constructor.
williamr@2
   279
 */
williamr@2
   280
	IMPORT_C CHeaderReader();
williamr@2
   281
williamr@2
   282
/**
williamr@2
   283
	Second phase construction in which any necessary allocation is done
williamr@2
   284
	Implementations of this interface may leave with standard errors like KErrNoMemory.
williamr@2
   285
 */
williamr@2
   286
	//##ModelId=3C4C18860315
williamr@2
   287
	IMPORT_C void ConstructL();
williamr@2
   288
williamr@2
   289
private: // methods
williamr@2
   290
williamr@2
   291
/**	
williamr@2
   292
	Intended Usage:	Reserve a slot in the v-table to preserve future BC
williamr@2
   293
 */
williamr@2
   294
	//##ModelId=3C4C18860314
williamr@2
   295
	inline virtual void Reserved1();
williamr@2
   296
williamr@2
   297
/**	
williamr@2
   298
	Intended Usage:	Reserve a slot in the v-table to preserve future BC
williamr@2
   299
 */
williamr@2
   300
	//##ModelId=3C4C18860313
williamr@2
   301
	inline virtual void Reserved2();
williamr@2
   302
	};
williamr@2
   303
williamr@2
   304
williamr@2
   305
inline void CHeaderCodec::Reserved1()
williamr@2
   306
	{}
williamr@2
   307
inline void CHeaderCodec::Reserved2()
williamr@2
   308
	{}
williamr@2
   309
inline void CHeaderWriter::Reserved1()
williamr@2
   310
	{}
williamr@2
   311
inline void CHeaderWriter::Reserved2()
williamr@2
   312
	{}
williamr@2
   313
inline void CHeaderReader::Reserved1()
williamr@2
   314
	{}
williamr@2
   315
inline void CHeaderReader::Reserved2()
williamr@2
   316
	{}
williamr@2
   317
williamr@2
   318
#endif /* __CHEADERCODEC_H__ */