亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
夜夜亚洲天天久久| 一区二区三区欧美日| 欧美综合色免费| 菠萝蜜视频在线观看一区| 国产一区二区三区av电影| 麻豆国产91在线播放| 日本v片在线高清不卡在线观看| 亚洲午夜国产一区99re久久| 亚洲一线二线三线视频| 亚洲国产视频a| 日韩av中文字幕一区二区三区| 亚洲成人一区二区| 日本中文一区二区三区| 蜜臀av性久久久久蜜臀aⅴ四虎| 免费成人深夜小野草| 国产毛片精品一区| 成人教育av在线| 91久久精品网| 欧美一区二区三区四区在线观看| 4438成人网| 欧美一级高清片| 国产亚洲一区二区三区| 国产精品视频麻豆| 亚洲一区二区三区四区五区黄| 日韩精品亚洲一区| 国产综合色精品一区二区三区| 国产一区三区三区| 91麻豆文化传媒在线观看| 欧美日韩一区二区三区在线| 欧美一级高清片| 久久亚洲免费视频| 亚洲欧美日韩国产综合| 亚洲成av人片一区二区梦乃| 久久精品噜噜噜成人88aⅴ| 成人看片黄a免费看在线| 在线观看视频一区二区| 337p日本欧洲亚洲大胆精品| 日韩一区中文字幕| 日本少妇一区二区| 99精品欧美一区二区三区综合在线| 精品视频在线免费观看| 国产蜜臀av在线一区二区三区| 日韩高清欧美激情| 成人午夜精品一区二区三区| 欧美欧美午夜aⅴ在线观看| 国产视频一区不卡| 日本少妇一区二区| 在线观看亚洲成人| 亚洲国产精品v| 久久国产精品99久久久久久老狼 | 91在线免费视频观看| 欧美日本免费一区二区三区| 国产精品免费视频观看| 免费视频最近日韩| 欧美少妇性性性| 国产精品久久久久久久浪潮网站| 日韩电影免费在线看| 色婷婷国产精品综合在线观看| 久久精品人人做人人爽97| 蜜臀av一区二区| 欧美精品乱人伦久久久久久| 亚洲免费高清视频在线| 成人av先锋影音| 久久综合一区二区| 日本美女一区二区三区视频| 欧美在线观看你懂的| 亚洲人成伊人成综合网小说| 国产精品1区2区3区| 日韩免费高清视频| 免费看欧美美女黄的网站| 欧美三级日韩在线| 亚洲成人久久影院| 在线一区二区三区四区| 成人免费在线播放视频| 国产成人高清在线| 日本一区二区三区dvd视频在线| 国产一区二区三区四| 欧美mv和日韩mv的网站| 蜜臀久久99精品久久久久久9| 欧美日韩国产经典色站一区二区三区| 一区二区三区在线播放| 欧美午夜影院一区| 天天亚洲美女在线视频| 91精品国产综合久久小美女| 日韩电影在线免费看| 日韩欧美激情一区| 国产麻豆成人精品| 中文字幕在线不卡视频| 91国在线观看| 视频一区视频二区中文字幕| 日韩一级黄色大片| 久久99国产精品麻豆| 国产丝袜美腿一区二区三区| av中文字幕一区| 亚洲综合一区二区精品导航| 欧美顶级少妇做爰| 国产原创一区二区三区| 国产精品久久久久久亚洲伦| 欧美色综合网站| 另类人妖一区二区av| www亚洲一区| 91丨porny丨首页| 日韩va欧美va亚洲va久久| 国产蜜臀97一区二区三区| 91精品办公室少妇高潮对白| 日韩黄色免费电影| 中文字幕精品—区二区四季| 色美美综合视频| 九一久久久久久| 国产精品视频免费| 日韩一区二区免费在线电影 | 亚洲欧洲av一区二区三区久久| 91国产丝袜在线播放| 精品一区二区三区视频在线观看 | 色美美综合视频| 国内精品国产三级国产a久久| 亚洲少妇30p| 欧美一区二区黄色| 91丨九色丨国产丨porny| 蜜臀av在线播放一区二区三区| 亚洲国产精品t66y| 欧美一二三区精品| 色八戒一区二区三区| 国产激情偷乱视频一区二区三区| 亚洲一区免费观看| 国产精品无码永久免费888| 日韩欧美视频在线| 欧美视频日韩视频在线观看| 不卡的电影网站| 国产成人亚洲综合a∨婷婷 | 国产欧美一区二区精品秋霞影院| 欧美午夜一区二区三区免费大片| 国产91清纯白嫩初高中在线观看 | 成人国产视频在线观看| 韩国v欧美v亚洲v日本v| 日本不卡视频一二三区| 亚洲精品免费在线| 综合久久国产九一剧情麻豆| 久久精品男人的天堂| 日韩女优视频免费观看| 欧美亚洲国产一区二区三区va| 成人av免费观看| 懂色av噜噜一区二区三区av| 久久99精品国产91久久来源| 免费在线看成人av| 蜜桃91丨九色丨蝌蚪91桃色| 亚洲国产另类精品专区| 一区二区三区小说| 亚洲伊人色欲综合网| 亚洲第四色夜色| 日韩精品视频网站| 午夜成人免费视频| 日韩高清欧美激情| 视频在线观看一区| 日本在线观看不卡视频| 免费观看91视频大全| 久久精品久久精品| 麻豆成人综合网| 日本aⅴ免费视频一区二区三区| 亚洲成人免费av| 免费av成人在线| 狠狠色丁香婷婷综合久久片| 精品中文字幕一区二区小辣椒| 精品一区二区久久久| 国产制服丝袜一区| 国产精品一区二区免费不卡 | 亚洲欧洲av一区二区三区久久| 国产精品成人一区二区艾草| 中文字幕欧美区| ㊣最新国产の精品bt伙计久久| 中文字幕佐山爱一区二区免费| 亚洲欧美激情视频在线观看一区二区三区| 国产精品国产自产拍在线| 亚洲人一二三区| 日韩在线卡一卡二| 精品亚洲国产成人av制服丝袜| 国产91精品露脸国语对白| 91丨国产丨九色丨pron| 在线不卡的av| 国产欧美一区二区在线| 亚洲黄网站在线观看| 久久99日本精品| 色狠狠色狠狠综合| 精品裸体舞一区二区三区| 日韩毛片在线免费观看| 日韩二区三区四区| 成人a级免费电影| 91麻豆精品国产91久久久久久久久 | 激情欧美一区二区| 色噜噜夜夜夜综合网| 欧美电影免费提供在线观看| 中文字幕一区在线| 久久er精品视频| 欧美午夜精品理论片a级按摩| 日韩三级视频在线观看| 亚洲免费观看在线观看| 韩国三级中文字幕hd久久精品| 色香蕉成人二区免费| 久久亚洲精品小早川怜子| 午夜精品一区二区三区免费视频 |