Lines Matching refs:ctx

100 static int param_get_bool(void *ctx, const char *key, int def)  in param_get_bool()  argument
103 if ((elem = zend_hash_str_find_ptr(ctx, key, strlen(key))) != NULL) { in param_get_bool()
111 static inline void *accounted_emalloc(size_t alloc_size, ser_context *ctx) in accounted_emalloc() argument
114 zend_llist_add_element(&ctx->allocations, &ret); in accounted_emalloc()
117 static inline void *accounted_ecalloc(size_t nmemb, size_t alloc_size, ser_context *ctx) in accounted_ecalloc() argument
120 zend_llist_add_element(&ctx->allocations, &ret); in accounted_ecalloc()
123 …line void *accounted_safe_ecalloc(size_t nmemb, size_t alloc_size, size_t offset, ser_context *ctx) in accounted_safe_ecalloc() argument
127 zend_llist_add_element(&ctx->allocations, &ret); in accounted_safe_ecalloc()
174 static void do_from_zval_err(ser_context *ctx, const char *fmt, ...) in do_from_zval_err() argument
179 do_from_to_zval_err(&ctx->err, &ctx->keys, "user", fmt, ap); in do_from_zval_err()
183 static void do_to_zval_err(res_context *ctx, const char *fmt, ...) in do_to_zval_err() argument
188 do_from_to_zval_err(&ctx->err, &ctx->keys, "native", fmt, ap); in do_to_zval_err()
209 void (*func)(zval *elem, unsigned i, void **args, ser_context *ctx), in from_array_iterate() argument
211 ser_context *ctx) in from_array_iterate()
224 zend_llist_add_element(&ctx->keys, &bufp); in from_array_iterate()
226 func(elem, i, args, ctx); in from_array_iterate()
228 zend_llist_remove_tail(&ctx->keys); in from_array_iterate()
229 if (ctx->err.has_error) { in from_array_iterate()
242 ser_context *ctx) in from_zval_write_aggregation() argument
248 do_from_zval_err(ctx, "%s", "expected an array here"); in from_zval_write_aggregation()
251 for (descr = descriptors; descr->name != NULL && !ctx->err.has_error; descr++) { in from_zval_write_aggregation()
256 do_from_zval_err(ctx, "No information on how to convert value " in from_zval_write_aggregation()
261 zend_llist_add_element(&ctx->keys, (void*)&descr->name); in from_zval_write_aggregation()
262 descr->from_zval(elem, ((char*)structure) + descr->field_offset, ctx); in from_zval_write_aggregation()
263 zend_llist_remove_tail(&ctx->keys); in from_zval_write_aggregation()
266 do_from_zval_err(ctx, "The key '%s' is required", descr->name); in from_zval_write_aggregation()
274 res_context *ctx) in to_zval_read_aggregation() argument
281 for (descr = descriptors; descr->name != NULL && !ctx->err.has_error; descr++) { in to_zval_read_aggregation()
285 do_to_zval_err(ctx, "No information on how to convert native " in to_zval_read_aggregation()
293 zend_llist_add_element(&ctx->keys, (void*)&descr->name); in to_zval_read_aggregation()
294 descr->to_zval(structure + descr->field_offset, new_zv, ctx); in to_zval_read_aggregation()
295 zend_llist_remove_tail(&ctx->keys); in to_zval_read_aggregation()
300 static zend_long from_zval_integer_common(const zval *arr_value, ser_context *ctx) in from_zval_integer_common() argument
329 ctx->err.has_error = 1; in from_zval_integer_common()
346 do_from_zval_err(ctx, "expected an integer, but got a non numeric " in from_zval_integer_common()
352 do_from_zval_err(ctx, "%s", "expected an integer, either of a PHP " in from_zval_integer_common()
361 void from_zval_write_int(const zval *arr_value, char *field, ser_context *ctx) in from_zval_write_int() argument
366 lval = from_zval_integer_common(arr_value, ctx); in from_zval_write_int()
367 if (ctx->err.has_error) { in from_zval_write_int()
372 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_int()
380 static void from_zval_write_uint32(const zval *arr_value, char *field, ser_context *ctx) in from_zval_write_uint32() argument
385 lval = from_zval_integer_common(arr_value, ctx); in from_zval_write_uint32()
386 if (ctx->err.has_error) { in from_zval_write_uint32()
391 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_uint32()
399 static void from_zval_write_net_uint16(const zval *arr_value, char *field, ser_context *ctx) in from_zval_write_net_uint16() argument
404 lval = from_zval_integer_common(arr_value, ctx); in from_zval_write_net_uint16()
405 if (ctx->err.has_error) { in from_zval_write_net_uint16()
410 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_net_uint16()
418 static void from_zval_write_sa_family(const zval *arr_value, char *field, ser_context *ctx) in from_zval_write_sa_family() argument
423 lval = from_zval_integer_common(arr_value, ctx); in from_zval_write_sa_family()
424 if (ctx->err.has_error) { in from_zval_write_sa_family()
429 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_sa_family()
439 static void from_zval_write_pid_t(const zval *arr_value, char *field, ser_context *ctx) in from_zval_write_pid_t() argument
444 lval = from_zval_integer_common(arr_value, ctx); in from_zval_write_pid_t()
445 if (ctx->err.has_error) { in from_zval_write_pid_t()
450 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_pid_t()
458 static void from_zval_write_uid_t(const zval *arr_value, char *field, ser_context *ctx) in from_zval_write_uid_t() argument
463 lval = from_zval_integer_common(arr_value, ctx); in from_zval_write_uid_t()
464 if (ctx->err.has_error) { in from_zval_write_uid_t()
471 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_uid_t()
477 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_uid_t()
488 void to_zval_read_int(const char *data, zval *zv, res_context *ctx) in to_zval_read_int() argument
495 static void to_zval_read_net_uint16(const char *data, zval *zv, res_context *ctx) in to_zval_read_net_uint16() argument
502 static void to_zval_read_sa_family(const char *data, zval *zv, res_context *ctx) in to_zval_read_sa_family() argument
510 static void to_zval_read_unsigned(const char *data, zval *zv, res_context *ctx) in to_zval_read_unsigned() argument
517 static void to_zval_read_uint32(const char *data, zval *zv, res_context *ctx) in to_zval_read_uint32() argument
526 static void to_zval_read_pid_t(const char *data, zval *zv, res_context *ctx) in to_zval_read_pid_t() argument
533 static void to_zval_read_uid_t(const char *data, zval *zv, res_context *ctx) in to_zval_read_uid_t() argument
543 static void from_zval_write_sin_addr(const zval *zaddr_str, char *inaddr, ser_context *ctx) in from_zval_write_sin_addr() argument
550 res = php_set_inet_addr(&saddr, ZSTR_VAL(addr_str), ctx->sock); in from_zval_write_sin_addr()
555 do_from_zval_err(ctx, "could not resolve address '%s' to get an AF_INET " in from_zval_write_sin_addr()
561 static void to_zval_read_sin_addr(const char *data, zval *zv, res_context *ctx) in to_zval_read_sin_addr() argument
571 do_to_zval_err(ctx, "could not convert IPv4 address to string " in to_zval_read_sin_addr()
584 static void from_zval_write_sockaddr_in(const zval *container, char *sockaddr, ser_context *ctx) in from_zval_write_sockaddr_in() argument
586 from_zval_write_aggregation(container, sockaddr, descriptors_sockaddr_in, ctx); in from_zval_write_sockaddr_in()
588 static void to_zval_read_sockaddr_in(const char *data, zval *zv, res_context *ctx) in to_zval_read_sockaddr_in() argument
590 to_zval_read_aggregation(data, zv, descriptors_sockaddr_in, ctx); in to_zval_read_sockaddr_in()
593 static void from_zval_write_sin6_addr(const zval *zaddr_str, char *addr6, ser_context *ctx) in from_zval_write_sin6_addr() argument
600 res = php_set_inet6_addr(&saddr6, ZSTR_VAL(addr_str), ctx->sock); in from_zval_write_sin6_addr()
605 do_from_zval_err(ctx, "could not resolve address '%s' to get an AF_INET6 " in from_zval_write_sin6_addr()
611 static void to_zval_read_sin6_addr(const char *data, zval *zv, res_context *ctx) in to_zval_read_sin6_addr() argument
622 do_to_zval_err(ctx, "could not convert IPv6 address to string " in to_zval_read_sin6_addr()
637 static void from_zval_write_sockaddr_in6(const zval *container, char *sockaddr6, ser_context *ctx) in from_zval_write_sockaddr_in6() argument
639 from_zval_write_aggregation(container, sockaddr6, descriptors_sockaddr_in6, ctx); in from_zval_write_sockaddr_in6()
641 static void to_zval_read_sockaddr_in6(const char *data, zval *zv, res_context *ctx) in to_zval_read_sockaddr_in6() argument
643 to_zval_read_aggregation(data, zv, descriptors_sockaddr_in6, ctx); in to_zval_read_sockaddr_in6()
646 static void from_zval_write_sun_path(const zval *path, char *sockaddr_un_c, ser_context *ctx) in from_zval_write_sun_path() argument
657 do_from_zval_err(ctx, "%s", "the path is cannot be empty"); in from_zval_write_sun_path()
662 do_from_zval_err(ctx, "the path is too long, the maximum permitted " in from_zval_write_sun_path()
673 static void to_zval_read_sun_path(const char *data, zval *zv, res_context *ctx) { in to_zval_read_sun_path() argument
679 do_to_zval_err(ctx, "could not find a NUL in the path"); in to_zval_read_sun_path()
690 static void from_zval_write_sockaddr_un(const zval *container, char *sockaddr, ser_context *ctx) in from_zval_write_sockaddr_un() argument
692 from_zval_write_aggregation(container, sockaddr, descriptors_sockaddr_un, ctx); in from_zval_write_sockaddr_un()
694 static void to_zval_read_sockaddr_un(const char *data, zval *zv, res_context *ctx) in to_zval_read_sockaddr_un() argument
696 to_zval_read_aggregation(data, zv, descriptors_sockaddr_un, ctx); in to_zval_read_sockaddr_un()
701 ser_context *ctx) in from_zval_write_sockaddr_aux() argument
711 do_from_zval_err(ctx, "%s", "expected an array here"); in from_zval_write_sockaddr_aux()
715 fill_sockaddr = param_get_bool(ctx, KEY_FILL_SOCKADDR, 1); in from_zval_write_sockaddr_aux()
720 zend_llist_add_element(&ctx->keys, &node); in from_zval_write_sockaddr_aux()
721 from_zval_write_int(elem, (char*)&family, ctx); in from_zval_write_sockaddr_aux()
722 zend_llist_remove_tail(&ctx->keys); in from_zval_write_sockaddr_aux()
724 if (UNEXPECTED(ctx->err.has_error)) { in from_zval_write_sockaddr_aux()
728 family = ctx->sock->type; in from_zval_write_sockaddr_aux()
734 if (ctx->sock->type != AF_INET && ctx->sock->type != AF_INET6) { in from_zval_write_sockaddr_aux()
735 do_from_zval_err(ctx, "the specified family (number %d) is not " in from_zval_write_sockaddr_aux()
739 *sockaddr_ptr = accounted_ecalloc(1, sizeof(struct sockaddr_in), ctx); in from_zval_write_sockaddr_aux()
742 from_zval_write_sockaddr_in(container, (char*)*sockaddr_ptr, ctx); in from_zval_write_sockaddr_aux()
749 if (ctx->sock->type != AF_INET6) { in from_zval_write_sockaddr_aux()
750 do_from_zval_err(ctx, "the specified family (AF_INET6) is not " in from_zval_write_sockaddr_aux()
754 *sockaddr_ptr = accounted_ecalloc(1, sizeof(struct sockaddr_in6), ctx); in from_zval_write_sockaddr_aux()
757 from_zval_write_sockaddr_in6(container, (char*)*sockaddr_ptr, ctx); in from_zval_write_sockaddr_aux()
764 if (ctx->sock->type != AF_UNIX) { in from_zval_write_sockaddr_aux()
765 do_from_zval_err(ctx, "the specified family (AF_UNIX) is not " in from_zval_write_sockaddr_aux()
769 *sockaddr_ptr = accounted_ecalloc(1, sizeof(struct sockaddr_un), ctx); in from_zval_write_sockaddr_aux()
773 from_zval_write_sockaddr_un(container, (char*)*sockaddr_ptr, ctx); in from_zval_write_sockaddr_aux()
790 do_from_zval_err(ctx, "%s", "the only families currently supported are " in from_zval_write_sockaddr_aux()
795 static void to_zval_read_sockaddr_aux(const char *sockaddr_c, zval *zv, res_context *ctx) in to_zval_read_sockaddr_aux() argument
808 to_zval_read_sockaddr_in(sockaddr_c, zv, ctx); in to_zval_read_sockaddr_aux()
813 to_zval_read_sockaddr_in6(sockaddr_c, zv, ctx); in to_zval_read_sockaddr_aux()
818 to_zval_read_sockaddr_un(sockaddr_c, zv, ctx); in to_zval_read_sockaddr_aux()
822 do_to_zval_err(ctx, "cannot read struct sockaddr with family %d; " in to_zval_read_sockaddr_aux()
844 ser_context *ctx) in from_zval_write_control() argument
867 from_zval_write_aggregation(arr, (char *)&level, descriptor_level, ctx); in from_zval_write_control()
868 if (ctx->err.has_error) { in from_zval_write_control()
871 from_zval_write_aggregation(arr, (char *)&type, descriptor_type, ctx); in from_zval_write_control()
872 if (ctx->err.has_error) { in from_zval_write_control()
878 do_from_zval_err(ctx, "cmsghdr with level %d and type %d not supported", in from_zval_write_control()
887 do_from_zval_err(ctx, "cmsghdr should have a 'data' element here"); in from_zval_write_control()
890 data_len = entry->calc_space(data_elem, ctx); in from_zval_write_control()
891 if (ctx->err.has_error) { in from_zval_write_control()
914 from_zval_write_aggregation(arr, (char*)CMSG_DATA(cmsghdr), descriptor_data, ctx); in from_zval_write_control()
918 static void from_zval_write_control_array(const zval *arr, char *msghdr_c, ser_context *ctx) in from_zval_write_control_array() argument
932 do_from_zval_err(ctx, "%s", "expected an array here"); in from_zval_write_control_array()
942 control_buf = accounted_safe_ecalloc(num_elems, CMSG_SPACE(20), 0, ctx); in from_zval_write_control_array()
943 alloc = ctx->allocations.tail; in from_zval_write_control_array()
948 if (ctx->err.has_error) { in from_zval_write_control_array()
955 zend_llist_add_element(&ctx->keys, &bufp); in from_zval_write_control_array()
957 from_zval_write_control(elem, &control_buf, alloc, &control_len, &cur_offset, ctx); in from_zval_write_control_array()
959 zend_llist_remove_tail(&ctx->keys); in from_zval_write_control_array()
965 static void to_zval_read_cmsg_data(const char *cmsghdr_c, zval *zv, res_context *ctx) in to_zval_read_cmsg_data() argument
974 do_to_zval_err(ctx, "cmsghdr with level %d and type %d not supported", in to_zval_read_cmsg_data()
979 do_to_zval_err(ctx, "the cmsghdr structure is unexpectedly small; " in to_zval_read_cmsg_data()
987 if (zend_hash_str_add_ptr(&ctx->params, KEY_CMSG_LEN, sizeof(KEY_CMSG_LEN) - 1, len_p) == NULL) { in to_zval_read_cmsg_data()
988 do_to_zval_err(ctx, "%s", "could not set parameter " KEY_CMSG_LEN); in to_zval_read_cmsg_data()
992 entry->to_array((const char *)CMSG_DATA(cmsg), zv, ctx); in to_zval_read_cmsg_data()
994 zend_hash_str_del(&ctx->params, KEY_CMSG_LEN, sizeof(KEY_CMSG_LEN) - 1); in to_zval_read_cmsg_data()
996 static void to_zval_read_control(const char *cmsghdr_c, zval *zv, res_context *ctx) in to_zval_read_control() argument
1007 to_zval_read_aggregation(cmsghdr_c, zv, descriptors, ctx); in to_zval_read_control()
1009 static void to_zval_read_control_array(const char *msghdr_c, zval *zv, res_context *ctx) in to_zval_read_control_array() argument
1020 cmsg != NULL && !ctx->err.has_error; in to_zval_read_control_array()
1030 zend_llist_add_element(&ctx->keys, &bufp); in to_zval_read_control_array()
1032 to_zval_read_control((const char *)cmsg, elem, ctx); in to_zval_read_control_array()
1034 zend_llist_remove_tail(&ctx->keys); in to_zval_read_control_array()
1039 static void from_zval_write_name(const zval *zname_arr, char *msghdr_c, ser_context *ctx) in from_zval_write_name() argument
1045 from_zval_write_sockaddr_aux(zname_arr, &sockaddr, &sockaddr_len, ctx); in from_zval_write_name()
1050 static void to_zval_read_name(const char *sockaddr_p, zval *zv, res_context *ctx) in to_zval_read_name() argument
1056 to_zval_read_sockaddr_aux(name, zv, ctx); in to_zval_read_name()
1059 static void from_zval_write_msghdr_buffer_size(const zval *elem, char *msghdr_c, ser_context *ctx) in from_zval_write_msghdr_buffer_size() argument
1064 lval = from_zval_integer_common(elem, ctx); in from_zval_write_msghdr_buffer_size()
1065 if (ctx->err.has_error) { in from_zval_write_msghdr_buffer_size()
1070 do_from_zval_err(ctx, "the buffer size must be between 1 and " ZEND_LONG_FMT "; " in from_zval_write_msghdr_buffer_size()
1076 msghdr->msg_iov = accounted_emalloc(sizeof(*msghdr->msg_iov) * 1, ctx); in from_zval_write_msghdr_buffer_size()
1077 msghdr->msg_iov[0].iov_base = accounted_emalloc((size_t)lval, ctx); in from_zval_write_msghdr_buffer_size()
1080 static void from_zval_write_iov_array_aux(zval *elem, unsigned i, void **args, ser_context *ctx) in from_zval_write_iov_array_aux() argument
1087 msg->msg_iov[i - 1].iov_base = accounted_emalloc(ZSTR_LEN(str), ctx); in from_zval_write_iov_array_aux()
1093 static void from_zval_write_iov_array(const zval *arr, char *msghdr_c, ser_context *ctx) in from_zval_write_iov_array() argument
1099 do_from_zval_err(ctx, "%s", "expected an array here"); in from_zval_write_iov_array()
1108 msg->msg_iov = accounted_safe_ecalloc(num_elem, sizeof *msg->msg_iov, 0, ctx); in from_zval_write_iov_array()
1111 from_array_iterate(arr, from_zval_write_iov_array_aux, (void**)&msg, ctx); in from_zval_write_iov_array()
1113 static void from_zval_write_controllen(const zval *elem, char *msghdr_c, ser_context *ctx) in from_zval_write_controllen() argument
1121 from_zval_write_uint32(elem, (char*)&len, ctx); in from_zval_write_controllen()
1122 if (ctx->err.has_error) { in from_zval_write_controllen()
1126 do_from_zval_err(ctx, "controllen cannot be 0"); in from_zval_write_controllen()
1129 msghdr->msg_control = accounted_emalloc(len, ctx); in from_zval_write_controllen()
1132 void from_zval_write_msghdr_send(const zval *container, char *msghdr_c, ser_context *ctx) in from_zval_write_msghdr_send() argument
1141 from_zval_write_aggregation(container, msghdr_c, descriptors, ctx); in from_zval_write_msghdr_send()
1143 void from_zval_write_msghdr_recv(const zval *container, char *msghdr_c, ser_context *ctx) in from_zval_write_msghdr_recv() argument
1169 …if (zend_hash_str_add_ptr(&ctx->params, KEY_FILL_SOCKADDR, sizeof(KEY_FILL_SOCKADDR) - 1, (void *)… in from_zval_write_msghdr_recv()
1170 do_from_zval_err(ctx, "could not add fill_sockaddr; this is a bug"); in from_zval_write_msghdr_recv()
1174 from_zval_write_aggregation(container, msghdr_c, descriptors, ctx); in from_zval_write_msghdr_recv()
1176 zend_hash_str_del(&ctx->params, KEY_FILL_SOCKADDR, sizeof(KEY_FILL_SOCKADDR) - 1); in from_zval_write_msghdr_recv()
1177 if (ctx->err.has_error) { in from_zval_write_msghdr_recv()
1183 msghdr->msg_iov = accounted_emalloc(sizeof(*msghdr->msg_iov) * 1, ctx); in from_zval_write_msghdr_recv()
1184 msghdr->msg_iov[0].iov_base = accounted_emalloc((size_t)DEFAULT_BUFF_SIZE, ctx); in from_zval_write_msghdr_recv()
1189 static void to_zval_read_iov(const char *msghdr_c, zval *zv, res_context *ctx) in to_zval_read_iov() argument
1198 do_to_zval_err(ctx, "unexpectedly large value for iov_len: %lu", in to_zval_read_iov()
1203 …if ((recvmsg_ret = zend_hash_str_find_ptr(&ctx->params, KEY_RECVMSG_RET, sizeof(KEY_RECVMSG_RET) -… in to_zval_read_iov()
1204 do_to_zval_err(ctx, "recvmsg_ret not found in params. This is a bug"); in to_zval_read_iov()
1222 void to_zval_read_msghdr(const char *msghdr_c, zval *zv, res_context *ctx) in to_zval_read_msghdr() argument
1234 to_zval_read_aggregation(msghdr_c, zv, descriptors, ctx); in to_zval_read_msghdr()
1239 static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context *ctx) in from_zval_write_ifindex() argument
1245 do_from_zval_err(ctx, "the interface index cannot be negative or " in from_zval_write_ifindex()
1258 do_from_zval_err(ctx, "no interface with name \"%s\" could be found", ZSTR_VAL(str)); in from_zval_write_ifindex()
1265 do_from_zval_err(ctx, "the interface name \"%s\" is too large ", ZSTR_VAL(str)); in from_zval_write_ifindex()
1266 } else if (ioctl(ctx->sock->bsd_socket, SIOCGIFINDEX, &ifr) < 0) { in from_zval_write_ifindex()
1268 do_from_zval_err(ctx, "no interface with name \"%s\" could be " in from_zval_write_ifindex()
1271 do_from_zval_err(ctx, "error fetching interface index for " in from_zval_write_ifindex()
1280 do_from_zval_err(ctx, in from_zval_write_ifindex()
1288 if (!ctx->err.has_error) { in from_zval_write_ifindex()
1299 void from_zval_write_in6_pktinfo(const zval *container, char *in6_pktinfo_c, ser_context *ctx) in from_zval_write_in6_pktinfo() argument
1301 from_zval_write_aggregation(container, in6_pktinfo_c, descriptors_in6_pktinfo, ctx); in from_zval_write_in6_pktinfo()
1303 void to_zval_read_in6_pktinfo(const char *data, zval *zv, res_context *ctx) in to_zval_read_in6_pktinfo() argument
1307 to_zval_read_aggregation(data, zv, descriptors_in6_pktinfo, ctx); in to_zval_read_in6_pktinfo()
1337 void from_zval_write_ucred(const zval *container, char *ucred_c, ser_context *ctx) in from_zval_write_ucred() argument
1339 from_zval_write_aggregation(container, ucred_c, descriptors_ucred, ctx); in from_zval_write_ucred()
1341 void to_zval_read_ucred(const char *data, zval *zv, res_context *ctx) in to_zval_read_ucred() argument
1345 to_zval_read_aggregation(data, zv, descriptors_ucred, ctx); in to_zval_read_ucred()
1351 size_t calculate_scm_rights_space(const zval *arr, ser_context *ctx) in calculate_scm_rights_space() argument
1356 do_from_zval_err(ctx, "%s", "expected an array here"); in calculate_scm_rights_space()
1362 do_from_zval_err(ctx, "%s", "expected at least one element in this array"); in calculate_scm_rights_space()
1368 static void from_zval_write_fd_array_aux(zval *elem, unsigned i, void **args, ser_context *ctx) in from_zval_write_fd_array_aux() argument
1375 do_from_zval_err(ctx, "socket is already closed"); in from_zval_write_fd_array_aux()
1388 do_from_zval_err(ctx, "resource is not a stream"); in from_zval_write_fd_array_aux()
1393 do_from_zval_err(ctx, "cast stream to file descriptor failed"); in from_zval_write_fd_array_aux()
1397 do_from_zval_err(ctx, "expected a Socket object or a stream resource"); in from_zval_write_fd_array_aux()
1400 void from_zval_write_fd_array(const zval *arr, char *int_arr, ser_context *ctx) in from_zval_write_fd_array() argument
1403 do_from_zval_err(ctx, "%s", "expected an array here"); in from_zval_write_fd_array()
1407 from_array_iterate(arr, &from_zval_write_fd_array_aux, (void**)&int_arr, ctx); in from_zval_write_fd_array()
1409 void to_zval_read_fd_array(const char *data, zval *zv, res_context *ctx) in to_zval_read_fd_array() argument
1420 …if ((cmsg_len = zend_hash_str_find_ptr(&ctx->params, KEY_CMSG_LEN, sizeof(KEY_CMSG_LEN) - 1)) == N… in to_zval_read_fd_array()
1421 do_to_zval_err(ctx, "could not get value of parameter " KEY_CMSG_LEN); in to_zval_read_fd_array()
1426 do_to_zval_err(ctx, "length of cmsg is smaller than its data member " in to_zval_read_fd_array()
1443 do_to_zval_err(ctx, "error creating resource for received file " in to_zval_read_fd_array()
1475 ser_context ctx; in from_zval_run_conversions() local
1484 memset(&ctx, 0, sizeof(ctx)); in from_zval_run_conversions()
1485 zend_hash_init(&ctx.params, 8, NULL, NULL, 0); in from_zval_run_conversions()
1486 zend_llist_init(&ctx.keys, sizeof(const char *), NULL, 0); in from_zval_run_conversions()
1487 zend_llist_init(&ctx.allocations, sizeof(void *), &free_from_zval_allocation, 0); in from_zval_run_conversions()
1488 ctx.sock = sock; in from_zval_run_conversions()
1492 zend_llist_add_element(&ctx.keys, &top_name); in from_zval_run_conversions()
1493 zend_llist_add_element(&ctx.allocations, &structure); in from_zval_run_conversions()
1496 writer(container, structure, &ctx); in from_zval_run_conversions()
1498 if (ctx.err.has_error) { in from_zval_run_conversions()
1499 zend_llist_destroy(&ctx.allocations); /* deallocates structure as well */ in from_zval_run_conversions()
1501 *err = ctx.err; in from_zval_run_conversions()
1504 **allocations = ctx.allocations; in from_zval_run_conversions()
1507 zend_llist_destroy(&ctx.keys); in from_zval_run_conversions()
1508 zend_hash_destroy(&ctx.params); in from_zval_run_conversions()
1518 res_context ctx; in to_zval_run_conversions() local
1525 memset(&ctx, 0, sizeof(ctx)); in to_zval_run_conversions()
1526 zend_llist_init(&ctx.keys, sizeof(const char *), NULL, 0); in to_zval_run_conversions()
1527 zend_llist_add_element(&ctx.keys, &top_name); in to_zval_run_conversions()
1529 zend_hash_init(&ctx.params, 8, NULL, NULL, 0); in to_zval_run_conversions()
1531 zend_hash_str_update_ptr(&ctx.params, kv->key, kv->key_size - 1, kv->value); in to_zval_run_conversions()
1536 reader(structure, zv, &ctx); in to_zval_run_conversions()
1538 if (ctx.err.has_error) { in to_zval_run_conversions()
1541 *err = ctx.err; in to_zval_run_conversions()
1544 zend_llist_destroy(&ctx.keys); in to_zval_run_conversions()
1545 zend_hash_destroy(&ctx.params); in to_zval_run_conversions()