#ifndef HEADER_CURL_TOOL_FORMPARSE_H1#define HEADER_CURL_TOOL_FORMPARSE_H2/***************************************************************************3* _ _ ____ _4* Project ___| | | | _ \| |5* / __| | | | |_) | |6* | (__| |_| | _ <| |___7* \___|\___/|_| \_\_____|8*9* Copyright (C) Daniel Stenberg, <[email protected]>, et al.10*11* This software is licensed as described in the file COPYING, which12* you should have received as part of this distribution. The terms13* are also available at https://curl.se/docs/copyright.html.14*15* You may opt to use, copy, modify, merge, publish, distribute and/or sell16* copies of the Software, and permit persons to whom the Software is17* furnished to do so, under the terms of the COPYING file.18*19* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY20* KIND, either express or implied.21*22* SPDX-License-Identifier: curl23*24***************************************************************************/25#include "tool_setup.h"2627/* Private structure for mime/parts. */2829typedef enum {30TOOLMIME_NONE = 0,31TOOLMIME_PARTS,32TOOLMIME_DATA,33TOOLMIME_FILE,34TOOLMIME_FILEDATA,35TOOLMIME_STDIN,36TOOLMIME_STDINDATA37} toolmimekind;3839struct tool_mime {40/* Structural fields. */41toolmimekind kind; /* Part kind. */42struct tool_mime *parent; /* Parent item. */43struct tool_mime *prev; /* Previous sibling (reverse order link). */44/* Common fields. */45char *data; /* Actual data or data filename. */46char *name; /* Part name. */47char *filename; /* Part's filename. */48char *type; /* Part's mime type. */49char *encoder; /* Part's requested encoding. */50struct curl_slist *headers; /* User-defined headers. */51/* TOOLMIME_PARTS fields. */52struct tool_mime *subparts; /* Part's subparts. */53/* TOOLMIME_STDIN/TOOLMIME_STDINDATA fields. */54curl_off_t origin; /* Stdin read origin offset. */55curl_off_t size; /* Stdin data size. */56curl_off_t curpos; /* Stdin current read position. */57struct GlobalConfig *config; /* For access from callback. */58};5960size_t tool_mime_stdin_read(char *buffer,61size_t size, size_t nitems, void *arg);62int tool_mime_stdin_seek(void *instream, curl_off_t offset, int whence);6364int formparse(struct OperationConfig *config,65const char *input,66struct tool_mime **mimeroot,67struct tool_mime **mimecurrent,68bool literal_value);69CURLcode tool2curlmime(CURL *curl, struct tool_mime *m, curl_mime **mime);70void tool_mime_free(struct tool_mime *mime);7172#endif /* HEADER_CURL_TOOL_FORMPARSE_H */737475