-
-
Notifications
You must be signed in to change notification settings - Fork 319
/
yar_transport.h
106 lines (89 loc) · 3.64 KB
/
yar_transport.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
+----------------------------------------------------------------------+
| Yar - Light, concurrent RPC framework |
+----------------------------------------------------------------------+
| Copyright (c) 2012-2013 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Xinchen Hui <laruence@php.net> |
| Zhenyu Zhang <zhangzhenyu@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_YAR_TRANSPORT_H
#define PHP_YAR_TRANSPORT_H
#if HAVE_EPOLL
#define ENABLE_EPOLL
#endif
#define YAR_MAX_CALLS 128
#define SEND_BUF_SIZE 1280
#define RECV_BUF_SIZE 1280
extern int le_plink;
/* forward declaration */
struct _yar_request;
struct _yar_response;
typedef struct _yar_persistent_le {
void *ptr;
void (*dtor)(void *ptr);
} yar_persistent_le_t;
typedef struct _yar_call_data {
zend_long sequence;
zend_string *uri;
zend_string *method;
zend_array *parameters;
void **options;
struct {
zend_fcall_info fci;
zend_fcall_info_cache fcc;
} callback;
struct {
zend_fcall_info fci;
zend_fcall_info_cache fcc;
} ecallback;
struct _yar_call_data *next;
} yar_call_data_t;
typedef int yar_concurrent_client_callback(yar_call_data_t *calldata, int status, struct _yar_response *response);
typedef struct _yar_transport_interface {
void *data;
int (*open)(struct _yar_transport_interface *self, zend_string *address, long options, char **msg);
int (*send)(struct _yar_transport_interface *self, struct _yar_request *request, char **msg);
struct _yar_response * (*exec)(struct _yar_transport_interface *self, struct _yar_request *request);
int (*setopt)(struct _yar_transport_interface *self, long type, void *value, void *addition);
int (*calldata)(struct _yar_transport_interface *self, yar_call_data_t *calldata);
void (*close)(struct _yar_transport_interface *self);
} yar_transport_interface_t;
typedef struct _yar_transport_multi_interface {
void *data;
int (*add)(struct _yar_transport_multi_interface *self, yar_transport_interface_t *cp);
int (*exec)(struct _yar_transport_multi_interface *self, yar_concurrent_client_callback *callback);
void (*close)(struct _yar_transport_multi_interface *self);
} yar_transport_multi_interface_t;
typedef struct _yar_transport_multi {
struct _yar_transport_multi_interface * (*init)();
} yar_transport_multi_t;
typedef struct _yar_transport {
const char *name;
struct _yar_transport_interface * (*init)();
void (*destroy)(yar_transport_interface_t *self);
yar_transport_multi_t *multi;
} yar_transport_t;
PHP_YAR_API const yar_transport_t * php_yar_transport_get(char *name, int nlen);
PHP_YAR_API int php_yar_transport_register(const yar_transport_t *transport);
YAR_STARTUP_FUNCTION(transport);
YAR_SHUTDOWN_FUNCTION(transport);
#endif /* PHP_YAR_TRANSPORT_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/