multipart.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef MULTIPART_H
  2. #define MULTIPART_H
  3. #include <httpd.h>
  4. typedef enum {
  5. FILE_UPLOAD_START, // multipart: uploading files started
  6. FILE_START, // multipart: the start of a new file (can be more)
  7. FILE_DATA, // multipart: file data
  8. FILE_DONE, // multipart: file end
  9. FILE_UPLOAD_DONE, // multipart: finished for all files
  10. } MultipartCmd;
  11. // multipart callback
  12. // -> FILE_START : data+dataLen contains the filename, position is 0
  13. // -> FILE_DATA : data+dataLen contains file data, position is the file position
  14. // -> FILE_DONE : data+dataLen is 0, position is the complete file size
  15. typedef int (* MultipartCallback)(MultipartCmd cmd, char *data, int dataLen, int position);
  16. struct _MultipartCtx; // the context for multipart listening
  17. typedef struct _MultipartCtx MultipartCtx;
  18. // use this for creating a multipart context
  19. MultipartCtx * ICACHE_FLASH_ATTR multipartCreateContext(MultipartCallback callback);
  20. // for destroying multipart context
  21. void ICACHE_FLASH_ATTR multipartDestroyContext(MultipartCtx * context);
  22. // use this function for processing HTML multipart updates
  23. int ICACHE_FLASH_ATTR multipartProcess(MultipartCtx * context, HttpdConnData * post );
  24. #endif /* MULTIPART_H */