xref: /PHP-5.4/main/rfc1867.h (revision c0d060f5)
1 /*
2   +----------------------------------------------------------------------+
3   | PHP Version 5                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 1997-2014 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 /* $Id$ */
20 
21 #ifndef RFC1867_H
22 #define RFC1867_H
23 
24 #include "SAPI.h"
25 
26 #define MULTIPART_CONTENT_TYPE "multipart/form-data"
27 #define MULTIPART_EVENT_START		0
28 #define MULTIPART_EVENT_FORMDATA	1
29 #define MULTIPART_EVENT_FILE_START	2
30 #define MULTIPART_EVENT_FILE_DATA	3
31 #define MULTIPART_EVENT_FILE_END	4
32 #define MULTIPART_EVENT_END		5
33 
34 typedef struct _multipart_event_start {
35 	size_t	content_length;
36 } multipart_event_start;
37 
38 typedef struct _multipart_event_formdata {
39 	size_t	post_bytes_processed;
40 	char	*name;
41 	char	**value;
42 	size_t	length;
43 	size_t	*newlength;
44 } multipart_event_formdata;
45 
46 typedef struct _multipart_event_file_start {
47 	size_t	post_bytes_processed;
48 	char	*name;
49 	char	**filename;
50 } multipart_event_file_start;
51 
52 typedef struct _multipart_event_file_data {
53 	size_t	post_bytes_processed;
54 	off_t	offset;
55 	char	*data;
56 	size_t	length;
57 	size_t	*newlength;
58 } multipart_event_file_data;
59 
60 typedef struct _multipart_event_file_end {
61 	size_t	post_bytes_processed;
62 	char	*temp_filename;
63 	int	cancel_upload;
64 } multipart_event_file_end;
65 
66 typedef struct _multipart_event_end {
67 	size_t	post_bytes_processed;
68 } multipart_event_end;
69 
70 typedef int (*php_rfc1867_encoding_translation_t)(TSRMLS_D);
71 typedef void (*php_rfc1867_get_detect_order_t)(const zend_encoding ***list, size_t *list_size TSRMLS_DC);
72 typedef void (*php_rfc1867_set_input_encoding_t)(const zend_encoding *encoding TSRMLS_DC);
73 typedef char* (*php_rfc1867_getword_t)(const zend_encoding *encoding, char **line, char stop TSRMLS_DC);
74 typedef char* (*php_rfc1867_getword_conf_t)(const zend_encoding *encoding, char *str TSRMLS_DC);
75 typedef char* (*php_rfc1867_basename_t)(const zend_encoding *encoding, char *str TSRMLS_DC);
76 
77 SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler);
78 
79 void destroy_uploaded_files_hash(TSRMLS_D);
80 void php_rfc1867_register_constants(TSRMLS_D);
81 extern PHPAPI int (*php_rfc1867_callback)(unsigned int event, void *event_data, void **extra TSRMLS_DC);
82 
83 SAPI_API void php_rfc1867_set_multibyte_callbacks(
84 					php_rfc1867_encoding_translation_t encoding_translation,
85 					php_rfc1867_get_detect_order_t get_detect_order,
86 					php_rfc1867_set_input_encoding_t set_input_encoding,
87 					php_rfc1867_getword_t getword,
88 					php_rfc1867_getword_conf_t getword_conf,
89 					php_rfc1867_basename_t basename);
90 
91 #endif /* RFC1867_H */
92