xref: /PHP-8.0/main/rfc1867.h (revision 5d6e923d)
1 /*
2   +----------------------------------------------------------------------+
3   | Copyright (c) The PHP Group                                          |
4   +----------------------------------------------------------------------+
5   | This source file is subject to version 3.01 of the PHP license,      |
6   | that is bundled with this package in the file LICENSE, and is        |
7   | available through the world-wide-web at the following url:           |
8   | http://www.php.net/license/3_01.txt                                  |
9   | If you did not receive a copy of the PHP license and are unable to   |
10   | obtain it through the world-wide-web, please send a note to          |
11   | license@php.net so we can mail you a copy immediately.               |
12   +----------------------------------------------------------------------+
13   | Author:                                                              |
14   +----------------------------------------------------------------------+
15 */
16 
17 #ifndef RFC1867_H
18 #define RFC1867_H
19 
20 #include "SAPI.h"
21 
22 #define MULTIPART_CONTENT_TYPE "multipart/form-data"
23 #define MULTIPART_EVENT_START		0
24 #define MULTIPART_EVENT_FORMDATA	1
25 #define MULTIPART_EVENT_FILE_START	2
26 #define MULTIPART_EVENT_FILE_DATA	3
27 #define MULTIPART_EVENT_FILE_END	4
28 #define MULTIPART_EVENT_END		5
29 
30 typedef struct _multipart_event_start {
31 	size_t	content_length;
32 } multipart_event_start;
33 
34 typedef struct _multipart_event_formdata {
35 	size_t	post_bytes_processed;
36 	char	*name;
37 	char	**value;
38 	size_t	length;
39 	size_t	*newlength;
40 } multipart_event_formdata;
41 
42 typedef struct _multipart_event_file_start {
43 	size_t	post_bytes_processed;
44 	char	*name;
45 	char	**filename;
46 } multipart_event_file_start;
47 
48 typedef struct _multipart_event_file_data {
49 	size_t	post_bytes_processed;
50 	zend_off_t	offset;
51 	char	*data;
52 	size_t	length;
53 	size_t	*newlength;
54 } multipart_event_file_data;
55 
56 typedef struct _multipart_event_file_end {
57 	size_t	post_bytes_processed;
58 	char	*temp_filename;
59 	int	cancel_upload;
60 } multipart_event_file_end;
61 
62 typedef struct _multipart_event_end {
63 	size_t	post_bytes_processed;
64 } multipart_event_end;
65 
66 typedef int (*php_rfc1867_encoding_translation_t)(void);
67 typedef void (*php_rfc1867_get_detect_order_t)(const zend_encoding ***list, size_t *list_size);
68 typedef void (*php_rfc1867_set_input_encoding_t)(const zend_encoding *encoding);
69 typedef char* (*php_rfc1867_getword_t)(const zend_encoding *encoding, char **line, char stop);
70 typedef char* (*php_rfc1867_getword_conf_t)(const zend_encoding *encoding, char *str);
71 typedef char* (*php_rfc1867_basename_t)(const zend_encoding *encoding, char *str);
72 
73 SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler);
74 
75 PHPAPI void destroy_uploaded_files_hash(void);
76 void php_rfc1867_register_constants(void);
77 extern PHPAPI int (*php_rfc1867_callback)(unsigned int event, void *event_data, void **extra);
78 
79 SAPI_API void php_rfc1867_set_multibyte_callbacks(
80 					php_rfc1867_encoding_translation_t encoding_translation,
81 					php_rfc1867_get_detect_order_t get_detect_order,
82 					php_rfc1867_set_input_encoding_t set_input_encoding,
83 					php_rfc1867_getword_t getword,
84 					php_rfc1867_getword_conf_t getword_conf,
85 					php_rfc1867_basename_t basename);
86 
87 #endif /* RFC1867_H */
88