8 #if !LWIP_STATS || !TCP_STATS || !MEMP_STATS
9 #error "This tests needs TCP- and MEMP-statistics enabled"
14 tcp_remove(
struct tcp_pcb* pcb_list)
16 struct tcp_pcb *pcb = pcb_list;
30 tcp_remove(tcp_listen_pcbs.pcbs);
31 tcp_remove(tcp_active_pcbs);
32 tcp_remove(tcp_tw_pcbs);
33 fail_unless(lwip_stats.memp[MEMP_TCP_PCB].used == 0);
34 fail_unless(lwip_stats.memp[MEMP_TCP_PCB_LISTEN].used == 0);
35 fail_unless(lwip_stats.memp[MEMP_TCP_SEG].used == 0);
36 fail_unless(lwip_stats.memp[MEMP_PBUF_POOL].used == 0);
47 return tcp_create_segment(&pcb->remote_ip, &pcb->local_ip, pcb->remote_port, pcb->local_port,
48 data, data_len, pcb->rcv_nxt + seqno_offset, pcb->snd_nxt + ackno_offset, headerflags);
54 u16_t src_port,
u16_t dst_port,
void* data,
size_t data_len,
59 struct tcp_hdr* tcphdr;
60 u16_t pbuf_len = (
u16_t)(
sizeof(
struct ip_hdr) +
sizeof(
struct tcp_hdr) + data_len);
71 iphdr->src.addr = src_ip->addr;
79 tcphdr->src =
htons(src_port);
80 tcphdr->dest =
htons(dst_port);
81 tcphdr->seqno =
htonl(seqno);
82 tcphdr->ackno =
htonl(ackno);
83 TCPH_HDRLEN_SET(tcphdr,
sizeof(
struct tcp_hdr)/4);
84 TCPH_FLAGS_SET(tcphdr, headerflags);
88 memcpy((
char*)tcphdr +
sizeof(
struct tcp_hdr), data, data_len);
107 if (state == ESTABLISHED) {
108 TCP_REG(&tcp_active_pcbs, pcb);
109 pcb->local_ip.addr = local_ip->addr;
110 pcb->local_port = local_port;
111 pcb->remote_ip.addr = remote_ip->addr;
112 pcb->remote_port = remote_port;
113 }
else if(state == LISTEN) {
114 TCP_REG(&tcp_listen_pcbs.pcbs, pcb);
115 pcb->local_ip.addr = local_ip->addr;
116 pcb->local_port = local_port;
117 }
else if(state == TIME_WAIT) {
118 TCP_REG(&tcp_tw_pcbs, pcb);
119 pcb->local_ip.addr = local_ip->addr;
120 pcb->local_port = local_port;
121 pcb->remote_ip.addr = remote_ip->addr;
122 pcb->remote_port = remote_port;
148 for(q = p; q !=
NULL; q = q->
next) {
150 for(i = 0; i < q->
len; i++) {
169 test_tcp_counters_check_rxdata(counters, p);
187 struct tcp_pcb* pcb = tcp_new();
190 tcp_arg(pcb, counters);