-
Notifications
You must be signed in to change notification settings - Fork 22
/
amf3.c
92 lines (80 loc) · 2.98 KB
/
amf3.c
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
/*
** Copyright (C) 2010-2018 Arseny Vakhrushev <[email protected]>
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and associated documentation files (the "Software"), to deal
** in the Software without restriction, including without limitation the rights
** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
** copies of the Software, and to permit persons to whom the Software is
** furnished to do so, subject to the following conditions:
**
** The above copyright notice and this permission notice shall be included in
** all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
** THE SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_amf3.h"
#include "ext/standard/info.h"
#include "amf3.h"
ZEND_BEGIN_ARG_INFO_EX(arginfo_amf3_encode, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_amf3_decode, 0, 0, 1)
ZEND_ARG_INFO(0, amf3)
ZEND_ARG_INFO(1, count)
ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(arginfo_AMF3Serializable___toAMF3, 0)
ZEND_END_ARG_INFO()
static const zend_function_entry amf3_functions[] = {
PHP_FE(amf3_encode, arginfo_amf3_encode)
PHP_FE(amf3_decode, arginfo_amf3_decode)
PHP_FE_END
};
static const zend_function_entry class_AMF3Serializable_methods[] = {
PHP_ABSTRACT_ME(AMF3Serializable, __toAMF3, arginfo_AMF3Serializable___toAMF3)
PHP_FE_END
};
zend_class_entry *amf3_serializable_ce;
zend_module_entry amf3_module_entry = {
STANDARD_MODULE_HEADER,
"amf3",
amf3_functions,
PHP_MINIT(amf3),
0,
0,
0,
PHP_MINFO(amf3),
PHP_AMF3_VERSION,
STANDARD_MODULE_PROPERTIES
};
#ifdef COMPILE_DL_AMF3
ZEND_GET_MODULE(amf3)
#endif
PHP_MINIT_FUNCTION(amf3) {
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "AMF3Serializable", class_AMF3Serializable_methods);
amf3_serializable_ce = zend_register_internal_interface(&ce);
REGISTER_LONG_CONSTANT("AMF3_FORCE_OBJECT", AMF3_FORCE_OBJECT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMF3_CLASS_MAP", AMF3_CLASS_MAP, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMF3_CLASS_AUTOLOAD", AMF3_CLASS_AUTOLOAD, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AMF3_CLASS_CONSTRUCT", AMF3_CLASS_CONSTRUCT, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
PHP_MINFO_FUNCTION(amf3) {
php_info_print_table_start();
php_info_print_table_row(2, "AMF3 support", "enabled");
php_info_print_table_row(2, "Version", PHP_AMF3_VERSION);
php_info_print_table_end();
}