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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? dhcps.c

?? VxWorks下DHCP的源代碼!
?? C
?? 第 1 頁 / 共 5 頁
字號(hào):
/* dhcps.c - WIDE project DHCP server routines *//* Copyright 1984 - 2001 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01n,23apr02,wap  use dhcpTime() instead of time() (SPR #68900), also use                 BPF_WORDALIGN() when traversing multiple packets in BPF                 buffers (SPR #74215)01m,08mar02,wap  Return sane lease renewal times for clients that request                 leases without specifying their own lease times (SPR #73243)01l,31oct01,vvv  allow low-priority tasks to run while server waits for 		 ICMP reply (SPR #33132)01k,12oct01,rae  merge from truestack ver 01s, base 01h                 SPRs 70184, 69547, 34799, 6680801j,24oct00,spm  fixed modification history after tor3_x merge; fixed invalid                 socket reference (SPR #27246)01i,23oct00,niq  merged from version 01j of tor3_x branch (base version 01h)01h,01mar99,spm  corrected checksum calculation for ICMP requests (SPR #24745)01g,06oct97,spm  removed reference to deleted endDriver global; replaced with                 support for dynamic driver type detection; split interface                 name into device name and unit number01f,26aug97,spm  rearranged functions to consolidate lease selection routines01e,02jun97,spm  changed DHCP option tags to prevent name conflicts (SPR #8667)                 and updated man pages01d,06may97,spm  changed memory access to align IP header on four byte                  boundary and corrected format of lease record01c,28apr97,spm  allowed user to change DHCP_MAX_HOPS setting01b,18apr97,spm  added conditional include DHCPS_DEBUG for displayed output01a,07apr97,spm  created by modifying WIDE project DHCP implementation*//*DESCRIPTIONThis library implements the server side of the Dynamic Host ConfigurationProtocol (DHCP). DHCP is an extension of BOOTP. Like BOOTP, it allows atarget to configure itself dynamically by obtaining its IP address, aboot file name, and the DHCP server's address over the network. Additionally,DHCP provides for automatic reuse of network addresses by specifyingindividual leases as well as many additional options. The compatiblemessage format allows DHCP participants to interoperate with BOOTPparticipants.INCLUDE FILES: dhcpsLib.hSEE ALSO: RFC 1541, RFC 1533*//* includes */#include "dhcp/copyright_dhcp.h"#include "vxWorks.h"#include "net/bpf.h"#include "logLib.h"#include "vxLib.h"              /* checksum() declaration */#include "inetLib.h"#include "sockLib.h"#include "ioLib.h"#include "wdLib.h"#include "taskLib.h"#include "sysLib.h"#include "muxLib.h"#include "netinet/ip.h"#include "netinet/in_systm.h"#include "netinet/ip_icmp.h"#include <time.h>#include <stdio.h>#include <stdlib.h>#include "dhcp/dhcp.h"#include "dhcp/common.h"#include "dhcp/hash.h"#include "dhcp/dhcps.h"#include "dhcpsLib.h"#include "dhcp/common_subr.h"/* defines */#define MEMORIZE 90             /* Seconds of delay before re-using offered lease. */#define E_NOMORE -2             /* Error code: no more space in options field. */#ifndef VIRTUAL_STACK/* globals */int nbind;                      /* Number of active or pending lease records. */struct msg dhcpsMsgIn;          /* Pointers to components of incoming message. */struct msg dhcpsMsgOut;         /* Pointers to outgoing message parts. */char *dhcpsSendBuf;             /* Transmit buffer for outgoing messages. */char *dhcpsOverflowBuf;         /* Extra space (for larger messages) starts here. */IMPORT struct if_info *dhcpsIntfaceList;    /* Interfaces to monitor. */struct iovec sbufvec[2];        /* Socket access to outgoing message.                                  * sbufvec[0] is standard message.                                  * sbufvec[1] contains message extensions if                                 * client accepts longer messages.                                  */IMPORT int dhcpsMaxSize;        /* Size of transmit buffer. */IMPORT int dhcpsBufSize;        /* Size of receive buffer. */IMPORT u_short dhcps_port;IMPORT u_short dhcpc_port;/* locals */LOCAL unsigned char dhcpCookie[] = RFC1048_MAGIC;   /* DHCP message indicator. */LOCAL int rdhcplen;             /* Size of received DHCP message. */LOCAL int overload;             /* Options in sname or file fields? */LOCAL int off_options;          /* Index into options field. */LOCAL int off_extopt;           /* Index into any options in sbufvec[1]. */LOCAL int maxoptlen;            /* Space available for options. */LOCAL int off_file;             /* Index into any options within file field. */LOCAL int off_sname;            /* Index into any options in sname field. */#else#include "netinet/vsLib.h"#include "netinet/vsDhcps.h"#endif /* VIRTUAL_STACK *//* forward declarations */LOCAL int icmp_check (int, struct in_addr *);IMPORT STATUS dhcpsSend (struct ifnet *, char *, int, struct sockaddr_in *, char *, int, BOOL);IMPORT void dhcpServerRelay (struct if_info *);IMPORT void dhcpClientRelay (struct if_info *, int, char *);IMPORT void delarp (struct in_addr *, int);/********************************************************************************* dhcpsStart - execute the DHCP server** This routine receives DHCP requests from clients and generates replies. If* configured to do so, it may also act as a relay agent and forward these * requests to other servers or transfer replies to clients. It is the entry * point for the DHCP server task and should only be called internally.** RETURNS: N/A** ERRNO: N/A** NOMANUAL*/int dhcpsStart (#ifndef VIRTUAL_STACK                   void#else                   int stackNum#endif                          /* VIRTUAL_STACK */    ){    struct if_info *ifp;        /* pointer to receiving interface descriptor */    int n = 0;                  /* number of bytes received */    int msgtype;                /* DHCP message type, or BOOTP indicator */    char *option = NULL;        /* pointer to access message options */    struct bpf_hdr *pMsgHdr;    char *pMsgData;    int msglen;    int curlen;    int totlen;                 /* Amount of data in BPF buffer. */#ifdef VIRTUAL_STACK    if (virtualStackNumTaskIdSet (stackNum) == ERROR)        return (ERROR);#endif /* VIRTUAL_STACK */    /* Main loop - read and process incoming messages. */    FOREVER {        garbage_collect ();     /* remove expired leases from hash table. */        /* select and read from interfaces */        ifp = read_interfaces (dhcpsIntfaceList, &n, dhcpsBufSize);        if (ifp == NULL)            continue;        /* Divide each DHCP message in buffer into protocol sections. */        msglen = curlen = 0;        totlen = n;        pMsgHdr = (struct bpf_hdr *) ifp->buf;        pMsgData = ifp->buf;        while (curlen < totlen) {            msglen = BPF_WORDALIGN (pMsgHdr->bh_hdrlen + pMsgHdr->bh_caplen);            curlen += msglen;            /* Set the IP pointer to skip the BPF and link level headers. */            dhcpsMsgIn.ip = (struct ip *) (pMsgData + pMsgHdr->bh_hdrlen + pMsgHdr->bh_linklen);            if ((dhcpsMsgIn.ip->ip_dst.s_addr == 0xffffffff ||                 dhcpsMsgIn.ip->ip_dst.s_addr == ifp->ipaddr.s_addr) && check_ipsum (dhcpsMsgIn.ip))                dhcpsMsgIn.udp =                    (struct udphdr *) ((UCHAR *) dhcpsMsgIn.ip + dhcpsMsgIn.ip->ip_hl * WORD);            else {                /* Invalid IP header: ignore. */                pMsgData = pMsgData + msglen;                pMsgHdr = (struct bpf_hdr *) pMsgData;                continue;            }            if (check_udpsum (dhcpsMsgIn.ip, dhcpsMsgIn.udp))                dhcpsMsgIn.dhcp = (struct dhcp *) ((UCHAR *) dhcpsMsgIn.udp + UDPHL);            else {                /* Invalid UDP header: ignore. */                pMsgData = pMsgData + msglen;                pMsgHdr = (struct bpf_hdr *) pMsgData;                continue;            }            /*             * Perform function of relay agent for received server replies.             * (Changes contents of input message IP and UDP headers while             * sending to client).             */            dhcpMsgIn.ip = dhcpsMsgIn.ip;            dhcpMsgIn.udp = dhcpsMsgIn.udp;            dhcpMsgIn.dhcp = dhcpsMsgIn.dhcp;            if (dhcpMsgIn.dhcp->op == BOOTREPLY)                dhcpClientRelay (dhcpsIntfaceList, DHCPLEN (dhcpsMsgIn.udp), dhcpsSendBuf);            if (dhcpsMsgIn.dhcp->op != BOOTREQUEST) {                pMsgData = pMsgData + msglen;                pMsgHdr = (struct bpf_hdr *) pMsgData;                continue;            }            /* Process DHCP client message received at server port. */            rdhcplen = DHCPLEN (dhcpsMsgIn.udp);            msgtype = BOOTP;            option = pickup_opt (dhcpsMsgIn.dhcp, rdhcplen, _DHCP_MSGTYPE_TAG);            if (option != NULL)                msgtype = (int) *OPTBODY (option);#ifdef DHCPS_DEBUG            if (msgtype < BOOTP || msgtype > DHCPRELEASE)                logMsg ("dhcps: unknown message received.\n", 0, 0, 0, 0, 0, 0);#endif            if (msgtype >= BOOTP && msgtype <= DHCPRELEASE)                if ((process_msg[msgtype]) != NULL)                    (*process_msg[msgtype]) (ifp);            /*             * Relay received client messages if target addresses available.             * (Changes contents of input DHCP message when sending to             * server or relay agent - must process first).             */            dhcpMsgIn.udp = dhcpsMsgIn.udp;            dhcpMsgIn.dhcp = dhcpsMsgIn.dhcp;            if (pDhcpTargetList != NULL)                dhcpServerRelay (ifp);            pMsgData = pMsgData + msglen;            pMsgHdr = (struct bpf_hdr *) pMsgData;        }    }}/********************************************************************************* haddrtos - convert hardware address to cache format** This routine converts the given hardware address to the <type>:<value> pair* used when adding lease record entries to permanent storage.** RETURNS: Pointer to converted string** ERRNO: N/A** NOMANUAL*/char *haddrtos (struct chaddr *haddr    /* pointer to parsed hardware address */    ){    int i;    int fin;    char tmp[3];    static char result[MAX_HLEN * 2 + 8];   /* it seems enough */    bzero (result, sizeof (result));    fin = haddr->hlen;    if (fin > MAX_HLEN)        fin = MAX_HLEN;    sprintf (result, "%d:0x", haddr->htype);    for (i = 0; i < fin; i++) {        sprintf (tmp, "%.2x", haddr->haddr[i] & 0xff);        strcat (result, tmp);    }    return (result);}/********************************************************************************* cidtos - convert client identifier to cache format** This routine converts the given client identifier to the <type>:<value> pair* used when adding lease record entries to permanent storage. It also* adds the current subnet number so that the server can deny inaccurate * leases caused by a client changing subnets. When used for user output, the* subnet is not included in the converted string.** RETURNS: Pointer to converted string** ERRNO: N/A** NOMANUAL*/char *cidtos (struct client_id *cid,    /* pointer to parsed client ID */              int withsubnet    /* flag for adding subnet to output string */    ){    int i = 0;    static char result[MAXOPT * 2 + sizeof ("255.255.255.255") + 3];    char tmp[sizeof ("255.255.255.255") + 1];    sprintf (result, "%d:0x", cid->idtype);    for (i = 0; i < cid->idlen; i++) {        sprintf (tmp, "%.2x", cid->id[i] & 0xff);        strcat (result, tmp);    }    if (withsubnet) {        inet_ntoa_b (cid->subnet, tmp);        strcat (result, ":");        strcat (result, tmp);    }    return (result);}/********************************************************************************* get_reqlease - Retrieve requested lease value ** This routine extracts the desired lease duration from the options field of * the DHCP client request and converts it to host byte order.** RETURNS: Requested lease duration, or 0 if none.** ERRNO: N/A** NOMANUAL*/static u_long get_reqlease (struct dhcp *msg,   /* pointer to incoming message */                            int length  /* length of incoming message */    ){    char *option = NULL;    u_long retval = 0;    if ((option = pickup_opt (msg, length, _DHCP_LEASE_TIME_TAG)) != NULL)        retval = GETHL (OPTBODY (option));    return (retval);}/********************************************************************************

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
激情综合网最新| 国产精品亚洲成人| 国产亚洲精久久久久久| 91免费看视频| 精品一区在线看| 亚洲免费资源在线播放| 2020国产精品| 欧美人妖巨大在线| 色偷偷一区二区三区| 精品一区二区三区免费视频| 亚洲视频免费在线| 久久亚洲捆绑美女| 日韩一区二区高清| 欧美性色欧美a在线播放| 国产精品一区三区| 亚洲国产综合视频在线观看| 欧美国产国产综合| 久久亚洲影视婷婷| 日韩欧美国产1| 欧美美女视频在线观看| 97国产一区二区| 粉嫩一区二区三区在线看| 久久爱www久久做| 日韩中文字幕不卡| 亚洲一区成人在线| 一区二区三区国产精华| 国产精品灌醉下药二区| 国产日韩欧美精品一区| 337p日本欧洲亚洲大胆色噜噜| 欧美日韩夫妻久久| 欧美午夜精品久久久久久孕妇 | 亚洲尤物视频在线| ...xxx性欧美| 最新不卡av在线| 国产精品国产a级| 中文字幕一区二区三区四区不卡| 久久网站热最新地址| 精品剧情v国产在线观看在线| 91精品久久久久久久91蜜桃 | 精品国产一区a| 日韩精品一区二区三区四区| 6080日韩午夜伦伦午夜伦| 欧美日韩另类一区| 欧美一区二区三区免费观看视频 | www国产精品av| 精品国产91洋老外米糕| 精品国产1区二区| 日韩精品最新网址| 久久久久国产精品麻豆| 国产欧美一区二区三区沐欲| 久久久精品综合| 中文av一区特黄| 亚洲免费在线视频| 午夜精品久久一牛影视| 天堂av在线一区| 久久国内精品自在自线400部| 蜜臀久久99精品久久久久宅男| 欧美aaaaa成人免费观看视频| 久久99久久久欧美国产| 国内精品在线播放| eeuss鲁片一区二区三区在线看| 99久久综合国产精品| 色伊人久久综合中文字幕| 欧美日韩视频在线观看一区二区三区 | 国产69精品久久99不卡| 成人看片黄a免费看在线| 99热国产精品| 欧美日韩国产美女| 2019国产精品| 亚洲美女在线一区| 日韩**一区毛片| 国产91综合一区在线观看| 波多野结衣中文字幕一区二区三区| 99久久国产综合色|国产精品| 欧美亚洲国产一区二区三区va| 欧美一级黄色大片| 国产精品久久久久久久裸模| 亚洲乱码国产乱码精品精可以看| 天天操天天干天天综合网| 精品综合久久久久久8888| 成人黄色小视频在线观看| 欧美日韩大陆在线| 欧美国产国产综合| 日韩精品乱码免费| 成人久久久精品乱码一区二区三区 | 中文字幕亚洲在| 亚洲va欧美va国产va天堂影院| 国内精品视频666| 在线精品亚洲一区二区不卡| 51精品秘密在线观看| 国产片一区二区| 日韩av一二三| 99国产欧美久久久精品| 欧美一区二区啪啪| 亚洲色欲色欲www| 经典三级视频一区| 欧美群妇大交群的观看方式 | 亚洲第一搞黄网站| 国产成人av电影在线| 欧美日韩国产小视频在线观看| 中文字幕国产一区| 看片网站欧美日韩| 91香蕉视频污在线| 久久久不卡网国产精品一区| 亚洲国产一区二区三区青草影视| 国产成人亚洲综合a∨婷婷图片| 欧美日韩国产精品自在自线| 国产精品免费丝袜| 国产在线视频不卡二| 欧美日韩视频第一区| 成人欧美一区二区三区视频网页| 美国精品在线观看| 欧美久久一二区| 一区二区三区中文字幕| 国产福利一区二区三区视频 | 精品视频在线免费看| 国产精品欧美久久久久无广告| 狠狠色丁香婷婷综合| 777a∨成人精品桃花网| 亚洲一区精品在线| 一本一道波多野结衣一区二区| 国产网红主播福利一区二区| 欧美aⅴ一区二区三区视频| 欧美午夜影院一区| 亚洲精品国产品国语在线app| 国产精品99久久久久久有的能看 | 亚洲日本丝袜连裤袜办公室| 国产盗摄一区二区| 久久九九国产精品| 国产九色sp调教91| 久久理论电影网| 狠狠色丁香婷婷综合久久片| 日韩一区二区三区高清免费看看| 亚洲1区2区3区视频| 91国偷自产一区二区三区成为亚洲经典 | 成人av在线播放网站| 国产女主播一区| 国产成人一区二区精品非洲| 久久先锋资源网| 国产一区二区伦理| 国产丝袜美腿一区二区三区| 九九国产精品视频| 国产片一区二区| 成人动漫在线一区| 亚洲乱码国产乱码精品精98午夜 | 国产一区二区三区四区五区美女| 日韩精品一区在线| 国产做a爰片久久毛片| 久久久久久久综合日本| 国产乱码精品1区2区3区| 国产三级精品三级| 成人激情黄色小说| 亚洲理论在线观看| 欧美日韩夫妻久久| 精品一区二区精品| 中文一区一区三区高中清不卡| 从欧美一区二区三区| 国产精品日日摸夜夜摸av| 一本到高清视频免费精品| 婷婷久久综合九色综合伊人色| 日韩午夜精品视频| 国产成人免费网站| 一区二区三区国产| 欧美裸体bbwbbwbbw| 精品中文字幕一区二区| 中文字幕欧美国产| 色狠狠桃花综合| 青青草97国产精品免费观看 | 国内精品伊人久久久久av影院 | 久久女同性恋中文字幕| 国产成人亚洲综合a∨婷婷图片| 专区另类欧美日韩| 在线成人av影院| 国产精品一二一区| 亚洲精品成人天堂一二三| 欧美高清一级片在线| 国内成+人亚洲+欧美+综合在线| 综合久久久久久久| 欧美一卡在线观看| 不卡av在线免费观看| 日韩国产在线观看一区| 中日韩av电影| 91精品国产91热久久久做人人| 国产成人自拍网| 亚洲一区二区三区在线看| 精品国产一区二区三区久久影院| 91网址在线看| 国产中文字幕一区| 亚洲一级二级三级在线免费观看| 精品福利一二区| 欧美怡红院视频| 国产精品一二二区| 性欧美疯狂xxxxbbbb| 国产精品欧美综合在线| 日韩午夜中文字幕| 欧美日韩中字一区| a4yy欧美一区二区三区| 极品少妇xxxx偷拍精品少妇| 亚洲一二三专区| 亚洲视频免费在线|