Implementation of the NetworkSocketAPI for LWIP

Dependencies:   lwip-eth lwip-sys lwip

Dependents:   HelloLWIPInterface HelloLWIPInterfaceNonBlocking LWIPInterfaceTests SimpleHTTPExample ... more

Revision:
8:cef01e812975
Parent:
5:2c7d2186543c
Child:
11:82796df87b0a
--- a/LWIPInterface.cpp	Wed Mar 09 05:58:19 2016 +0000
+++ b/LWIPInterface.cpp	Wed Mar 09 06:01:14 2016 +0000
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- 
+
 #include "LWIPInterface.h"
 
 #include "mbed.h"
@@ -40,36 +40,41 @@
 static Semaphore netif_linked(0);
 static Semaphore netif_up(0);
 
-static void tcpip_init_done(void *) {
+static void tcpip_init_done(void *)
+{
     tcpip_inited.release();
 }
 
-static void netif_link_callback(struct netif *netif) {
+static void netif_link_callback(struct netif *netif)
+{
     if (netif_is_link_up(netif)) {
         netif_linked.release();
     }
 }
 
-static void netif_status_callback(struct netif *netif) {
+static void netif_status_callback(struct netif *netif)
+{
     if (netif_is_up(netif)) {
         strcpy(ip_addr, inet_ntoa(netif->ip_addr));
         netif_up.release();
     }
 }
 
-static void init_netif(ip_addr_t *ipaddr, ip_addr_t *netmask, ip_addr_t *gw) {
+static void init_netif(ip_addr_t *ipaddr, ip_addr_t *netmask, ip_addr_t *gw)
+{
     tcpip_init(tcpip_init_done, NULL);
     tcpip_inited.wait();
-    
+
     memset((void*) &netif, 0, sizeof(netif));
     netif_add(&netif, ipaddr, netmask, gw, NULL, eth_arch_enetif_init, tcpip_input);
     netif_set_default(&netif);
-    
+
     netif_set_link_callback  (&netif, netif_link_callback);
     netif_set_status_callback(&netif, netif_status_callback);
 }
 
-static void set_mac_address(void) {
+static void set_mac_address(void)
+{
 #if (MBED_MAC_ADDRESS_SUM != MBED_MAC_ADDR_INTERFACE)
     snprintf(mac_addr, 19, "%02x:%02x:%02x:%02x:%02x:%02x", MBED_MAC_ADDR_0, MBED_MAC_ADDR_1, MBED_MAC_ADDR_2,
              MBED_MAC_ADDR_3, MBED_MAC_ADDR_4, MBED_MAC_ADDR_5);
@@ -92,7 +97,7 @@
     eth_arch_enable_interrupts();
 
     dhcp_start(&netif);
-        
+
     // Wait for an IP Address
     // -1: error, 0: timeout
     if (netif_up.wait(LWIP_TIMEOUT) < 0) {
@@ -106,9 +111,9 @@
 {
     dhcp_release(&netif);
     dhcp_stop(&netif);
-    
+
     eth_arch_disable_interrupts();
-    
+
     return 0;
 }
 
@@ -117,7 +122,7 @@
     return ip_addr;
 }
 
-const char *LWIPInterface::getMACAddress() 
+const char *LWIPInterface::getMACAddress()
 {
     return mac_addr;
 }