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 family = ctx->sock->type; in from_zval_write_sockaddr_aux()
730 if (ctx->sock->type != AF_INET && ctx->sock->type != AF_INET6) { in from_zval_write_sockaddr_aux()
731 do_from_zval_err(ctx, "the specified family (number %d) is not " in from_zval_write_sockaddr_aux()
735 *sockaddr_ptr = accounted_ecalloc(1, sizeof(struct sockaddr_in), ctx); in from_zval_write_sockaddr_aux()
738 from_zval_write_sockaddr_in(container, (char*)*sockaddr_ptr, ctx); in from_zval_write_sockaddr_aux()
745 if (ctx->sock->type != AF_INET6) { in from_zval_write_sockaddr_aux()
746 do_from_zval_err(ctx, "the specified family (AF_INET6) is not " in from_zval_write_sockaddr_aux()
750 *sockaddr_ptr = accounted_ecalloc(1, sizeof(struct sockaddr_in6), ctx); in from_zval_write_sockaddr_aux()
753 from_zval_write_sockaddr_in6(container, (char*)*sockaddr_ptr, ctx); in from_zval_write_sockaddr_aux()
760 if (ctx->sock->type != AF_UNIX) { in from_zval_write_sockaddr_aux()
761 do_from_zval_err(ctx, "the specified family (AF_UNIX) is not " in from_zval_write_sockaddr_aux()
765 *sockaddr_ptr = accounted_ecalloc(1, sizeof(struct sockaddr_un), ctx); in from_zval_write_sockaddr_aux()
769 from_zval_write_sockaddr_un(container, (char*)*sockaddr_ptr, ctx); in from_zval_write_sockaddr_aux()
786 do_from_zval_err(ctx, "%s", "the only families currently supported are " in from_zval_write_sockaddr_aux()
791 static void to_zval_read_sockaddr_aux(const char *sockaddr_c, zval *zv, res_context *ctx) in to_zval_read_sockaddr_aux() argument
804 to_zval_read_sockaddr_in(sockaddr_c, zv, ctx); in to_zval_read_sockaddr_aux()
809 to_zval_read_sockaddr_in6(sockaddr_c, zv, ctx); in to_zval_read_sockaddr_aux()
814 to_zval_read_sockaddr_un(sockaddr_c, zv, ctx); in to_zval_read_sockaddr_aux()
818 do_to_zval_err(ctx, "cannot read struct sockaddr with family %d; " in to_zval_read_sockaddr_aux()
840 ser_context *ctx) in from_zval_write_control() argument
863 from_zval_write_aggregation(arr, (char *)&level, descriptor_level, ctx); in from_zval_write_control()
864 if (ctx->err.has_error) { in from_zval_write_control()
867 from_zval_write_aggregation(arr, (char *)&type, descriptor_type, ctx); in from_zval_write_control()
868 if (ctx->err.has_error) { in from_zval_write_control()
874 do_from_zval_err(ctx, "cmsghdr with level %d and type %d not supported", in from_zval_write_control()
883 do_from_zval_err(ctx, "cmsghdr should have a 'data' element here"); in from_zval_write_control()
886 data_len = entry->calc_space(data_elem, ctx); in from_zval_write_control()
887 if (ctx->err.has_error) { in from_zval_write_control()
910 from_zval_write_aggregation(arr, (char*)CMSG_DATA(cmsghdr), descriptor_data, ctx); in from_zval_write_control()
914 static void from_zval_write_control_array(const zval *arr, char *msghdr_c, ser_context *ctx) in from_zval_write_control_array() argument
928 do_from_zval_err(ctx, "%s", "expected an array here"); in from_zval_write_control_array()
938 control_buf = accounted_safe_ecalloc(num_elems, CMSG_SPACE(20), 0, ctx); in from_zval_write_control_array()
939 alloc = ctx->allocations.tail; in from_zval_write_control_array()
944 if (ctx->err.has_error) { in from_zval_write_control_array()
951 zend_llist_add_element(&ctx->keys, &bufp); in from_zval_write_control_array()
953 from_zval_write_control(elem, &control_buf, alloc, &control_len, &cur_offset, ctx); in from_zval_write_control_array()
955 zend_llist_remove_tail(&ctx->keys); in from_zval_write_control_array()
961 static void to_zval_read_cmsg_data(const char *cmsghdr_c, zval *zv, res_context *ctx) in to_zval_read_cmsg_data() argument
970 do_to_zval_err(ctx, "cmsghdr with level %d and type %d not supported", in to_zval_read_cmsg_data()
975 do_to_zval_err(ctx, "the cmsghdr structure is unexpectedly small; " in to_zval_read_cmsg_data()
983 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()
984 do_to_zval_err(ctx, "%s", "could not set parameter " KEY_CMSG_LEN); in to_zval_read_cmsg_data()
988 entry->to_array((const char *)CMSG_DATA(cmsg), zv, ctx); in to_zval_read_cmsg_data()
990 zend_hash_str_del(&ctx->params, KEY_CMSG_LEN, sizeof(KEY_CMSG_LEN) - 1); in to_zval_read_cmsg_data()
992 static void to_zval_read_control(const char *cmsghdr_c, zval *zv, res_context *ctx) in to_zval_read_control() argument
1003 to_zval_read_aggregation(cmsghdr_c, zv, descriptors, ctx); in to_zval_read_control()
1005 static void to_zval_read_control_array(const char *msghdr_c, zval *zv, res_context *ctx) in to_zval_read_control_array() argument
1016 cmsg != NULL && !ctx->err.has_error; in to_zval_read_control_array()
1026 zend_llist_add_element(&ctx->keys, &bufp); in to_zval_read_control_array()
1028 to_zval_read_control((const char *)cmsg, elem, ctx); in to_zval_read_control_array()
1030 zend_llist_remove_tail(&ctx->keys); in to_zval_read_control_array()
1035 static void from_zval_write_name(const zval *zname_arr, char *msghdr_c, ser_context *ctx) in from_zval_write_name() argument
1041 from_zval_write_sockaddr_aux(zname_arr, &sockaddr, &sockaddr_len, ctx); in from_zval_write_name()
1046 static void to_zval_read_name(const char *sockaddr_p, zval *zv, res_context *ctx) in to_zval_read_name() argument
1052 to_zval_read_sockaddr_aux(name, zv, ctx); in to_zval_read_name()
1055 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
1060 lval = from_zval_integer_common(elem, ctx); in from_zval_write_msghdr_buffer_size()
1061 if (ctx->err.has_error) { in from_zval_write_msghdr_buffer_size()
1066 do_from_zval_err(ctx, "the buffer size must be between 1 and " ZEND_LONG_FMT "; " in from_zval_write_msghdr_buffer_size()
1072 msghdr->msg_iov = accounted_emalloc(sizeof(*msghdr->msg_iov) * 1, ctx); in from_zval_write_msghdr_buffer_size()
1073 msghdr->msg_iov[0].iov_base = accounted_emalloc((size_t)lval, ctx); in from_zval_write_msghdr_buffer_size()
1076 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
1083 msg->msg_iov[i - 1].iov_base = accounted_emalloc(ZSTR_LEN(str), ctx); in from_zval_write_iov_array_aux()
1089 static void from_zval_write_iov_array(const zval *arr, char *msghdr_c, ser_context *ctx) in from_zval_write_iov_array() argument
1095 do_from_zval_err(ctx, "%s", "expected an array here"); in from_zval_write_iov_array()
1104 msg->msg_iov = accounted_safe_ecalloc(num_elem, sizeof *msg->msg_iov, 0, ctx); in from_zval_write_iov_array()
1107 from_array_iterate(arr, from_zval_write_iov_array_aux, (void**)&msg, ctx); in from_zval_write_iov_array()
1109 static void from_zval_write_controllen(const zval *elem, char *msghdr_c, ser_context *ctx) in from_zval_write_controllen() argument
1117 from_zval_write_uint32(elem, (char*)&len, ctx); in from_zval_write_controllen()
1118 if (!ctx->err.has_error && len == 0) { in from_zval_write_controllen()
1119 do_from_zval_err(ctx, "controllen cannot be 0"); in from_zval_write_controllen()
1122 msghdr->msg_control = accounted_emalloc(len, ctx); in from_zval_write_controllen()
1125 void from_zval_write_msghdr_send(const zval *container, char *msghdr_c, ser_context *ctx) in from_zval_write_msghdr_send() argument
1134 from_zval_write_aggregation(container, msghdr_c, descriptors, ctx); in from_zval_write_msghdr_send()
1136 void from_zval_write_msghdr_recv(const zval *container, char *msghdr_c, ser_context *ctx) in from_zval_write_msghdr_recv() argument
1162 …if (zend_hash_str_add_ptr(&ctx->params, KEY_FILL_SOCKADDR, sizeof(KEY_FILL_SOCKADDR) - 1, (void *)… in from_zval_write_msghdr_recv()
1163 do_from_zval_err(ctx, "could not add fill_sockaddr; this is a bug"); in from_zval_write_msghdr_recv()
1167 from_zval_write_aggregation(container, msghdr_c, descriptors, ctx); in from_zval_write_msghdr_recv()
1169 zend_hash_str_del(&ctx->params, KEY_FILL_SOCKADDR, sizeof(KEY_FILL_SOCKADDR) - 1); in from_zval_write_msghdr_recv()
1170 if (ctx->err.has_error) { in from_zval_write_msghdr_recv()
1176 msghdr->msg_iov = accounted_emalloc(sizeof(*msghdr->msg_iov) * 1, ctx); in from_zval_write_msghdr_recv()
1177 msghdr->msg_iov[0].iov_base = accounted_emalloc((size_t)DEFAULT_BUFF_SIZE, ctx); in from_zval_write_msghdr_recv()
1182 static void to_zval_read_iov(const char *msghdr_c, zval *zv, res_context *ctx) in to_zval_read_iov() argument
1191 do_to_zval_err(ctx, "unexpectedly large value for iov_len: %lu", in to_zval_read_iov()
1196 …if ((recvmsg_ret = zend_hash_str_find_ptr(&ctx->params, KEY_RECVMSG_RET, sizeof(KEY_RECVMSG_RET) -… in to_zval_read_iov()
1197 do_to_zval_err(ctx, "recvmsg_ret not found in params. This is a bug"); in to_zval_read_iov()
1215 void to_zval_read_msghdr(const char *msghdr_c, zval *zv, res_context *ctx) in to_zval_read_msghdr() argument
1227 to_zval_read_aggregation(msghdr_c, zv, descriptors, ctx); in to_zval_read_msghdr()
1232 static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context *ctx) in from_zval_write_ifindex() argument
1238 do_from_zval_err(ctx, "the interface index cannot be negative or " in from_zval_write_ifindex()
1251 do_from_zval_err(ctx, "no interface with name \"%s\" could be found", ZSTR_VAL(str)); in from_zval_write_ifindex()
1258 do_from_zval_err(ctx, "the interface name \"%s\" is too large ", ZSTR_VAL(str)); in from_zval_write_ifindex()
1259 } else if (ioctl(ctx->sock->bsd_socket, SIOCGIFINDEX, &ifr) < 0) { in from_zval_write_ifindex()
1261 do_from_zval_err(ctx, "no interface with name \"%s\" could be " in from_zval_write_ifindex()
1264 do_from_zval_err(ctx, "error fetching interface index for " in from_zval_write_ifindex()
1273 do_from_zval_err(ctx, in from_zval_write_ifindex()
1281 if (!ctx->err.has_error) { in from_zval_write_ifindex()
1292 void from_zval_write_in6_pktinfo(const zval *container, char *in6_pktinfo_c, ser_context *ctx) in from_zval_write_in6_pktinfo() argument
1294 from_zval_write_aggregation(container, in6_pktinfo_c, descriptors_in6_pktinfo, ctx); in from_zval_write_in6_pktinfo()
1296 void to_zval_read_in6_pktinfo(const char *data, zval *zv, res_context *ctx) in to_zval_read_in6_pktinfo() argument
1300 to_zval_read_aggregation(data, zv, descriptors_in6_pktinfo, ctx); in to_zval_read_in6_pktinfo()
1320 void from_zval_write_ucred(const zval *container, char *ucred_c, ser_context *ctx) in from_zval_write_ucred() argument
1322 from_zval_write_aggregation(container, ucred_c, descriptors_ucred, ctx); in from_zval_write_ucred()
1324 void to_zval_read_ucred(const char *data, zval *zv, res_context *ctx) in to_zval_read_ucred() argument
1328 to_zval_read_aggregation(data, zv, descriptors_ucred, ctx); in to_zval_read_ucred()
1334 size_t calculate_scm_rights_space(const zval *arr, ser_context *ctx) in calculate_scm_rights_space() argument
1339 do_from_zval_err(ctx, "%s", "expected an array here"); in calculate_scm_rights_space()
1345 do_from_zval_err(ctx, "%s", "expected at least one element in this array"); in calculate_scm_rights_space()
1351 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
1358 do_from_zval_err(ctx, "socket is already closed"); in from_zval_write_fd_array_aux()
1371 do_from_zval_err(ctx, "resource is not a stream"); in from_zval_write_fd_array_aux()
1376 do_from_zval_err(ctx, "cast stream to file descriptor failed"); in from_zval_write_fd_array_aux()
1380 do_from_zval_err(ctx, "expected a Socket object or a stream resource"); in from_zval_write_fd_array_aux()
1383 void from_zval_write_fd_array(const zval *arr, char *int_arr, ser_context *ctx) in from_zval_write_fd_array() argument
1386 do_from_zval_err(ctx, "%s", "expected an array here"); in from_zval_write_fd_array()
1390 from_array_iterate(arr, &from_zval_write_fd_array_aux, (void**)&int_arr, ctx); in from_zval_write_fd_array()
1392 void to_zval_read_fd_array(const char *data, zval *zv, res_context *ctx) in to_zval_read_fd_array() argument
1403 …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()
1404 do_to_zval_err(ctx, "could not get value of parameter " KEY_CMSG_LEN); in to_zval_read_fd_array()
1409 do_to_zval_err(ctx, "length of cmsg is smaller than its data member " in to_zval_read_fd_array()
1426 do_to_zval_err(ctx, "error creating resource for received file " in to_zval_read_fd_array()
1458 ser_context ctx; in from_zval_run_conversions() local
1467 memset(&ctx, 0, sizeof(ctx)); in from_zval_run_conversions()
1468 zend_hash_init(&ctx.params, 8, NULL, NULL, 0); in from_zval_run_conversions()
1469 zend_llist_init(&ctx.keys, sizeof(const char *), NULL, 0); in from_zval_run_conversions()
1470 zend_llist_init(&ctx.allocations, sizeof(void *), &free_from_zval_allocation, 0); in from_zval_run_conversions()
1471 ctx.sock = sock; in from_zval_run_conversions()
1475 zend_llist_add_element(&ctx.keys, &top_name); in from_zval_run_conversions()
1476 zend_llist_add_element(&ctx.allocations, &structure); in from_zval_run_conversions()
1479 writer(container, structure, &ctx); in from_zval_run_conversions()
1481 if (ctx.err.has_error) { in from_zval_run_conversions()
1482 zend_llist_destroy(&ctx.allocations); /* deallocates structure as well */ in from_zval_run_conversions()
1484 *err = ctx.err; in from_zval_run_conversions()
1487 **allocations = ctx.allocations; in from_zval_run_conversions()
1490 zend_llist_destroy(&ctx.keys); in from_zval_run_conversions()
1491 zend_hash_destroy(&ctx.params); in from_zval_run_conversions()
1501 res_context ctx; in to_zval_run_conversions() local
1508 memset(&ctx, 0, sizeof(ctx)); in to_zval_run_conversions()
1509 zend_llist_init(&ctx.keys, sizeof(const char *), NULL, 0); in to_zval_run_conversions()
1510 zend_llist_add_element(&ctx.keys, &top_name); in to_zval_run_conversions()
1512 zend_hash_init(&ctx.params, 8, NULL, NULL, 0); in to_zval_run_conversions()
1514 zend_hash_str_update_ptr(&ctx.params, kv->key, kv->key_size - 1, kv->value); in to_zval_run_conversions()
1519 reader(structure, zv, &ctx); in to_zval_run_conversions()
1521 if (ctx.err.has_error) { in to_zval_run_conversions()
1524 *err = ctx.err; in to_zval_run_conversions()
1527 zend_llist_destroy(&ctx.keys); in to_zval_run_conversions()
1528 zend_hash_destroy(&ctx.params); in to_zval_run_conversions()