Code and Libraries for Lab 4
Dependencies: Socket lwip-eth lwip-sys lwip
Fork of EthernetInterface by
Diff: EthernetInterface.cpp
- Revision:
- 35:cba86db5ab96
- Parent:
- 33:c21b055c45b8
- Child:
- 37:926eb6517318
--- 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; +} + +