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

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

?? dhcpcstate2.c

?? VxWorks下DHCP的源代碼!
?? C
?? 第 1 頁 / 共 5 頁
字號:
    int msgtype;    int status;    struct dhcp_param tmpparam;#ifdef DHCPC_DEBUG    char newAddr[INET_ADDR_LEN];#endif    LEASE_DATA *pLeaseData;    char *pMsgData;    int length;    struct sockaddr_in dest;    struct ifnet *pIf;    struct ifreq ifr;    bzero (errmsg, sizeof (errmsg));    bzero ((char *) &tmpparam, sizeof (tmpparam));    if (dhcpTime (&curr_epoch) == -1) {#ifdef DHCPC_DEBUG        logMsg ("time() error in rebinding()\n", 0, 0, 0, 0, 0, 0);#endif        return (ERROR);    }    /*     * Use the cookie to access the lease-specific data structures. For now,     * just typecast the cookie. This translation could be replaced with a more     * sophisticated lookup at some point.     */    pLeaseData = (LEASE_DATA *) pEvent->leaseId;    if (pLeaseData->prevState == BOUND) {        /* Resume filtering with the BPF device (suspended while bound). */        bzero ((char *) &ifr, sizeof (struct ifreq));        sprintf (ifr.ifr_name, "%s%d", pLeaseData->ifData.iface->if_name,                 pLeaseData->ifData.iface->if_unit);        ioctl (pLeaseData->ifData.bpfDev, BIOCSTART, (int) &ifr);    }    if (pEvent->source == DHCP_AUTO_EVENT) {        if (pEvent->type == DHCP_TIMEOUT) {            /*             * The interval between a timeout event and the entry to the             * rebinding() routine depends on the workload of the client             * monitor task and is completely unpredictable. The lease             * may have expired during that time, and the final retransmission              * timeout will always end after the lease has expired. In either              * case, set the lease data to restart the negotiation with the              * init() routine. Otherwise, repeat the broadcast of the request              * message.             */            limit = pLeaseData->dhcpcParam->lease_origin + pLeaseData->dhcpcParam->lease_duration;            if (limit <= curr_epoch) {                /* Lease has expired:                  *    shut down network and return to initial state.                  */#ifdef DHCPC_DEBUG                logMsg ("Can't extend lease. Entering INIT state.\n", 0, 0, 0, 0, 0, 0);#endif                pLeaseData->prevState = REBINDING;                pLeaseData->currState = INIT;                return (DHCPC_MORE);            }            /* Retransmit rebinding request. */            length = make_request (pLeaseData, REBINDING, FALSE);            if (length < 0) {#ifdef DHCPC_DEBUG                logMsg ("Error making rebind request. Entering INIT state.\n", 0, 0, 0, 0, 0, 0);#endif                pLeaseData->prevState = REBINDING;                pLeaseData->currState = INIT;                return (DHCPC_MORE);            }            dhcpcMsgOut.udp->uh_sum = 0;            dhcpcMsgOut.udp->uh_sum = udp_cksum (&spudph,                                                 (char *) dhcpcMsgOut.udp, ntohs (spudph.ulen));            bzero ((char *) &dest, sizeof (struct sockaddr_in));            dest.sin_len = sizeof (struct sockaddr_in);            dest.sin_family = AF_INET;            dest.sin_addr.s_addr = dhcpcMsgOut.ip->ip_dst.s_addr;            pIf = pLeaseData->ifData.iface;            if (dhcpSend (pIf, &dest, sbuf.buf, length, TRUE) == ERROR) {#ifdef DHCPC_DEBUG                logMsg ("Can't send DHCPREQUEST(REBINDING)\n", 0, 0, 0, 0, 0, 0);#endif                pLeaseData->prevState = REBINDING;                pLeaseData->currState = INIT;                return (DHCPC_MORE);            }            /* DHCP request sent. Set lease data to repeat current state. */            pLeaseData->prevState = REBINDING;            pLeaseData->currState = REBINDING;            pLeaseData->initEpoch = curr_epoch;            /*             * Set the retransmission timer to wait for one-half of the             * remaining time before the lease expires, or 60 seconds if it             * expires in less than one minute.             */            timeout = pLeaseData->dhcpcParam->lease_origin +                pLeaseData->dhcpcParam->lease_duration - curr_epoch;            timeout /= 2;            if (timeout < 60)                timeout = 60;            /* Set timer for retransmission of request message. */            wdStart (pLeaseData->timer, sysClkRateGet () * timeout,                     (FUNCPTR) retrans_rebinding, (int) pLeaseData);        } /* End of timeout processing. */        else {            bzero ((char *) &tmpparam, sizeof (tmpparam));            /*             * Process DHCP message stored in receive buffer by monitor task.             * The 4-byte alignment of the IP header needed by Sun BSP's is             * guaranteed by the Berkeley Packet Filter during input.             */            pMsgData = pLeaseData->msgBuffer;            align_msg (&dhcpcMsgIn, pMsgData);            /* Examine type of message. Accept DHCPACK or DHCPNAK replies. */            option = (char *) pickup_opt (dhcpcMsgIn.dhcp,                                          DHCPLEN (dhcpcMsgIn.udp), _DHCP_MSGTYPE_TAG);            if (option == NULL) {                /*                 * Message type not found -  ignore untyped DHCP messages, and                 * any BOOTP replies.                 */                return (OK);            } else {                msgtype = *OPTBODY (option);                if (msgtype == DHCPNAK) {#ifdef DHCPC_DEBUG                    logMsg ("Got DHCPNAK in rebinding()\n", 0, 0, 0, 0, 0, 0);                    option = (char *) pickup_opt (dhcpcMsgIn.dhcp,                                                  DHCPLEN (dhcpcMsgIn.udp), _DHCP_ERRMSG_TAG);                    if (option != NULL &&                        nvttostr (OPTBODY (option), errmsg, (int) DHCPOPTLEN (option)) == 0)                        logMsg ("DHCPNAK contains the error message \"%s\"\n",                                (int) errmsg, 0, 0, 0, 0, 0);#endif                    clean_param (pLeaseData->dhcpcParam);                    free (pLeaseData->dhcpcParam);                    pLeaseData->dhcpcParam = NULL;                    pLeaseData->prevState = REBINDING;                    pLeaseData->currState = INIT;                    return (DHCPC_MORE);                } else if (msgtype == DHCPACK) {                    /* Fill in host requirements defaults. */                    dhcpcDefaultsSet (&tmpparam);                    if (dhcp_msgtoparam (dhcpcMsgIn.dhcp,                                         DHCPLEN (dhcpcMsgIn.udp), &tmpparam) == OK) {                        merge_param (pLeaseData->dhcpcParam, &tmpparam);                        *(pLeaseData->dhcpcParam) = tmpparam;                        pLeaseData->dhcpcParam->lease_origin = pLeaseData->initEpoch;#ifdef DHCPC_DEBUG                        inet_ntoa_b (pLeaseData->dhcpcParam->yiaddr, newAddr);                        logMsg ("Got DHCPACK (IP = %s, duration = %d secs)\n",                                (int) newAddr, pLeaseData->dhcpcParam->lease_duration, 0, 0, 0, 0);#endif                        status = use_parameter (pLeaseData->dhcpcParam, pLeaseData);                        semTake (dhcpcMutexSem, WAIT_FOREVER);                        if (status != 0) {#ifdef DHCPC_DEBUG                            logMsg ("Error configuring network. Shutting down.\n",                                    0, 0, 0, 0, 0, 0);#endif                            pLeaseData->leaseGood = FALSE;                        } else {                            pLeaseData->leaseGood = TRUE;                        }                        semGive (dhcpcMutexSem);                        pLeaseData->prevState = REBINDING;                        pLeaseData->currState = BOUND;                    }                    return (DHCPC_MORE);                }            }                   /* End of processing for typed DHCP message. */        }                       /* End of DHCP message processing. */    } else {        /* Process user requests. */        if (pEvent->type == DHCP_USER_RELEASE) {    /* Relinquish lease. */            release (pLeaseData, TRUE);            return (DHCPC_DONE);        }        if (pEvent->type == DHCP_USER_VERIFY) { /* Verify lease. */            /* Set the lease data to execute verify() routine. */            pLeaseData->prevState = REBINDING;            pLeaseData->currState = VERIFY;            return (DHCPC_MORE);        }    }    return (OK);}/********************************************************************************* init_reboot - Rebooting state of the client finite state machine** This routine implements the "zeroth" state of the client finite state* machine. It attempts to renew an active lease after the client has* rebooted. This generally requires the presence of a cache, but the lease* data may also be read from global variables to renew the lease obtained* during system startup. If no lease data is found or renewal fails, processing* continues with the INIT state.* .IP* This routine is invoked by the event handler of the client monitor task,* and should only be called internally. Any user requests generated by* incorrect calls or delayed responses to the dhcpcVerify() routine are * ignored.** RETURNS: OK (processing complete), DHCPC_DONE (remove lease),*          DHCPC_MORE (continue), or ERROR.** ERRNO: N/A** INTERNAL** When calculating the values for the lease timers, floating-point calculations* can't be used because some boards (notably the SPARC architectures) disable* software floating point by default to speed up context switching. These* boards abort with an exception when floating point operations are* encountered. The error introduced by the integer approximations is not* significant.** NOMANUAL*/int init_reboot (EVENT_DATA * pEvent    /* pointer to event descriptor */    ){    char *rbufp = NULL;    STATUS result;    int length = 0;    unsigned long origin = 0;    int tmp;    int status;    struct sockaddr_in dest;    struct ifnet *pIf;    LEASE_DATA *pLeaseData = NULL;    /*     * Use the cookie to access the lease-specific data structures. For now,     * just typecast the cookie. This translation could be replaced with a more     * sophisticated lookup at some point.     */    pLeaseData = (LEASE_DATA *) pEvent->leaseId;    /*     * The DHCP_USER_RELEASE event occurs in response to the dhcpcRelease()     * or dhcpcShutdown() call. Remove all data structures for this lease.     */    if (pEvent->type == DHCP_USER_RELEASE) {        dhcpcLeaseCleanup (pLeaseData);        return (DHCPC_DONE);    }    /* Ignore verify user events, which are meaningless here. */    if (pEvent->source == DHCP_USER_EVENT && pEvent->type != DHCP_USER_BIND)        return (OK);    /*      * Safety check - ignore timeouts and message arrivals, which are     * theoretically possible under extremely unlikely chains of events.     */    if (pEvent->source == DHCP_AUTO_EVENT)        return (OK);    /* If a cache is needed and unavailable, restart from the INIT state. */    if (pLeaseData->cacheHookRtn == NULL && pLeaseData->leaseType == DHCP_MANUAL) {        pLeaseData->prevState = INIT_REBOOT;        pLeaseData->currState = INIT;        return (DHCPC_MORE);    }#ifdef DHCPC_DEBUG    logMsg ("dhcpc: Attempting to re-use parameters.\n", 0, 0, 0, 0, 0, 0);#endif    bzero (sbuf.buf, sbuf.size);    /*     * The client might have established a lease (during boot-time) with     * an older DHCP server which ignores messages less than the minimum     * length obtained with a fixed options field. Set this lease attempt     * to pad the renewal request to the minimum size (for RFC 1541) to     * avoid unnecessary retransmissions in that case.     */    pLeaseData->oldFlag = TRUE;    if (pLeaseData->leaseType == DHCP_MANUAL) {        /*         * Post-boot: read from cache into aligned scratch buffer         * (used during other states to transmit DHCP messages).         */        length = sbuf.size;        rbufp = sbuf.buf;        result = (*pLeaseData->cacheHookRtn) (DHCP_CACHE_READ, &origin, &length, rbufp);        if (result != OK) {     /* Can't re-use stored parameters. */            pLeaseData->prevState = INIT_REBOOT;            pLeaseData->currState = INIT;            return (DHCPC_MORE);        }        /*         * Set the pointers to access the individual DHCP message components.         */        dhcpcMsgIn.ip = (struct ip *) rbufp;#if BSD<44        dhcpcMsgIn.udp = (struct udphdr *) &rbufp[(dhcpcMsgIn.ip->ip_v_hl & 0xf) * WORD];        dhcpcMsgIn.dhcp = (struct dhcp *) &rbufp[(dhcpcMsgIn.ip->ip_v_hl & 0xf) * WORD + UDPHL];#else        dhcpcMsgIn.udp = (struct udphdr *) &rbufp[dhcpcMsgIn.ip->ip_hl * WORD];        dhcpcMsgIn.dhcp = (struct dhcp *) &rbufp[dhcpcMsgIn.ip->ip_hl * WORD + UDPHL];#endif    }    if (pLeaseData->dhcpcParam == NULL) {        pLeaseData->dhcpcParam = (struct dhcp_param *) calloc (1, sizeof (struct dhcp_param));        if (pLeaseData->dhcpcParam == NULL) {#ifdef DHCPC_DEBUG            logMsg ("calloc() error in init_reboot()\n", 0, 0, 0, 0, 0, 0);#endif            pLeaseData->prevState = INIT_REBOOT;            pLeaseData->currState = INIT;            return (DHCPC_MORE);        }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕一区二区视频| 日韩精品亚洲专区| 日韩国产欧美在线观看| 国产精品一区二区久久精品爱涩| 91在线丨porny丨国产| 日韩欧美专区在线| 一区二区三区在线免费视频| 国产一区二区免费在线| 欧美精品一二三| 亚洲情趣在线观看| 国产不卡一区视频| 欧美xxxxx裸体时装秀| 亚洲午夜免费视频| 一本色道久久综合亚洲aⅴ蜜桃| 精品国产麻豆免费人成网站| 秋霞成人午夜伦在线观看| 97久久人人超碰| 国产精品青草综合久久久久99| 蜜桃久久久久久久| 欧美一区二区私人影院日本| 午夜av一区二区三区| 91免费视频大全| 日韩毛片视频在线看| 国产精品中文有码| 久久久精品黄色| 国产乱人伦精品一区二区在线观看| 欧美日韩成人在线一区| 洋洋成人永久网站入口| 91黄色小视频| 一区二区三区在线视频播放| 日本大香伊一区二区三区| 一区二区三区四区在线| 色成人在线视频| 亚洲已满18点击进入久久| 色婷婷av久久久久久久| 一区二区三区日韩欧美精品| 91黄视频在线观看| 日韩精品一区第一页| 日韩一区二区精品在线观看| 午夜电影久久久| 欧美电影精品一区二区| 国产精品66部| 亚洲欧美激情插 | 亚洲欧美日韩成人高清在线一区| 懂色av中文字幕一区二区三区| 日本一区二区久久| 93久久精品日日躁夜夜躁欧美| 亚洲欧美国产77777| 在线亚洲免费视频| 久久精品国产99国产| 国产丝袜美腿一区二区三区| 成人免费毛片app| 亚洲第一av色| 精品久久一二三区| hitomi一区二区三区精品| 一区二区三区在线视频观看| 69p69国产精品| 国产成人综合在线播放| 亚洲靠逼com| 日韩女同互慰一区二区| 成人av在线一区二区| 亚洲不卡在线观看| www国产精品av| 91成人在线精品| 激情丁香综合五月| 亚洲女与黑人做爰| 欧美大片在线观看| 91免费精品国自产拍在线不卡 | 在线影视一区二区三区| 日本亚洲视频在线| 国产精品久久久久久亚洲毛片| 欧美在线三级电影| 国产一区不卡精品| 亚洲综合免费观看高清完整版| 久久这里只有精品视频网| 91福利国产精品| 国产91精品久久久久久久网曝门| 亚洲午夜久久久久中文字幕久| 2024国产精品视频| 在线免费一区三区| 欧美亚洲国产一区二区三区| 免费成人在线观看视频| 亚洲美女电影在线| 国产亚洲va综合人人澡精品| 欧美三级乱人伦电影| 99re这里只有精品首页| 国产精品亚洲一区二区三区在线| 日韩激情一区二区| 亚洲欧美另类小说视频| 国产欧美日韩在线| 精品久久人人做人人爽| 欧美日韩不卡视频| 色综合久久66| 91老司机福利 在线| 成人中文字幕在线| 国产一区激情在线| 久久精品国产精品青草| 日韩电影免费在线看| 亚洲福利视频三区| 亚洲自拍与偷拍| 樱花影视一区二区| 亚洲欧美日韩一区| 综合自拍亚洲综合图不卡区| 国产女人18水真多18精品一级做| 精品日韩成人av| 亚洲精品一区二区精华| 日韩欧美国产麻豆| 2017欧美狠狠色| 精品国产三级a在线观看| 欧美精品一区男女天堂| 日韩精品一区二区三区中文不卡| 7777精品伊人久久久大香线蕉的 | 欧美一区二区三区系列电影| 欧美在线播放高清精品| 91国偷自产一区二区使用方法| 93久久精品日日躁夜夜躁欧美| caoporn国产精品| 91网上在线视频| 色婷婷久久99综合精品jk白丝| 99久久99久久综合| 欧美性色欧美a在线播放| 欧美日韩成人综合天天影院 | 国产日韩欧美高清| 国产精品毛片大码女人| 亚洲婷婷国产精品电影人久久| 亚洲啪啪综合av一区二区三区| 亚洲桃色在线一区| 亚洲一区二区三区小说| 婷婷综合五月天| 韩国精品主播一区二区在线观看| 国产麻豆91精品| 91免费国产在线观看| 欧美日韩美女一区二区| 欧美变态tickle挠乳网站| 国产精品三级av在线播放| 亚洲综合色噜噜狠狠| 蜜臀av性久久久久av蜜臀妖精| 国产美女在线精品| 色欧美乱欧美15图片| 日韩视频免费直播| 国产精品天美传媒| 一区二区三区四区高清精品免费观看 | 中文av一区二区| 亚洲精品免费播放| 日本欧美在线观看| 99精品在线免费| 欧美日韩一级大片网址| 久久久久久电影| 一区二区三区四区五区视频在线观看| 日本视频一区二区三区| 国产精品一二三| 欧美日韩国产片| 国产日韩欧美激情| 日韩电影在线免费看| 成人午夜视频网站| 制服丝袜成人动漫| 国产精品久久久久久久第一福利 | 91年精品国产| 日韩精品一区二区三区中文不卡 | 精品欧美一区二区久久| 亚洲欧美成aⅴ人在线观看| 精久久久久久久久久久| 色婷婷一区二区| 久久久久久久综合| 日本v片在线高清不卡在线观看| 波多野结衣在线一区| 欧美videossexotv100| 一区二区三区在线播放| 成人三级伦理片| 欧美tickling网站挠脚心| 亚洲最色的网站| 成人动漫精品一区二区| 精品噜噜噜噜久久久久久久久试看| 亚洲一区在线视频观看| av在线不卡电影| 国产女主播在线一区二区| 久草这里只有精品视频| 欧美区在线观看| 亚洲一区二区三区在线播放| av色综合久久天堂av综合| 久久影院电视剧免费观看| 蜜桃av噜噜一区二区三区小说| 欧美影院精品一区| 亚洲综合在线电影| 91亚洲国产成人精品一区二区三| 久久久精品影视| 国产精品羞羞答答xxdd| 亚洲精品在线免费播放| 蜜桃免费网站一区二区三区| 91精品国产综合久久精品app | 91麻豆精品国产91久久久资源速度| 亚洲欧美区自拍先锋| 91一区二区三区在线观看| 国产精品国产三级国产普通话三级| 精品亚洲成av人在线观看| 精品成人a区在线观看| 久久99国产精品尤物| 精品国产青草久久久久福利| 国产在线一区二区| 国产亚洲欧美激情|