php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
conversions.h
Go to the documentation of this file.
1#ifndef PHP_SOCK_CONVERSIONS_H
2#define PHP_SOCK_CONVERSIONS_H 1
3
4#include <php.h>
5
6#ifndef PHP_WIN32
7# include <netinet/in.h>
8# include <sys/socket.h>
9# if defined(__FreeBSD__) || defined(__NetBSD__)
10# include <sys/un.h>
11# if defined(__FreeBSD__)
12 // we can't fully implement the ancillary data feature with
13 // the legacy sockcred/LOCAL_CREDS pair (due to lack of process
14 // id handling), so we disable it since only the
15 // sockcred2/LOCAL_CREDS_PERSISTENT pair can address it.
16# undef LOCAL_CREDS
17# endif
18# endif
19#else
20# include <Ws2tcpip.h>
21#endif
22
23#include "php_sockets.h"
24
25/* TYPE DEFINITIONS */
26struct err_s {
28 char *msg;
29 int level;
31};
32
33struct key_value {
34 const char *key;
35 unsigned key_size;
36 void *value;
37};
38
39/* the complete types of these two are not relevant to the outside */
42
43#define KEY_RECVMSG_RET "recvmsg_ret"
44
45typedef void (from_zval_write_field)(const zval *arr_value, char *field, ser_context *ctx);
46typedef void (to_zval_read_field)(const char *data, zval *zv, res_context *ctx);
47
48/* VARIABLE DECLARATIONS */
49extern const struct key_value empty_key_value_list[];
50
51/* AUX FUNCTIONS */
52void err_msg_dispose(struct err_s *err);
53void allocations_dispose(zend_llist **allocations);
54
55/* CONVERSION FUNCTIONS */
56void from_zval_write_int(const zval *arr_value, char *field, ser_context *ctx);
57void to_zval_read_int(const char *data, zval *zv, res_context *ctx);
58
59#ifdef IPV6_PKTINFO
60void from_zval_write_in6_pktinfo(const zval *container, char *in6_pktinfo_c, ser_context *ctx);
61void to_zval_read_in6_pktinfo(const char *data, zval *zv, res_context *ctx);
62#endif
63
64#if defined(SO_PASSCRED) || defined(LOCAL_CREDS_PERSISTENT) || defined(LOCAL_CREDS)
65void from_zval_write_ucred(const zval *container, char *ucred_c, ser_context *ctx);
66void to_zval_read_ucred(const char *data, zval *zv, res_context *ctx);
67#endif
68
69#ifdef SCM_RIGHTS
70size_t calculate_scm_rights_space(const zval *arr, ser_context *ctx);
71void from_zval_write_fd_array(const zval *arr, char *int_arr, ser_context *ctx);
72void to_zval_read_fd_array(const char *data, zval *zv, res_context *ctx);
73#endif
74
75void from_zval_write_msghdr_send(const zval *container, char *msghdr_c, ser_context *ctx);
76void from_zval_write_msghdr_recv(const zval *container, char *msghdr_c, ser_context *ctx);
77void to_zval_read_msghdr(const char *msghdr_c, zval *zv, res_context *ctx);
78
79/* ENTRY POINTS FOR CONVERSIONS */
81 php_socket *sock,
83 size_t struct_size,
84 const char *top_name,
85 zend_llist **allocations /* out */,
86 struct err_s *err /* in/out */);
87
88zval *to_zval_run_conversions(const char *structure,
89 to_zval_read_field *reader,
90 const char *top_name,
91 const struct key_value *key_value_pairs,
92 struct err_s *err, zval *zv);
93
94#endif
const struct key_value empty_key_value_list[]
struct _ser_context ser_context
Definition conversions.h:40
void * from_zval_run_conversions(const zval *container, php_socket *sock, from_zval_write_field *writer, size_t struct_size, const char *top_name, zend_llist **allocations, struct err_s *err)
struct _res_context res_context
Definition conversions.h:41
void to_zval_read_msghdr(const char *msghdr_c, zval *zv, res_context *ctx)
void to_zval_read_field(const char *data, zval *zv, res_context *ctx)
Definition conversions.h:46
void from_zval_write_field(const zval *arr_value, char *field, ser_context *ctx)
Definition conversions.h:45
void from_zval_write_msghdr_recv(const zval *container, char *msghdr_c, ser_context *ctx)
void allocations_dispose(zend_llist **allocations)
void from_zval_write_int(const zval *arr_value, char *field, ser_context *ctx)
void err_msg_dispose(struct err_s *err)
void from_zval_write_msghdr_send(const zval *container, char *msghdr_c, ser_context *ctx)
void to_zval_read_int(const char *data, zval *zv, res_context *ctx)
zval * to_zval_run_conversions(const char *structure, to_zval_read_field *reader, const char *top_name, const struct key_value *key_value_pairs, struct err_s *err, zval *zv)
zval * zv
Definition ffi.c:3975
char * err
Definition ffi.c:3029
zend_constant * data
int level
Definition conversions.h:29
int has_error
Definition conversions.h:27
int should_free
Definition conversions.h:30
char * msg
Definition conversions.h:28
const char * key
Definition conversions.h:34
unsigned key_size
Definition conversions.h:35
void * value
Definition conversions.h:36
struct _zval_struct zval
ZEND_API void(ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data)
struct _zend_llist zend_llist
container