Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DnsQuery
Dependents: WizFi310_TCP_Echo_Server_Example
Fork of NetworkSocketAPI by
Diff: NetworkInterface.cpp
- Branch:
- api-changes
- Revision:
- 28:163fbe3263f4
- Parent:
- 23:1e86d9fb3d86
- Child:
- 29:7bcec3189a93
diff -r d7ed39727306 -r 163fbe3263f4 NetworkInterface.cpp
--- 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);
}
