1/*
2 +----------------------------------------------------------------------+
3 | PHP Version 5 |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 1997-2015 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: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
16 +----------------------------------------------------------------------+
17*/
18
19/* $Id$ */
20
21/* Synced with php 3.0 revision 1.30 1999-06-16 [ssb] */
22
23#ifndef FILE_H
24#define FILE_H
25
26PHP_MINIT_FUNCTION(file);
27PHP_MSHUTDOWN_FUNCTION(file);
28
29PHP_FUNCTION(tempnam);
30PHP_NAMED_FUNCTION(php_if_tmpfile);
31PHP_NAMED_FUNCTION(php_if_fopen);
32PHPAPI PHP_FUNCTION(fclose);
33PHP_FUNCTION(popen);
34PHP_FUNCTION(pclose);
35PHPAPI PHP_FUNCTION(feof);
36PHPAPI PHP_FUNCTION(fread);
37PHPAPI PHP_FUNCTION(fgetc);
38PHPAPI PHP_FUNCTION(fgets);
39PHP_FUNCTION(fscanf);
40PHPAPI PHP_FUNCTION(fgetss);
41PHP_FUNCTION(fgetcsv);
42PHP_FUNCTION(fputcsv);
43PHPAPI PHP_FUNCTION(fwrite);
44PHPAPI PHP_FUNCTION(fflush);
45PHPAPI PHP_FUNCTION(rewind);
46PHPAPI PHP_FUNCTION(ftell);
47PHPAPI PHP_FUNCTION(fseek);
48PHP_FUNCTION(mkdir);
49PHP_FUNCTION(rmdir);
50PHPAPI PHP_FUNCTION(fpassthru);
51PHP_FUNCTION(readfile);
52PHP_FUNCTION(umask);
53PHP_FUNCTION(rename);
54PHP_FUNCTION(unlink);
55PHP_FUNCTION(copy);
56PHP_FUNCTION(file);
57PHP_FUNCTION(file_get_contents);
58PHP_FUNCTION(file_put_contents);
59PHP_FUNCTION(get_meta_tags);
60PHP_FUNCTION(flock);
61PHP_FUNCTION(fd_set);
62PHP_FUNCTION(fd_isset);
63#if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
64PHP_FUNCTION(realpath);
65#endif
66#ifdef HAVE_FNMATCH
67PHP_FUNCTION(fnmatch);
68#endif
69PHP_NAMED_FUNCTION(php_if_ftruncate);
70PHP_NAMED_FUNCTION(php_if_fstat);
71PHP_FUNCTION(sys_get_temp_dir);
72
73PHP_MINIT_FUNCTION(user_streams);
74
75PHPAPI int php_le_stream_context(TSRMLS_D);
76PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC);
77PHPAPI int php_copy_file(const char *src, const char *dest TSRMLS_DC);
78PHPAPI int php_copy_file_ex(const char *src, const char *dest, int src_chk TSRMLS_DC);
79PHPAPI int php_copy_file_ctx(const char *src, const char *dest, int src_chk, php_stream_context *ctx TSRMLS_DC);
80PHPAPI int php_mkdir_ex(const char *dir, long mode, int options TSRMLS_DC);
81PHPAPI int php_mkdir(const char *dir, long mode TSRMLS_DC);
82PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape_char, size_t buf_len, char *buf, zval *return_value TSRMLS_DC);
83PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC);
84
85#define META_DEF_BUFSIZE 8192
86
87#define PHP_FILE_USE_INCLUDE_PATH 1
88#define PHP_FILE_IGNORE_NEW_LINES 2
89#define PHP_FILE_SKIP_EMPTY_LINES 4
90#define PHP_FILE_APPEND 8
91#define PHP_FILE_NO_DEFAULT_CONTEXT 16
92
93typedef enum _php_meta_tags_token {
94 TOK_EOF = 0,
95 TOK_OPENTAG,
96 TOK_CLOSETAG,
97 TOK_SLASH,
98 TOK_EQUAL,
99 TOK_SPACE,
100 TOK_ID,
101 TOK_STRING,
102 TOK_OTHER
103} php_meta_tags_token;
104
105typedef struct _php_meta_tags_data {
106 php_stream *stream;
107 int ulc;
108 int lc;
109 char *input_buffer;
110 char *token_data;
111 int token_len;
112 int in_meta;
113} php_meta_tags_data;
114
115php_meta_tags_token php_next_meta_token(php_meta_tags_data * TSRMLS_DC);
116
117typedef struct {
118 int pclose_ret;
119 size_t def_chunk_size;
120 long auto_detect_line_endings;
121 long default_socket_timeout;
122 char *user_agent; /* for the http wrapper */
123 char *from_address; /* for the ftp and http wrappers */
124 const char *user_stream_current_filename; /* for simple recursion protection */
125 php_stream_context *default_context;
126 HashTable *stream_wrappers; /* per-request copy of url_stream_wrappers_hash */
127 HashTable *stream_filters; /* per-request copy of stream_filters_hash */
128 HashTable *wrapper_errors; /* key: wrapper address; value: linked list of char* */
129 int pclose_wait;
130} php_file_globals;
131
132#ifdef ZTS
133#define FG(v) TSRMG(file_globals_id, php_file_globals *, v)
134extern PHPAPI int file_globals_id;
135#else
136#define FG(v) (file_globals.v)
137extern PHPAPI php_file_globals file_globals;
138#endif
139
140
141#endif /* FILE_H */
142
143