This is WIZnet Ethernet Interface using Hardware TCP/IP chip, W5500, W5200 and W5100. One of them can be selected by enabling it in wiznet.h.
Dependents: Embedded_web EmailButton EmailButton HTTPClient_Weather ... more
other drivers
for only W5500 / WIZ550io user, you could use
Import libraryW5500Interface
This is the Interface library for WIZnet W5500 chip which forked of EthernetInterfaceW5500, WIZnetInterface and WIZ550ioInterface. This library has simple name as "W5500Interface". and can be used for Wiz550io users also.
WIZnetInterface/DNSClient/dnsname.h@8:cb8808b47e69, 2015-05-31 (annotated)
- Committer:
- Bongjun
- Date:
- Sun May 31 10:25:40 2015 +0000
- Revision:
- 8:cb8808b47e69
- Parent:
- 0:b72d22e10709
fix some codes of reading Sn_RX_RSR, Sn_TX_FSR in W5100.cpp, W5200.cpp; added is_fin_received() in W5100, W5200 files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jbkim | 0:b72d22e10709 | 1 | // dnsname.h 2013/8/27 |
jbkim | 0:b72d22e10709 | 2 | #pragma once |
jbkim | 0:b72d22e10709 | 3 | //#include <string> |
jbkim | 0:b72d22e10709 | 4 | #include "pico_string.h" |
jbkim | 0:b72d22e10709 | 5 | class dnsname { |
jbkim | 0:b72d22e10709 | 6 | public: |
jbkim | 0:b72d22e10709 | 7 | uint8_t *buf; |
jbkim | 0:b72d22e10709 | 8 | pico_string str; |
jbkim | 0:b72d22e10709 | 9 | dnsname(uint8_t *s) { |
jbkim | 0:b72d22e10709 | 10 | buf = s; |
jbkim | 0:b72d22e10709 | 11 | } |
jbkim | 0:b72d22e10709 | 12 | int decode(int pos) { |
jbkim | 0:b72d22e10709 | 13 | while(1) { |
jbkim | 0:b72d22e10709 | 14 | int len = buf[pos++]; |
jbkim | 0:b72d22e10709 | 15 | if (len == 0x00) { |
jbkim | 0:b72d22e10709 | 16 | break; |
jbkim | 0:b72d22e10709 | 17 | } |
jbkim | 0:b72d22e10709 | 18 | if ((len&0xc0) == 0xc0) { //compress |
jbkim | 0:b72d22e10709 | 19 | int offset = (len&0x3f)<<8|buf[pos]; |
jbkim | 0:b72d22e10709 | 20 | decode(offset); |
jbkim | 0:b72d22e10709 | 21 | return pos+1; |
jbkim | 0:b72d22e10709 | 22 | } |
jbkim | 0:b72d22e10709 | 23 | if (!str.empty()) { |
jbkim | 0:b72d22e10709 | 24 | str.append("."); |
jbkim | 0:b72d22e10709 | 25 | } |
jbkim | 0:b72d22e10709 | 26 | str.append((const char*)(buf+pos), len); |
jbkim | 0:b72d22e10709 | 27 | pos += len; |
jbkim | 0:b72d22e10709 | 28 | } |
jbkim | 0:b72d22e10709 | 29 | return pos; |
jbkim | 0:b72d22e10709 | 30 | } |
jbkim | 0:b72d22e10709 | 31 | |
jbkim | 0:b72d22e10709 | 32 | int encode(int pos, char* s) { |
jbkim | 0:b72d22e10709 | 33 | while(*s) { |
jbkim | 0:b72d22e10709 | 34 | char *f = strchr(s, '.'); |
jbkim | 0:b72d22e10709 | 35 | if (f == NULL) { |
jbkim | 0:b72d22e10709 | 36 | int len = strlen(s); |
jbkim | 0:b72d22e10709 | 37 | buf[pos++] = len; |
jbkim | 0:b72d22e10709 | 38 | memcpy(buf+pos, s, len); |
jbkim | 0:b72d22e10709 | 39 | pos += len; |
jbkim | 0:b72d22e10709 | 40 | break; |
jbkim | 0:b72d22e10709 | 41 | } |
jbkim | 0:b72d22e10709 | 42 | int len = f - s; |
jbkim | 0:b72d22e10709 | 43 | buf[pos++] = len; |
jbkim | 0:b72d22e10709 | 44 | memcpy(buf+pos, s, len); |
jbkim | 0:b72d22e10709 | 45 | s = f+1; |
jbkim | 0:b72d22e10709 | 46 | pos += len; |
jbkim | 0:b72d22e10709 | 47 | } |
jbkim | 0:b72d22e10709 | 48 | buf[pos++] = 0x00; |
jbkim | 0:b72d22e10709 | 49 | return pos; |
jbkim | 0:b72d22e10709 | 50 | } |
jbkim | 0:b72d22e10709 | 51 | }; |
jbkim | 0:b72d22e10709 | 52 |