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

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

?? dhcps.c

?? VxWorks下DHCP的源代碼!
?? C
?? 第 1 頁 / 共 5 頁
字號:
                      struct dhcp_resource *res,    /* pointer to lease descriptor */                      u_long lease, /* lease duration, in seconds */                      time_t curr_epoch /* current time, in seconds */    ){    struct dhcp_binding *binding = NULL;    /*     * Ignore lease descriptors already offered (res->binding != NULL)     * if also reserved to specific clients (STATIC_ENTRY flag set).     */    if (res->binding != NULL && (res->binding->flag & STATIC_ENTRY) != 0)        return (0);    /* Remove old client identifier association from prior lease record. */    if (res->binding != NULL)        hash_del (&cidhashtable, res->binding->cid.id, res->binding->cid.idlen,                  bindcidcmp, &res->binding->cid, free_bind);    /* Create and assign new lease record entry. */    binding = (struct dhcp_binding *) calloc (1, sizeof (struct dhcp_binding));    if (binding == NULL) {#ifdef DHCPS_DEBUG        logMsg ("Warning: memory allocation error updating database.\n", 0, 0, 0, 0, 0, 0);#endif        return (-1);    }    if (cidcopy (cid, &binding->cid) != 0)        return (-1);    if (msgtype == DHCPDISCOVER)        binding->temp_epoch = curr_epoch + MEMORIZE;    else if (lease == 0xffffffff)        binding->expire_epoch = 0xffffffff;    else        binding->expire_epoch = curr_epoch + lease;    /* Link lease record and lease descriptor. */    binding->res = res;    bcopy (res->entryname, binding->res_name, strlen (res->entryname));    binding->res_name[strlen (res->entryname)] = '\0';    res->binding = binding;    /* Record client hardware address. */    binding->haddr.htype = dhcpsMsgIn.dhcp->htype;    binding->haddr.hlen = dhcpsMsgIn.dhcp->hlen;    if (binding->haddr.hlen > MAX_HLEN)        binding->haddr.hlen = MAX_HLEN;    bcopy (dhcpsMsgIn.dhcp->chaddr, binding->haddr.haddr, binding->haddr.hlen);    /* Add association of lease record and client identifier. */    if ((hash_ins (&cidhashtable, binding->cid.id, binding->cid.idlen,                   bindcidcmp, &binding->cid, binding) < 0)) {#ifdef DHCPS_DEBUG        logMsg ("Warning: hash table insertion with client ID failed.\n", 0, 0, 0, 0, 0, 0);#endif        return (-1);    }    /* Store record of lease. */    if (add_bind (binding) != 0)        return (-1);    return (0);}/********************************************************************************* turnoff_bind - mark resource entry as unavailable** This routine updates the binding list and corresponding hash tables when* the server discovers (through an ICMP check or client decline) that an IP * address is unexpectedly in use. The corresponding resource is marked as an * active lease for the next half-hour.** RETURNS: N/A** ERRNO: N/A** NOMANUAL*/static void turnoff_bind (struct dhcp_binding *binding  /* unavailable lease record */    ){    time_t curr_epoch = 0;    int result;    if (binding == NULL)        return;    if (dhcpTime (&curr_epoch) == -1) {#ifdef DHCPS_DEBUG        logMsg ("Warning: turnoff_bind() can't retrieve current time.\n", 0, 0, 0, 0, 0, 0);#endif        return;    }    /* Remove client ID from hash table entry for address in use. */    binding->expire_epoch = binding->temp_epoch = curr_epoch + 1800;    hash_del (&cidhashtable, binding->cid.id, binding->cid.idlen, bindcidcmp,              &binding->cid, free_fake);    bzero (binding->cid.id, binding->cid.idlen);    result = hash_ins (&cidhashtable, binding->cid.id, binding->cid.idlen,                       bindcidcmp, &binding->cid, binding);#ifdef DHCPS_DEBUG    if (result < 0)        logMsg ("Warning: couldn't alter hash table in turnoff_bind()", 0, 0, 0, 0, 0, 0);#endif    binding->flag &= ~COMPLETE_ENTRY;    return;}/********************************************************************************* clean_sbuf - clean the message transmission buffers** This routine clears the vectored buffers used to store outgoing DHCP * messages. The first buffer contains the Ethernet, IP and UDP headers, as well* as the fixed-length portion of the DHCP message and the options which fit * within the default (312 byte) option field. The second buffer contains * overflow options, if any, for clients capable of receiving DHCP messages * longer than the default 548 bytes.** RETURNS: N/A** ERRNO: N/A** NOMANUAL*/static voidclean_sbuf (void){    bzero (sbufvec[0].iov_base, sbufvec[0].iov_len);    bzero (sbufvec[1].iov_base, sbufvec[1].iov_len);    sbufvec[1].iov_len = 0;    return;}/********************************************************************************* construct_msg - make an outgoing DHCP message** This routine creates all DHCP server responses to client requests, according* to the behavior specified in RFC 1541. The message type parameter indicates* whether to build a DHCP offer message, a DHCP ACK message, or a NAK reply.** RETURNS: N/A** ERRNO: N/A** NOMANUAL*/static void construct_msg (u_char msgtype,  /* type of DHCP message to construct */                           struct dhcp_resource *res,   /* lease descriptor describing contents */                           u_long lease,    /* lease duration, in seconds */                           struct if_info *ifp  /* descriptor of receiving interface */    ){    int i = 0;    int reqoptlen = 0;    u_long tmp = 0;    char *reqopt = NULL;    char inserted[32];    char *option = NULL;    struct client_id paramId;   /* Key for additional parameters. */    struct dhcp_resource *params;   /* Client- or class-specific options. */    int result;    bzero (inserted, sizeof (inserted));    clean_sbuf ();              /* Zero out outgoing message buffer. */    dhcpsMsgOut.dhcp->op = BOOTREPLY;    dhcpsMsgOut.dhcp->htype = dhcpsMsgIn.dhcp->htype;    dhcpsMsgOut.dhcp->hlen = dhcpsMsgIn.dhcp->hlen;    dhcpsMsgOut.dhcp->hops = 0;    dhcpsMsgOut.dhcp->xid = dhcpsMsgIn.dhcp->xid;    dhcpsMsgOut.dhcp->secs = 0;    dhcpsMsgOut.dhcp->flags = dhcpsMsgIn.dhcp->flags;    dhcpsMsgOut.dhcp->giaddr.s_addr = dhcpsMsgIn.dhcp->giaddr.s_addr;    bcopy (dhcpsMsgIn.dhcp->chaddr, dhcpsMsgOut.dhcp->chaddr, dhcpsMsgIn.dhcp->hlen);    if (msgtype == DHCPACK)     /* ciaddr stays zero for all other types. */        dhcpsMsgOut.dhcp->ciaddr.s_addr = dhcpsMsgIn.dhcp->ciaddr.s_addr;    if (msgtype != DHCPNAK) {        dhcpsMsgOut.dhcp->yiaddr.s_addr = res->ip_addr.s_addr;        if (ISSET (res->valid, S_SIADDR)) {            dhcpsMsgOut.dhcp->siaddr.s_addr = res->siaddr.s_addr;        } else {            dhcpsMsgOut.dhcp->siaddr.s_addr = 0;        }        overload = BOTH_AREOPT;        if (ISSET (res->valid, S_SNAME)) {            strncpy (dhcpsMsgOut.dhcp->sname, res->sname, MAX_SNAME);            dhcpsMsgOut.dhcp->sname[MAX_SNAME - 1] = '\0';            overload -= SNAME_ISOPT;        }        if (ISSET (res->valid, S_FILE)) {            strncpy (dhcpsMsgOut.dhcp->file, res->file, MAX_FILE);            dhcpsMsgOut.dhcp->file[MAX_FILE - 1] = '\0';            overload -= FILE_ISOPT;        }    } else {        dhcpsMsgOut.dhcp->yiaddr.s_addr = 0;        dhcpsMsgOut.dhcp->siaddr.s_addr = 0;        /* Refinement for draft RFC. */        /* if (dhcpsMsgIn.giaddr.s_addr != 0)           SETBRDCAST (dhcpsMsgOut.dhcp->flags); */    }    /* insert magic cookie */    bcopy ((char *) dhcpCookie, dhcpsMsgOut.dhcp->options, MAGIC_LEN);    off_options = MAGIC_LEN;    off_extopt = 0;    /* insert dhcp message type option */    dhcpsMsgOut.dhcp->options[off_options++] = _DHCP_MSGTYPE_TAG;    dhcpsMsgOut.dhcp->options[off_options++] = 1;    dhcpsMsgOut.dhcp->options[off_options++] = msgtype;    /* Insert client ID when permitted. (Only allowed under draft RFC). */    if (msgtype == DHCPNAK) {        SETBRDCST (dhcpsMsgOut.dhcp->flags);/*      option = pickup_opt (dhcpsMsgIn.dhcp, rdhcplen, _DHCP_CLIENT_ID_TAG);        if (option != NULL)             {            dhcpsMsgOut.dhcp->options [off_options++] = _DHCP_CLIENT_ID_TAG;            dhcpsMsgOut.dhcp->options [off_options++] = DHCPOPTLEN(option);            bcopy (option, &dhcpsMsgOut.dhcp->options [off_options],                   DHCPOPTLEN (option));            off_options += DHCPOPTLEN (option);            } */        return;    }    /* insert "server identifier" (required). */    dhcpsMsgOut.dhcp->options[off_options++] = _DHCP_SERVER_ID_TAG;    dhcpsMsgOut.dhcp->options[off_options++] = 4;    bcopy ((char *) &ifp->ipaddr.s_addr, &dhcpsMsgOut.dhcp->options[off_options], 4);    off_options += 4;    /* insert "subnet mask" (permitted). */    result = insert_opt (res, lease, _DHCP_SUBNET_MASK_TAG, inserted, PASSIVE);#ifdef DHCPS_DEBUG    if (result == E_NOMORE)        logMsg ("No space left in options field for DHCP%s",                (int) ((msgtype == DHCPOFFER) ? "OFFER" : "ACK"), 0, 0, 0, 0, 0);#endif    /* insert "lease duration" (required). */    tmp = htonl (lease);    dhcpsMsgOut.dhcp->options[off_options++] = _DHCP_LEASE_TIME_TAG;    dhcpsMsgOut.dhcp->options[off_options++] = 4;    bcopy ((char *) &tmp, &dhcpsMsgOut.dhcp->options[off_options], sizeof (u_long));    off_options += 4;    /* Insert "option overload" tag, if needed. */    if (overload != 0) {        dhcpsMsgOut.dhcp->options[off_options++] = _DHCP_OPT_OVERLOAD_TAG;        dhcpsMsgOut.dhcp->options[off_options++] = 1;        dhcpsMsgOut.dhcp->options[off_options++] = overload;    }    /* insert the requested options */    option = pickup_opt (dhcpsMsgIn.dhcp, rdhcplen, _DHCP_REQ_LIST_TAG);    if (option != NULL) {        reqopt = OPTBODY (option);        reqoptlen = DHCPOPTLEN (option);        /*          * Handle requested parameters. The PASSIVE flag only inserts options         * explicity configured into the resource entry. (Rule 1 of RFC 1541).         * Because the implementation used "tblc=dflt" to force inclusion of         * any missing parameters defined in the Host Requirements Document,         * the PASSIVE flag will also include those settings if not already          * present. (Rule 2 of RFC 1541).         */        for (i = 0; i < reqoptlen; i++)            if (ISCLR (inserted, *(reqopt + i))) {                result = insert_opt (res, lease, *(reqopt + i), inserted, PASSIVE);                if (result == E_NOMORE) {#ifdef DHCPS_DEBUG                    logMsg ("No space left in options field for DHCP%s",                            (int) ((msgtype == DHCPOFFER) ? "OFFER" : "ACK"), 0, 0, 0, 0, 0);#endif                    break;                }            }    }    /*      * Insert parameters which differ from the Host Requirements RFC defaults.     * (The tags for these parameters are preceded by "!" in the server     * configuration table).     */    for (i = 0; i < _DHCP_LAST_OPTION; i++)        if (ISCLR (inserted, i))            if (insert_opt (res, lease, i, inserted, ACTIVE) == E_NOMORE) {#ifdef DHCPS_DEBUG                logMsg ("No space left in options field for DHCP%s",                        (int) ((msgtype == DHCPOFFER) ? "OFFER" : "ACK"), 0, 0, 0, 0, 0);#endif                break;            }    /* Insert any client-specific options. */    /* Insert any parameters associated with explicit client identifier. */    tmp = 0;    option = pickup_opt (dhcpsMsgIn.dhcp, rdhcplen, _DHCP_CLIENT_ID_TAG);    if (option != NULL) {        paramId.idlen = DHCPOPTLEN (option) - 1;        paramId.idtype = *(char *) OPTBODY (option);        bcopy (OPTBODY (option) + sizeof (char), paramId.id, paramId.idlen);        params = hash_find (&paramhashtable, paramId.id, paramId.idlen, paramcidcmp, &paramId);        /* Insert options from matching resource entry not already present. */        if (params != NULL) {            for (i = 0; i < _DHCP_LAST_OPTION; i++)                if (ISCLR (inserted, i))                    if (insert_opt (params, lease, i, inserted, PASSIVE)                        == E_NOMORE) {#ifdef DHCPS_DEBUG                        logMsg ("No space left in options field for DHCP%s",                                (int) ((msgtype == DHCPOFFER) ? "OFFER" : "ACK"), 0, 0, 0, 0, 0);#endif                        break;                    }            tmp = 1;            /* Client-specific options found. */        }    }    /*     * If no client ID included, or no associated options found, check      * hardware address.      */    if (tmp == 0) {        paramId.idlen = dhcpsMsgIn.dhcp->hlen;        paramId.idtype = dhcpsMsgIn.dhcp->htype;        bcopy (dhcpsMsgIn.dhcp->chaddr, paramId.id, dhcpsMsgIn.dhcp->hlen);        params = hash_find (&paramhashtable, paramId.id, paramId.idlen, paramcidcmp, &paramId);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99精品欧美一区二区三区小说 | 99精品久久免费看蜜臀剧情介绍| 精品久久国产老人久久综合| 欧美福利视频一区| 欧美成人bangbros| 国内精品久久久久影院色| 成人黄色大片在线观看| 欧美精品vⅰdeose4hd| 香蕉成人伊视频在线观看| 国产在线日韩欧美| 国产精品少妇自拍| 日韩精品亚洲一区二区三区免费| 成人涩涩免费视频| 日韩欧美不卡一区| 亚洲国产日韩一区二区| 亚洲动漫第一页| 欧美一区中文字幕| 亚洲444eee在线观看| 精品粉嫩aⅴ一区二区三区四区| 尤物视频一区二区| 国产精品一二三四区| 日韩一区二区三区三四区视频在线观看| 亚洲日本一区二区三区| 久久99精品久久久久婷婷| 欧美另类高清zo欧美| 国产一区二区三区黄视频 | 国产精品毛片大码女人| 在线看日韩精品电影| 国产日韩欧美不卡在线| 日本v片在线高清不卡在线观看| 91麻豆国产精品久久| 国产日产欧美一区二区视频| 色老汉av一区二区三区| 最好看的中文字幕久久| 欧美一区永久视频免费观看| 成人av在线资源网| 免费观看成人av| 亚洲精品国产精品乱码不99| 欧美电视剧在线看免费| 北岛玲一区二区三区四区 | 国产精品免费丝袜| 91麻豆精品国产自产在线| 亚洲国产精品久久久男人的天堂| 欧美精品一区二区高清在线观看| 亚洲国产精品久久久男人的天堂| 久久久久久久综合色一本| 国产美女在线精品| 午夜精品一区在线观看| 这里是久久伊人| 91亚洲精品乱码久久久久久蜜桃| 精一区二区三区| 日韩国产欧美三级| 精品国产一区二区三区久久影院 | 亚洲成av人片在线| 国产精品久久久久aaaa樱花| 91网站在线播放| 国产激情一区二区三区四区 | 美女国产一区二区| 久久久蜜臀国产一区二区| 在线不卡欧美精品一区二区三区| 色综合天天视频在线观看| 夜夜嗨av一区二区三区| 欧美日韩高清在线播放| 久久99精品国产麻豆婷婷 | 日本强好片久久久久久aaa| 亚洲乱码日产精品bd| 中文字幕av一区二区三区高 | 国产福利91精品一区| 久久成人免费网站| 中文字幕av一区二区三区高 | 久久99国产精品尤物| 日韩和欧美一区二区| 亚洲国产精品一区二区久久恐怖片| 国产精品拍天天在线| 中文一区一区三区高中清不卡| 久久新电视剧免费观看| 久久人人超碰精品| 久久天天做天天爱综合色| 精品蜜桃在线看| 精品国免费一区二区三区| 精品国精品自拍自在线| 久久久精品黄色| 中文字幕在线观看不卡| 欧美区一区二区三区| 欧美日韩国产一级| 91精品国产色综合久久不卡电影 | 国产精品理论片| 国产精品天干天干在线综合| 国产精品丝袜在线| 中文字幕一区二区三区不卡在线 | 欧美猛男超大videosgay| 在线播放视频一区| 欧美va在线播放| 日本一区二区久久| 亚洲激情网站免费观看| 香蕉影视欧美成人| 国产资源精品在线观看| jlzzjlzz亚洲女人18| 色婷婷亚洲精品| 日韩欧美色综合| 中文字幕av一区 二区| 亚洲午夜在线电影| 免费高清视频精品| 国产精品一二三四五| 91久久免费观看| 日韩免费观看高清完整版在线观看 | 亚洲h在线观看| 国产精品白丝jk黑袜喷水| 成人精品免费视频| 欧美午夜精品电影| 成人深夜在线观看| 欧美日韩一区高清| 在线精品观看国产| 日韩欧美一二三四区| 国产精品久久久久久久久免费相片 | 国产欧美一区二区精品婷婷| 亚洲视频一区二区免费在线观看| 亚洲福利视频一区二区| 国产69精品一区二区亚洲孕妇| 六月丁香综合在线视频| 成人午夜私人影院| 欧美美女激情18p| 国产精品天美传媒| 美女视频免费一区| 色国产综合视频| 国产亚洲欧洲一区高清在线观看| 精品成a人在线观看| 中文字幕一区在线观看视频| 日本aⅴ精品一区二区三区 | 在线成人小视频| 综合av第一页| 激情久久五月天| 欧美色精品在线视频| 欧美激情综合五月色丁香小说| 亚洲成人免费av| 99天天综合性| 精品国产乱码久久久久久浪潮| 亚洲国产欧美日韩另类综合| www.日韩大片| 久久亚洲免费视频| 美美哒免费高清在线观看视频一区二区 | 日韩中文字幕不卡| 在线观看欧美黄色| 国产精品沙发午睡系列990531| 久久国产精品色| 欧美日韩高清一区二区不卡 | 久久久久国产精品麻豆ai换脸| 日韩精品每日更新| 欧美四级电影在线观看| 综合中文字幕亚洲| av高清久久久| 国产精品视频一二三| 国产成人精品影视| 久久只精品国产| 美国三级日本三级久久99| 日韩欧美在线123| 日韩成人午夜精品| 欧美福利电影网| 日本美女一区二区| 欧美精品久久一区二区三区| 亚洲综合自拍偷拍| 欧美日韩中文另类| 香蕉成人伊视频在线观看| 欧美日韩在线观看一区二区| 亚洲成av人**亚洲成av**| 欧美性感一类影片在线播放| 亚洲一区二区三区视频在线播放| 日韩成人精品在线观看| 欧美性大战久久| 午夜精品成人在线| 91精品国产综合久久香蕉麻豆| 亚洲国产综合91精品麻豆| 欧美在线免费观看视频| 亚洲第一激情av| 91精品国产福利在线观看 | 亚洲bt欧美bt精品| 欧美日韩国产大片| 麻豆91小视频| 26uuu国产一区二区三区| 国产91丝袜在线18| 成人欧美一区二区三区1314| 在线视频欧美精品| 日韩高清中文字幕一区| 久久综合九色综合久久久精品综合 | 国产欧美日本一区视频| 91在线精品一区二区| 一区二区国产视频| 91麻豆精品国产91久久久久久久久| 丝袜a∨在线一区二区三区不卡| 日韩欧美精品在线| 成人一二三区视频| 一区二区三区在线观看国产| 欧美精品亚洲一区二区在线播放| 免费在线观看日韩欧美| 国产午夜精品福利| 欧美性猛交一区二区三区精品| 美女国产一区二区| 中文字幕一区二区三区四区| 欧美精品少妇一区二区三区 | 99在线精品视频|