NetworkSocketAPI
Dependents: HelloWizFi250Interface
Fork of NetworkSocketAPI by
Diff: NetworkInterface.cpp
- Branch:
- api-changes
- Revision:
- 28:163fbe3263f4
- Parent:
- 23:1e86d9fb3d86
- Child:
- 29:7bcec3189a93
--- a/NetworkInterface.cpp Thu Feb 18 09:20:39 2016 -0600 +++ b/NetworkInterface.cpp Thu Feb 18 13:19:47 2016 -0600 @@ -18,32 +18,21 @@ #include <stdlib.h> #include <string.h> -#define IP_SIZE 16 - -NetworkInterface::NetworkInterface() - : _ip_address(0) - , _network_mask(0) - , _gateway(0) { -} - -NetworkInterface::~NetworkInterface() { - if (_ip_address) free(_ip_address); - if (_network_mask) free(_network_mask); - if (_gateway) free(_gateway); +NetworkInterface::NetworkInterface() { + memset(_ip_address, 0, SOCK_IP_SIZE); + memset(_network_mask, 0, SOCK_IP_SIZE); + memset(_gateway, 0, SOCK_IP_SIZE); } void NetworkInterface::setIPAddress(const char *ip) { - _ip_address = (char*)malloc(IP_SIZE); strcpy(_ip_address, ip); } void NetworkInterface::setNetworkMask(const char *mask) { - _network_mask = (char*)malloc(IP_SIZE); strcpy(_network_mask, mask); } void NetworkInterface::setGateway(const char *gateway) { - _gateway = (char*)malloc(IP_SIZE); strcpy(_gateway, gateway); }