summaryrefslogtreecommitdiff
path: root/main/streams/php_stream_transport.h
diff options
context:
space:
mode:
Diffstat (limited to 'main/streams/php_stream_transport.h')
-rw-r--r--main/streams/php_stream_transport.h75
1 files changed, 42 insertions, 33 deletions
diff --git a/main/streams/php_stream_transport.h b/main/streams/php_stream_transport.h
index 52df73d731..9674314c49 100644
--- a/main/streams/php_stream_transport.h
+++ b/main/streams/php_stream_transport.h
@@ -1,8 +1,8 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2013 The PHP Group |
+ | Copyright (c) 1997-2014 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 |
@@ -50,7 +50,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in
int flags, const char *persistent_id,
struct timeval *timeout,
php_stream_context *context,
- char **error_string,
+ zend_string **error_string,
int *error_code
STREAMS_DC TSRMLS_DC);
@@ -60,7 +60,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in
/* Bind the stream to a local address */
PHPAPI int php_stream_xport_bind(php_stream *stream,
const char *name, size_t namelen,
- char **error_text
+ zend_string **error_text
TSRMLS_DC);
/* Connect to a remote address */
@@ -68,28 +68,28 @@ PHPAPI int php_stream_xport_connect(php_stream *stream,
const char *name, size_t namelen,
int asynchronous,
struct timeval *timeout,
- char **error_text,
+ zend_string **error_text,
int *error_code
TSRMLS_DC);
/* Prepare to listen */
PHPAPI int php_stream_xport_listen(php_stream *stream,
int backlog,
- char **error_text
+ zend_string **error_text
TSRMLS_DC);
/* Get the next client and their address as a string, or the underlying address
* structure. You must efree either of these if you request them */
PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client,
- char **textaddr, int *textaddrlen,
+ zend_string **textaddr,
void **addr, socklen_t *addrlen,
struct timeval *timeout,
- char **error_text
+ zend_string **error_text
TSRMLS_DC);
/* Get the name of either the socket or it's peer */
PHPAPI int php_stream_xport_get_name(php_stream *stream, int want_peer,
- char **textaddr, int *textaddrlen,
+ zend_string **textaddr,
void **addr, socklen_t *addrlen
TSRMLS_DC);
@@ -102,7 +102,7 @@ enum php_stream_xport_send_recv_flags {
* peeking, optionally retrieving OOB data */
PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, size_t buflen,
long flags, void **addr, socklen_t *addrlen,
- char **textaddr, int *textaddrlen TSRMLS_DC);
+ zend_string **textaddr TSRMLS_DC);
/* Similar to send() system call; send data to the stream, optionally
* sending it as OOB data */
@@ -142,58 +142,67 @@ typedef struct _php_stream_xport_param {
struct {
char *name;
size_t namelen;
- int backlog;
struct timeval *timeout;
struct sockaddr *addr;
- socklen_t addrlen;
char *buf;
size_t buflen;
- long flags;
+ zend_long flags;
+ socklen_t addrlen;
+ int backlog;
} inputs;
struct {
php_stream *client;
- int returncode;
struct sockaddr *addr;
socklen_t addrlen;
- char *textaddr;
- long textaddrlen;
-
- char *error_text;
+ zend_string *textaddr;
+ zend_string *error_text;
+ int returncode;
int error_code;
} outputs;
} php_stream_xport_param;
-
-/* These functions provide crypto support on the underlying transport */
+/* Because both client and server streams use the same mechanisms
+ for encryption we use the LSB to denote clients.
+*/
typedef enum {
- STREAM_CRYPTO_METHOD_SSLv2_CLIENT,
- STREAM_CRYPTO_METHOD_SSLv3_CLIENT,
- STREAM_CRYPTO_METHOD_SSLv23_CLIENT,
- STREAM_CRYPTO_METHOD_TLS_CLIENT,
- STREAM_CRYPTO_METHOD_SSLv2_SERVER,
- STREAM_CRYPTO_METHOD_SSLv3_SERVER,
- STREAM_CRYPTO_METHOD_SSLv23_SERVER,
- STREAM_CRYPTO_METHOD_TLS_SERVER
+ STREAM_CRYPTO_METHOD_SSLv2_CLIENT = (1 << 1 | 1),
+ STREAM_CRYPTO_METHOD_SSLv3_CLIENT = (1 << 2 | 1),
+ STREAM_CRYPTO_METHOD_SSLv23_CLIENT = ((1 << 1) | (1 << 2) | 1),
+ STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT = (1 << 3 | 1),
+ STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT = (1 << 4 | 1),
+ STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT = (1 << 5 | 1),
+ STREAM_CRYPTO_METHOD_TLS_CLIENT = ((1 << 3) | (1 << 4) | (1 << 5) | 1),
+ STREAM_CRYPTO_METHOD_ANY_CLIENT = ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | 1),
+ STREAM_CRYPTO_METHOD_SSLv2_SERVER = (1 << 1),
+ STREAM_CRYPTO_METHOD_SSLv3_SERVER = (1 << 2),
+ STREAM_CRYPTO_METHOD_SSLv23_SERVER = ((1 << 1) | (1 << 2)),
+ STREAM_CRYPTO_METHOD_TLSv1_0_SERVER = (1 << 3),
+ STREAM_CRYPTO_METHOD_TLSv1_1_SERVER = (1 << 4),
+ STREAM_CRYPTO_METHOD_TLSv1_2_SERVER = (1 << 5),
+ STREAM_CRYPTO_METHOD_TLS_SERVER = ((1 << 3) | (1 << 4) | (1 << 5)),
+ STREAM_CRYPTO_METHOD_ANY_SERVER = ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5))
} php_stream_xport_crypt_method_t;
+/* These functions provide crypto support on the underlying transport */
+
BEGIN_EXTERN_C()
PHPAPI int php_stream_xport_crypto_setup(php_stream *stream, php_stream_xport_crypt_method_t crypto_method, php_stream *session_stream TSRMLS_DC);
PHPAPI int php_stream_xport_crypto_enable(php_stream *stream, int activate TSRMLS_DC);
END_EXTERN_C()
typedef struct _php_stream_xport_crypto_param {
- enum {
- STREAM_XPORT_CRYPTO_OP_SETUP,
- STREAM_XPORT_CRYPTO_OP_ENABLE
- } op;
struct {
+ php_stream *session;
int activate;
php_stream_xport_crypt_method_t method;
- php_stream *session;
} inputs;
struct {
int returncode;
} outputs;
+ enum {
+ STREAM_XPORT_CRYPTO_OP_SETUP,
+ STREAM_XPORT_CRYPTO_OP_ENABLE
+ } op;
} php_stream_xport_crypto_param;
BEGIN_EXTERN_C()