Mistake on this page?
Report an issue in GitHub or email us
tcp_helper.h
1 #ifndef LWIP_HDR_TCP_HELPER_H
2 #define LWIP_HDR_TCP_HELPER_H
3 
4 #include "../lwip_check.h"
5 #include "lwip/arch.h"
6 #include "lwip/tcp.h"
7 #include "lwip/netif.h"
8 
9 /* counters used for test_tcp_counters_* callback functions */
11  u32_t recv_calls;
12  u32_t recved_bytes;
13  u32_t recv_calls_after_close;
14  u32_t recved_bytes_after_close;
15  u32_t close_calls;
16  u32_t err_calls;
17  err_t last_err;
18  char* expected_data;
19  u32_t expected_data_len;
20 };
21 
23  u32_t num_tx_calls;
24  u32_t num_tx_bytes;
25  u8_t copy_tx_packets;
26  struct pbuf *tx_packets;
27 };
28 
29 extern const ip_addr_t test_local_ip;
30 extern const ip_addr_t test_remote_ip;
31 extern const ip_addr_t test_netmask;
32 #define TEST_REMOTE_PORT 0x100
33 #define TEST_LOCAL_PORT 0x101
34 
35 /* Helper functions */
36 void tcp_remove_all(void);
37 
38 struct pbuf* tcp_create_segment(ip_addr_t* src_ip, ip_addr_t* dst_ip,
39  u16_t src_port, u16_t dst_port, void* data, size_t data_len,
40  u32_t seqno, u32_t ackno, u8_t headerflags);
41 struct pbuf* tcp_create_rx_segment(struct tcp_pcb* pcb, void* data, size_t data_len,
42  u32_t seqno_offset, u32_t ackno_offset, u8_t headerflags);
43 struct pbuf* tcp_create_rx_segment_wnd(struct tcp_pcb* pcb, void* data, size_t data_len,
44  u32_t seqno_offset, u32_t ackno_offset, u8_t headerflags, u16_t wnd);
45 void tcp_set_state(struct tcp_pcb* pcb, enum tcp_state state, const ip_addr_t* local_ip,
46  const ip_addr_t* remote_ip, u16_t local_port, u16_t remote_port);
47 void test_tcp_counters_err(void* arg, err_t err);
48 err_t test_tcp_counters_recv(void* arg, struct tcp_pcb* pcb, struct pbuf* p, err_t err);
49 
50 struct tcp_pcb* test_tcp_new_counters_pcb(struct test_tcp_counters* counters);
51 
52 void test_tcp_input(struct pbuf *p, struct netif *inp);
53 
54 void test_tcp_init_netif(struct netif *netif, struct test_tcp_txcounters *txcounters,
55  const ip_addr_t *ip_addr, const ip_addr_t *netmask);
56 
57 
58 #endif
netif API (to be used from TCPIP thread)
Main packet buffer struct.
Generic data structure used for all lwIP network interfaces.
IP address structure for passing IP addresses by value.
Definition: nsapi_types.h:235
Support for different processor and compiler architectures.
TCP API (to be used from TCPIP thread) See also tcp_raw.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.