亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? dns.c

?? lwip-1.4.0
?? C
?? 第 1 頁 / 共 3 頁
字號:
/** * @file * DNS - host name to IP address resolver. * *//** * This file implements a DNS host name to IP address resolver. * Port to lwIP from uIP * by Jim Pettinato April 2007 * uIP version Copyright (c) 2002-2003, Adam Dunkels. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote *    products derived from this software without specific prior *    written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * DNS.C * * The lwIP DNS resolver functions are used to lookup a host name and * map it to a numerical IP address. It maintains a list of resolved * hostnames that can be queried with the dns_lookup() function. * New hostnames can be resolved using the dns_query() function. * * The lwIP version of the resolver also adds a non-blocking version of * gethostbyname() that will work with a raw API application. This function * checks for an IP address string first and converts it if it is valid. * gethostbyname() then does a dns_lookup() to see if the name is  * already in the table. If so, the IP is returned. If not, a query is  * issued and the function returns with a ERR_INPROGRESS status. The app * using the dns client must then go into a waiting state. * * Once a hostname has been resolved (or found to be non-existent), * the resolver code calls a specified callback function (which  * must be implemented by the module that uses the resolver). *//*----------------------------------------------------------------------------- * RFC 1035 - Domain names - implementation and specification * RFC 2181 - Clarifications to the DNS Specification *----------------------------------------------------------------------------*//** @todo: define good default values (rfc compliance) *//** @todo: improve answer parsing, more checkings... *//** @todo: check RFC1035 - 7.3. Processing responses *//*----------------------------------------------------------------------------- * Includes *----------------------------------------------------------------------------*/#include "lwip/opt.h"#if LWIP_DNS /* don't build if not configured for use in lwipopts.h */#include "lwip/udp.h"#include "lwip/mem.h"#include "lwip/memp.h"#include "lwip/dns.h"#include <string.h>/** DNS server IP address */#ifndef DNS_SERVER_ADDRESS#define DNS_SERVER_ADDRESS(ipaddr)        (ip4_addr_set_u32(ipaddr, ipaddr_addr("208.67.222.222"))) /* resolver1.opendns.com */#endif/** DNS server port address */#ifndef DNS_SERVER_PORT#define DNS_SERVER_PORT           53#endif/** DNS maximum number of retries when asking for a name, before "timeout". */#ifndef DNS_MAX_RETRIES#define DNS_MAX_RETRIES           4#endif/** DNS resource record max. TTL (one week as default) */#ifndef DNS_MAX_TTL#define DNS_MAX_TTL               604800#endif/* DNS protocol flags */#define DNS_FLAG1_RESPONSE        0x80#define DNS_FLAG1_OPCODE_STATUS   0x10#define DNS_FLAG1_OPCODE_INVERSE  0x08#define DNS_FLAG1_OPCODE_STANDARD 0x00#define DNS_FLAG1_AUTHORATIVE     0x04#define DNS_FLAG1_TRUNC           0x02#define DNS_FLAG1_RD              0x01#define DNS_FLAG2_RA              0x80#define DNS_FLAG2_ERR_MASK        0x0f#define DNS_FLAG2_ERR_NONE        0x00#define DNS_FLAG2_ERR_NAME        0x03/* DNS protocol states */#define DNS_STATE_UNUSED          0#define DNS_STATE_NEW             1#define DNS_STATE_ASKING          2#define DNS_STATE_DONE            3#ifdef PACK_STRUCT_USE_INCLUDES#  include "arch/bpstruct.h"#endifPACK_STRUCT_BEGIN/** DNS message header */struct dns_hdr {  PACK_STRUCT_FIELD(u16_t id);  PACK_STRUCT_FIELD(u8_t flags1);  PACK_STRUCT_FIELD(u8_t flags2);  PACK_STRUCT_FIELD(u16_t numquestions);  PACK_STRUCT_FIELD(u16_t numanswers);  PACK_STRUCT_FIELD(u16_t numauthrr);  PACK_STRUCT_FIELD(u16_t numextrarr);} PACK_STRUCT_STRUCT;PACK_STRUCT_END#ifdef PACK_STRUCT_USE_INCLUDES#  include "arch/epstruct.h"#endif#define SIZEOF_DNS_HDR 12/** DNS query message structure.    No packing needed: only used locally on the stack. */struct dns_query {  /* DNS query record starts with either a domain name or a pointer     to a name already present somewhere in the packet. */  u16_t type;  u16_t cls;};#define SIZEOF_DNS_QUERY 4/** DNS answer message structure.    No packing needed: only used locally on the stack. */struct dns_answer {  /* DNS answer record starts with either a domain name or a pointer     to a name already present somewhere in the packet. */  u16_t type;  u16_t cls;  u32_t ttl;  u16_t len;};#define SIZEOF_DNS_ANSWER 10/** DNS table entry */struct dns_table_entry {  u8_t  state;  u8_t  numdns;  u8_t  tmr;  u8_t  retries;  u8_t  seqno;  u8_t  err;  u32_t ttl;  char name[DNS_MAX_NAME_LENGTH];  ip_addr_t ipaddr;  /* pointer to callback on DNS query done */  dns_found_callback found;  void *arg;};#if DNS_LOCAL_HOSTLIST#if DNS_LOCAL_HOSTLIST_IS_DYNAMIC/** Local host-list. For hostnames in this list, no *  external name resolution is performed */static struct local_hostlist_entry *local_hostlist_dynamic;#else /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC *//** Defining this allows the local_hostlist_static to be placed in a different * linker section (e.g. FLASH) */#ifndef DNS_LOCAL_HOSTLIST_STORAGE_PRE#define DNS_LOCAL_HOSTLIST_STORAGE_PRE static#endif /* DNS_LOCAL_HOSTLIST_STORAGE_PRE *//** Defining this allows the local_hostlist_static to be placed in a different * linker section (e.g. FLASH) */#ifndef DNS_LOCAL_HOSTLIST_STORAGE_POST#define DNS_LOCAL_HOSTLIST_STORAGE_POST#endif /* DNS_LOCAL_HOSTLIST_STORAGE_POST */DNS_LOCAL_HOSTLIST_STORAGE_PRE struct local_hostlist_entry local_hostlist_static[]  DNS_LOCAL_HOSTLIST_STORAGE_POST = DNS_LOCAL_HOSTLIST_INIT;#endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */static void dns_init_local();#endif /* DNS_LOCAL_HOSTLIST *//* forward declarations */static void dns_recv(void *s, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t port);static void dns_check_entries(void);/*----------------------------------------------------------------------------- * Globales *----------------------------------------------------------------------------*//* DNS variables */static struct udp_pcb        *dns_pcb;static u8_t                   dns_seqno;static struct dns_table_entry dns_table[DNS_TABLE_SIZE];static ip_addr_t              dns_servers[DNS_MAX_SERVERS];/** Contiguous buffer for processing responses */static u8_t                   dns_payload_buffer[LWIP_MEM_ALIGN_BUFFER(DNS_MSG_SIZE)];static u8_t*                  dns_payload;/** * Initialize the resolver: set up the UDP pcb and configure the default server * (DNS_SERVER_ADDRESS). */voiddns_init(){  ip_addr_t dnsserver;  dns_payload = (u8_t *)LWIP_MEM_ALIGN(dns_payload_buffer);    /* initialize default DNS server address */  DNS_SERVER_ADDRESS(&dnsserver);  LWIP_DEBUGF(DNS_DEBUG, ("dns_init: initializing\n"));  /* if dns client not yet initialized... */  if (dns_pcb == NULL) {    dns_pcb = udp_new();    if (dns_pcb != NULL) {      /* initialize DNS table not needed (initialized to zero since it is a       * global variable) */      LWIP_ASSERT("For implicit initialization to work, DNS_STATE_UNUSED needs to be 0",        DNS_STATE_UNUSED == 0);      /* initialize DNS client */      udp_bind(dns_pcb, IP_ADDR_ANY, 0);      udp_recv(dns_pcb, dns_recv, NULL);      /* initialize default DNS primary server */      dns_setserver(0, &dnsserver);    }  }#if DNS_LOCAL_HOSTLIST  dns_init_local();#endif}/** * Initialize one of the DNS servers. * * @param numdns the index of the DNS server to set must be < DNS_MAX_SERVERS * @param dnsserver IP address of the DNS server to set */voiddns_setserver(u8_t numdns, ip_addr_t *dnsserver){  if ((numdns < DNS_MAX_SERVERS) && (dns_pcb != NULL) &&      (dnsserver != NULL) && !ip_addr_isany(dnsserver)) {    dns_servers[numdns] = (*dnsserver);  }}/** * Obtain one of the currently configured DNS server. * * @param numdns the index of the DNS server * @return IP address of the indexed DNS server or "ip_addr_any" if the DNS *         server has not been configured. */ip_addr_tdns_getserver(u8_t numdns){  if (numdns < DNS_MAX_SERVERS) {    return dns_servers[numdns];  } else {    return *IP_ADDR_ANY;  }}/** * The DNS resolver client timer - handle retries and timeouts and should * be called every DNS_TMR_INTERVAL milliseconds (every second by default). */voiddns_tmr(void){  if (dns_pcb != NULL) {    LWIP_DEBUGF(DNS_DEBUG, ("dns_tmr: dns_check_entries\n"));    dns_check_entries();  }}#if DNS_LOCAL_HOSTLISTstatic voiddns_init_local(){#if DNS_LOCAL_HOSTLIST_IS_DYNAMIC && defined(DNS_LOCAL_HOSTLIST_INIT)  int i;  struct local_hostlist_entry *entry;  /* Dynamic: copy entries from DNS_LOCAL_HOSTLIST_INIT to list */  struct local_hostlist_entry local_hostlist_init[] = DNS_LOCAL_HOSTLIST_INIT;  size_t namelen;  for (i = 0; i < sizeof(local_hostlist_init) / sizeof(struct local_hostlist_entry); i++) {    struct local_hostlist_entry *init_entry = &local_hostlist_init[i];    LWIP_ASSERT("invalid host name (NULL)", init_entry->name != NULL);    namelen = strlen(init_entry->name);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品入口麻豆原神| 色网综合在线观看| 日本人妖一区二区| 欧美aⅴ一区二区三区视频| 亚洲一区二区三区四区的| 一区二区三区精密机械公司| 亚洲人成精品久久久久| 亚洲精品国产成人久久av盗摄 | 中文字幕一区二| 国产精品国产三级国产普通话三级 | 欧美一级在线观看| 日韩欧美成人一区二区| 久久久久国产一区二区三区四区| 久久亚洲精品小早川怜子| 欧美韩日一区二区三区四区| 亚洲欧美综合色| 尤物av一区二区| 久久成人av少妇免费| 国产精品资源网站| 91蜜桃免费观看视频| 欧美电影一区二区| 久久久国产一区二区三区四区小说 | 奇米影视一区二区三区| 国产一区二区三区四区五区美女| av一区二区三区在线| 欧美视频在线一区| 久久久天堂av| 亚洲妇熟xx妇色黄| 国产福利一区二区三区视频| 91福利国产成人精品照片| 日韩欧美国产高清| 亚洲乱码日产精品bd| 毛片基地黄久久久久久天堂| 91在线视频官网| 欧美日韩一区精品| 久久精品欧美日韩精品| 亚洲成人免费看| 成人动漫在线一区| 日韩一级黄色大片| 亚洲另类色综合网站| 国产乱子伦一区二区三区国色天香| 99re这里只有精品首页| 久久久久久久国产精品影院| 首页综合国产亚洲丝袜| 成人精品一区二区三区四区| 日韩一区二区在线观看视频播放| 日韩美女啊v在线免费观看| 久久99九九99精品| 国产在线精品视频| 欧美精品少妇一区二区三区| 椎名由奈av一区二区三区| 国产一区二区调教| 日韩一区二区麻豆国产| 亚洲电影在线播放| 色综合中文字幕国产 | 蜜臀99久久精品久久久久久软件| 成人午夜视频福利| 精品av综合导航| 午夜精品福利视频网站| 99久久婷婷国产综合精品电影| 久久综合九色综合97婷婷女人| 日本免费新一区视频| 欧美视频自拍偷拍| 亚洲成国产人片在线观看| 91免费看`日韩一区二区| 国产精品色一区二区三区| 国产成a人亚洲精品| 国产午夜精品美女毛片视频| 韩国毛片一区二区三区| 日韩欧美国产一区二区在线播放 | 国产在线精品一区二区不卡了 | 亚洲欧洲99久久| av网站免费线看精品| 国产精品视频看| av不卡免费电影| 亚洲天堂中文字幕| 欧洲一区二区三区在线| 亚洲综合色噜噜狠狠| 欧美三级电影一区| 蜜臀久久99精品久久久久宅男| 日韩美女在线视频| 激情亚洲综合在线| 中文一区二区在线观看| 93久久精品日日躁夜夜躁欧美| 亚洲三级免费观看| 欧美伊人久久大香线蕉综合69 | 精品粉嫩aⅴ一区二区三区四区| 久久99精品久久久| 国产欧美日韩卡一| 一本一道波多野结衣一区二区| 亚洲精品免费看| 欧美一卡二卡三卡四卡| 国产麻豆精品视频| 亚洲日本va在线观看| 欧美日韩一区二区电影| 九色综合狠狠综合久久| 日本一区二区成人| 欧美色网站导航| 久久aⅴ国产欧美74aaa| 国产精品美日韩| 欧美美女bb生活片| 国产精品99久| 亚洲高清视频在线| 国产欧美久久久精品影院| 色婷婷综合视频在线观看| 青青草国产精品97视觉盛宴| 久久精品一区二区| 欧美日韩久久不卡| 国产999精品久久久久久| 亚洲午夜久久久| 日本一区二区久久| 91精品国产色综合久久不卡电影 | 欧美人成免费网站| 成人一级片网址| 日本vs亚洲vs韩国一区三区二区| 国产欧美日韩不卡免费| 欧美久久久一区| 国产成人精品三级| 日本亚洲电影天堂| 亚洲欧洲制服丝袜| 国产日韩欧美电影| 欧美日韩免费一区二区三区视频| 国产成人亚洲综合a∨婷婷图片| 亚洲大片一区二区三区| 国产精品对白交换视频| 欧美变态口味重另类| 欧美日韩视频在线观看一区二区三区 | 久久精品99国产精品| 亚洲免费观看高清完整版在线 | 91精品婷婷国产综合久久| aaa欧美色吧激情视频| 国产一区美女在线| 丝袜诱惑亚洲看片| 一区二区三区四区视频精品免费| 国产日韩欧美在线一区| 精品久久久久一区| 欧美一卡二卡三卡四卡| 欧美精品久久一区| 欧美日韩综合在线| 一本大道久久a久久综合| k8久久久一区二区三区 | 韩国一区二区视频| 日本欧美大码aⅴ在线播放| 亚洲曰韩产成在线| 亚洲制服丝袜av| 亚洲电影激情视频网站| 亚洲欧美另类久久久精品| 国产精品久久福利| 中文字幕一区二区三区四区不卡 | 色老汉一区二区三区| 成人av网在线| 91在线丨porny丨国产| 色一情一乱一乱一91av| 91黄色免费观看| 欧美日韩不卡视频| 欧美精品在线一区二区| 欧美精品在线视频| 欧美xxxxx裸体时装秀| 精品一区二区在线免费观看| 一区二区三区不卡视频| 亚洲一二三区视频在线观看| 五月综合激情婷婷六月色窝| 天天操天天综合网| 黑人巨大精品欧美一区| 亚洲成人资源在线| 欧美一级理论性理论a| 欧美一级理论片| 日本一区二区免费在线| 国产精品青草综合久久久久99| 中文字幕制服丝袜成人av| 亚洲免费av网站| 偷拍自拍另类欧美| 韩国女主播成人在线| 成人av电影在线网| 欧美日韩一区二区在线观看| 日韩精品专区在线| 中国av一区二区三区| 亚洲国产婷婷综合在线精品| 免费观看在线综合| 丁香婷婷综合色啪| 欧美日韩免费一区二区三区| 精品1区2区在线观看| 亚洲婷婷在线视频| 久久成人麻豆午夜电影| 白白色 亚洲乱淫| 欧美日本一区二区| 日本一区二区不卡视频| 天天色 色综合| 成人av电影免费观看| 777久久久精品| 亚洲日本青草视频在线怡红院| 日韩高清在线一区| 成人美女视频在线观看| 欧美一区二区视频观看视频| 国产精品国产三级国产三级人妇| 蜜臀va亚洲va欧美va天堂| 色婷婷综合久久久中文字幕| 久久久久久久久久看片| 日韩av中文在线观看| 91丝袜国产在线播放|