Server : nginx/1.18.0 System : Linux localhost 6.14.3-x86_64-linode168 #1 SMP PREEMPT_DYNAMIC Mon Apr 21 19:47:55 EDT 2025 x86_64 User : www-data ( 33) PHP Version : 8.0.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/include/php/20200930/ext/igbinary/src/php7/ |
/*
+----------------------------------------------------------------------+
| See COPYING file for further copyright information |
+----------------------------------------------------------------------+
| Author: Oleg Grenrus <oleg.grenrus@dynamoid.com> |
| See CREDITS for contributors |
+----------------------------------------------------------------------+
*/
#ifndef IGBINARY_H
#define IGBINARY_H
#include <stdint.h>
/* Forward declarations. */
struct zval;
/* Constants and constant macros */
/** Binary protocol version of igbinary. */
#define IGBINARY_FORMAT_VERSION 0x00000002
#define PHP_IGBINARY_VERSION "3.2.6"
/* Macros */
#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
/** Struct that contains pointers to memory allocation and deallocation functions.
* @see igbinary_serialize_data
*/
struct igbinary_memory_manager {
void *(*alloc)(size_t size, void *context);
void *(*realloc)(void *ptr, size_t new_size, void *context);
void (*free)(void *ptr, void *context);
void *context;
};
/** 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);
/** 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
* @param[in] memory_manager Pointer to the structure that contains memory allocation functions.
* @return 0 on success, 1 elsewhere.
*/
IGBINARY_API int igbinary_serialize_ex(uint8_t **ret, size_t *ret_len, zval *z, struct igbinary_memory_manager *memory_manager);
/** 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);
#endif /* IGBINARY_H */