File: php_uploadprogress.h

package info (click to toggle)
php-uploadprogress 2.0.2%2B%2B-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 320 kB
  • sloc: ansic: 429; xml: 335; php: 45; makefile: 1
file content (112 lines) | stat: -rw-r--r-- 3,348 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
  +----------------------------------------------------------------------+
  | Uploadprogress extension                                             |
  +----------------------------------------------------------------------+
  | Copyright (c) The PHP Group                                          |
  +----------------------------------------------------------------------+
  | This source file is subject to version 3.01 of the PHP license,      |
  | that is bundled with this package in the file LICENSE, and is        |
  | available through the world-wide-web at the following url:           |
  | http://www.php.net/license/3_01.txt.                                 |
  | If you did not receive a copy of the PHP license and are unable to   |
  | obtain it through the world-wide-web, please send a note to          |
  | license@php.net so we can mail you a copy immediately.               |
  +----------------------------------------------------------------------+
  | Author: Christian Stocker (chregu@liip.ch)                           |
  |  Derived from: Doru Petrescu (pdoru-php-upm@kappa.ro)                |
  |                http://pdoru.from.ro/upload-progress-meter/           |
  +----------------------------------------------------------------------+
*/

#ifndef PHP_UPLOADPROGRESS_H
#define PHP_UPLOADPROGRESS_H

#ifdef  __cplusplus
extern "C" {
#endif

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <php.h>

#ifdef HAVE_UPLOADPROGRESS

#include <php_ini.h>
#include <SAPI.h>
#include <ext/standard/info.h>
#include <ext/standard/php_string.h>

#ifdef  __cplusplus
} // extern "C"
#endif
#ifdef  __cplusplus
extern "C" {
#endif

extern zend_module_entry uploadprogress_module_entry;
#define phpext_uploadprogress_ptr &uploadprogress_module_entry

#define PHP_UPLOADPROGRESS_VERSION "2.0.2"

#ifdef PHP_WIN32
#define PHP_UPLOADPROGRESS_API __declspec(dllexport)
#else
#define PHP_UPLOADPROGRESS_API
#endif

typedef struct _uploadprogress_data {
    /* Full filename, or just the identifier, depending on method */
    char *identifier;

    /* Full filename, or just the identifier, depending on method */
    char *identifier_tmp;

    /* Raw string of the UPLOAD_IDENTIFIER */
    char *upload_id;

    /* Full filename of temporary data file */
    char *data_filename;

    /* Name of form field for current file being uploaded */
    char *fieldname;

    /* Filename of the uploaded file */
    char *filename;

    time_t time_start;
    time_t time_last;
    unsigned int speed_average;
    unsigned int speed_last;
    unsigned long bytes_uploaded;
    unsigned long bytes_total;
    unsigned int files_uploaded;
    int est_sec;
} uploadprogress_data;

static char *uploadprogress_mk_filename(char *identifier, char *template);

static void uploadprogress_file_php_get_info(char *, zval *);
static void uploadprogress_file_php_get_contents(char *, char *, long, zval *);

PHP_MINIT_FUNCTION(uploadprogress);
PHP_MSHUTDOWN_FUNCTION(uploadprogress);
PHP_RINIT_FUNCTION(uploadprogress);
PHP_RSHUTDOWN_FUNCTION(uploadprogress);
PHP_MINFO_FUNCTION(uploadprogress);

#ifdef ZTS
#include "TSRM.h"
#endif

PHP_FUNCTION(uploadprogress_get_info);
PHP_FUNCTION(uploadprogress_get_contents);

#ifdef  __cplusplus
} // extern "C"
#endif

#endif /* PHP_HAVE_UPLOADPROGRESS */

#endif /* PHP_UPLOADPROGRESS_H */