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

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

?? dhcprlib.c

?? vxwork源代碼
?? C
字號(hào):
/* dhcprLib.c - DHCP relay agent library *//* Copyright 1984 - 2001 Wind River Systems, Inc.  */#include "copyright_wrs.h"/*modification history--------------------01p,22mar02,wap  don't start DHCP relay task if the relay table is empty                 (SPR #74456)01o,16nov01,spm  fixed modification history following merge01n,15oct01,rae  merge from truestack ver 01q, base 01lj (SPR #69981)01m,17nov00,spm  added support for BSD Ethernet devices01l,24oct00,spm  fixed modification history after merge from tor3_0_x branch01k,23oct00,niq  merged from version 01l of tor3_0_x branch (base version 01j);                 upgrade to BPF replaces tagged frames support01j,04dec97,spm  added code review modifications01i,06oct97,spm  split interface name into device name and unit number; removed                 reference to deleted endDriver global; added stub routine to                 support delayed startup01h,25sep97,gnn  SENS beta feedback fixes01g,02sep97,spm  removed excess debug message (SPR #9149); corrected removal                 of target list in cleanup routine01f,26aug97,spm  reorganized code and added support for UDP port selection01e,12aug97,gnn  changes necessitated by MUX/END update.01d,02jun97,spm  updated man pages and added ERRNO entries01c,06may97,spm  changed memory access to align IP header on four byte boundary01b,10apr97,kbw  changed title line to match actual file name 01a,07apr97,spm  created by modifying WIDE project DHCP implementation*//*DESCRIPTIONThis library implements a relay agent for the Dynamic Host ConfigurationProtocol (DHCP).  DHCP is an extension of BOOTP.  Like BOOTP, it allows a target to configure itself dynamically by using the network to get its IP address, a boot file name, and the DHCP server's address.  The relay agent forwards DHCP messages between clients and servers resident on different subnets.  The standard DHCP server, if present on a subnet, can also forward messages across subnet boundaries.  The relay agent is needed only if there is no DHCP server running on the subnet.  The dhcprLibInit()routine links this library into the VxWorks system.  This happens automaticallyif INCLUDE_DHCPR is defined at the time the system is built, as long as INCLUDE_DHCPS is <not> also defined.HIGH-LEVEL INTERFACEThe dhcprInit() routine initializes the relay agent automatically.  The relay agent forwards incoming DHCP messages to the IP addresses specified at build time in the 'dhcpTargetTbl[]' array.INTERNALThe core relay agent code, derived from code developed by the WIDE project,is located in the dhcpr.c module in the directory /wind/river/target/src/dhcp.INCLUDE FILES: dhcprLib.hSEE ALSO: RFC 1541, RFC 1533*//* includes */#include "dhcp/copyright_dhcp.h"#include "vxWorks.h"#include <stdio.h>#include <stdlib.h>#include <netinet/if_ether.h>#include <netinet/in.h>#include <netinet/ip.h>#include <netinet/udp.h>#include <sys/ioctl.h>#include "end.h"#include "ipProto.h"#include "logLib.h"#include "rngLib.h"#include "muxLib.h"#include "semLib.h"#include "sockLib.h"#include "ioLib.h"#include "dhcprLib.h"#include "dhcp/dhcp.h"#include "dhcp/common.h"#include "dhcp/common_subr.h"#include "bpfDrv.h"/* defines */#define _DHCPR_MAX_DEVNAME 21 	/* "/bpf/dhcpr" + max unit number *//* globals */IMPORT int 	dhcpSPort; 	/* Port used by DHCP servers */IMPORT int 	dhcpCPort; 	/* Port used by DHCP clients */IMPORT int 	dhcpMaxHops;    /* Hop limit before message is discarded. */IMPORT struct iovec sbufvec[2];            /* send buffer */IMPORT struct msg dhcprMsgOut;int dhcprBufSize; 	/* Size of buffer for BPF devices */char * pDhcprSendBuf; 	/* Buffer for transmitting messages */IMPORT u_short dhcps_port;     /* Server port */IMPORT u_short dhcpc_port;     /* Client port */void dhcprCleanup (int checkpoint);/* locals */LOCAL BOOL dhcprInitialized = FALSE;struct if_info *dhcprIntfaceList = NULL;    /* Berkeley Packet Filter instructions for catching DHCP messages. */LOCAL struct bpf_insn dhcpfilter[] = {  BPF_STMT(BPF_LD+BPF_TYPE,0),                /* Save lltype in accumulator */  BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, ETHERTYPE_IP, 0, 20),  /* IP packet? */  /*   * The remaining statements use the (new) BPF_HLEN alias to avoid any   * link-layer dependencies. The expected length values are assigned to the   * correct values during startup. The expected destination port is also   * altered to match the actual value chosen.   */  BPF_STMT(BPF_LD+BPF_H+BPF_ABS+BPF_HLEN, 6),    /* A <- IP FRAGMENT field */  BPF_JUMP(BPF_JMP+BPF_JSET+BPF_K, 0x1fff, 18, 0),         /* OFFSET == 0 ? */  BPF_STMT(BPF_LDX+BPF_HLEN, 0),          /* X <- frame data offset */  BPF_STMT(BPF_LD+BPF_H+BPF_IND, 2),      /* A <- IP_LEN field */  BPF_JUMP(BPF_JMP+BPF_JGE+BPF_K, 0, 0, 15),     /* IP/UDP headers + DHCP? */  BPF_STMT(BPF_LD+BPF_B+BPF_IND, 9),      /* A <- IP_PROTO field */  BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, IPPROTO_UDP, 0, 13),     /* UDP ? */  BPF_STMT(BPF_LD+BPF_HLEN, 0),           /* A <- frame data offset */  BPF_STMT(BPF_LDX+BPF_B+BPF_MSH+BPF_HLEN, 0), /* X <- IPHDR LEN field */  BPF_STMT(BPF_ALU+BPF_ADD+BPF_X, 0),     /* A <- start of UDP datagram */  BPF_STMT(BPF_MISC+BPF_TAX, 0),          /* X <- start of UDP datagram */  BPF_STMT(BPF_LD+BPF_H+BPF_IND, 2),      /* A <- UDP DSTPORT */  BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 67, 0, 7), /* check DSTPORT */  BPF_STMT(BPF_LD+BPF_H+BPF_IND, 4),      /* A <- UDP LENGTH */  BPF_JUMP(BPF_JMP+BPF_JGE+BPF_K, 0, 0, 5), /* UDP header + DHCP? */  BPF_STMT(BPF_LD+BPF_B+BPF_IND, 11),      /* A <- DHCP hops field */  BPF_JUMP(BPF_JMP+BPF_JGT+BPF_K, -1, 3, 0),   /* -1 replaced with max hops */  BPF_STMT(BPF_LD+BPF_W+BPF_IND, 244),    /* A <- DHCP options */  BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x63825363, 0, 1),                                                 /* Matches magic cookie? */  BPF_STMT(BPF_RET+BPF_K+BPF_HLEN, DFLTDHCPLEN + UDPHL + IPHL),                                           /*                                            * ignore data beyond expected                                            * size (some drivers add padding).                                            */  BPF_STMT(BPF_RET+BPF_K, 0)          /* unrecognized message: ignore frame */  };LOCAL struct bpf_program dhcpread = {    sizeof (dhcpfilter) / sizeof (struct bpf_insn),    dhcpfilter    };/********************************************************************************* dhcprLibInit - initialize DHCP relay agent library** This routine links the DHCP relay agent code into the runtime image and* allocates storage for incoming DHCP messages. The <maxSize> parameter* specifies the maximum length supported for any DHCP message, including* the UDP and IP headers and the largest link level header for all supported* devices. The smallest valid value for the <maxSize> parameter is 576 bytes,* corresponding to the minimum IP datagram a host must accept. Larger values* will allow the relay agent to handle longer DHCP messages.** This routine must be called before calling any other library routines.* The routine is called automatically if INCLUDE_DHCPR is defined at the* time the system is built and assigns the maximum size to the value* specified by the DHCPR_MAX_MSGSIZE constant.* * RETURNS: OK, or ERROR if initialization fails.** ERRNO: N/A** NOMANUAL*/STATUS dhcprLibInit    (    int 	maxSize 	/* largest DHCP message supported, in bytes */    )    {    if (dhcprInitialized)        return (OK);    if (maxSize < DFLTDHCPLEN + UDPHL + IPHL)        return (ERROR);    if (bpfDrv () == ERROR)        return (ERROR);    pDhcprSendBuf = (char *)memalign (4, maxSize);    if (pDhcprSendBuf == NULL)        return (ERROR);    dhcprBufSize = maxSize + sizeof (struct bpf_hdr);    dhcprInitialized = TRUE;    return (OK);    }/********************************************************************************* dhcprInit - set up the DHCP relay agent parameters and data structures** This routine creates the necessary data structures to monitor the specified* network interfaces for incoming DHCP messages and forward the messages to* the given Internet addresses. It may be called after the dhcprLibInit()* routine has initialized the global data structures.** The <ppIf> argument provides a list of devices which the relay agent will* monitor to forward packets. The relay agent supports devices attached* to the IP protocol with the MUX/END interface or BSD Ethernet devices* attached to that protocol. Each device must be capable of sending broadcast* messages and the MTU size of the interface must be large enough to receive* a minimum IP datagram of 576 bytes.* * RETURNS: OK, or ERROR if could not initialize.** ERRNO: N/A** NOMANUAL*/STATUS dhcprInit    (    struct ifnet **	ppIf, 		/* network devices used by server */    int			numDev, 	/* number of devices */    DHCP_TARGET_DESC *  pTargetTbl, 	/* table of receiving DHCP servers */    int                 targetSize 	/* size of DHCP server table */    )    {    struct if_info *pIf = NULL;          /* pointer to interface */    char bpfDevName [_DHCPR_MAX_DEVNAME];  /* "/bpf/dhcpr" + max unit number */    int bpfDev;    int loop;    int result;    struct ifreq ifr;    if (!dhcprInitialized)        return (ERROR);    if (ppIf == NULL)        return (ERROR);    if (numDev == 0)        return (ERROR);    if (bpfDevCreate ("/bpf/dhcpr", numDev, dhcprBufSize) == ERROR)        return (ERROR);    /* Validate the MTU size for each device. */    for (loop = 0; loop < numDev; loop++)        {        if (ppIf[loop]->if_mtu == 0)    /* No MTU size given: not attached? */            return (ERROR);        if (ppIf[loop]->if_mtu < DHCP_MSG_SIZE)            return (ERROR);        }    /*     * Alter the filter program to check for the correct length values and     * use the specified UDP destination port and maximum hop count.     */      /* IP length must at least equal a DHCP message with 4 option bytes. */    dhcpfilter [6].k = (DFLTDHCPLEN - DFLTOPTLEN + 4) + UDPHL + IPHL;    dhcpfilter [14].k = dhcpSPort;   /* Use actual destination port in test. */       /* UDP length must at least equal a DHCP message with 4 option bytes. */    dhcpfilter [16].k = (DFLTDHCPLEN - DFLTOPTLEN + 4) + UDPHL;    dhcpfilter [18].k = dhcpMaxHops;   /* Use real maximum hop count. */    /* Store the interface control information and get each BPF device. */    for (loop = 0; loop < numDev; loop++)        {        pIf = (struct if_info *)calloc (1, sizeof (struct if_info));        if (pIf == NULL)             {            logMsg ("Memory allocation error.\n", 0, 0, 0, 0, 0, 0);            dhcprCleanup (1);            return (ERROR);            }        pIf->buf = (char *)memalign (4, dhcprBufSize);        if (pIf->buf == NULL)            {            logMsg ("Memory allocation error.\n", 0, 0, 0, 0, 0, 0);            dhcprCleanup (1);            return (ERROR);            }        bzero (pIf->buf, DHCP_MSG_SIZE);        sprintf (bpfDevName, "/bpf/dhcpr%d", loop);        bpfDev = open (bpfDevName, 0, 0);        if (bpfDev < 0)            {            logMsg ("BPF device creation error.\n", 0, 0, 0, 0, 0, 0);            dhcprCleanup (1);            return (ERROR);            }        /* Enable immediate mode for reading messages. */        result = 1;        result = ioctl (bpfDev, BIOCIMMEDIATE, (int)&result);        if (result != 0)            {            logMsg ("BPF device creation error.\n", 0, 0, 0, 0, 0, 0);            dhcprCleanup (1);            return (ERROR);            }        result = ioctl (bpfDev, BIOCSETF, (int)&dhcpread);        if (result != 0)            {            logMsg ("BPF filter assignment error.\n", 0, 0, 0, 0, 0, 0);            dhcprCleanup (1);            return (ERROR);            }        bzero ( (char *)&ifr, sizeof (struct ifreq));        sprintf (ifr.ifr_name, "%s%d", ppIf[loop]->if_name,                                       ppIf[loop]->if_unit);        result = ioctl (bpfDev, BIOCSETIF, (int)&ifr);        if (result != 0)            {            logMsg ("BPF interface attachment error.\n", 0, 0, 0, 0, 0, 0);            dhcprCleanup (1);            return (ERROR);            }        pIf->next = dhcprIntfaceList;        dhcprIntfaceList = pIf;        /* Fill in device name and hardware address. */        sprintf (pIf->name, "%s", ppIf[loop]->if_name);        pIf->unit = ppIf[loop]->if_unit;        pIf->bpfDev = bpfDev;        pIf->mtuSize = ppIf[loop]->if_mtu;        }    /* Access target DHCP server data. */    pDhcpRelayTargetTbl = pTargetTbl;  /* read database of DHCP servers */    if (targetSize != 0)        read_server_db (targetSize);     if (dhcpNumTargets == 0)        {        logMsg ("DHCP relay agent server table is empty -- aborting.\n",                0, 0, 0, 0, 0, 0);        dhcprCleanup(2);        return (ERROR);        }    /* Use defined ports for client and server. */    dhcps_port = htons (dhcpSPort);    dhcpc_port = htons (dhcpCPort);    /* Fill in subnet mask and IP address for each monitored interface. */    pIf = dhcprIntfaceList;    while (pIf != NULL)        {         if (open_if (pIf) < 0)             {            dhcprCleanup (2);            return (ERROR);            }        pIf = pIf->next;        }    return (OK);    }/********************************************************************************* dhcprCleanup - remove data structures** This routine frees all dynamically allocated memory obtained by the DHCP* relay agent.  It is called at multiple points before the program exits due to* an error occurring or manual shutdown.  The checkpoint parameter indicates * which data structures have been created.** RETURNS: N/A** ERRNO: N/A** NOMANUAL*/void dhcprCleanup     (    int checkpoint 	/* Progress identifier indicating created resources */    )    {    int current = 0;    struct if_info *pIf;    DHCP_SERVER_DESC * 	pServer;    int loop;    /* Checkpoint 0 is empty. */    current++;    if (current > checkpoint)        return;    while (dhcprIntfaceList != NULL)         /* Checkpoint 1 */        {        pIf = dhcprIntfaceList;        if (pIf->buf != NULL)            {            if (pIf->bpfDev >= 0)                close (pIf->bpfDev);            free (pIf->buf);            }        dhcprIntfaceList = dhcprIntfaceList->next;        free (pIf);        }    bpfDevDelete ("/bpf/dhcpr");    current++;    if (current > checkpoint)        return;    /* Remove elements of circular list created by read_server_db(). */                                             /* Checkpoint 2 */    for (loop = 0; loop < dhcpNumTargets; loop++)        {        pServer = pDhcpTargetList;        pDhcpTargetList = pDhcpTargetList->next;        free (pServer);        }    current++;    if (current > checkpoint)        return;    return;    }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久精品国产观看| 中文字幕一区二区三区色视频| 91亚洲资源网| 精品影院一区二区久久久| 蜜桃91丨九色丨蝌蚪91桃色| 黄页视频在线91| 色综合天天狠狠| 久久综合色一综合色88| 国产精品无遮挡| 人人狠狠综合久久亚洲| 国产不卡一区视频| 日韩免费高清av| 偷拍亚洲欧洲综合| 不卡在线观看av| 国产午夜精品美女毛片视频| 亚洲福利视频一区| 蜜臀精品一区二区三区在线观看| 成人的网站免费观看| 欧美在线观看视频在线| 中文字幕一区av| 国产在线精品一区二区夜色| 欧美日韩一区高清| 性做久久久久久免费观看欧美| 成人黄色小视频在线观看| 精品美女在线观看| 亚洲成人免费视| 欧美视频一区在线观看| 亚洲综合久久久久| 4hu四虎永久在线影院成人| 热久久国产精品| 国产精品日韩成人| 色综合色狠狠综合色| 一区二区三区免费| 欧美精品tushy高清| 日韩av电影免费观看高清完整版 | 一区二区成人在线视频| 日本精品免费观看高清观看| 亚洲一区二区三区四区五区中文| 欧美日韩免费视频| 激情亚洲综合在线| 亚洲国产成人在线| 欧美丝袜丝交足nylons图片| 久久国产日韩欧美精品| 国产精品美女久久久久高潮| 欧美顶级少妇做爰| av午夜一区麻豆| 青青青爽久久午夜综合久久午夜| 日韩精品一区二区三区视频在线观看 | 一区二区三区鲁丝不卡| www国产成人| 在线电影一区二区三区| 成人美女视频在线观看| 精品制服美女久久| 亚洲一区二区三区三| 久久久精品免费网站| 欧美一区二区三区免费观看视频| 激情综合五月婷婷| 日韩国产欧美在线观看| 亚洲线精品一区二区三区| 国产精品久久久爽爽爽麻豆色哟哟| 日韩欧美一区二区不卡| 欧美日本高清视频在线观看| 91女厕偷拍女厕偷拍高清| 成人午夜免费电影| 成人激情校园春色| 不卡欧美aaaaa| 一本一道综合狠狠老| 色天天综合久久久久综合片| 国产成人综合视频| 成人午夜电影小说| 91视频你懂的| 欧美专区在线观看一区| 欧美另类高清zo欧美| 欧美大胆一级视频| 久久色.com| 亚洲自拍欧美精品| 日本不卡一区二区三区| 精品亚洲国产成人av制服丝袜| 国产精品亚洲专一区二区三区| 国产69精品久久久久毛片| www.成人网.com| 色综合久久综合网欧美综合网| 欧美三区免费完整视频在线观看| 欧美主播一区二区三区| 久久久精品免费观看| 婷婷开心激情综合| 9i在线看片成人免费| 欧美日韩综合不卡| 波多野结衣欧美| 精品一区二区三区免费播放| 欧美日韩精品一区视频| 一区二区三区久久| 制服丝袜亚洲色图| 精品播放一区二区| 一区二区成人在线| 顶级嫩模精品视频在线看| 欧美精选在线播放| 综合中文字幕亚洲| 麻豆91在线播放免费| 欧美在线观看18| 国产香蕉久久精品综合网| 亚洲成人免费观看| 在线观看日韩一区| 亚洲最色的网站| 欧美日本视频在线| 美女国产一区二区三区| 日韩欧美在线观看一区二区三区| 免费人成精品欧美精品| 欧美v国产在线一区二区三区| 亚洲一卡二卡三卡四卡五卡| 91麻豆视频网站| 亚洲国产视频一区二区| 欧美一级艳片视频免费观看| 久久精品噜噜噜成人88aⅴ| 欧美一区国产二区| 国产在线精品不卡| 中文字幕一区二区三区视频| 一本久久a久久精品亚洲| 成人av在线网| 884aa四虎影成人精品一区| 国产午夜精品久久久久久久| 在线观看中文字幕不卡| 91国产精品成人| 91美女在线看| 99精品一区二区| 精品影视av免费| 久久99精品久久久久久| 性久久久久久久久| 亚洲另类春色校园小说| 久久综合久久鬼色中文字| 日韩午夜在线观看| 欧美日韩一区中文字幕| 91国产视频在线观看| av一二三不卡影片| 成人黄色大片在线观看| 国产精品一区二区在线观看不卡| 激情六月婷婷久久| 国产精品一区免费视频| 国产在线国偷精品免费看| 久久99久久久久| 国产精华液一区二区三区| 亚洲视频一区二区在线| 椎名由奈av一区二区三区| 中文字幕日韩精品一区| 亚洲码国产岛国毛片在线| 中文字幕亚洲精品在线观看| 亚洲欧美在线aaa| 亚洲综合免费观看高清在线观看| 亚洲一区在线视频观看| 亚洲不卡一区二区三区| 毛片一区二区三区| 国产精品主播直播| 99国产精品久久久久久久久久 | 美女性感视频久久| 成人黄色一级视频| 久久这里只有精品6| 午夜影视日本亚洲欧洲精品| av毛片久久久久**hd| 2021中文字幕一区亚洲| 久久精工是国产品牌吗| 国产成人日日夜夜| 成人动漫视频在线| 欧美va亚洲va香蕉在线| 中文在线一区二区 | 成人免费视频在线观看| 亚洲一二三四区| 久久66热re国产| 欧美在线free| 欧美极品aⅴ影院| 久久超碰97人人做人人爱| 91美女在线看| 中文字幕亚洲综合久久菠萝蜜| 日韩在线a电影| 色综合久久久久久久久| 欧美成人三级在线| 日韩精品亚洲一区二区三区免费| 国产成人免费高清| 久久人人爽人人爽| 国内一区二区在线| 精品国产91亚洲一区二区三区婷婷| 一级做a爱片久久| 色天天综合色天天久久| 亚洲人123区| 91啪亚洲精品| 亚洲尤物视频在线| 欧美三级电影在线看| 亚洲成人福利片| 精品美女一区二区| 国产一区美女在线| 国产无一区二区| 99在线精品一区二区三区| 亚洲精品福利视频网站| 99国产精品久久久久久久久久| 中文字幕一区二区三中文字幕| av激情亚洲男人天堂| 亚洲美女一区二区三区| 欧美疯狂做受xxxx富婆| 韩国毛片一区二区三区| 亚洲美腿欧美偷拍| 26uuu国产一区二区三区|