2
0

IP4.cpp 257 B

123456789101112131415
  1. #include "IP4.h"
  2. #include <lwip/inet.h>
  3. IP4::IP4(const char *str) {
  4. in_addr_t addr;
  5. if (str && inet_aton(str, &addr))
  6. *this = addr;
  7. else
  8. *this = null_ip;
  9. }
  10. const char * IP4::cstr() {
  11. in_addr_t addr = *this;
  12. return inet_ntoa(addr);
  13. }