forked from Imagelibrary/lwip
test_tcp: de-duplicate test IP addresses, netmask, and ports
This creates a single version of test IP addresses, netmasks, and ports. All tests were using the same values, but duplicated in each test This also adds const to some functions so we can use a const version of addresses
This commit is contained in:
@@ -26,6 +26,12 @@ struct test_tcp_txcounters {
|
||||
struct pbuf *tx_packets;
|
||||
};
|
||||
|
||||
extern const ip_addr_t test_local_ip;
|
||||
extern const ip_addr_t test_remote_ip;
|
||||
extern const ip_addr_t test_netmask;
|
||||
#define TEST_REMOTE_PORT 0x100
|
||||
#define TEST_LOCAL_PORT 0x101
|
||||
|
||||
/* Helper functions */
|
||||
void tcp_remove_all(void);
|
||||
|
||||
@@ -36,8 +42,8 @@ struct pbuf* tcp_create_rx_segment(struct tcp_pcb* pcb, void* data, size_t data_
|
||||
u32_t seqno_offset, u32_t ackno_offset, u8_t headerflags);
|
||||
struct pbuf* tcp_create_rx_segment_wnd(struct tcp_pcb* pcb, void* data, size_t data_len,
|
||||
u32_t seqno_offset, u32_t ackno_offset, u8_t headerflags, u16_t wnd);
|
||||
void tcp_set_state(struct tcp_pcb* pcb, enum tcp_state state, ip_addr_t* local_ip,
|
||||
ip_addr_t* remote_ip, u16_t local_port, u16_t remote_port);
|
||||
void tcp_set_state(struct tcp_pcb* pcb, enum tcp_state state, const ip_addr_t* local_ip,
|
||||
const ip_addr_t* remote_ip, u16_t local_port, u16_t remote_port);
|
||||
void test_tcp_counters_err(void* arg, err_t err);
|
||||
err_t test_tcp_counters_recv(void* arg, struct tcp_pcb* pcb, struct pbuf* p, err_t err);
|
||||
|
||||
@@ -46,7 +52,7 @@ struct tcp_pcb* test_tcp_new_counters_pcb(struct test_tcp_counters* counters);
|
||||
void test_tcp_input(struct pbuf *p, struct netif *inp);
|
||||
|
||||
void test_tcp_init_netif(struct netif *netif, struct test_tcp_txcounters *txcounters,
|
||||
ip_addr_t *ip_addr, ip_addr_t *netmask);
|
||||
const ip_addr_t *ip_addr, const ip_addr_t *netmask);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user