formdata.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef __FORMDATA_H
  2. #define __FORMDATA_H
  3. /*****************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 2000, Daniel Stenberg, <[email protected]>, et al.
  11. *
  12. * In order to be useful for every potential user, curl and libcurl are
  13. * dual-licensed under the MPL and the MIT/X-derivate licenses.
  14. *
  15. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  16. * copies of the Software, and permit persons to whom the Software is
  17. * furnished to do so, under the terms of the MPL or the MIT/X-derivate
  18. * licenses. You may pick one of these licenses.
  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. struct curl_slist* contentheader;
  45. struct FormInfo *more;
  46. } FormInfo;
  47. int Curl_FormInit(struct Form *form, struct FormData *formdata );
  48. struct FormData *Curl_getFormData(struct HttpPost *post,
  49. int *size);
  50. /* fread() emulation */
  51. int Curl_FormReader(char *buffer,
  52. size_t size,
  53. size_t nitems,
  54. FILE *mydata);
  55. /* possible (old) fread() emulation that copies at most one line */
  56. int Curl_FormReadOneLine(char *buffer,
  57. size_t size,
  58. size_t nitems,
  59. FILE *mydata);
  60. char *Curl_FormBoundary(void);
  61. void Curl_formclean(struct FormData *);
  62. #endif