mbed IP library over Ethernet

Dependencies:   lwip-eth Socket lwip lwip-sys

Dependents:   denki-yohou_b Network-RTOS NTPClient_HelloWorld temp_FIAP ... more

Legacy Networking Libraries

This is an mbed 2 networking library. For mbed 5, the networking libraries have been revised to better support additional network stacks and thread safety here.

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Wed Oct 09 12:00:18 2013 +0100
Parent:
34:4aa9e92d1a58
Child:
36:6a67d2bddc7c
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
--- 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;
+}
+
+
--- 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"