You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
esp-link/httpd/multipart.h

33 lines
1.1 KiB

#ifndef MULTIPART_H
#define MULTIPART_H
#include <httpd.h>
typedef enum {
FILE_START, // multipart: the start of a new file
FILE_DATA, // multipart: file data
FILE_DONE, // multipart: file end
} MultipartCmd;
// multipart callback
// -> FILE_START : data+dataLen contains the filename, position is 0
// -> FILE_DATA : data+dataLen contains file data, position is the file position
// -> FILE_DONE : data+dataLen is 0, position is the complete file size
typedef int (* MultipartCallback)(MultipartCmd cmd, char *data, int dataLen, int position);
struct _MultipartCtx; // the context for multipart listening
typedef struct _MultipartCtx MultipartCtx;
// use this for creating a multipart context
MultipartCtx * ICACHE_FLASH_ATTR multipartCreateContext(MultipartCallback callback);
// for destroying multipart context
void ICACHE_FLASH_ATTR multipartDestroyContext(MultipartCtx * context);
// use this function for processing HTML multipart updates
int ICACHE_FLASH_ATTR multipartProcess(MultipartCtx * context, HttpdConnData * post );
#endif /* MULTIPART_H */