mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-30 04:29:01 +01:00
add uv_udp_set_membership api
This commit is contained in:
parent
eb60baf01f
commit
f57217a8e1
2
TODO.md
2
TODO.md
@ -8,12 +8,10 @@
|
||||
* UV_EXTERN int uv_process_kill(uv_process_t*, int signum);
|
||||
* UV_EXTERN uv_err_t uv_set_process_title(const char* title);
|
||||
|
||||
|
||||
# functions
|
||||
|
||||
* UV_EXTERN int uv_read2_start(uv_stream_t*, uv_alloc_cb alloc_cb,uv_read2_cb read_cb);
|
||||
* UV_EXTERN int uv_write2(uv_write_t* req, uv_stream_t* handle, uv_buf_t bufs[],int bufcnt, uv_stream_t* send_handle, uv_write_cb cb);
|
||||
* UV_EXTERN int uv_udp_set_membership(uv_udp_t* handle,const char* multicast_addr, const char* interface_addr,uv_membership membership);
|
||||
|
||||
* UV_EXTERN int uv_queue_work(uv_loop_t* loop, uv_work_t* req, uv_work_cb work_cb, uv_after_work_cb after_work_cb);
|
||||
* UV_EXTERN char** uv_setup_args(int argc, char** argv);
|
||||
|
23
php_uv.c
23
php_uv.c
@ -2480,6 +2480,28 @@ PHP_FUNCTION(uv_udp_recv_stop)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
PHP_FUNCTION(uv_udp_set_membership)
|
||||
{
|
||||
zval *client;
|
||||
php_uv_t *uv;
|
||||
char *multicast_addr, interface_addr = NULL;
|
||||
int error, multicast_addr_len, interface_addr_len = 0;
|
||||
long membership;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
|
||||
"rssl", &client, &multicast_addr, &multicast_addr_len, &interface_addr, &interface_addr_len, &membership) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(uv, php_uv_t *, &client, -1, PHP_UV_RESOURCE_NAME, uv_resource_handle);
|
||||
|
||||
error = uv_udp_set_membership((uv_udp_t*)&uv->uv.udp, multicast_addr, interface_addr, membership);
|
||||
|
||||
RETURN_LONG(error);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ */
|
||||
PHP_FUNCTION(uv_udp_set_multicast_loop)
|
||||
{
|
||||
@ -4962,6 +4984,7 @@ static zend_function_entry uv_functions[] = {
|
||||
PHP_FE(uv_udp_send, arginfo_uv_udp_send)
|
||||
PHP_FE(uv_udp_recv_start, arginfo_uv_udp_recv_start)
|
||||
PHP_FE(uv_udp_recv_stop, arginfo_uv_udp_recv_stop)
|
||||
PHP_FE(uv_udp_set_membership, NULL)
|
||||
/* other network functions */
|
||||
PHP_FE(uv_tcp_getsockname, NULL)
|
||||
PHP_FE(uv_tcp_getpeername, NULL)
|
||||
|
3
uv.c
3
uv.c
@ -61,6 +61,9 @@ static int php_uv_class_init(TSRMLS_D)
|
||||
zend_declare_class_constant_long(uv_class_entry, "AF_INET6", sizeof("AF_INET6")-1, AF_INET6 TSRMLS_CC);
|
||||
zend_declare_class_constant_long(uv_class_entry, "AF_UNSPEC", sizeof("AF_UNSPEC")-1, AF_UNSPEC TSRMLS_CC);
|
||||
|
||||
zend_declare_class_constant_long(uv_class_entry, "LEAVE_GROUP", sizeof("LEAVE_GROUP")-1, UV_LEAVE_GROUP TSRMLS_CC);
|
||||
zend_declare_class_constant_long(uv_class_entry, "JOIN_GROUP", sizeof("JOIN_GROUP")-1, UV_JOIN_GROUP TSRMLS_CC);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user