mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-06-16 18:03:44 +08:00
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:
@@ -10,6 +10,10 @@
|
||||
#error "This tests needs TCP- and MEMP-statistics enabled"
|
||||
#endif
|
||||
|
||||
const ip_addr_t test_local_ip = IPADDR4_INIT_BYTES(192, 168, 1, 1);
|
||||
const ip_addr_t test_remote_ip = IPADDR4_INIT_BYTES(192, 168, 1, 2);
|
||||
const ip_addr_t test_netmask = IPADDR4_INIT_BYTES(255, 255, 255, 0);
|
||||
|
||||
/** Remove all pcbs on the given list. */
|
||||
static void
|
||||
tcp_remove(struct tcp_pcb* pcb_list)
|
||||
@@ -138,8 +142,8 @@ struct pbuf* tcp_create_rx_segment_wnd(struct tcp_pcb* pcb, void* data, size_t d
|
||||
|
||||
/** Safely bring a tcp_pcb into the requested state */
|
||||
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)
|
||||
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)
|
||||
{
|
||||
u32_t iss;
|
||||
|
||||
@@ -292,7 +296,7 @@ static err_t test_tcp_netif_output(struct netif *netif, struct pbuf *p,
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
struct netif *n;
|
||||
memset(netif, 0, sizeof(struct netif));
|
||||
|
||||
Reference in New Issue
Block a user