1.1 --- a/epoc32/include/http/framework/cheadercodec.h Tue Mar 16 16:12:26 2010 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,318 +0,0 @@
1.4 -// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 -// All rights reserved.
1.6 -// This component and the accompanying materials are made available
1.7 -// 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
1.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 -//
1.11 -// Initial Contributors:
1.12 -// Nokia Corporation - initial contribution.
1.13 -//
1.14 -// Contributors:
1.15 -//
1.16 -// Description:
1.17 -//
1.18 -
1.19 -
1.20 -
1.21 -/**
1.22 - @file CHeaderCodec.h
1.23 - @warning : This file contains Rose Model ID comments - please do not delete
1.24 -*/
1.25 -
1.26 -#ifndef __CHEADERCODEC_H__
1.27 -#define __CHEADERCODEC_H__
1.28 -
1.29 -// System includes
1.30 -#include <e32base.h>
1.31 -#include <http/framework/rheaderfield.h>
1.32 -
1.33 -// Forward declarations
1.34 -class CHeaderWriter;
1.35 -class CHeaderReader;
1.36 -
1.37 -
1.38 -//##ModelId=3C4C18850126
1.39 -class CHeaderCodec : public CBase
1.40 -/**
1.41 -An abstract HTTP header codec.
1.42 -
1.43 -Each instance of a concrete subclass of CHeaderCodec is associated with, and owned
1.44 -by, a specific CProtocolHandler. It provides on-demand encoding/decoding of
1.45 -HTTP header data, between the generic format used by clients/filters to formulate
1.46 -requests and interpret responses, and the raw format used by
1.47 -the transport handlers (and origin servers/gateways/etc.)
1.48 -
1.49 -The CHeaderCodec has an associated instance of a sub-class of each of
1.50 -CHeaderReader and CHeaderWriter. It delegates the actual encoding and
1.51 -decoding function to these instances.
1.52 -
1.53 -Header codecs provide a mechanism for extensibility whereby if one codec can't
1.54 -decode (or encode) a given header, it locates a codec that can, and then delegates
1.55 -the task to that codec instead.
1.56 -@publishedAll
1.57 -@released
1.58 -*/
1.59 - {
1.60 -public: // methods
1.61 -
1.62 -/**
1.63 - Intended Usage: Destructor - cleans up and releases resources to the system.
1.64 -*/
1.65 - //##ModelId=3C4C18850194
1.66 - IMPORT_C virtual ~CHeaderCodec();
1.67 -
1.68 -/**
1.69 - Encode the supplied header field. This method uses the associated
1.70 - concrete CHeaderWriter object to do a conversion of the field into
1.71 - raw form from the generic internal representation.
1.72 -
1.73 - @param aHeader (in) A proxy for the header field to be encoded
1.74 - @leave KErrNotSupported if a codec that supports encoding this header
1.75 - cannot be found
1.76 -*/
1.77 - //##ModelId=3C4C1885018C
1.78 - IMPORT_C void EncodeHeaderL(RHeaderField& aHeader) const;
1.79 -
1.80 -/**
1.81 - Decode the supplied header field. This method uses the associated
1.82 - concrete CHeaderReader object to do a conversion of the field into
1.83 - the generic internal representation from the raw form.
1.84 -
1.85 - @param aHeader (in) A proxy for the header field to be decoded
1.86 -
1.87 - @leave KErrNotSupported if a codec that supports decoding this header
1.88 - cannot be found
1.89 -
1.90 -*/
1.91 - //##ModelId=3C4C1885018A
1.92 - IMPORT_C void DecodeHeaderL(RHeaderField& aHeader) const;
1.93 -
1.94 -/**
1.95 - Intended Usage: Concrete header codec classes must implement this method to
1.96 - indicate to the framework whether their concrete CHeaderWriter is
1.97 - capable of encoding the named header field.
1.98 - @param aHeaderField (in) A proxy for the header field to be encoded
1.99 - @return A flag indicating ETrue if the field can be encoded.
1.100 -*/
1.101 - //##ModelId=3C4C18850181
1.102 - virtual TBool CanEncode(RStringF aHeaderField) const = 0;
1.103 -
1.104 -/**
1.105 - Intended Usage: Concrete header codec classes must implement this method to
1.106 - indicate to the framework whether their concrete CHeaderReader is
1.107 - capable of decoding the named header field.
1.108 - @param aHeaderField (in) A proxy for the header field to be encoded
1.109 - @return A flag indicating ETrue if the field can be decoded.
1.110 - */
1.111 - //##ModelId=3C4C18850178
1.112 - virtual TBool CanDecode(RStringF aHeaderField) const = 0;
1.113 -
1.114 -/**
1.115 - Intended Usage: Concrete header codecs must be implement this method if they wish to
1.116 - delegate the encoding/decoding of particular header fields to a
1.117 - different codec.
1.118 - This would be done if the codec doesn't have the ability itself to
1.119 - do the encode/decode but can locate an alternative that does. This
1.120 - function may leave with a Standard Symbian OS error code. eg. KErrNoMemory
1.121 -
1.122 - The caller takes ownership of the returned codec.
1.123 - @param aHeaderField (in) A proxy for the header field to be encoded
1.124 - @return A pointer to the new CHeaderCodec, or NULL if one couldn't be found.
1.125 - @leave KErrNoMemory, Not enough memory to create object.
1.126 -*/
1.127 - //##ModelId=3C4C18850176
1.128 - virtual CHeaderCodec* FindDelegateCodecL(RStringF aHeaderField) const = 0;
1.129 -
1.130 -protected: // methods
1.131 -
1.132 -/**
1.133 - Default constructor.
1.134 - */
1.135 - //##ModelId=3A914DF20273
1.136 - IMPORT_C CHeaderCodec();
1.137 -
1.138 -/**
1.139 - Second phase construction in which any necessary allocation is done
1.140 - Implementations of this interface may leave with standard erros like KErrNoMemory if there is
1.141 - insufficient memory for allocation in the second phase.
1.142 - */
1.143 - //##ModelId=3C4C1885016E
1.144 - IMPORT_C void ConstructL();
1.145 -
1.146 -protected: // attributes
1.147 -
1.148 - /** The owned header writer object that does actual encoding of header fields.
1.149 - */
1.150 - //##ModelId=3C4C18850164
1.151 - CHeaderWriter* iWriter;
1.152 -
1.153 - /** The owned header reader object that does actual decoding of header fields.
1.154 - */
1.155 - //##ModelId=3C4C1885015A
1.156 - CHeaderReader* iReader;
1.157 -
1.158 -private: // methods
1.159 -
1.160 -/**
1.161 - Intended Usage: Reserve a slot in the v-table to preserve future BC
1.162 - */
1.163 - //##ModelId=3C4C1885016D
1.164 - inline virtual void Reserved1();
1.165 -
1.166 -/**
1.167 - Intended Usage: Reserve a slot in the v-table to preserve future BC
1.168 - */
1.169 - //##ModelId=3C4C1885016C
1.170 - inline virtual void Reserved2();
1.171 -
1.172 -private: // attributes
1.173 -
1.174 - /** The most recently-obtained delegate codec
1.175 - */
1.176 - //##ModelId=3C4C18850150
1.177 - mutable CHeaderCodec* iDelegateCodec;
1.178 - };
1.179 -
1.180 -
1.181 -//##ModelId=3C4C188601D1
1.182 -class CHeaderWriter : public CBase
1.183 -/**
1.184 -An abstract HTTP header encoder. CHeaderWriter provides an interface used by its
1.185 -owning codec to do conversion of header data from the generic internal header
1.186 -representation to the raw representation used for a particular protocol/transport.
1.187 -Specific sub-classes of CHeaderWriter are associated with specific protocol handlers.
1.188 -@publishedAll
1.189 -@released
1.190 -*/
1.191 - {
1.192 -public: // methods
1.193 -
1.194 -/**
1.195 - Intended Usage: Destructor - cleans up and release resources to the system.
1.196 -*/
1.197 - //##ModelId=3C4C188601FC
1.198 - IMPORT_C virtual ~CHeaderWriter();
1.199 -
1.200 -/**
1.201 - Intended Usage: Encodes the supplied header field. This method does a conversion
1.202 - of the field into raw form from the generic internal representation.
1.203 -
1.204 - Implementations of this interface may leave with any of KErrNotSupported, KErrHttpEncodeDoWWWAuthenticate,
1.205 - KErrHttpEncodeAuthorization, KErrHttpEncodeDoAge, KErrHttpEncodeDoVary, KErrHttpEncodeDoContentLanguage.
1.206 -
1.207 - Specific header writer sub-classes must implement this method.
1.208 - @param aHeader (in) A proxy for the header field to be encoded
1.209 - */
1.210 - //##ModelId=3C4C188601FA
1.211 - virtual void EncodeHeaderL(RHeaderField& aHeader) = 0;
1.212 -
1.213 -protected: // methods
1.214 -
1.215 -/**
1.216 - Default constructor.
1.217 - */
1.218 - IMPORT_C CHeaderWriter();
1.219 -
1.220 -/**
1.221 - Second phase construction in which any necessary allocation is done
1.222 - Implementations of this interface may leave with standard errors like KErrNoMemory.
1.223 - */
1.224 - //##ModelId=3C4C188601F9
1.225 - IMPORT_C void ConstructL();
1.226 -
1.227 -private: // methods
1.228 -
1.229 -/**
1.230 - Intended Usage: Reserve a slot in the v-table to preserve future BC
1.231 - */
1.232 - //##ModelId=3C4C188601F1
1.233 - inline virtual void Reserved1();
1.234 -
1.235 -/**
1.236 - Intended Usage: Reserve a slot in the v-table to preserve future BC
1.237 - */
1.238 - //##ModelId=3C4C188601F0
1.239 - inline virtual void Reserved2();
1.240 - };
1.241 -
1.242 -
1.243 -//##ModelId=3C4C188602FE
1.244 -class CHeaderReader : public CBase
1.245 -/**
1.246 -An abstract HTTP header decoder. CHeaderReader provides an interface used by its
1.247 -owning codec to do conversion of header data from the raw representation used for
1.248 -a particular protocol/transport to the generic internal header representation.
1.249 -Specific sub-classes of CHeaderWriter are associated with specific protocol
1.250 -handlers.
1.251 -@publishedAll
1.252 -@released
1.253 -*/
1.254 - {
1.255 -public: // methods
1.256 -
1.257 -/**
1.258 - Intended Usage: Destructor - cleans up and release resources to the system.
1.259 -*/
1.260 - //##ModelId=3C4C1886031E
1.261 - IMPORT_C virtual ~CHeaderReader();
1.262 -
1.263 -/**
1.264 - Intended Usage: Decodes the supplied header field. This method does a conversion
1.265 - of the field from the generic internal representation into raw form.
1.266 -
1.267 - Specific header reader sub-classes must implement this method.
1.268 -
1.269 - Implementations of this interface may leave with any of KErrHttpDecodeAccept, KErrHttpDecodeAcceptCharset,
1.270 - KErrHttpDecodeAcceptLanguage, KErrHttpDecodeAcceptEncoding, KErrNotSupported.
1.271 -
1.272 - @param aHeader (in) A proxy for the header field to be decoded
1.273 -
1.274 -*/
1.275 - //##ModelId=3C4C1886031C
1.276 - virtual void DecodeHeaderL(RHeaderField& aHeader) = 0;
1.277 -
1.278 -protected: // methods
1.279 -
1.280 -/**
1.281 - Default constructor.
1.282 - */
1.283 - IMPORT_C CHeaderReader();
1.284 -
1.285 -/**
1.286 - Second phase construction in which any necessary allocation is done
1.287 - Implementations of this interface may leave with standard errors like KErrNoMemory.
1.288 - */
1.289 - //##ModelId=3C4C18860315
1.290 - IMPORT_C void ConstructL();
1.291 -
1.292 -private: // methods
1.293 -
1.294 -/**
1.295 - Intended Usage: Reserve a slot in the v-table to preserve future BC
1.296 - */
1.297 - //##ModelId=3C4C18860314
1.298 - inline virtual void Reserved1();
1.299 -
1.300 -/**
1.301 - Intended Usage: Reserve a slot in the v-table to preserve future BC
1.302 - */
1.303 - //##ModelId=3C4C18860313
1.304 - inline virtual void Reserved2();
1.305 - };
1.306 -
1.307 -
1.308 -inline void CHeaderCodec::Reserved1()
1.309 - {}
1.310 -inline void CHeaderCodec::Reserved2()
1.311 - {}
1.312 -inline void CHeaderWriter::Reserved1()
1.313 - {}
1.314 -inline void CHeaderWriter::Reserved2()
1.315 - {}
1.316 -inline void CHeaderReader::Reserved1()
1.317 - {}
1.318 -inline void CHeaderReader::Reserved2()
1.319 - {}
1.320 -
1.321 -#endif /* __CHEADERCODEC_H__ */