42 INET::aton(
const char* addr, uint8_t ip[4],
bool progmem)
44 const char* ap = addr;
46 for (uint8_t i = 0; i <
IP_MAX; i++) {
48 while (isdigit(c = (progmem ? pgm_read_byte(ap++) : *ap++)))
49 r = (r * 10) + (c -
'0');
51 if (c !=
'.')
return (
EINVAL);
54 if (i < IP_MAX - 1)
return (
E2BIG);
65 const char* hp = hostname;
71 char c = (progmem ? pgm_read_byte(hp++) : *hp++);
72 if (c == 0 || c ==
'.') {
106 if (n != 0) outs <<
'.';
113 outs << toHEX(mac[0] >> 4) <<
toHEX(mac[0]);
114 for (uint8_t i = 1; i <
MAC_MAX; i++)
115 outs <<
':' <<
toHEX(mac[i] >> 4) <<
toHEX(mac[i]);
122 for (uint8_t i = 1; i <
IP_MAX; i++) outs <<
'.' << addr[i];
132 const uint16_t* bp = (
const uint16_t*) buf;
143 sum += *(
const uint8_t*) bp;
147 sum = (sum & 0xffff) + (sum >> 16);
static void print_mac(IOStream &outs, const uint8_t mac[MAC_MAX])
static int aton(const char *addr, uint8_t ip[IP_MAX], bool progmem=false)
static bool is_illegal(uint8_t addr[IP_MAX], uint16_t port)
static uint16_t checksum(const void *buf, size_t count)
char toHEX(uint8_t value)
static void print_path(IOStream &outs, const char *path)
static const uint8_t IP_MAX
static const uint8_t MAC_MAX
static void print_addr(IOStream &outs, const uint8_t addr[IP_MAX], uint16_t port=0)
static const uint8_t PATH_MAX
static int nametopath(const char *hostname, char *path, bool progmem=false)