1 /* 2 +----------------------------------------------------------------------+ 3 | Yar - Light, concurrent RPC framework | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) 2012-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: Xinchen Hui <laruence@php.net> | 16 | Zhenyu Zhang <zhangzhenyu@php.net> | 17 +----------------------------------------------------------------------+ 18 */ 19 20 /* $Id$ */ 21 22 #ifndef PHP_YAR_TRANSPORT_H 23 #define PHP_YAR_TRANSPORT_H 24 25 #if HAVE_EPOLL 26 #define ENABLE_EPOLL 27 #endif 28 29 #define SEND_BUF_SIZE 1280 30 #define RECV_BUF_SIZE 1280 31 32 typedef struct _yar_call_data { 33 zend_long sequence; 34 zend_string *uri; 35 zend_string *method; 36 zval callback; 37 zval ecallback; 38 zval parameters; 39 zval options; 40 } yar_call_data_t; 41 42 typedef struct _yar_persistent_le { 43 void *ptr; 44 void (*dtor)(void *ptr); 45 } yar_persistent_le_t; 46 47 typedef int yar_concurrent_client_callback(yar_call_data_t *calldata, int status, struct _yar_response *response); 48 49 typedef struct _yar_transport_interface { 50 void *data; 51 int (*open)(struct _yar_transport_interface *self, zend_string *address, long options, char **msg); 52 int (*send)(struct _yar_transport_interface *self, struct _yar_request *request, char **msg); 53 struct _yar_response * (*exec)(struct _yar_transport_interface *self, struct _yar_request *request); 54 int (*setopt)(struct _yar_transport_interface *self, long type, void *value, void *addition); 55 int (*calldata)(struct _yar_transport_interface *self, yar_call_data_t *calldata); 56 void (*close)(struct _yar_transport_interface *self); 57 } yar_transport_interface_t; 58 59 typedef struct _yar_transport_multi_interface { 60 void *data; 61 int (*add)(struct _yar_transport_multi_interface *self, yar_transport_interface_t *cp); 62 int (*exec)(struct _yar_transport_multi_interface *self, yar_concurrent_client_callback *callback); 63 void (*close)(struct _yar_transport_multi_interface *self); 64 } yar_transport_multi_interface_t; 65 66 typedef struct _yar_transport_multi { 67 struct _yar_transport_multi_interface * (*init)(); 68 } yar_transport_multi_t; 69 70 typedef struct _yar_transport { 71 const char *name; 72 struct _yar_transport_interface * (*init)(); 73 void (*destroy)(yar_transport_interface_t *self); 74 yar_transport_multi_t *multi; 75 } yar_transport_t; 76 77 extern int le_calldata; 78 extern int le_plink; 79 80 PHP_YAR_API const yar_transport_t * php_yar_transport_get(char *name, int nlen); 81 PHP_YAR_API int php_yar_transport_register(const yar_transport_t *transport); 82 83 YAR_STARTUP_FUNCTION(transport); 84 YAR_SHUTDOWN_FUNCTION(transport); 85 86 #endif /* PHP_YAR_TRANSPORT_H */ 87 88 /* 89 * Local variables: 90 * tab-width: 4 91 * c-basic-offset: 4 92 * End: 93 * vim600: noet sw=4 ts=4 fdm=marker 94 * vim<600: noet sw=4 ts=4 95 */ 96