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