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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? dhcprlib.c

?? vxworks的完整的源代碼
?? 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;    }

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人免费xxxxxxxx| 丝袜亚洲另类欧美| 国产91精品一区二区麻豆网站| 欧美精品一区二区三区在线播放| 久久99久国产精品黄毛片色诱| 日韩你懂的电影在线观看| 久久国产尿小便嘘嘘尿| 国产亚洲欧美日韩日本| 成人h动漫精品一区二| 亚洲免费观看高清完整版在线| 欧美在线小视频| 视频一区二区三区在线| 久久人人爽人人爽| 91丨九色丨黑人外教| 亚洲第一综合色| 26uuu国产一区二区三区| 成人在线视频一区二区| 亚洲欧美一区二区三区极速播放 | 精品国产91亚洲一区二区三区婷婷| 婷婷六月综合网| 日韩一级片在线播放| 国产九色sp调教91| 亚洲欧美日韩精品久久久久| 欧美日韩另类一区| 国产又粗又猛又爽又黄91精品| 日本一区二区三区在线不卡| 91小视频免费看| 日本最新不卡在线| 国产精品成人一区二区三区夜夜夜 | 国产综合色精品一区二区三区| 欧美高清在线一区| 欧美日本在线看| 国产伦理精品不卡| 亚洲美女屁股眼交3| 日韩欧美视频在线| 91美女片黄在线观看| 奇米色一区二区三区四区| 国产欧美日韩三级| 日韩一区在线免费观看| 88在线观看91蜜桃国自产| 成人久久久精品乱码一区二区三区 | 国产精品88av| 亚洲sss视频在线视频| 国产三级一区二区三区| 欧美天天综合网| 成人精品免费看| 久久成人久久鬼色| 亚洲18色成人| 亚洲美腿欧美偷拍| 久久久精品免费网站| 欧美视频在线不卡| 成人激情开心网| 久久99久久99| 欧美aⅴ一区二区三区视频| 亚洲视频精选在线| 中文字幕精品一区二区精品绿巨人 | 国产精品综合二区| 日日嗨av一区二区三区四区| 日韩理论在线观看| 中日韩av电影| 国产日产精品1区| 久久精品在这里| 日韩欧美资源站| 欧美精品少妇一区二区三区| 色婷婷综合久久久中文一区二区| 国产高清成人在线| 精品中文字幕一区二区| 亚洲国产精品综合小说图片区| 亚洲欧美激情视频在线观看一区二区三区 | 91看片淫黄大片一级| 国产成人精品亚洲777人妖 | 欧美日韩国产a| 色视频欧美一区二区三区| 成人一区二区三区| 国产suv精品一区二区6| 粉嫩av一区二区三区在线播放| 国产一区二区不卡在线| 韩国一区二区三区| 国产一区不卡视频| 成人午夜电影久久影院| 亚洲尤物在线视频观看| 国产亚洲精品免费| 久久久久久综合| 久久久久国产精品免费免费搜索| 精品福利一二区| 久久久无码精品亚洲日韩按摩| 精品美女在线播放| 精品成人私密视频| 中文字幕第一区综合| 人人狠狠综合久久亚洲| 亚洲小说欧美激情另类| 日本 国产 欧美色综合| 麻豆一区二区三| 国产一区三区三区| 成人app下载| 91福利在线看| 欧美一区二区三区系列电影| 欧美岛国在线观看| 久久日韩粉嫩一区二区三区| 国产日产欧产精品推荐色| 自拍视频在线观看一区二区| 亚洲精品午夜久久久| 五月天视频一区| 国产一区高清在线| 91在线观看美女| 欧美高清视频www夜色资源网| 精品剧情v国产在线观看在线| 日本一区二区电影| 视频一区二区欧美| 国产在线播放一区二区三区| 色综合天天综合在线视频| 欧美精品一二三区| 国产拍揄自揄精品视频麻豆| 一区二区三区在线高清| 精品一区二区三区久久久| 不卡的av电影| 日韩精品一区二区三区蜜臀| 国产精品久久久久久久久图文区 | 国产尤物一区二区在线| 99久久国产综合色|国产精品| 欧美日韩国产高清一区| 亚洲国产精品激情在线观看| 午夜激情久久久| 成人免费的视频| 在线综合亚洲欧美在线视频| 亚洲欧美综合在线精品| 美女性感视频久久| 91浏览器在线视频| 精品免费国产二区三区| 亚洲国产日韩在线一区模特| 国产成人自拍高清视频在线免费播放| 欧美吞精做爰啪啪高潮| 国产免费成人在线视频| 三级亚洲高清视频| 91麻豆6部合集magnet| 久久精品一区四区| 青青草97国产精品免费观看| 在线一区二区观看| 国产精品网站一区| 国产一区二区不卡| 日韩欧美电影一区| 日韩精品乱码av一区二区| 久久精品人人爽人人爽| 日韩和欧美一区二区三区| 91蝌蚪porny成人天涯| 国产精品视频一二三| 国产一区二区调教| 日韩精品一区二区三区在线观看| 一级特黄大欧美久久久| av一区二区三区四区| 精品久久一区二区| 日av在线不卡| 欧美一区二区在线视频| 午夜精品久久久久久久蜜桃app| 色婷婷综合久久久中文字幕| 国产精品久久久久一区二区三区 | 成人精品免费看| 国产午夜亚洲精品不卡| 久久99日本精品| 日韩美女视频在线| 另类中文字幕网| 91精品一区二区三区久久久久久| 亚洲自拍另类综合| 欧美日韩一区在线观看| 亚洲综合一区二区| 欧美三级电影一区| 亚洲午夜久久久久久久久久久| 欧美综合在线视频| 亚洲一区二区av电影| 欧美色图第一页| 日韩专区中文字幕一区二区| 欧美丰满美乳xxx高潮www| 日韩av在线免费观看不卡| 日韩一区二区在线观看| 紧缚捆绑精品一区二区| 久久久久九九视频| 不卡的电影网站| 亚洲人成精品久久久久| 欧洲中文字幕精品| 五月综合激情日本mⅴ| 日韩亚洲欧美一区| 国产一区二区主播在线| 久久精品视频在线免费观看| 国产乱子伦一区二区三区国色天香| 国产亚洲欧美日韩日本| 99在线视频精品| 一区二区三国产精华液| 制服丝袜中文字幕亚洲| 国内久久精品视频| 国产精品午夜在线观看| 色噜噜夜夜夜综合网| 日韩成人精品在线观看| 久久久99精品免费观看| a亚洲天堂av| 亚洲成人第一页| 精品欧美久久久| av在线这里只有精品| 亚洲福中文字幕伊人影院| 欧美精品一区二区高清在线观看 | 一区二区三区在线播放|