• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From fdccb3a2c430c6270ff5272220cf471bf760fda7 Mon Sep 17 00:00:00 2001
2From: wuchangsheng <wuchangsheng2@huawei.com>
3Date: Sat, 21 Aug 2021 15:22:52 +0800
4Subject: [PATCH] del tcp_conn
5
6---
7 src/core/tcp.c         | 78 ------------------------------------------
8 src/include/lwip/tcp.h |  3 --
9 2 files changed, 81 deletions(-)
10
11diff --git a/src/core/tcp.c b/src/core/tcp.c
12index 2cfbce2..0f3e830 100644
13--- a/src/core/tcp.c
14+++ b/src/core/tcp.c
15@@ -2484,84 +2484,6 @@ tcp_tcp_get_tcp_addrinfo(struct tcp_pcb *pcb, int local, ip_addr_t *addr, u16_t
16   return ERR_VAL;
17 }
18
19-uint32_t tcp_get_conn_num(void)
20-{
21-    struct tcp_pcb *pcb = NULL;
22-    struct tcp_pcb_listen *pcbl = NULL;
23-    uint32_t conn_num = 0;
24-
25-    for (pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
26-        conn_num++;
27-    }
28-
29-    for (pcbl = tcp_listen_pcbs.listen_pcbs; pcbl != NULL; pcbl = pcbl->next) {
30-        conn_num++;
31-    }
32-
33-    for (pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) {
34-        conn_num++;
35-    }
36-
37-    return conn_num;
38-}
39-
40-void tcp_get_conn(char *buf, int32_t len, uint32_t *conn_num)
41-{
42-  int tmp_len = 0;
43-  char *tmp_buf = buf;
44-  struct tcp_pcb_dp tdp;
45-  struct tcp_pcb *pcb = NULL;
46-  struct tcp_pcb_listen *pcbl = NULL;
47-
48-#define COPY_TDP(b, l) \
49-  do { \
50-    if (l + sizeof(tdp) <= len) { \
51-	  memcpy(b, &tdp, sizeof(tdp)); \
52-	  b += sizeof(tdp); \
53-	  l += sizeof(tdp); \
54-      *conn_num += 1; \
55-    } else \
56-      return; \
57-  } while(0);
58-
59-  *conn_num = 0;
60-
61-  for (pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
62-    tdp.state = ACTIVE_LIST;
63-    tdp.lip = pcb->local_ip.addr;
64-    tdp.rip = pcb->remote_ip.addr;
65-    tdp.l_port = pcb->local_port;
66-    tdp.r_port = pcb->remote_port;
67-    tdp.s_next = pcb->snd_queuelen;
68-    /* lwip not cache rcv buf. Set it to 0. */
69-    tdp.r_next = 0;
70-    tdp.tcp_sub_state = pcb->state;
71-    COPY_TDP(tmp_buf, tmp_len);
72-  }
73-
74-  for (pcbl = tcp_listen_pcbs.listen_pcbs; pcbl != NULL; pcbl = pcbl->next) {
75-    tdp.state = LISTEN_LIST;
76-    tdp.lip = pcbl->local_ip.addr;
77-    tdp.rip = pcbl->remote_ip.addr;
78-    tdp.l_port = pcbl->local_port;
79-    tdp.tcp_sub_state = pcbl->state;
80-    COPY_TDP(tmp_buf, tmp_len);
81-  }
82-
83-  for (pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) {
84-    tdp.state = TIME_WAIT_LIST;
85-    tdp.lip = pcb->local_ip.addr;
86-    tdp.rip = pcb->remote_ip.addr;
87-    tdp.l_port = pcb->local_port;
88-    tdp.r_port = pcb->remote_port;
89-    tdp.s_next = pcb->snd_queuelen;
90-    /* lwip not cache rcv buf. Set it to 0. */
91-    tdp.r_next = 0;
92-    tdp.tcp_sub_state = pcb->state;
93-    COPY_TDP(tmp_buf, tmp_len);
94-  }
95-}
96-
97 #if TCP_QUEUE_OOSEQ
98 /* Free all ooseq pbufs (and possibly reset SACK state) */
99 void
100diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
101index 4f86b46..b36bf33 100644
102--- a/src/include/lwip/tcp.h
103+++ b/src/include/lwip/tcp.h
104@@ -570,9 +570,6 @@ struct tcp_pcb_dp {
105   uint32_t tcp_sub_state;
106 };
107
108-void tcp_get_conn(char *buf, int32_t len, uint32_t *conn_num);
109-uint32_t tcp_get_conn_num(void);
110-
111 /* for compatibility with older implementation */
112 #define tcp_new_ip6() tcp_new_ip_type(IPADDR_TYPE_V6)
113
114--
1152.23.0
116
117