ext-uv/php_uv.h

85 lines
1.5 KiB
C
Raw Normal View History

2012-05-22 19:43:11 +02:00
#ifndef PHP_UV_H
#define PHP_UV_H
#define PHP_UV_EXTNAME "uv"
#define PHP_UV_EXTVER "0.1"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "uv.h"
2012-05-22 19:43:11 +02:00
#include "ext/spl/spl_exceptions.h"
#include "zend_interfaces.h"
/* Define the entry point symbol
* Zend will use when loading this module
*/
extern zend_module_entry uv_module_entry;
#define phpext_uv_ptr &uv_module_entry;
extern zend_class_entry *uv_class_entry;
2012-05-29 18:47:30 +02:00
enum php_uv_resource_type{
IS_UV_TCP = 0,
IS_UV_UDP = 1,
IS_UV_PIPE = 2,
IS_UV_IDLE = 3,
IS_UV_TIMER = 4,
IS_UV_ASYNC = 5,
IS_UV_LOOP = 6,
IS_UV_HANDLE = 7,
IS_UV_STREAM = 8,
IS_UV_ADDRINFO = 9,
IS_UV_MAX = 10
};
typedef struct {
2012-05-27 08:36:03 +02:00
int in_free;
2012-05-26 16:26:29 +02:00
int resource_id;
2012-05-29 18:47:30 +02:00
int type;
2012-05-26 15:59:59 +02:00
union {
uv_tcp_t tcp;
uv_udp_t udp;
uv_pipe_t pipe;
uv_idle_t idle;
uv_timer_t timer;
uv_async_t async;
uv_loop_t loop;
uv_handle_t handle;
uv_stream_t stream;
2012-05-28 18:12:09 +02:00
uv_getaddrinfo_t addrinfo;
2012-05-26 15:59:59 +02:00
} uv;
2012-05-28 18:12:09 +02:00
zval *address;
2012-05-26 15:25:15 +02:00
zval *listen_cb;
zval *read_cb;
zval *write_cb;
2012-05-26 15:54:43 +02:00
zval *close_cb;
2012-05-26 16:26:29 +02:00
zval *timer_cb;
2012-05-28 05:29:15 +02:00
zval *idle_cb;
2012-05-28 15:55:58 +02:00
zval *connect_cb;
2012-05-28 18:12:09 +02:00
zval *getaddr_cb;
2012-05-29 18:47:30 +02:00
zval *udp_recv_cb;
zval *udp_send_cb;
zval *pipe_connect_cb;
} php_uv_t;
2012-05-28 18:12:09 +02:00
typedef struct {
int is_ipv4;
int resource_id;
union {
struct sockaddr_in ipv4;
struct sockaddr_in6 ipv6;
} addr;
} php_uv_sockaddr_t;
#define PHP_UV_RESOURCE_NAME "uv"
2012-05-28 18:12:09 +02:00
#define PHP_UV_SOCKADDR_RESOURCE_NAME "uv_sockaddr"
#define PHP_UV_LOOP_RESOURCE_NAME "uv_loop"
2012-05-24 06:07:52 +02:00
#define PHP_UV_CONNECT_RESOURCE_NAME "uv_connect"
2012-05-22 19:43:11 +02:00
#endif /* PHP_UV_H */