summaryrefslogtreecommitdiff
path: root/main/streams/php_stream_transport.h
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2003-11-29 21:46:50 +0000
committerWez Furlong <wez@php.net>2003-11-29 21:46:50 +0000
commit37f135ceeffa522ec558cfac07bd53b98f5867e6 (patch)
tree1abe80f4f3ded538a6aafb76d9c4bfad0f9e370e /main/streams/php_stream_transport.h
parentfe93c2ac09276bd1971826f5b56c08335d78e314 (diff)
downloadphp-git-37f135ceeffa522ec558cfac07bd53b98f5867e6.tar.gz
Add stream_socket_sendto and stream_socket_recvfrom which work very much
like sendto() and recvfrom() syscalls.
Diffstat (limited to 'main/streams/php_stream_transport.h')
-rw-r--r--main/streams/php_stream_transport.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/main/streams/php_stream_transport.h b/main/streams/php_stream_transport.h
index 19da443a39..aa00132eb8 100644
--- a/main/streams/php_stream_transport.h
+++ b/main/streams/php_stream_transport.h
@@ -88,6 +88,22 @@ PHPAPI int php_stream_xport_get_name(php_stream *stream, int want_peer,
void **addr, socklen_t *addrlen
TSRMLS_DC);
+enum php_stream_xport_send_recv_flags {
+ STREAM_OOB = 1,
+ STREAM_PEEK = 2
+};
+
+/* Similar to recv() system call; read data from the stream, optionally
+ * 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);
+
+/* Similar to send() system call; send data to the stream, optionally
+ * sending it as OOB data */
+PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, size_t buflen,
+ long flags, void *addr, socklen_t addrlen TSRMLS_DC);
+
/* Structure definition for the set_option interface that the above functions wrap */
typedef struct _php_stream_xport_param {
@@ -96,7 +112,9 @@ typedef struct _php_stream_xport_param {
STREAM_XPORT_OP_LISTEN, STREAM_XPORT_OP_ACCEPT,
STREAM_XPORT_OP_CONNECT_ASYNC,
STREAM_XPORT_OP_GET_NAME,
- STREAM_XPORT_OP_GET_PEER_NAME
+ STREAM_XPORT_OP_GET_PEER_NAME,
+ STREAM_XPORT_OP_RECV,
+ STREAM_XPORT_OP_SEND
} op;
unsigned int want_addr:1;
unsigned int want_textaddr:1;
@@ -107,6 +125,11 @@ typedef struct _php_stream_xport_param {
long namelen;
int backlog;
struct timeval *timeout;
+ struct sockaddr *addr;
+ socklen_t addrlen;
+ char *buf;
+ size_t buflen;
+ long flags;
} inputs;
struct {
php_stream *client;