xref: /PHP-7.3/ext/wddx/php_wddx_api.h (revision 8d3f8ca1)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1997-2018 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:  Andrei Zmievski <andrei@ispi.net>                           |
16    +----------------------------------------------------------------------+
17  */
18 
19 #ifndef PHP_WDDX_API_H
20 #define PHP_WDDX_API_H
21 
22 #include "zend_smart_str_public.h"
23 
24 #define WDDX_ARRAY_S			"<array length='%d'>"
25 #define WDDX_ARRAY_E			"</array>"
26 #define WDDX_BINARY_S			"<binary>"
27 #define WDDX_BINARY_E			"</binary>"
28 #define WDDX_BOOLEAN_TRUE		"<boolean value='true'/>"
29 #define WDDX_BOOLEAN_FALSE		"<boolean value='false'/>"
30 #define WDDX_CHAR				"<char code='%02X'/>"
31 #define WDDX_COMMENT_S			"<comment>"
32 #define WDDX_COMMENT_E			"</comment>"
33 #define WDDX_DATA_S				"<data>"
34 #define WDDX_DATA_E				"</data>"
35 #define WDDX_HEADER				"<header/>"
36 #define WDDX_HEADER_S			"<header>"
37 #define WDDX_HEADER_E			"</header>"
38 #define WDDX_NULL				"<null/>"
39 #define WDDX_NUMBER				"<number>%s</number>"
40 #define WDDX_PACKET_S			"<wddxPacket version='1.0'>"
41 #define WDDX_PACKET_E			"</wddxPacket>"
42 #define WDDX_STRING_S			"<string>"
43 #define WDDX_STRING_E			"</string>"
44 #define WDDX_STRUCT_S			"<struct>"
45 #define WDDX_STRUCT_E			"</struct>"
46 #define WDDX_VAR_S				"<var name='%s'>"
47 #define WDDX_VAR_E				"</var>"
48 
49 #define php_wddx_add_chunk(packet, str)	smart_str_appends(packet, str)
50 #define php_wddx_add_chunk_ex(packet, str, len)	smart_str_appendl(packet, str, len)
51 #define php_wddx_add_chunk_static(packet, str) smart_str_appendl(packet, str, sizeof(str)-1)
52 
53 typedef smart_str wddx_packet;
54 
55 wddx_packet* php_wddx_constructor(void);
56 void		 php_wddx_destructor(wddx_packet *packet);
57 
58 void 		 php_wddx_packet_start(wddx_packet *packet, char *comment, size_t comment_len);
59 void 		 php_wddx_packet_end(wddx_packet *packet);
60 
61 void 		 php_wddx_serialize_var(wddx_packet *packet, zval *var, zend_string *name);
62 int 		 php_wddx_deserialize_ex(const char *, size_t, zval *return_value);
63 #define php_wddx_gather(packet) estrndup(packet->c, packet->len)
64 
65 #endif /* PHP_WDDX_API_H */
66