forked from laruence/yar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
yar_transport.h
75 lines (63 loc) · 3.2 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
/*
+----------------------------------------------------------------------+
| Yar - Light, concurrent RPC framework |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2011 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 |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Xinchen Hui <[email protected]> |
| Zhenyu Zhang <[email protected]> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_YAR_TRANSPORT_H
#define PHP_YAR_TRANSPORT_H
#include "yar_client.h"
#if 0 && HAVE_EPOLL
#define ENABLE_EPOLL
#endif
typedef int yar_concurrent_client_callback(zval *calldata, int status, int code, char *ret, size_t len TSRMLS_DC);
typedef struct _yar_transport_interface {
void *data;
int (*open)(struct _yar_transport_interface *self, char *address, uint len, char *hostname, long options, char **msg TSRMLS_DC);
int (*send)(struct _yar_transport_interface *self, char *payload, size_t len TSRMLS_DC);
int (*exec)(struct _yar_transport_interface *self, char **response, size_t *len, uint *code, char **msg TSRMLS_DC);
int (*setopt)(struct _yar_transport_interface *self, long type, void *value, void *addition TSRMLS_DC);
int (*calldata)(struct _yar_transport_interface *self, zval *calldata TSRMLS_DC);
void (*close)(struct _yar_transport_interface *self TSRMLS_DC);
} 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 TSRMLS_DC);
int (*exec)(struct _yar_transport_multi_interface *self, yar_concurrent_client_callback *callback TSRMLS_DC);
void (*close)(struct _yar_transport_multi_interface *self TSRMLS_DC);
} yar_transport_multi_interface_t;
typedef struct _yar_transport_multi {
struct _yar_transport_multi_interface * (*init)(TSRMLS_D);
} yar_transport_multi_t;
typedef struct _yar_transport {
const char *name;
struct _yar_transport_interface * (*init)(TSRMLS_D);
void (*destroy)(yar_transport_interface_t *self TSRMLS_DC);
yar_transport_multi_t *multi;
} yar_transport_t;
PHP_YAR_API yar_transport_t * php_yar_transport_get(char *name, int nlen TSRMLS_DC);
PHP_YAR_API int php_yar_transport_register(yar_transport_t *transport TSRMLS_DC);
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
*/