Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Socket lwip-eth lwip-sys lwip
Dependents: FreedomK64F_CandyMachine
Fork of EthernetInterface by
Diff: EthernetInterface.cpp
- Revision:
- 35:cba86db5ab96
- Parent:
- 33:c21b055c45b8
- Child:
- 37:926eb6517318
diff -r 4aa9e92d1a58 -r cba86db5ab96 EthernetInterface.cpp
--- a/EthernetInterface.cpp	Tue Oct 01 11:29:54 2013 +0000
+++ b/EthernetInterface.cpp	Wed Oct 09 12:00:18 2013 +0100
@@ -33,6 +33,8 @@
 
 static char mac_addr[19];
 static char ip_addr[17] = "\0";
+static char gateway[17] = "\0";
+static char networkmask[17] = "\0";
 static bool use_dhcp = false;
 
 static Semaphore tcpip_inited(0);
@@ -52,6 +54,8 @@
 static void netif_status_callback(struct netif *netif) {
     if (netif_is_up(netif)) {
         strcpy(ip_addr, inet_ntoa(netif->ip_addr));
+        strcpy(gateway, inet_ntoa(netif->gw));
+        strcpy(networkmask, inet_ntoa(netif->netmask));
         netif_up.release();
     }
 }
@@ -142,3 +146,13 @@
 char* EthernetInterface::getIPAddress() {
     return ip_addr;
 }
+
+char* EthernetInterface::getGateway() {
+    return gateway;
+}
+
+char* EthernetInterface::getNetworkMask() {
+    return networkmask;
+}
+
+
    