summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authoraozima <[email protected]>2018-05-22 23:56:35 +0800
committeraozima <[email protected]>2018-05-25 22:30:14 +0800
commit6daf88d7a485ca1ce96eb5d128d21cc1d4ba4f1e (patch)
treecbb81ed29130e0abde4ee044bd36e78bff3743dd /components
parent18941a1e692d5a62233abd9785e4fc2b9382ac4c (diff)
[lwip] add list_udps.
Diffstat (limited to 'components')
-rw-r--r--components/net/lwip-2.0.2/src/netif/ethernetif.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/components/net/lwip-2.0.2/src/netif/ethernetif.c b/components/net/lwip-2.0.2/src/netif/ethernetif.c
index 7fc605407d..21f71e4287 100644
--- a/components/net/lwip-2.0.2/src/netif/ethernetif.c
+++ b/components/net/lwip-2.0.2/src/netif/ethernetif.c
@@ -673,6 +673,35 @@ void list_tcps(void)
rt_exit_critical();
}
FINSH_FUNCTION_EXPORT(list_tcps, list all of tcp connections);
-#endif
+#endif /* LWIP_TCP */
+
+#if LWIP_UDP
+void list_udps(void)
+{
+ struct udp_pcb *pcb;
+ rt_uint32_t num = 0;
+ char local_ip_str[16];
+ char remote_ip_str[16];
+
+ rt_enter_critical();
+ rt_kprintf("Active UDP PCB states:\n");
+ for (pcb = udp_pcbs; pcb != NULL; pcb = pcb->next)
+ {
+ strcpy(local_ip_str, ipaddr_ntoa(&(pcb->local_ip)));
+ strcpy(remote_ip_str, ipaddr_ntoa(&(pcb->remote_ip)));
+
+ rt_kprintf("#%d %d %s:%d <==> %s:%d \n",
+ num, (int)pcb->flags,
+ local_ip_str,
+ pcb->local_port,
+ remote_ip_str,
+ pcb->remote_port);
+
+ num++;
+ }
+ rt_exit_critical();
+}
+FINSH_FUNCTION_EXPORT(list_udps, list all of udp connections);
+#endif /* LWIP_UDP */
#endif