forked from phadej/igbinary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
igbinary.h
52 lines (46 loc) · 1.66 KB
/
igbinary.h
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
/*
+----------------------------------------------------------------------+
| See COPYING file for further copyright information |
+----------------------------------------------------------------------+
| Author: Oleg Grenrus <[email protected]> |
| See CREDITS for contributors |
+----------------------------------------------------------------------+
*/
#ifndef IGBINARY_H
#define IGBINARY_H
#ifdef PHP_WIN32
# include "ig_win32.h"
#else
# include <stdint.h>
#endif
#include "php.h"
#ifdef PHP_WIN32
# if defined(IGBINARY_EXPORTS) || (!defined(COMPILE_DL_IGBINARY))
# define IGBINARY_API __declspec(dllexport)
# elif defined(COMPILE_DL_IGBINARY)
# define IGBINARY_API __declspec(dllimport)
# else
# define IGBINARY_API /* nothing special */
# endif
#elif defined(__GNUC__) && __GNUC__ >= 4
# define IGBINARY_API __attribute__ ((visibility("default")))
#else
# define IGBINARY_API /* nothing special */
#endif
#define IGBINARY_VERSION "1.1.2-dev"
/** Serialize zval.
* Return buffer is allocated by this function with emalloc.
* @param[out] ret Return buffer
* @param[out] ret_len Size of return buffer
* @param[in] z Variable to be serialized
* @return 0 on success, 1 elsewhere.
*/
IGBINARY_API int igbinary_serialize(uint8_t **ret, size_t *ret_len, zval *z TSRMLS_DC);
/** Unserialize to zval.
* @param[in] buf Buffer with serialized data.
* @param[in] buf_len Buffer length.
* @param[out] z Unserialized zval
* @return 0 on success, 1 elsewhere.
*/
IGBINARY_API int igbinary_unserialize(const uint8_t *buf, size_t buf_len, zval **z TSRMLS_DC);
#endif /* IGBINARY_H */