NetworkSocketAPI
Dependents: HelloWizFi250Interface
Fork of NetworkSocketAPI by
Revision 59:badee747a030, committed 2016-02-25
- Comitter:
- Christopher Haster
- Date:
- Thu Feb 25 21:52:57 2016 -0600
- Parent:
- 58:1caa187fa5af
- Child:
- 60:0360cb987da3
- Commit message:
- Removed setIPAddress/NetworkMask/Gateway set of functions from NetworkInterface
Changed in this revision
NetworkInterface.cpp | Show annotated file Show diff for this revision Revisions of this file |
NetworkInterface.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/NetworkInterface.cpp Thu Feb 25 21:20:25 2016 -0600 +++ b/NetworkInterface.cpp Thu Feb 25 21:52:57 2016 -0600 @@ -19,64 +19,24 @@ #include "DnsQuery.h" #include <string.h> -NetworkInterface::NetworkInterface() - : _dhcp_enabled(true) -{ - memset(_ip_address, 0, NS_IP_SIZE); - memset(_network_mask, 0, NS_IP_SIZE); - memset(_gateway, 0, NS_IP_SIZE); -} - -void NetworkInterface::setDHCP(bool enabled) -{ - _dhcp_enabled = enabled; -} - -void NetworkInterface::setIPAddress(const char *ip) -{ - strcpy(_ip_address, ip); -} - -void NetworkInterface::setNetworkMask(const char *mask) -{ - strcpy(_network_mask, mask); -} - -void NetworkInterface::setGateway(const char *gateway) -{ - strcpy(_gateway, gateway); -} - -bool NetworkInterface::getDHCP() -{ - return _dhcp_enabled; -} - const char *NetworkInterface::getIPAddress() { - if (_ip_address[0]) { - return _ip_address; - } else { - return 0; - } + return 0; } const char *NetworkInterface::getNetworkMask() { - if (_network_mask[0]) { - return _network_mask; - } else { - return 0; - } + return 0; } const char *NetworkInterface::getGateway() { - if (_gateway[0]) { - return _gateway; - } else { - return 0; - } + return 0; +} + +const char *NetworkInterface::getMACAddress() +{ + return 0; } bool NetworkInterface::isConnected()
--- a/NetworkInterface.h Thu Feb 25 21:20:25 2016 -0600 +++ b/NetworkInterface.h Thu Feb 25 21:52:57 2016 -0600 @@ -50,32 +50,6 @@ public: virtual ~NetworkInterface() {}; - /** Enables or disables DHCP - * @note DHCP resolution does not occur until connect - * @note DHCP is enabled by default - * @param enable Enables DHCP if true - */ - virtual void setDHCP(bool enable); - - /** Set the static IP address of the network interface - * @param ip Static IP address, copied internally - */ - virtual void setIPAddress(const char *ip); - - /** Set the static network mask of the network interface - * @param mask Static network mask, copied internally - */ - virtual void setNetworkMask(const char *mask); - - /** Set the static gateway of the network interface - * @param gateway Gateway address, copied internally - */ - virtual void setGateway(const char *gateway); - - /** Checks if DHCP is enabled - * @return True if DHCP is enabled - */ - virtual bool getDHCP(); /** Get the IP address * @return IP address of the interface @@ -95,13 +69,14 @@ /** Get the current MAC address * @return String MAC address of the interface */ - virtual const char *getMACAddress() = 0; + virtual const char *getMACAddress(); /** Get the current status of the interface * @return true if connected */ virtual bool isConnected(); + /** Looks up the specified host's IP address * @param name URL of host * @param ip Buffer to hold IP address, must be at least SOCK_IP_SIZE @@ -110,8 +85,6 @@ virtual int32_t getHostByName(const char *name, char *ip); protected: - NetworkInterface(); - friend class Socket; /** Internally create a socket @@ -125,12 +98,6 @@ * @returns 0 on success */ virtual void destroySocket(SocketInterface *socket) = 0; - -private: - bool _dhcp_enabled; - char _ip_address[NS_IP_SIZE]; - char _network_mask[NS_IP_SIZE]; - char _gateway[NS_IP_SIZE]; }; #endif