formdata.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef __FORMDATA_H
  2. #define __FORMDATA_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at http://curl.haxx.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. * $Id$
  24. ***************************************************************************/
  25. /* plain and simple linked list with lines to send */
  26. struct FormData {
  27. struct FormData *next;
  28. char *line;
  29. size_t length;
  30. };
  31. struct Form {
  32. struct FormData *data; /* current form line to send */
  33. unsigned int sent; /* number of bytes of the current line that has already
  34. been sent in a previous invoke */
  35. };
  36. /* used by FormAdd for temporary storage */
  37. typedef struct FormInfo {
  38. char *name;
  39. size_t namelength;
  40. char *value;
  41. size_t contentslength;
  42. char *contenttype;
  43. long flags;
  44. char *buffer; /* pointer to existing buffer used for file upload */
  45. size_t bufferlength;
  46. char *showfilename; /* The file name to show. If not set, the actual
  47. file name will be used */
  48. struct curl_slist* contentheader;
  49. struct FormInfo *more;
  50. } FormInfo;
  51. int Curl_FormInit(struct Form *form, struct FormData *formdata );
  52. CURLcode
  53. Curl_getFormData(struct FormData **,
  54. struct curl_httppost *post,
  55. curl_off_t *size);
  56. /* fread() emulation */
  57. size_t Curl_FormReader(char *buffer,
  58. size_t size,
  59. size_t nitems,
  60. FILE *mydata);
  61. /* possible (old) fread() emulation that copies at most one line */
  62. size_t Curl_FormReadOneLine(char *buffer,
  63. size_t size,
  64. size_t nitems,
  65. FILE *mydata);
  66. char *Curl_FormBoundary(void);
  67. void Curl_formclean(struct FormData *);
  68. #endif