exeption of receive(TCPSocketconnection)
Dependents: FTP_SDCard_File_Client_WIZwiki-W7500 FTPClient_example Freedman DigitalCamera_OV5642_WIZwiki-W7500 ... more
Fork of WIZnetInterface by
dnsname.h
00001 // dnsname.h 2013/8/27 00002 #pragma once 00003 //#include <string> 00004 #include "pico_string.h" 00005 class dnsname { 00006 public: 00007 uint8_t *buf; 00008 pico_string str; 00009 dnsname(uint8_t *s) { 00010 buf = s; 00011 } 00012 int decode(int pos) { 00013 while(1) { 00014 int len = buf[pos++]; 00015 if (len == 0x00) { 00016 break; 00017 } 00018 if ((len&0xc0) == 0xc0) { //compress 00019 int offset = (len&0x3f)<<8|buf[pos]; 00020 decode(offset); 00021 return pos+1; 00022 } 00023 if (!str.empty()) { 00024 str.append("."); 00025 } 00026 str.append((const char*)(buf+pos), len); 00027 pos += len; 00028 } 00029 return pos; 00030 } 00031 00032 int encode(int pos, char* s) { 00033 while(*s) { 00034 char *f = strchr(s, '.'); 00035 if (f == NULL) { 00036 int len = strlen(s); 00037 buf[pos++] = len; 00038 memcpy(buf+pos, s, len); 00039 pos += len; 00040 break; 00041 } 00042 int len = f - s; 00043 buf[pos++] = len; 00044 memcpy(buf+pos, s, len); 00045 s = f+1; 00046 pos += len; 00047 } 00048 buf[pos++] = 0x00; 00049 return pos; 00050 } 00051 }; 00052
Generated on Thu Jul 14 2022 05:42:13 by 1.7.2