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

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

?? dns.c

?? eCos操作系統源碼
?? C
字號:
//=============================================================================////      dns.c////      DNS client code////=============================================================================//####ECOSGPLCOPYRIGHTBEGIN####// -------------------------------------------// This file is part of eCos, the Embedded Configurable Operating System.// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.// Copyright (C) 2003 Gary Thomas//// eCos is free software; you can redistribute it and/or modify it under// the terms of the GNU General Public License as published by the Free// Software Foundation; either version 2 or (at your option) any later version.//// eCos is distributed in the hope that it will be useful, but WITHOUT ANY// WARRANTY; without even the implied warranty of MERCHANTABILITY or// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License// for more details.//// You should have received a copy of the GNU General Public License along// with eCos; if not, write to the Free Software Foundation, Inc.,// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.//// As a special exception, if other files instantiate templates or use macros// or inline functions from this file, or you compile this file and link it// with other works to produce a work based on this file, this file does not// by itself cause the resulting work to be covered by the GNU General Public// License. However the source code for this file must still be made available// in accordance with section (3) of the GNU General Public License.//// This exception does not invalidate any other reasons why a work based on// this file might be covered by the GNU General Public License.//// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.// at http://sources.redhat.com/ecos/ecos-license/// -------------------------------------------//####ECOSGPLCOPYRIGHTEND####//=============================================================================//#####DESCRIPTIONBEGIN####//// Author(s):   jskov// Contributors:jskov// Date:        2001-09-26// Description: Provides DNS lookup as per RFC 1034/1035.// // Note:        This is a stripped down clone of dns.c from the CYGPKG_NS_DNS//              package which does not use malloc/free and has been tweaked to//              use UDP via RedBoot's network stack. Also adds commands//              to set the DNS server IP at runtime.////####DESCRIPTIONEND####////=============================================================================#include <cyg/hal/drv_api.h>#include <cyg/infra/cyg_type.h>#include <cyg/infra/cyg_trac.h>         /* Tracing support */#include <net/net.h>#include <redboot.h>/* #include <cyg/ns/dns/dns.h> - it's been moved to redboot.h */#include <cyg/ns/dns/dns_priv.h>#ifdef CYGSEM_REDBOOT_FLASH_CONFIG#include <flash_config.h>RedBoot_config_option("DNS server IP address",                      dns_ip,                      ALWAYS_ENABLED, true,                      CONFIG_IP,                      0    );#endif/* So we remember which ports have been used */static int get_port = 7700;#define DOMAIN_PORT           53/* Some magic to make dns_impl.inl compile under RedBoot */#define sprintf diag_sprintf/* DNS server address possibly returned from bootp */struct in_addr __bootp_dns_addr;cyg_bool __bootp_dns_set = false;struct sockaddr_in server;/* static buffers so we can make do without malloc */static struct hostent _hent;static char* _h_addr_list[2];static struct in_addr _h_addr_list0;static int _hent_alloc = 0;#define _STRING_COUNT  2#define _STRING_LENGTH 64static char _strings[_STRING_COUNT][_STRING_LENGTH];static int _strings_alloc = 0;/* as in dns.c proper */static short id = 0;              /* ID of the last query */static int s = -1;                /* Socket to the DNS server */static cyg_drv_mutex_t dns_mutex; /* Mutex to stop multiple queries as once */static char * domainname=NULL;    /* Domain name used for queries *//* Allocate space for string of length (len). Return NULL on   failure. */static char*alloc_string(int len){    int i;    if (len > _STRING_LENGTH)        return NULL;    for (i = 0; i < _STRING_COUNT; i++) {        if (_strings_alloc & (1 << i)) continue;        _strings_alloc |= (1<<i);        return _strings[i];    }    return NULL;}static voidfree_string(char* s){    int i;    for (i = 0; i < _STRING_COUNT; i++) {        if (_strings[i] == s) {            _strings_alloc &= ~(1<<i);            break;        }    }}/* Deallocate the memory taken to hold a hent structure */static voidfree_hent(struct hostent * hent){    if (hent->h_name) {        free_string(hent->h_name);    }    _hent_alloc = 0;}/* Allocate hent structure with room for one in_addr. Returns NULL on   failure. */static struct hostent*alloc_hent(void){    struct hostent *hent;    if (_hent_alloc) return NULL;    hent = &_hent;    memset(hent, 0, sizeof(struct hostent));    hent->h_addr_list = _h_addr_list;    hent->h_addr_list[0] = (char*)&_h_addr_list0;    hent->h_addr_list[1] = NULL;    _hent_alloc = 1;    return hent;}static __inline__ voidfree_stored_hent(void){    free_hent( &_hent );}static __inline__ voidstore_hent(struct hostent *hent){    hent=hent; // avoid warning}/* Send the query to the server and read the response back. Return -1   if it fails, otherwise put the response back in msg and return the   length of the response. */static int send_recv(char * msg, int len, int msglen){    struct dns_header *dns_hdr;    int finished = false;    int read = 0;    dns_hdr = (struct dns_header *) msg;    do {         int len_togo = len;        struct timeval timeout;        struct sockaddr_in local_addr, from_addr;        memset((char *)&local_addr, 0, sizeof(local_addr));        local_addr.sin_family = AF_INET;        local_addr.sin_addr.s_addr = htonl(INADDR_ANY);        local_addr.sin_port = htons(get_port++);        if (__udp_sendto(msg, len_togo, &server, &local_addr) < 0)            return -1;        memset((char *)&from_addr, 0, sizeof(from_addr));        timeout.tv_sec = CYGNUM_REDBOOT_NETWORKING_DNS_TIMEOUT;        timeout.tv_usec = 0;        read = __udp_recvfrom(msg, len, &from_addr, &local_addr, &timeout);        if (read < 0)            return -1;        /* Reply to an old query. Ignore it */        if (ntohs(dns_hdr->id) != (id-1)) {            continue;        }        finished = true;    } while (!finished);    return read;}    voidset_dns(char* new_ip){    in_addr_t dns_ip;    memset(&server.sin_addr, 0, sizeof(server.sin_addr));    if (!inet_aton(new_ip, &dns_ip)) {        diag_printf("Bad DNS server address: %s\n", new_ip);    } else {        memcpy(&server.sin_addr, &dns_ip, sizeof(dns_ip));        /* server config is valid */        s = 0;    }}voidshow_dns(void){    diag_printf(", DNS server IP: %s", inet_ntoa((in_addr_t *)&server.sin_addr));    if (0 == server.sin_addr.s_addr) {        s = -1;    }}/* Initialise the resolver. Open a socket and bind it to the address   of the server.  return -1 if something goes wrong, otherwise 0 */int  redboot_dns_res_init(void){    memset((char *)&server, 0, sizeof(server));    server.sin_len = sizeof(server);    server.sin_family = AF_INET;    server.sin_port = htons(DOMAIN_PORT);    cyg_drv_mutex_init(&dns_mutex);    /* If we got a DNS server address from the DHCP/BOOTP, then use that address */    if ( __bootp_dns_set ) {	memcpy(&server.sin_addr, &__bootp_dns_addr, sizeof(__bootp_dns_addr) );	s = 0;    }    else {#ifdef CYGSEM_REDBOOT_FLASH_CONFIG    {        ip_addr_t dns_ip;        flash_get_config("dns_ip", &dns_ip, CONFIG_IP);        if (dns_ip[0] == 0 && dns_ip[1] == 0 && dns_ip[2] == 0 && dns_ip[3] == 0)            return -1;        memcpy(&server.sin_addr, &dns_ip, sizeof(dns_ip));        /* server config is valid */        s = 0;    }#else      // Use static configuration	set_dns(__Xstr(CYGPKG_REDBOOT_NETWORKING_DNS_IP));#endif    }    return 0;}/* Include the DNS client implementation code */#include <cyg/ns/dns/dns_impl.inl>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产精品传媒在线观看| 国产精华液一区二区三区| 欧美日韩亚洲国产综合| 国产一区二区精品久久99| 亚洲精品国产a久久久久久| 久久女同性恋中文字幕| 欧美一区二区播放| 欧美日韩久久久| 日本高清成人免费播放| 成人一区二区视频| 亚洲电影一级黄| 亚洲精品第一国产综合野| 中文字幕乱码一区二区免费| 久久老女人爱爱| 欧美高清hd18日本| 91精品免费在线观看| 欧洲一区在线观看| 91国内精品野花午夜精品| 成人18视频日本| eeuss鲁片一区二区三区在线观看| 琪琪一区二区三区| 久久精品久久99精品久久| 免费观看日韩电影| 久久成人精品无人区| 精品一区二区三区香蕉蜜桃| 一区二区成人在线| 一区二区三区中文字幕电影 | 日韩国产欧美在线播放| 亚洲一区二区视频| 亚洲大型综合色站| 免费的成人av| 国产精品亚洲一区二区三区妖精| 经典三级在线一区| 麻豆91精品视频| 韩国三级在线一区| 成人天堂资源www在线| 波多野结衣欧美| 99久久99精品久久久久久| 91一区二区三区在线观看| 91欧美激情一区二区三区成人| 色哟哟精品一区| 欧美日本不卡视频| 久久综合九色综合97婷婷女人| 国产三级久久久| 亚洲天堂中文字幕| 日韩国产欧美三级| 粉嫩av一区二区三区| aaa欧美色吧激情视频| 欧美日本精品一区二区三区| 久久久精品欧美丰满| 综合久久一区二区三区| 日韩中文字幕亚洲一区二区va在线| 蜜桃视频第一区免费观看| 成人av动漫网站| 5566中文字幕一区二区电影| 久久久99精品免费观看| 亚洲综合另类小说| 国产成人啪免费观看软件| 欧美性猛交xxxx乱大交退制版 | 日韩精品久久理论片| 国产xxx精品视频大全| 欧美无砖砖区免费| 日韩精品一区二区三区在线观看| 国产欧美精品一区二区三区四区 | 成人激情小说乱人伦| 欧美视频一区在线| 中文字幕国产一区| 日韩av不卡在线观看| 国产精品18久久久久久久网站| www.日韩在线| 精品国产凹凸成av人网站| 一区二区三区在线播放| 丁香另类激情小说| 欧美xxx久久| 日韩精品久久久久久| 欧美综合欧美视频| 国产精品久久一级| 国产夫妻精品视频| 精品电影一区二区| 老鸭窝一区二区久久精品| 色爱区综合激月婷婷| 中文字幕第一区二区| 精品一区二区三区欧美| 91精品国产麻豆| 亚洲成人黄色小说| 在线中文字幕一区二区| 国产精品国产a| 国产超碰在线一区| 欧美高清性hdvideosex| 亚洲国产精品人人做人人爽| 国产精品一区二区在线观看不卡 | 国产在线精品一区二区不卡了| 欧美精品精品一区| 日韩中文字幕不卡| 欧美一区二区三区四区在线观看| 亚洲精品国产高清久久伦理二区| 91麻豆6部合集magnet| 日韩美女视频19| 一本久久精品一区二区| 中文字幕五月欧美| 色狠狠色噜噜噜综合网| 一区二区久久久久久| 色狠狠色狠狠综合| 久久久久久久久久美女| 免费成人在线观看| 欧美mv日韩mv国产| 国产a视频精品免费观看| 欧美极品aⅴ影院| 91捆绑美女网站| 亚洲午夜精品17c| 欧美丰满高潮xxxx喷水动漫| 日本不卡视频在线观看| 欧美大胆一级视频| 国产成人午夜99999| 亚洲色图一区二区| 91在线视频在线| 亚洲国产日韩在线一区模特| 色狠狠色狠狠综合| 日韩激情中文字幕| 中文子幕无线码一区tr| 日本韩国精品在线| 青青草原综合久久大伊人精品| 欧美xxxxx裸体时装秀| 国产白丝精品91爽爽久久| 亚洲精品国产品国语在线app| 69精品人人人人| 国产伦理精品不卡| 亚洲影院理伦片| 2023国产精品视频| 欧洲av一区二区嗯嗯嗯啊| 久久精品久久综合| 亚洲乱码国产乱码精品精小说| 91精品国产一区二区三区| 国产美女av一区二区三区| 亚洲精品视频在线观看免费| 欧美一区二区福利视频| 成人动漫视频在线| 一二三区精品视频| 久久精品欧美一区二区三区不卡| 成人国产精品免费| 国产中文字幕精品| 亚洲成人午夜影院| 亚洲欧洲精品天堂一级| 久久综合精品国产一区二区三区| 在线观看免费亚洲| jiyouzz国产精品久久| 久久精品99久久久| 亚洲成av人影院| 亚洲欧美激情一区二区| 国产欧美视频一区二区| 日韩写真欧美这视频| 欧美影片第一页| 91首页免费视频| 成人精品视频一区二区三区尤物| 日本成人超碰在线观看| 亚洲一区二区视频在线观看| 国产精品久久久一本精品| 精品国产乱码久久久久久老虎| 欧美日韩成人综合| 国产69精品久久久久毛片| 婷婷中文字幕一区三区| 一区二区三区四区五区视频在线观看| 久久综合99re88久久爱| 欧美成人精品二区三区99精品| 欧美精品一二三区| 欧美视频一区二区三区在线观看 | 久久伊人中文字幕| 91精品午夜视频| 成人av动漫在线| 日韩一区二区三区观看| 91精品欧美福利在线观看| 欧美精品一区二区三| 国产精品丝袜久久久久久app| 亚洲精品中文字幕在线观看| 午夜私人影院久久久久| 精品一区二区在线视频| 99vv1com这只有精品| 在线电影欧美成精品| 亚洲精品在线观看网站| 中文字幕视频一区| 欧美bbbbb| eeuss影院一区二区三区| 欧美久久久久免费| 久久人人爽爽爽人久久久| 亚洲男人都懂的| 精品午夜一区二区三区在线观看| 99re热视频这里只精品| 欧美一区二区三区视频免费| 欧美激情一区二区三区四区| 亚洲高清免费观看| 国产999精品久久久久久绿帽| 在线免费观看成人短视频| 久久久久久久久久美女| 午夜影院久久久| 成人精品国产一区二区4080| 欧美一区二视频| 亚洲激情网站免费观看| 国产精品1区二区.| 欧美一级xxx| 夜夜爽夜夜爽精品视频|