ZVAL_LONG(zv, (zend_long)ival);
}
-static void to_zval_read_unsigned(const char *data, zval *zv, res_context *ctx)
+static void to_zval_read_net_uint16(const char *data, zval *zv, res_context *ctx)
{
- unsigned ival;
+ uint16_t ival;
memcpy(&ival, data, sizeof(ival));
- ZVAL_LONG(zv, (zend_long)ival);
+ ZVAL_LONG(zv, (zend_long)ntohs(ival));
}
-static void to_zval_read_net_uint16(const char *data, zval *zv, res_context *ctx)
+static void to_zval_read_sa_family(const char *data, zval *zv, res_context *ctx)
{
- uint16_t ival;
+ sa_family_t ival;
memcpy(&ival, data, sizeof(ival));
- ZVAL_LONG(zv, (zend_long)ntohs(ival));
+ ZVAL_LONG(zv, (zend_long)ival);
}
-static void to_zval_read_uint32(const char *data, zval *zv, res_context *ctx)
+#if HAVE_IPV6
+static void to_zval_read_unsigned(const char *data, zval *zv, res_context *ctx)
{
- uint32_t ival;
+ unsigned ival;
memcpy(&ival, data, sizeof(ival));
ZVAL_LONG(zv, (zend_long)ival);
}
-static void to_zval_read_sa_family(const char *data, zval *zv, res_context *ctx)
+static void to_zval_read_uint32(const char *data, zval *zv, res_context *ctx)
{
- sa_family_t ival;
+ uint32_t ival;
memcpy(&ival, data, sizeof(ival));
ZVAL_LONG(zv, (zend_long)ival);
}
+#endif
#ifdef SO_PASSCRED
static void to_zval_read_pid_t(const char *data, zval *zv, res_context *ctx)
{
to_zval_read_aggregation(msghdr_c, zv, descriptors, ctx);
}
+#if defined(IPV6_PKTINFO) && HAVE_IPV6
/* CONVERSIONS for if_index */
static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context *ctx)
{
}
/* CONVERSIONS for struct in6_pktinfo */
-#if defined(IPV6_PKTINFO) && HAVE_IPV6
static const field_descriptor descriptors_in6_pktinfo[] = {
{"addr", sizeof("addr"), 1, offsetof(struct in6_pktinfo, ipi6_addr), from_zval_write_sin6_addr, to_zval_read_sin6_addr},
{"ifindex", sizeof("ifindex"), 1, offsetof(struct in6_pktinfo, ipi6_ifindex), from_zval_write_ifindex, to_zval_read_unsigned},