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

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

?? dhcps.c

?? VxWorks下DHCP的源代碼!
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* 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);}/********************************************************************************

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚瑟在线精品视频| 欧美日韩电影在线| 欧美精品乱码久久久久久按摩| 2017欧美狠狠色| 亚洲国产综合人成综合网站| 国产美女一区二区三区| 91精品久久久久久久99蜜桃 | 欧美影院午夜播放| 精品成人免费观看| 视频一区二区不卡| 色婷婷av一区二区三区大白胸| 久久久夜色精品亚洲| 视频一区二区中文字幕| 色婷婷av一区二区三区软件| 国产精品久久夜| 精品在线一区二区三区| 777午夜精品免费视频| 亚洲码国产岛国毛片在线| 国产乱子伦一区二区三区国色天香| 欧美三级视频在线| 亚洲一本大道在线| 欧美三级在线播放| 亚洲自拍另类综合| 在线观看av不卡| 国产一区二区三区在线观看免费 | 欧美电影精品一区二区| 午夜精品久久久久久久| 在线观看av一区| 亚洲小少妇裸体bbw| 99视频国产精品| 国产精品入口麻豆原神| 在线一区二区三区做爰视频网站| 亚洲综合成人网| 精品日韩在线观看| 欧美猛男超大videosgay| 国产激情精品久久久第一区二区| 老鸭窝一区二区久久精品| 青青草国产精品97视觉盛宴| 久久国产免费看| 欧美国产禁国产网站cc| 风间由美一区二区三区在线观看| 久久九九久久九九| 国产99精品视频| 国产精品二三区| 日本精品一级二级| 亚洲r级在线视频| 4438x成人网最大色成网站| 日韩国产欧美在线播放| 91精品国产综合久久久蜜臀粉嫩| 日韩国产在线观看| 久久综合丝袜日本网| 国产成人免费高清| 中文字幕一区二区三区不卡在线| 99r精品视频| 亚洲国产你懂的| 日韩精品一区二区在线| 国产成人精品1024| 亚洲精品国产第一综合99久久 | 亚洲aaa精品| 精品盗摄一区二区三区| 国产不卡视频在线播放| 亚洲综合在线五月| 精品精品欲导航| 成人久久久精品乱码一区二区三区| 亚洲婷婷综合色高清在线| 精品视频一区二区不卡| 国产美女一区二区| 亚洲成人动漫在线观看| 久久女同互慰一区二区三区| 色婷婷av久久久久久久| 韩国av一区二区| 亚洲视频免费在线观看| 精品少妇一区二区三区视频免付费| 国产69精品久久777的优势| 亚洲一卡二卡三卡四卡无卡久久| 久久影视一区二区| 91麻豆精品国产91久久久久 | 麻豆精品视频在线观看| 亚洲图片你懂的| 26uuu色噜噜精品一区| 欧美性猛交xxxxxx富婆| 国产精品白丝jk白祙喷水网站| 亚洲午夜久久久| 国产精品乱码一区二三区小蝌蚪| 欧美日高清视频| 色综合中文综合网| 亚洲成人1区2区| 国产精品午夜春色av| 日韩欧美电影在线| 欧美午夜视频网站| 波多野结衣欧美| 国产精品一区二区免费不卡| 日本亚洲视频在线| 性感美女久久精品| 亚洲欧美另类久久久精品2019| 欧美成人性战久久| 在线播放91灌醉迷j高跟美女| 色综合天天综合网国产成人综合天 | 成人小视频免费在线观看| 日韩av成人高清| 亚洲自拍偷拍欧美| 亚洲精品国产第一综合99久久| 国产蜜臀av在线一区二区三区| 欧美成人一区二区三区片免费| 欧美美女bb生活片| 欧美日韩在线免费视频| 91丨九色丨蝌蚪富婆spa| 国产精品主播直播| 国产一区二区三区四区五区入口 | 91久久线看在观草草青青| 国产成人夜色高潮福利影视| 国产精品综合一区二区三区| 久色婷婷小香蕉久久| 蜜桃视频第一区免费观看| 美腿丝袜一区二区三区| 老司机一区二区| 国产主播一区二区| 国产成人一区在线| 成年人国产精品| 99在线视频精品| 91天堂素人约啪| 欧美影视一区二区三区| 精品视频123区在线观看| 3d成人h动漫网站入口| 日韩欧美你懂的| 久久青草欧美一区二区三区| 国产偷国产偷亚洲高清人白洁| 国产精品久久久一区麻豆最新章节| 国产精品免费久久久久| 一级女性全黄久久生活片免费| 亚洲精品成人少妇| 全国精品久久少妇| 国产传媒欧美日韩成人| 色综合视频一区二区三区高清| 欧美优质美女网站| 欧美成人午夜电影| 国产精品少妇自拍| 亚洲一区二区高清| 狠狠色狠狠色综合日日91app| 国产成人一区在线| 欧美在线短视频| 精品成人私密视频| 亚洲免费观看在线视频| 日韩一区精品视频| 国产精品亚洲午夜一区二区三区| 成人黄色免费短视频| 欧美三级在线看| 久久久99精品免费观看| 一区二区在线看| 麻豆精品视频在线观看| av网站一区二区三区| 欧美日韩国产经典色站一区二区三区 | 久久99精品国产麻豆不卡| 国产成人亚洲综合a∨猫咪| 色综合天天性综合| 精品成人a区在线观看| 亚洲欧美成aⅴ人在线观看| 日韩中文字幕麻豆| 91丝袜高跟美女视频| 精品日韩一区二区| 亚洲国产精品二十页| 免费精品视频在线| 日本国产一区二区| 中文字幕av一区二区三区高| 三级久久三级久久| www.视频一区| 精品伦理精品一区| 午夜视频一区二区| 99久久精品国产麻豆演员表| 日韩视频在线观看一区二区| 樱桃国产成人精品视频| 成人永久免费视频| 精品日产卡一卡二卡麻豆| 一区二区三区四区在线播放| 国产高清视频一区| 日韩久久久精品| 亚洲国产精品久久不卡毛片 | 亚洲欧美电影院| 国产91丝袜在线播放| 日韩欧美高清在线| 日本中文字幕一区二区有限公司| 91麻豆国产在线观看| 中文字幕av一区二区三区高| 国内精品久久久久影院色| 欧美一级片在线观看| 亚洲成av人影院在线观看网| 在线免费观看日本一区| 亚洲色图19p| 99久久er热在这里只有精品66| 久久青草国产手机看片福利盒子| 另类人妖一区二区av| 日韩欧美一区二区三区在线| 日日摸夜夜添夜夜添精品视频 | 99免费精品在线观看| 国产亚洲成年网址在线观看| 国产专区综合网| 久久综合网色—综合色88| 韩国一区二区在线观看| 欧美成人伊人久久综合网| 久久精品国产网站|