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