webengine/wmlengine/src/utils/include/nw_loadreq.h
branchRCL_3
changeset 49 919f36ff910f
equal deleted inserted replaced
48:79859ed3eea9 49:919f36ff910f
       
     1 /*
       
     2 * Copyright (c) 1999 - 2001 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef NW_LOADREQ_H
       
    19 #define NW_LOADREQ_H
       
    20 
       
    21 /*
       
    22 ** Includes
       
    23 */
       
    24 #include "nwx_defs.h"
       
    25 
       
    26 #include "nw_nvpair.h"
       
    27 #include "nwx_buffer.h"
       
    28 #include "nwx_http_header.h"
       
    29 #include "urlloader_urlresponse.h"
       
    30 #include "nw_hed_appservices.h"
       
    31 #include "BrsrStatusCodes.h"
       
    32 /*
       
    33 ** Type Declarations
       
    34 */
       
    35 
       
    36 /*
       
    37 ** Preprocessor Macro Definitions
       
    38 */
       
    39 
       
    40 #ifdef __cplusplus
       
    41 extern "C" {
       
    42 #endif
       
    43 
       
    44 /*
       
    45 ** Global Function Declarations
       
    46 */
       
    47 
       
    48 /*****************************************************************
       
    49 
       
    50   Name: NW_LoadReq_Create
       
    51 
       
    52   Description:  
       
    53     Create loader data structures for an Http load request.
       
    54     Helper routine to create request for the loaders. 
       
    55 
       
    56   Parameters:   
       
    57     url             - in: url to load.
       
    58     postMethodFlag  - in: flag indicating HTTP POST method or not.
       
    59     referer         - in: referer to the url.
       
    60     acceptCharset   - in: character set gateway will accept.
       
    61     postfields      - in: postdata name/value pairs.
       
    62                       Note: Not const because have to change to iterate over.
       
    63     enctype         - in: urlencoded or multipart/form-data.
       
    64     docCharset      - in: charset encoding for document.
       
    65     header          - in/out: if empty (NULL) a new header is created.
       
    66                               if not empty, a copy is made and added to.
       
    67     resultUrl       - out: url created for request
       
    68     method          - out: post or get.
       
    69     body            - out: body for load request.
       
    70     appServices ?
       
    71     appCtx ?
       
    72 
       
    73   Return Value: KBrsrSuccess
       
    74                 KBrsrFailure
       
    75                 KBrsrUnsupportedFormCharset
       
    76                 KBrsrOutOfMemory
       
    77 
       
    78   Notes:
       
    79      cacheMode not needed for this helper function.
       
    80 
       
    81 ******************************************************************/
       
    82 TBrowserStatusCode NW_LoadReq_Create ( const NW_Ucs2 *url,
       
    83                                 const NW_Bool postMethodFlag, 
       
    84                                 const NW_Ucs2 *referer, 
       
    85                                 const NW_Ucs2 *acceptCharset,
       
    86                                 NW_NVPair_t   *postfields,  /* Can't be const. */
       
    87                                 const NW_Ucs2 *enctype,
       
    88                                 const NW_Http_CharSet_t docCharset,
       
    89                                 NW_Http_Header_t **header,  /* Start output params */
       
    90                                 NW_Ucs2       **resultUrl,
       
    91                                 NW_Uint8      *method,
       
    92                                 NW_Buffer_t   **body,
       
    93                                 NW_HED_AppServices_t * appServices,
       
    94                                 void * appCtx);
       
    95 
       
    96 
       
    97 /************************************************************************
       
    98  
       
    99   Function: NW_LoadReq_BuildQuery
       
   100 
       
   101   Description:  Construct a query from the url and escaped_postdata, 
       
   102                 and places the result in *query.  It is the caller's 
       
   103                 responsibility to delete the resulting string.
       
   104  
       
   105                 If the number of postfields is 0, the query is just a 
       
   106                 new copy the original url. This prevents us from 
       
   107                 appending a lone '?' at the end of a 'canned' query 
       
   108                 url like 
       
   109  
       
   110                 "http://waplabdc/foo.wml?name=bar;value=foo"
       
   111  
       
   112   Parameters:   url        - in: pointer to the URL
       
   113                 postfields - in: pointer to the postfield data
       
   114                 resultUrl - out: constructed result URL.
       
   115                 appServices ?
       
   116                 appCtx ?
       
   117     
       
   118   Return Value: KBrsrSuccess
       
   119                 KBrsrFailure
       
   120                 KBrsrOutOfMemory
       
   121                   
       
   122 **************************************************************************/
       
   123 TBrowserStatusCode NW_LoadReq_BuildQuery(const NW_Ucs2 *url,
       
   124                                   NW_NVPair_t *postfields, 
       
   125                                   NW_Ucs2 **resultUrl,
       
   126                                   NW_HED_AppServices_t * appServices,
       
   127                                   void * appCtx);
       
   128 
       
   129 /**
       
   130 * Checks the encoding type to see if it is for a multipart request.
       
   131 * @since 2.5
       
   132 * @param aEncodingType Ptr to encoding type string to be checked.
       
   133 * @return   NW_TRUE if multipart.
       
   134 *           NW_FALSE if not multipart.
       
   135 */
       
   136 NW_Bool NW_LoadReq_IsMultipart( const NW_Ucs2* aEncodingType );
       
   137 
       
   138 /**
       
   139 * Determines whether or not the current part of the multipart post is for a
       
   140 * file to be uploaded or not.
       
   141 * @param aValue Ptr to value of the variable.
       
   142 * @return   NW_TRUE if the part is for file to be uploaded.
       
   143 *           NW_FALSE if not a file.
       
   144 */
       
   145 NW_Bool NW_LoadReq_IsUploadFile( const NW_Ucs2 *aValue );
       
   146 
       
   147 
       
   148 #ifdef __cplusplus
       
   149 } /* extern "C" */
       
   150 #endif
       
   151 
       
   152 #endif /* NW_NVPAIR_H */
       
   153 
       
   154