File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
libraries/net/eth/EthernetInterface Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ static struct netif lpcNetif;
33
33
34
34
static char mac_addr[19 ];
35
35
static char ip_addr[17 ] = " \0 " ;
36
+ static char gateway[17 ] = " \0 " ;
37
+ static char networkmask[17 ] = " \0 " ;
36
38
static bool use_dhcp = false ;
37
39
38
40
static Semaphore tcpip_inited (0 );
@@ -52,6 +54,8 @@ static void netif_link_callback(struct netif *netif) {
52
54
static void netif_status_callback (struct netif *netif) {
53
55
if (netif_is_up (netif)) {
54
56
strcpy (ip_addr, inet_ntoa (netif->ip_addr ));
57
+ strcpy (gateway, inet_ntoa (netif->gw ));
58
+ strcpy (networkmask, inet_ntoa (netif->netmask ));
55
59
netif_up.release ();
56
60
}
57
61
}
@@ -142,3 +146,13 @@ char* EthernetInterface::getMACAddress() {
142
146
char * EthernetInterface::getIPAddress () {
143
147
return ip_addr;
144
148
}
149
+
150
+ char * EthernetInterface::getGateway () {
151
+ return gateway;
152
+ }
153
+
154
+ char * EthernetInterface::getNetworkMask () {
155
+ return networkmask;
156
+ }
157
+
158
+
Original file line number Diff line number Diff line change @@ -69,6 +69,16 @@ class EthernetInterface {
69
69
* \return a pointer to a string containing the IP address
70
70
*/
71
71
static char * getIPAddress ();
72
+
73
+ /* * Get the Gateway address of your Ethernet interface
74
+ * \return a pointer to a string containing the Gateway address
75
+ */
76
+ static char * getGateway ();
77
+
78
+ /* * Get the Network mask of your Ethernet interface
79
+ * \return a pointer to a string containing the Network mask
80
+ */
81
+ static char * getNetworkMask ();
72
82
};
73
83
74
84
#include " TCPSocketConnection.h"
You can’t perform that action at this time.
0 commit comments