Lines Matching refs:ctx
107 static int param_get_bool(void *ctx, const char *key, int def) in param_get_bool() argument
110 if ((elem = zend_hash_str_find_ptr(ctx, key, strlen(key))) != NULL) { in param_get_bool()
118 static inline void *accounted_emalloc(size_t alloc_size, ser_context *ctx) in accounted_emalloc() argument
121 zend_llist_add_element(&ctx->allocations, &ret); in accounted_emalloc()
124 static inline void *accounted_ecalloc(size_t nmemb, size_t alloc_size, ser_context *ctx) in accounted_ecalloc() argument
127 zend_llist_add_element(&ctx->allocations, &ret); in accounted_ecalloc()
130 …line void *accounted_safe_ecalloc(size_t nmemb, size_t alloc_size, size_t offset, ser_context *ctx) in accounted_safe_ecalloc() argument
134 zend_llist_add_element(&ctx->allocations, &ret); in accounted_safe_ecalloc()
181 static void do_from_zval_err(ser_context *ctx, const char *fmt, ...) in do_from_zval_err() argument
186 do_from_to_zval_err(&ctx->err, &ctx->keys, "user", fmt, ap); in do_from_zval_err()
190 static void do_to_zval_err(res_context *ctx, const char *fmt, ...) in do_to_zval_err() argument
195 do_from_to_zval_err(&ctx->err, &ctx->keys, "native", fmt, ap); in do_to_zval_err()
216 void (*func)(zval *elem, unsigned i, void **args, ser_context *ctx), in from_array_iterate() argument
218 ser_context *ctx) in from_array_iterate()
231 zend_llist_add_element(&ctx->keys, &bufp); in from_array_iterate()
233 func(elem, i, args, ctx); in from_array_iterate()
235 zend_llist_remove_tail(&ctx->keys); in from_array_iterate()
236 if (ctx->err.has_error) { in from_array_iterate()
249 ser_context *ctx) in from_zval_write_aggregation() argument
255 do_from_zval_err(ctx, "%s", "expected an array here"); in from_zval_write_aggregation()
258 for (descr = descriptors; descr->name != NULL && !ctx->err.has_error; descr++) { in from_zval_write_aggregation()
263 do_from_zval_err(ctx, "No information on how to convert value " in from_zval_write_aggregation()
268 zend_llist_add_element(&ctx->keys, (void*)&descr->name); in from_zval_write_aggregation()
269 descr->from_zval(elem, ((char*)structure) + descr->field_offset, ctx); in from_zval_write_aggregation()
270 zend_llist_remove_tail(&ctx->keys); in from_zval_write_aggregation()
273 do_from_zval_err(ctx, "The key '%s' is required", descr->name); in from_zval_write_aggregation()
281 res_context *ctx) in to_zval_read_aggregation() argument
288 for (descr = descriptors; descr->name != NULL && !ctx->err.has_error; descr++) { in to_zval_read_aggregation()
292 do_to_zval_err(ctx, "No information on how to convert native " in to_zval_read_aggregation()
300 zend_llist_add_element(&ctx->keys, (void*)&descr->name); in to_zval_read_aggregation()
301 descr->to_zval(structure + descr->field_offset, new_zv, ctx); in to_zval_read_aggregation()
302 zend_llist_remove_tail(&ctx->keys); in to_zval_read_aggregation()
307 static zend_long from_zval_integer_common(const zval *arr_value, ser_context *ctx) in from_zval_integer_common() argument
350 do_from_zval_err(ctx, "expected an integer, but got a non numeric " in from_zval_integer_common()
356 do_from_zval_err(ctx, "%s", "expected an integer, either of a PHP " in from_zval_integer_common()
365 void from_zval_write_int(const zval *arr_value, char *field, ser_context *ctx) in from_zval_write_int() argument
370 lval = from_zval_integer_common(arr_value, ctx); in from_zval_write_int()
371 if (ctx->err.has_error) { in from_zval_write_int()
376 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_int()
384 static void from_zval_write_uint32(const zval *arr_value, char *field, ser_context *ctx) in from_zval_write_uint32() argument
389 lval = from_zval_integer_common(arr_value, ctx); in from_zval_write_uint32()
390 if (ctx->err.has_error) { in from_zval_write_uint32()
395 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_uint32()
403 static void from_zval_write_net_uint16(const zval *arr_value, char *field, ser_context *ctx) in from_zval_write_net_uint16() argument
408 lval = from_zval_integer_common(arr_value, ctx); in from_zval_write_net_uint16()
409 if (ctx->err.has_error) { in from_zval_write_net_uint16()
414 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_net_uint16()
422 static void from_zval_write_sa_family(const zval *arr_value, char *field, ser_context *ctx) in from_zval_write_sa_family() argument
427 lval = from_zval_integer_common(arr_value, ctx); in from_zval_write_sa_family()
428 if (ctx->err.has_error) { in from_zval_write_sa_family()
433 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_sa_family()
441 static void from_zval_write_pid_t(const zval *arr_value, char *field, ser_context *ctx) in from_zval_write_pid_t() argument
446 lval = from_zval_integer_common(arr_value, ctx); in from_zval_write_pid_t()
447 if (ctx->err.has_error) { in from_zval_write_pid_t()
452 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_pid_t()
460 static void from_zval_write_uid_t(const zval *arr_value, char *field, ser_context *ctx) in from_zval_write_uid_t() argument
465 lval = from_zval_integer_common(arr_value, ctx); in from_zval_write_uid_t()
466 if (ctx->err.has_error) { in from_zval_write_uid_t()
473 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_uid_t()
479 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_uid_t()
489 void to_zval_read_int(const char *data, zval *zv, res_context *ctx) in to_zval_read_int() argument
496 static void to_zval_read_unsigned(const char *data, zval *zv, res_context *ctx) in to_zval_read_unsigned() argument
503 static void to_zval_read_net_uint16(const char *data, zval *zv, res_context *ctx) in to_zval_read_net_uint16() argument
510 static void to_zval_read_uint32(const char *data, zval *zv, res_context *ctx) in to_zval_read_uint32() argument
517 static void to_zval_read_sa_family(const char *data, zval *zv, res_context *ctx) in to_zval_read_sa_family() argument
524 static void to_zval_read_pid_t(const char *data, zval *zv, res_context *ctx) in to_zval_read_pid_t() argument
531 static void to_zval_read_uid_t(const char *data, zval *zv, res_context *ctx) in to_zval_read_uid_t() argument
540 static void from_zval_write_sin_addr(const zval *zaddr_str, char *inaddr, ser_context *ctx) in from_zval_write_sin_addr() argument
547 res = php_set_inet_addr(&saddr, ZSTR_VAL(addr_str), ctx->sock); in from_zval_write_sin_addr()
552 do_from_zval_err(ctx, "could not resolve address '%s' to get an AF_INET " in from_zval_write_sin_addr()
558 static void to_zval_read_sin_addr(const char *data, zval *zv, res_context *ctx) in to_zval_read_sin_addr() argument
568 do_to_zval_err(ctx, "could not convert IPv4 address to string " in to_zval_read_sin_addr()
581 static void from_zval_write_sockaddr_in(const zval *container, char *sockaddr, ser_context *ctx) in from_zval_write_sockaddr_in() argument
583 from_zval_write_aggregation(container, sockaddr, descriptors_sockaddr_in, ctx); in from_zval_write_sockaddr_in()
585 static void to_zval_read_sockaddr_in(const char *data, zval *zv, res_context *ctx) in to_zval_read_sockaddr_in() argument
587 to_zval_read_aggregation(data, zv, descriptors_sockaddr_in, ctx); in to_zval_read_sockaddr_in()
590 static void from_zval_write_sin6_addr(const zval *zaddr_str, char *addr6, ser_context *ctx) in from_zval_write_sin6_addr() argument
597 res = php_set_inet6_addr(&saddr6, ZSTR_VAL(addr_str), ctx->sock); in from_zval_write_sin6_addr()
602 do_from_zval_err(ctx, "could not resolve address '%s' to get an AF_INET6 " in from_zval_write_sin6_addr()
608 static void to_zval_read_sin6_addr(const char *data, zval *zv, res_context *ctx) in to_zval_read_sin6_addr() argument
619 do_to_zval_err(ctx, "could not convert IPv6 address to string " in to_zval_read_sin6_addr()
634 static void from_zval_write_sockaddr_in6(const zval *container, char *sockaddr6, ser_context *ctx) in from_zval_write_sockaddr_in6() argument
636 from_zval_write_aggregation(container, sockaddr6, descriptors_sockaddr_in6, ctx); in from_zval_write_sockaddr_in6()
638 static void to_zval_read_sockaddr_in6(const char *data, zval *zv, res_context *ctx) in to_zval_read_sockaddr_in6() argument
640 to_zval_read_aggregation(data, zv, descriptors_sockaddr_in6, ctx); in to_zval_read_sockaddr_in6()
643 static void from_zval_write_sun_path(const zval *path, char *sockaddr_un_c, ser_context *ctx) in from_zval_write_sun_path() argument
654 do_from_zval_err(ctx, "%s", "the path is cannot be empty"); in from_zval_write_sun_path()
658 do_from_zval_err(ctx, "the path is too long, the maximum permitted " in from_zval_write_sun_path()
668 static void to_zval_read_sun_path(const char *data, zval *zv, res_context *ctx) { in to_zval_read_sun_path() argument
674 do_to_zval_err(ctx, "could not find a NUL in the path"); in to_zval_read_sun_path()
685 static void from_zval_write_sockaddr_un(const zval *container, char *sockaddr, ser_context *ctx) in from_zval_write_sockaddr_un() argument
687 from_zval_write_aggregation(container, sockaddr, descriptors_sockaddr_un, ctx); in from_zval_write_sockaddr_un()
689 static void to_zval_read_sockaddr_un(const char *data, zval *zv, res_context *ctx) in to_zval_read_sockaddr_un() argument
691 to_zval_read_aggregation(data, zv, descriptors_sockaddr_un, ctx); in to_zval_read_sockaddr_un()
696 ser_context *ctx) in from_zval_write_sockaddr_aux() argument
703 do_from_zval_err(ctx, "%s", "expected an array here"); in from_zval_write_sockaddr_aux()
707 fill_sockaddr = param_get_bool(ctx, KEY_FILL_SOCKADDR, 1); in from_zval_write_sockaddr_aux()
712 zend_llist_add_element(&ctx->keys, &node); in from_zval_write_sockaddr_aux()
713 from_zval_write_int(elem, (char*)&family, ctx); in from_zval_write_sockaddr_aux()
714 zend_llist_remove_tail(&ctx->keys); in from_zval_write_sockaddr_aux()
716 family = ctx->sock->type; in from_zval_write_sockaddr_aux()
722 if (ctx->sock->type != AF_INET && ctx->sock->type != AF_INET6) { in from_zval_write_sockaddr_aux()
723 do_from_zval_err(ctx, "the specified family (number %d) is not " in from_zval_write_sockaddr_aux()
727 *sockaddr_ptr = accounted_ecalloc(1, sizeof(struct sockaddr_in), ctx); in from_zval_write_sockaddr_aux()
730 from_zval_write_sockaddr_in(container, (char*)*sockaddr_ptr, ctx); in from_zval_write_sockaddr_aux()
737 if (ctx->sock->type != AF_INET6) { in from_zval_write_sockaddr_aux()
738 do_from_zval_err(ctx, "the specified family (AF_INET6) is not " in from_zval_write_sockaddr_aux()
742 *sockaddr_ptr = accounted_ecalloc(1, sizeof(struct sockaddr_in6), ctx); in from_zval_write_sockaddr_aux()
745 from_zval_write_sockaddr_in6(container, (char*)*sockaddr_ptr, ctx); in from_zval_write_sockaddr_aux()
752 if (ctx->sock->type != AF_UNIX) { in from_zval_write_sockaddr_aux()
753 do_from_zval_err(ctx, "the specified family (AF_UNIX) is not " in from_zval_write_sockaddr_aux()
757 *sockaddr_ptr = accounted_ecalloc(1, sizeof(struct sockaddr_un), ctx); in from_zval_write_sockaddr_aux()
761 from_zval_write_sockaddr_un(container, (char*)*sockaddr_ptr, ctx); in from_zval_write_sockaddr_aux()
778 do_from_zval_err(ctx, "%s", "the only families currently supported are " in from_zval_write_sockaddr_aux()
783 static void to_zval_read_sockaddr_aux(const char *sockaddr_c, zval *zv, res_context *ctx) in to_zval_read_sockaddr_aux() argument
796 to_zval_read_sockaddr_in(sockaddr_c, zv, ctx); in to_zval_read_sockaddr_aux()
801 to_zval_read_sockaddr_in6(sockaddr_c, zv, ctx); in to_zval_read_sockaddr_aux()
806 to_zval_read_sockaddr_un(sockaddr_c, zv, ctx); in to_zval_read_sockaddr_aux()
810 do_to_zval_err(ctx, "cannot read struct sockaddr with family %d; " in to_zval_read_sockaddr_aux()
832 ser_context *ctx) in from_zval_write_control() argument
855 from_zval_write_aggregation(arr, (char *)&level, descriptor_level, ctx); in from_zval_write_control()
856 if (ctx->err.has_error) { in from_zval_write_control()
859 from_zval_write_aggregation(arr, (char *)&type, descriptor_type, ctx); in from_zval_write_control()
860 if (ctx->err.has_error) { in from_zval_write_control()
866 do_from_zval_err(ctx, "cmsghdr with level %d and type %d not supported", in from_zval_write_control()
875 do_from_zval_err(ctx, "cmsghdr should have a 'data' element here"); in from_zval_write_control()
878 data_len = entry->calc_space(data_elem, ctx); in from_zval_write_control()
879 if (ctx->err.has_error) { in from_zval_write_control()
902 from_zval_write_aggregation(arr, (char*)CMSG_DATA(cmsghdr), descriptor_data, ctx); in from_zval_write_control()
906 static void from_zval_write_control_array(const zval *arr, char *msghdr_c, ser_context *ctx) in from_zval_write_control_array() argument
920 do_from_zval_err(ctx, "%s", "expected an array here"); in from_zval_write_control_array()
930 control_buf = accounted_safe_ecalloc(num_elems, CMSG_SPACE(20), 0, ctx); in from_zval_write_control_array()
931 alloc = ctx->allocations.tail; in from_zval_write_control_array()
936 if (ctx->err.has_error) { in from_zval_write_control_array()
943 zend_llist_add_element(&ctx->keys, &bufp); in from_zval_write_control_array()
945 from_zval_write_control(elem, &control_buf, alloc, &control_len, &cur_offset, ctx); in from_zval_write_control_array()
947 zend_llist_remove_tail(&ctx->keys); in from_zval_write_control_array()
953 static void to_zval_read_cmsg_data(const char *cmsghdr_c, zval *zv, res_context *ctx) in to_zval_read_cmsg_data() argument
962 do_to_zval_err(ctx, "cmsghdr with level %d and type %d not supported", in to_zval_read_cmsg_data()
967 do_to_zval_err(ctx, "the cmsghdr structure is unexpectedly small; " in to_zval_read_cmsg_data()
975 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()
976 do_to_zval_err(ctx, "%s", "could not set parameter " KEY_CMSG_LEN); in to_zval_read_cmsg_data()
980 entry->to_array((const char *)CMSG_DATA(cmsg), zv, ctx); in to_zval_read_cmsg_data()
982 zend_hash_str_del(&ctx->params, KEY_CMSG_LEN, sizeof(KEY_CMSG_LEN) - 1); in to_zval_read_cmsg_data()
984 static void to_zval_read_control(const char *cmsghdr_c, zval *zv, res_context *ctx) in to_zval_read_control() argument
995 to_zval_read_aggregation(cmsghdr_c, zv, descriptors, ctx); in to_zval_read_control()
997 static void to_zval_read_control_array(const char *msghdr_c, zval *zv, res_context *ctx) in to_zval_read_control_array() argument
1015 cmsg != NULL && !ctx->err.has_error; in to_zval_read_control_array()
1025 zend_llist_add_element(&ctx->keys, &bufp); in to_zval_read_control_array()
1027 to_zval_read_control((const char *)cmsg, elem, ctx); in to_zval_read_control_array()
1029 zend_llist_remove_tail(&ctx->keys); in to_zval_read_control_array()
1034 static void from_zval_write_name(const zval *zname_arr, char *msghdr_c, ser_context *ctx) in from_zval_write_name() argument
1040 from_zval_write_sockaddr_aux(zname_arr, &sockaddr, &sockaddr_len, ctx); in from_zval_write_name()
1045 static void to_zval_read_name(const char *sockaddr_p, zval *zv, res_context *ctx) in to_zval_read_name() argument
1051 to_zval_read_sockaddr_aux(name, zv, ctx); in to_zval_read_name()
1054 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
1059 lval = from_zval_integer_common(elem, ctx); in from_zval_write_msghdr_buffer_size()
1060 if (ctx->err.has_error) { in from_zval_write_msghdr_buffer_size()
1065 do_from_zval_err(ctx, "the buffer size must be between 1 and %pd; " in from_zval_write_msghdr_buffer_size()
1071 msghdr->msg_iov = accounted_emalloc(sizeof(*msghdr->msg_iov) * 1, ctx); in from_zval_write_msghdr_buffer_size()
1072 msghdr->msg_iov[0].iov_base = accounted_emalloc((size_t)lval, ctx); in from_zval_write_msghdr_buffer_size()
1075 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
1086 msg->msg_iov[i - 1].iov_base = accounted_emalloc(len, ctx); in from_zval_write_iov_array_aux()
1092 static void from_zval_write_iov_array(const zval *arr, char *msghdr_c, ser_context *ctx) in from_zval_write_iov_array() argument
1098 do_from_zval_err(ctx, "%s", "expected an array here"); in from_zval_write_iov_array()
1107 msg->msg_iov = accounted_safe_ecalloc(num_elem, sizeof *msg->msg_iov, 0, ctx); in from_zval_write_iov_array()
1110 from_array_iterate(arr, from_zval_write_iov_array_aux, (void**)&msg, ctx); in from_zval_write_iov_array()
1112 static void from_zval_write_controllen(const zval *elem, char *msghdr_c, ser_context *ctx) in from_zval_write_controllen() argument
1120 from_zval_write_uint32(elem, (char*)&len, ctx); in from_zval_write_controllen()
1121 if (!ctx->err.has_error && len == 0) { in from_zval_write_controllen()
1122 do_from_zval_err(ctx, "controllen cannot be 0"); in from_zval_write_controllen()
1125 msghdr->msg_control = accounted_emalloc(len, ctx); in from_zval_write_controllen()
1128 void from_zval_write_msghdr_send(const zval *container, char *msghdr_c, ser_context *ctx) in from_zval_write_msghdr_send() argument
1137 from_zval_write_aggregation(container, msghdr_c, descriptors, ctx); in from_zval_write_msghdr_send()
1139 void from_zval_write_msghdr_recv(const zval *container, char *msghdr_c, ser_context *ctx) in from_zval_write_msghdr_recv() argument
1165 …if (zend_hash_str_add_ptr(&ctx->params, KEY_FILL_SOCKADDR, sizeof(KEY_FILL_SOCKADDR) - 1, (void *)… in from_zval_write_msghdr_recv()
1166 do_from_zval_err(ctx, "could not add fill_sockaddr; this is a bug"); in from_zval_write_msghdr_recv()
1170 from_zval_write_aggregation(container, msghdr_c, descriptors, ctx); in from_zval_write_msghdr_recv()
1172 zend_hash_str_del(&ctx->params, KEY_FILL_SOCKADDR, sizeof(KEY_FILL_SOCKADDR) - 1); in from_zval_write_msghdr_recv()
1173 if (ctx->err.has_error) { in from_zval_write_msghdr_recv()
1179 msghdr->msg_iov = accounted_emalloc(sizeof(*msghdr->msg_iov) * 1, ctx); in from_zval_write_msghdr_recv()
1180 msghdr->msg_iov[0].iov_base = accounted_emalloc((size_t)DEFAULT_BUFF_SIZE, ctx); in from_zval_write_msghdr_recv()
1185 static void to_zval_read_iov(const char *msghdr_c, zval *zv, res_context *ctx) in to_zval_read_iov() argument
1194 do_to_zval_err(ctx, "unexpectedly large value for iov_len: %lu", in to_zval_read_iov()
1199 …if ((recvmsg_ret = zend_hash_str_find_ptr(&ctx->params, KEY_RECVMSG_RET, sizeof(KEY_RECVMSG_RET) -… in to_zval_read_iov()
1200 do_to_zval_err(ctx, "recvmsg_ret not found in params. This is a bug"); in to_zval_read_iov()
1218 void to_zval_read_msghdr(const char *msghdr_c, zval *zv, res_context *ctx) in to_zval_read_msghdr() argument
1230 to_zval_read_aggregation(msghdr_c, zv, descriptors, ctx); in to_zval_read_msghdr()
1234 static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context *ctx) in from_zval_write_ifindex() argument
1240 do_from_zval_err(ctx, "the interface index cannot be negative or " in from_zval_write_ifindex()
1253 do_from_zval_err(ctx, "no interface with name \"%s\" could be found", ZSTR_VAL(str)); in from_zval_write_ifindex()
1260 do_from_zval_err(ctx, "the interface name \"%s\" is too large ", ZSTR_VAL(str)); in from_zval_write_ifindex()
1261 } else if (ioctl(ctx->sock->bsd_socket, SIOCGIFINDEX, &ifr) < 0) { in from_zval_write_ifindex()
1263 do_from_zval_err(ctx, "no interface with name \"%s\" could be " in from_zval_write_ifindex()
1266 do_from_zval_err(ctx, "error fetching interface index for " in from_zval_write_ifindex()
1275 do_from_zval_err(ctx, in from_zval_write_ifindex()
1283 if (!ctx->err.has_error) { in from_zval_write_ifindex()
1295 void from_zval_write_in6_pktinfo(const zval *container, char *in6_pktinfo_c, ser_context *ctx) in from_zval_write_in6_pktinfo() argument
1297 from_zval_write_aggregation(container, in6_pktinfo_c, descriptors_in6_pktinfo, ctx); in from_zval_write_in6_pktinfo()
1299 void to_zval_read_in6_pktinfo(const char *data, zval *zv, res_context *ctx) in to_zval_read_in6_pktinfo() argument
1303 to_zval_read_aggregation(data, zv, descriptors_in6_pktinfo, ctx); in to_zval_read_in6_pktinfo()
1316 void from_zval_write_ucred(const zval *container, char *ucred_c, ser_context *ctx) in from_zval_write_ucred() argument
1318 from_zval_write_aggregation(container, ucred_c, descriptors_ucred, ctx); in from_zval_write_ucred()
1320 void to_zval_read_ucred(const char *data, zval *zv, res_context *ctx) in to_zval_read_ucred() argument
1324 to_zval_read_aggregation(data, zv, descriptors_ucred, ctx); in to_zval_read_ucred()
1330 size_t calculate_scm_rights_space(const zval *arr, ser_context *ctx) in calculate_scm_rights_space() argument
1335 do_from_zval_err(ctx, "%s", "expected an array here"); in calculate_scm_rights_space()
1341 do_from_zval_err(ctx, "%s", "expected at least one element in this array"); in calculate_scm_rights_space()
1347 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
1363 do_from_zval_err(ctx, "resource is not a stream or a socket"); in from_zval_write_fd_array_aux()
1369 do_from_zval_err(ctx, "cast stream to file descriptor failed"); in from_zval_write_fd_array_aux()
1373 do_from_zval_err(ctx, "expected a resource variable"); in from_zval_write_fd_array_aux()
1376 void from_zval_write_fd_array(const zval *arr, char *int_arr, ser_context *ctx) in from_zval_write_fd_array() argument
1379 do_from_zval_err(ctx, "%s", "expected an array here"); in from_zval_write_fd_array()
1383 from_array_iterate(arr, &from_zval_write_fd_array_aux, (void**)&int_arr, ctx); in from_zval_write_fd_array()
1385 void to_zval_read_fd_array(const char *data, zval *zv, res_context *ctx) in to_zval_read_fd_array() argument
1396 …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()
1397 do_to_zval_err(ctx, "could not get value of parameter " KEY_CMSG_LEN); in to_zval_read_fd_array()
1402 do_to_zval_err(ctx, "length of cmsg is smaller than its data member " in to_zval_read_fd_array()
1419 do_to_zval_err(ctx, "error creating resource for received file " in to_zval_read_fd_array()
1449 ser_context ctx; in from_zval_run_conversions() local
1458 memset(&ctx, 0, sizeof(ctx)); in from_zval_run_conversions()
1459 zend_hash_init(&ctx.params, 8, NULL, NULL, 0); in from_zval_run_conversions()
1460 zend_llist_init(&ctx.keys, sizeof(const char *), NULL, 0); in from_zval_run_conversions()
1461 zend_llist_init(&ctx.allocations, sizeof(void *), &free_from_zval_allocation, 0); in from_zval_run_conversions()
1462 ctx.sock = sock; in from_zval_run_conversions()
1466 zend_llist_add_element(&ctx.keys, &top_name); in from_zval_run_conversions()
1467 zend_llist_add_element(&ctx.allocations, &structure); in from_zval_run_conversions()
1470 writer(container, structure, &ctx); in from_zval_run_conversions()
1472 if (ctx.err.has_error) { in from_zval_run_conversions()
1473 zend_llist_destroy(&ctx.allocations); /* deallocates structure as well */ in from_zval_run_conversions()
1475 *err = ctx.err; in from_zval_run_conversions()
1478 **allocations = ctx.allocations; in from_zval_run_conversions()
1481 zend_llist_destroy(&ctx.keys); in from_zval_run_conversions()
1482 zend_hash_destroy(&ctx.params); in from_zval_run_conversions()
1492 res_context ctx; in to_zval_run_conversions() local
1499 memset(&ctx, 0, sizeof(ctx)); in to_zval_run_conversions()
1500 zend_llist_init(&ctx.keys, sizeof(const char *), NULL, 0); in to_zval_run_conversions()
1501 zend_llist_add_element(&ctx.keys, &top_name); in to_zval_run_conversions()
1503 zend_hash_init(&ctx.params, 8, NULL, NULL, 0); in to_zval_run_conversions()
1505 zend_hash_str_update_ptr(&ctx.params, kv->key, kv->key_size - 1, kv->value); in to_zval_run_conversions()
1510 reader(structure, zv, &ctx); in to_zval_run_conversions()
1512 if (ctx.err.has_error) { in to_zval_run_conversions()
1515 *err = ctx.err; in to_zval_run_conversions()
1518 zend_llist_destroy(&ctx.keys); in to_zval_run_conversions()
1519 zend_hash_destroy(&ctx.params); in to_zval_run_conversions()