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
Fork of EthernetInterface by
Revision 36:cba86db5ab96, committed 2013-10-09
- Comitter:
- mbed_official
- Date:
- Wed Oct 09 12:00:18 2013 +0100
- Parent:
- 35:4aa9e92d1a58
- Commit message:
- Synchronized with git revision d3963de05d9ddff98b9da2b2a1fee0d51fd9481e
Changed in this revision
| EthernetInterface.cpp | Show annotated file Show diff for this revision Revisions of this file |
| EthernetInterface.h | Show annotated file Show diff for this revision Revisions of this file |
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;
+}
+
+
diff -r 4aa9e92d1a58 -r cba86db5ab96 EthernetInterface.h
--- a/EthernetInterface.h Tue Oct 01 11:29:54 2013 +0000
+++ b/EthernetInterface.h Wed Oct 09 12:00:18 2013 +0100
@@ -69,6 +69,16 @@
* \return a pointer to a string containing the IP address
*/
static char* getIPAddress();
+
+ /** Get the Gateway address of your Ethernet interface
+ * \return a pointer to a string containing the Gateway address
+ */
+ static char* getGateway();
+
+ /** Get the Network mask of your Ethernet interface
+ * \return a pointer to a string containing the Network mask
+ */
+ static char* getNetworkMask();
};
#include "TCPSocketConnection.h"
