MEDIUM: samples: Use the "struct sample_data" in the "struct sample"
This patch remove the struct information stored both in the struct
sample_data and in the striuct sample. Now, only thestruct sample_data
contains data, and the struct sample use the struct sample_data for storing
his own data.
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 077bc13..29d68c3 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -1222,11 +1222,11 @@
if (cap[h->index] == NULL) /* no more capture memory */
continue;
- len = key->data.str.len;
+ len = key->data.data.str.len;
if (len > h->len)
len = h->len;
- memcpy(cap[h->index], key->data.str.str, len);
+ memcpy(cap[h->index], key->data.data.str.str, len);
cap[h->index][len] = 0;
}
else {
@@ -1999,12 +1999,12 @@
switch (cli_conn->addr.from.ss_family) {
case AF_INET:
- smp->data.ipv4 = ((struct sockaddr_in *)&cli_conn->addr.from)->sin_addr;
- smp->type = SMP_T_IPV4;
+ smp->data.data.ipv4 = ((struct sockaddr_in *)&cli_conn->addr.from)->sin_addr;
+ smp->data.type = SMP_T_IPV4;
break;
case AF_INET6:
- smp->data.ipv6 = ((struct sockaddr_in6 *)&cli_conn->addr.from)->sin6_addr;
- smp->type = SMP_T_IPV6;
+ smp->data.data.ipv6 = ((struct sockaddr_in6 *)&cli_conn->addr.from)->sin6_addr;
+ smp->data.type = SMP_T_IPV6;
break;
default:
return 0;
@@ -2023,8 +2023,8 @@
if (!cli_conn)
return 0;
- smp->type = SMP_T_SINT;
- if (!(smp->data.sint = get_host_port(&cli_conn->addr.from)))
+ smp->data.type = SMP_T_SINT;
+ if (!(smp->data.data.sint = get_host_port(&cli_conn->addr.from)))
return 0;
smp->flags = 0;
@@ -2044,12 +2044,12 @@
switch (cli_conn->addr.to.ss_family) {
case AF_INET:
- smp->data.ipv4 = ((struct sockaddr_in *)&cli_conn->addr.to)->sin_addr;
- smp->type = SMP_T_IPV4;
+ smp->data.data.ipv4 = ((struct sockaddr_in *)&cli_conn->addr.to)->sin_addr;
+ smp->data.type = SMP_T_IPV4;
break;
case AF_INET6:
- smp->data.ipv6 = ((struct sockaddr_in6 *)&cli_conn->addr.to)->sin6_addr;
- smp->type = SMP_T_IPV6;
+ smp->data.data.ipv6 = ((struct sockaddr_in6 *)&cli_conn->addr.to)->sin6_addr;
+ smp->data.type = SMP_T_IPV6;
break;
default:
return 0;
@@ -2070,8 +2070,8 @@
conn_get_to_addr(cli_conn);
- smp->type = SMP_T_SINT;
- if (!(smp->data.sint = get_host_port(&cli_conn->addr.to)))
+ smp->data.type = SMP_T_SINT;
+ if (!(smp->data.data.sint = get_host_port(&cli_conn->addr.to)))
return 0;
smp->flags = 0;