Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion cores/esp8266/IPAddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
#include <Print.h>
#include <StreamString.h>

IPAddress::IPAddress(const IPAddress& from)
{
ip_addr_copy(_ip, from._ip);
}

IPAddress::IPAddress() {
_ip = *IP_ANY_TYPE; // lwIP's v4-or-v6 generic address
}
Expand All @@ -45,7 +50,10 @@ void IPAddress::ctor32(uint32_t address) {

IPAddress::IPAddress(const uint8_t *address) {
setV4();
v4() = *reinterpret_cast<const uint32_t*>(address);
(*this)[0] = address[0];
(*this)[1] = address[1];
(*this)[2] = address[2];
(*this)[3] = address[3];
}

bool IPAddress::fromString(const char *address) {
Expand Down
1 change: 1 addition & 0 deletions cores/esp8266/IPAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class IPAddress: public Printable {
public:
// Constructors
IPAddress();
IPAddress(const IPAddress& from);
IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet);
IPAddress(uint32_t address) { ctor32(address); }
IPAddress(u32_t address) { ctor32(address); }
Expand Down