formdata.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #ifndef __FORMDATA_H
  2. #define __FORMDATA_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2002, Daniel Stenberg, <[email protected]>, 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. long length;
  30. };
  31. struct Form {
  32. struct FormData *data; /* current form line to send */
  33. 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. long namelength;
  40. char *value;
  41. long contentslength;
  42. char *contenttype;
  43. long flags;
  44. /* CMC: Added support for buffer uploads */
  45. char *buffer; /* pointer to existing buffer used for file upload */
  46. long bufferlength;
  47. char *showfilename; /* The file name to show. If not set, the actual
  48. file name will be used */
  49. struct curl_slist* contentheader;
  50. struct FormInfo *more;
  51. } FormInfo;
  52. int Curl_FormInit(struct Form *form, struct FormData *formdata );
  53. CURLcode
  54. Curl_getFormData(struct FormData **,
  55. struct HttpPost *post,
  56. int *size);
  57. /* fread() emulation */
  58. int Curl_FormReader(char *buffer,
  59. size_t size,
  60. size_t nitems,
  61. FILE *mydata);
  62. /* possible (old) fread() emulation that copies at most one line */
  63. int Curl_FormReadOneLine(char *buffer,
  64. size_t size,
  65. size_t nitems,
  66. FILE *mydata);
  67. char *Curl_FormBoundary(void);
  68. void Curl_formclean(struct FormData *);
  69. #endif