formdata.h
Go to the documentation of this file.
00001 #ifndef HEADER_CURL_FORMDATA_H
00002 #define HEADER_CURL_FORMDATA_H
00003 /***************************************************************************
00004  *                                  _   _ ____  _
00005  *  Project                     ___| | | |  _ \| |
00006  *                             / __| | | | |_) | |
00007  *                            | (__| |_| |  _ <| |___
00008  *                             \___|\___/|_| \_\_____|
00009  *
00010  * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
00011  *
00012  * This software is licensed as described in the file COPYING, which
00013  * you should have received as part of this distribution. The terms
00014  * are also available at https://curl.haxx.se/docs/copyright.html.
00015  *
00016  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
00017  * copies of the Software, and permit persons to whom the Software is
00018  * furnished to do so, under the terms of the COPYING file.
00019  *
00020  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
00021  * KIND, either express or implied.
00022  *
00023  ***************************************************************************/
00024 
00025 enum formtype {
00026   FORM_DATAMEM, /* already allocated FORM_DATA memory */
00027   FORM_DATA,    /* form metadata (convert to network encoding if necessary) */
00028   FORM_CONTENT, /* form content  (never convert) */
00029   FORM_CALLBACK, /* 'line' points to the custom pointer we pass to the callback
00030                   */
00031   FORM_FILE     /* 'line' points to a file name we should read from
00032                    to create the form data (never convert) */
00033 };
00034 
00035 /* plain and simple linked list with lines to send */
00036 struct FormData {
00037   struct FormData *next;
00038   enum formtype type;
00039   char *line;
00040   size_t length;
00041 };
00042 
00043 struct Form {
00044   struct FormData *data; /* current form line to send */
00045   size_t sent;           /* number of bytes of the current line that has
00046                             already been sent in a previous invoke */
00047   FILE *fp;              /* file to read from */
00048   curl_read_callback fread_func; /* fread callback pointer */
00049 };
00050 
00051 /* used by FormAdd for temporary storage */
00052 typedef struct FormInfo {
00053   char *name;
00054   bool name_alloc;
00055   size_t namelength;
00056   char *value;
00057   bool value_alloc;
00058   curl_off_t contentslength;
00059   char *contenttype;
00060   bool contenttype_alloc;
00061   long flags;
00062   char *buffer;      /* pointer to existing buffer used for file upload */
00063   size_t bufferlength;
00064   char *showfilename; /* The file name to show. If not set, the actual
00065                          file name will be used */
00066   bool showfilename_alloc;
00067   char *userp;        /* pointer for the read callback */
00068   struct curl_slist *contentheader;
00069   struct FormInfo *more;
00070 } FormInfo;
00071 
00072 int Curl_FormInit(struct Form *form, struct FormData *formdata);
00073 
00074 CURLcode Curl_getformdata(struct Curl_easy *data,
00075                           struct FormData **,
00076                           struct curl_httppost *post,
00077                           const char *custom_contenttype,
00078                           curl_off_t *size);
00079 
00080 /* fread() emulation */
00081 size_t Curl_FormReader(char *buffer,
00082                        size_t size,
00083                        size_t nitems,
00084                        FILE *mydata);
00085 
00086 /*
00087  * Curl_formpostheader() returns the first line of the formpost, the
00088  * request-header part (which is not part of the request-body like the rest of
00089  * the post).
00090  */
00091 char *Curl_formpostheader(void *formp, size_t *len);
00092 
00093 char *Curl_FormBoundary(void);
00094 
00095 void Curl_formclean(struct FormData **);
00096 
00097 CURLcode Curl_formconvert(struct Curl_easy *, struct FormData *);
00098 
00099 #endif /* HEADER_CURL_FORMDATA_H */


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:02