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.
Dependents: EvrythngApi Websocket_Ethernet_HelloWorld_W5500 Websocket_Ethernet_W5500 CurrentWeatherData_W5500 ... more
Information
It has EthernetInterface class like official EthernetInterface , but uses Wiznet chip driver codes.
So this library can use only the WIZnet W5500 or WIZ550io users.
This library has referred to many project such as WIZ550ioInterface, WiflyInterface and WIZnet Library.
Thanks all.
DNSClient/dnsname.h@11:5499fa2d8898, 2015-04-28 (annotated)
- Committer:
- embeddist
- Date:
- Tue Apr 28 13:52:23 2015 +0000
- Revision:
- 11:5499fa2d8898
- Parent:
- 0:e11e8793c3ce
Remove the setting of tx/rx buffer in SWReset
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Bongjun | 0:e11e8793c3ce | 1 | // dnsname.h 2013/8/27 |
Bongjun | 0:e11e8793c3ce | 2 | #pragma once |
Bongjun | 0:e11e8793c3ce | 3 | //#include <string> |
Bongjun | 0:e11e8793c3ce | 4 | #include "pico_string.h" |
Bongjun | 0:e11e8793c3ce | 5 | class dnsname { |
Bongjun | 0:e11e8793c3ce | 6 | public: |
Bongjun | 0:e11e8793c3ce | 7 | uint8_t *buf; |
Bongjun | 0:e11e8793c3ce | 8 | pico_string str; |
Bongjun | 0:e11e8793c3ce | 9 | dnsname(uint8_t *s) { |
Bongjun | 0:e11e8793c3ce | 10 | buf = s; |
Bongjun | 0:e11e8793c3ce | 11 | } |
Bongjun | 0:e11e8793c3ce | 12 | int decode(int pos) { |
Bongjun | 0:e11e8793c3ce | 13 | while(1) { |
Bongjun | 0:e11e8793c3ce | 14 | int len = buf[pos++]; |
Bongjun | 0:e11e8793c3ce | 15 | if (len == 0x00) { |
Bongjun | 0:e11e8793c3ce | 16 | break; |
Bongjun | 0:e11e8793c3ce | 17 | } |
Bongjun | 0:e11e8793c3ce | 18 | if ((len&0xc0) == 0xc0) { //compress |
Bongjun | 0:e11e8793c3ce | 19 | int offset = (len&0x3f)<<8|buf[pos]; |
Bongjun | 0:e11e8793c3ce | 20 | decode(offset); |
Bongjun | 0:e11e8793c3ce | 21 | return pos+1; |
Bongjun | 0:e11e8793c3ce | 22 | } |
Bongjun | 0:e11e8793c3ce | 23 | if (!str.empty()) { |
Bongjun | 0:e11e8793c3ce | 24 | str.append("."); |
Bongjun | 0:e11e8793c3ce | 25 | } |
Bongjun | 0:e11e8793c3ce | 26 | str.append((const char*)(buf+pos), len); |
Bongjun | 0:e11e8793c3ce | 27 | pos += len; |
Bongjun | 0:e11e8793c3ce | 28 | } |
Bongjun | 0:e11e8793c3ce | 29 | return pos; |
Bongjun | 0:e11e8793c3ce | 30 | } |
Bongjun | 0:e11e8793c3ce | 31 | |
Bongjun | 0:e11e8793c3ce | 32 | int encode(int pos, char* s) { |
Bongjun | 0:e11e8793c3ce | 33 | while(*s) { |
Bongjun | 0:e11e8793c3ce | 34 | char *f = strchr(s, '.'); |
Bongjun | 0:e11e8793c3ce | 35 | if (f == NULL) { |
Bongjun | 0:e11e8793c3ce | 36 | int len = strlen(s); |
Bongjun | 0:e11e8793c3ce | 37 | buf[pos++] = len; |
Bongjun | 0:e11e8793c3ce | 38 | memcpy(buf+pos, s, len); |
Bongjun | 0:e11e8793c3ce | 39 | pos += len; |
Bongjun | 0:e11e8793c3ce | 40 | break; |
Bongjun | 0:e11e8793c3ce | 41 | } |
Bongjun | 0:e11e8793c3ce | 42 | int len = f - s; |
Bongjun | 0:e11e8793c3ce | 43 | buf[pos++] = len; |
Bongjun | 0:e11e8793c3ce | 44 | memcpy(buf+pos, s, len); |
Bongjun | 0:e11e8793c3ce | 45 | s = f+1; |
Bongjun | 0:e11e8793c3ce | 46 | pos += len; |
Bongjun | 0:e11e8793c3ce | 47 | } |
Bongjun | 0:e11e8793c3ce | 48 | buf[pos++] = 0x00; |
Bongjun | 0:e11e8793c3ce | 49 | return pos; |
Bongjun | 0:e11e8793c3ce | 50 | } |
Bongjun | 0:e11e8793c3ce | 51 | }; |