webengine/wmlengine/src/urlloader/include/urlloader_urlresponse.h
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Creating and deleting of url response
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef URLRESPONSE_H
       
    20 #define URLRESPONSE_H
       
    21 
       
    22 #ifdef __cplusplus
       
    23 extern "C" {
       
    24 #endif
       
    25     //  INCLUDES
       
    26 #include "nwx_defs.h"
       
    27 #include "nwx_buffer.h"
       
    28 #include "BrsrStatusCodes.h"
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 // MACROS
       
    33 
       
    34 // DATA TYPES
       
    35 typedef enum {
       
    36     NW_CACHE_NORMAL,      // Normal Http load, use cache if not stale
       
    37     NW_CACHE_HISTPREV,    // History Prev load, use cache even if stale,
       
    38 						  // unless must-revalidate
       
    39     NW_CACHE_NOCACHE,     // Do not use cache, even if fresh
       
    40     NW_CACHE_ONLYCACHE    // Only load from cache, for loading saved deck
       
    41 } NW_Cache_Mode_t;
       
    42 
       
    43 
       
    44 typedef struct NW_Url_Resp_s
       
    45 {
       
    46     NW_Ucs2     *uri;               // The original URL of the request
       
    47 									// NULL terminated
       
    48     NW_Buffer_t *body;              // The body of the request
       
    49     void        *headers;           // The response headers
       
    50     NW_Uint8    *contentTypeString; // The string representation of content type
       
    51     NW_Uint8    *contentLocationString; // The string representation of Content Base header
       
    52     NW_Bool     noStore;            // HTTP cache-control directive.
       
    53     NW_Uint8    *boundary;          // The string representation of boundary (multipart)
       
    54     NW_Ucs2     *lastModified;      // The string representation of last-modified header. Used by ECMAScript
       
    55     NW_Uint16   charset;            // WAP encoding of response's character set
       
    56     NW_Uint8    *charsetString;     // The charset string
       
    57     NW_Uint8    byteOrder;          // Byte order: big-endian or little-endian for 2-byte charset or single byte
       
    58     NW_Uint32   httpStatus;         // Response status as received from server
       
    59     NW_Uint8    method;             // Method used for the final request
       
    60     NW_Uint16   transId;            // The transaction id of the response
       
    61     void* 		certInfo;           // The certificate information
       
    62     NW_Uint32   contentLength;      // The content length of the response. Used only for HEAD requests
       
    63 } NW_Url_Resp_t;
       
    64 
       
    65 
       
    66 // A URLPartialResponseCallback is passed into this component to receive partial response
       
    67 typedef TBrowserStatusCode (NW_Url_RespCallback_t)
       
    68 	(TBrowserStatusCode   status,        // The load status
       
    69      NW_Uint16     transId,       // The transaction id of the response
       
    70      NW_Int32      chunkIndex,      // chunk index
       
    71      void          *loadContext,  // A context to pass back with the response
       
    72      NW_Url_Resp_t *resp);        // The response structure
       
    73 
       
    74 // FUNCTION PROTOTYPES
       
    75 
       
    76 // FORWARD DECLARATIONS
       
    77 
       
    78 /**
       
    79 * Create a url response structure
       
    80 * aUri The response URL, NULL terminated.
       
    81 * aBody The body of the request.
       
    82 * aBodyLength The length of the body of the request.
       
    83 * aHeaders The response headers.
       
    84 * aContentTypeString The string representation of the content type.
       
    85 * aCharset The WAP encoding of the response's character set.
       
    86 * aCharsetString The response's character set.
       
    87 * aHttpStatus The response status, as received from the server.
       
    88 * aMethod The method used for the final request.
       
    89 * aTransId The transaction id of the response.
       
    90 * aContentLength The content length of the response. Used only for HEAD requests.
       
    91 */
       
    92 
       
    93 NW_Url_Resp_t* UrlLoader_UrlResponseNew(const NW_Ucs2   *aUri,
       
    94                                         NW_Uint8        *aBody,
       
    95                                         NW_Uint32       aBodyLength,
       
    96                                         void            *aHeaders,
       
    97                                         NW_Uint8        *aContentTypeString,
       
    98                                         NW_Uint8        *aContentLocationString,
       
    99                                         NW_Bool         noStore,
       
   100                                         NW_Uint8        *aBoundaryString,
       
   101                                         NW_Ucs2         *aLastModified,
       
   102                                         NW_Uint16       aCharset,
       
   103                                         NW_Uint8        *aCharsetString,
       
   104                                         NW_Uint32       aHttpStatus,
       
   105                                         NW_Uint8        aMethod,
       
   106                                         NW_Uint16       aTransId,
       
   107                                         NW_Uint32       aContentLength);
       
   108 /*//R
       
   109 NW_Url_Resp_t* UrlLoader_UrlResponseNew(const NW_Ucs2   	*aUri,
       
   110                                         const NW_Uint8      *aBody,
       
   111                                         NW_Uint32       	aBodyLength,
       
   112                                         void            	*aHeaders,
       
   113                                         const NW_Uint8      *aContentTypeString,
       
   114                                         const NW_Uint8      *aContentLocationString,
       
   115                                         NW_Bool         	noStore,
       
   116                                         const NW_Uint8      *aBoundaryString,
       
   117                                         const NW_Ucs2         	*aLastModified,
       
   118                                         const NW_Uint16     aCharset,
       
   119                                         NW_Uint8        	*aCharsetString,
       
   120                                         NW_Uint32       	aHttpStatus,
       
   121                                         NW_Uint8        	aMethod,
       
   122                                         NW_Uint16       	aTransId,
       
   123                                         NW_Uint32       	aContentLength);
       
   124 */
       
   125 
       
   126 /**
       
   127 * Free a url response structure
       
   128 */
       
   129 void UrlLoader_UrlResponseDelete(NW_Url_Resp_t* aResp);
       
   130 
       
   131 
       
   132 #ifdef __cplusplus
       
   133 } /* extern "C" */
       
   134 #endif
       
   135 
       
   136 #endif      // URLRESPONSE_H
       
   137 
       
   138 // End of File