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

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

?? rarplib.c

?? vxworks的完整的源代碼
?? C
字號:
/* rarpLib.c - Reverse Address Resolution Protocol (RARP) client library *//* Copyright 1999 - 2002 Wind River Systems, Inc. */#include "copyright_wrs.h"/* * Copyright (c) 1982, 1986, 1988, 1993 *      The Regents of the University of California.  All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software *    must display the following acknowledgement: *      This product includes software developed by the University of *      California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * *      @(#)if_ether.c  8.2 (Berkeley) 9/26/94 *//*modification history--------------------01i,17dec01,vvv  fixed doc build errors01h,05nov01,vvv  fixed compilation warnings01g,29mar01,spm  file creation: copied from version 01f of tor2_0.open_stack                 branch (wpwr VOB) for unified code base; fixed published                 routine name for coding conventions01f,29jun00,spm  updated to handle NPT version of MUX interface01e,11may00,brx  fixed error returns to set errno and return ERROR01d,11may00,ead  added calls to virtualStackIdCheck() in the various RARP                 commands01c,25apr00,spm  made virtual stack support optional (enabled by default)01b,18apr00,ead  modified to be multi-instance01a,28dec99,brx  created from RARP code found in if_ether.c*//*DESCRIPTIONThis library is an implementation of the Reverse Address Resolution Protocol.This protocol allows devices such as diskless workstations request an IP address at boot-time from a dedicated server on the local network.The routine rarpGet() broadcasts a RARP request on the local ethernet andreturns a response.  If a RARP server does not respond after the specifiedtimeout interval, rarpGet() returns with an error code set in errno. */#include "vxWorks.h"#include "stdio.h"#include "taskLib.h"#include "end.h"#include "muxLib.h"#include "ipProto.h"#include "sysLib.h"#include "logLib.h"#include "errnoLib.h"#ifdef VIRTUAL_STACK#include "netinet/vsLib.h"#endif /* VIRTUAL_STACK *//* defines */#define SAMPLE_RATE 6/* define ERROR codes */#define S_rarpLib_TIMEOUT           (M_rarpLib | 1)#define S_rarpLib_NETDOWN           (M_rarpLib | 2)#define S_rarpLib_INPROGRESS        (M_rarpLib | 3)#define S_rarpLib_NORESPONSE        (M_rarpLib | 4)/* typedefs *//* externs *//* locals */#ifndef VIRTUAL_STACKLOCAL SEM_ID	revarpInProgress = NULL;#endif /* VIRTUAL_STACK *//* revarp state */#ifndef VIRTUAL_STACKtypedef struct    {    BOOL		ipAddrInitialized;     struct in_addr 	ipAddr;    END_OBJ		*pEndId;    BOOL		rarpDebug;    } RARPSTATE;LOCAL RARPSTATE rarpState;#endif /* VIRTUAL_STACK *//* forward declarations */void rarpSetDebug( int );int rarpGet ( char *, int, struct in_addr *, int);		void rarpIn ( END_OBJ *, long, M_BLK_ID, LL_HDR_INFO *, IP_DRV_CTRL *);int revarpwhoami(struct in_addr *, struct ifnet *, int);void revarprequest(struct ifnet *);void in_revarpinput(struct ether_arp *);/******************************************************************************** rarpLibInit - Initialize rarp client** This routine links the RARP facility into the VxWorks system.* These routines are included automatically if INCLUDE_RARP is defined.* ** Returns: N/A**/STATUS rarpLibInit(void)    {#ifndef VIRTUAL_STACK    if (revarpInProgress == NULL){#endif /* VIRTUAL_STACK */        revarpInProgress = semBCreate(SEM_Q_PRIORITY, SEM_FULL);        if (revarpInProgress == NULL)    	    return ERROR;        return OK;#ifndef VIRTUAL_STACK    }    else        return OK;#endif /* VIRTUAL_STACK */#ifdef VIRTUAL_STACK    rarpState.ipAddrInitialized = FALSE;    rarpState.ipAddr.s_addr = 0;    rarpState.pEndId = 0;    rarpState.rarpDebug = FALSE;    return OK;#endif /* VIRTUAL_STACK */    }/******************************************************************************** rarpDebugSet - Set the debug facility in RARP** This routine sets the RARP debug facility.  If the argument is non-zero, * debug messages will be sent to the logging task.  If the argument is zero* RARP operates quietly.  Default is quiet operation.** Returns: N/A**/void rarpDebugSet    (    int flag    )    {#ifdef VIRTUAL_STACK    virtualStackIdCheck();#endif /* VIRTUAL_STACK */    logMsg("Setting rarpDebug to %d\n", flag, 0, 0, 0, 0, 0);    rarpState.rarpDebug = (flag != 0) ? TRUE : FALSE;    }/********************************************************************************* rarpGet - broadcast a RARP packet and wait for a reply** rarpGet() maps ethernet hardware addresses to IP protocol addresses.* This routine generates an ethertype 0x8035 packet and * broadcasts it on the device local network.  If a RARP server is on the * network, it replies with an IP address that corresponds to the device * hardware address. ** .IP <IFname>* Expects a pointer to the character string which contains the name of the * interface.* .IP <IFunit>* Expects a number which is the unit of the device named in IFname.* .IP <Addr> * Expects a pointer to a struct in_addr. The IP address of the device will* be placed in this buffer after it is received from the RARP server.* .IP <Tmo>* Expects an integer for timeout value in seconds.** Returns: OK, S_rarpLib_NETDOWN if IFname is not a valid device, *          S_rarpLib_INPROGRESS if another RARP request is in progress, *          S_rarpLib_NORESPONSE if there is no response from a server.*/int rarpGet    (    char *IFname,     int IFunit,     struct in_addr *Addr,     int tmo    )    {    struct ifnet *pIf;    END_OBJ * pEnd;    void *pCookie;    int errorFlag = 0;    char cName[16];#ifdef VIRTUAL_STACK    virtualStackIdCheck();#endif /* VIRTUAL_STACK */    semTake(revarpInProgress, WAIT_FOREVER);    rarpState.ipAddrInitialized = FALSE;    rarpState.ipAddr.s_addr = 0;    pEnd = endFindByName (IFname, IFunit);    sprintf(cName,"%s%d", IFname, IFunit);    pIf = (struct ifnet *)ifunit(cName);    if (pIf == NULL || pEnd == NULL)         {	if (rarpState.rarpDebug)            logMsg ("RARP: Can't find interface %s!\n", (int)cName,                    0, 0, 0, 0, 0);	semGive(revarpInProgress);        errnoSet(S_rarpLib_NETDOWN);	return ERROR;        }    if ((pCookie = muxBind(IFname, IFunit, (FUNCPTR)rarpIn, NULL, 	NULL, NULL, 0x8035, "IP 4.4 RARP", NULL )) == NULL)        {	 if (rarpState.rarpDebug)              logMsg("RARP: Can't bind to MUX\n",0,0,0,0,0,0);	 semGive(revarpInProgress);         errnoSet(S_rarpLib_NETDOWN);	 return ERROR;        }    rarpState.pEndId = pEnd;    /* broadcast  RARP request, wait for answer */    errorFlag = revarpwhoami(Addr, pIf, tmo);     if( muxUnbind( pCookie, 0x8035, (FUNCPTR)rarpIn) != OK)	if (rarpState.rarpDebug)	    logMsg("RARP: Error in MUX unbind\n",0,0,0,0,0,0);    semGive(revarpInProgress);    if (errorFlag != 0)        {	if (rarpState.rarpDebug)	    logMsg("RARP: no response\n",0,0,0,0,0,0);        errnoSet(errorFlag);	return ERROR;	        }    else     return OK;    }/********************************************************************************* revarpwhoami - issues RARP request and waits for a reply from a server*** RETURNS: OK if the IP has been received, S_rarpLib_NORESPONSE if no*          response has been received before tmo seconds.*** NOMANUAL*/intrevarpwhoami    (    struct in_addr *pClientIn,    struct ifnet *pIfp,    int tmo    )    {    int count;	    if (rarpState.ipAddrInitialized)         return OK;    if (rarpState.rarpDebug)	logMsg("RARP: sending request\n",0,0,0,0,0,0);    revarprequest(pIfp);    for(count=0; count < SAMPLE_RATE*tmo; count++)        {        if (rarpState.ipAddrInitialized == FALSE)            taskDelay (sysClkRateGet()/SAMPLE_RATE);         else 	    {            bcopy((caddr_t)&rarpState.ipAddr, (char *)pClientIn, 		   sizeof(*pClientIn));            if (rarpState.rarpDebug)	        logMsg("RARP: received reply: 0x%x\n",		        (unsigned int)rarpState.ipAddr.s_addr, 0, 0, 0, 0, 0);            return OK;            }         }    /* no reply before time out */    if (rarpState.rarpDebug)        logMsg("RARP: did not receive reply after %d seconds\n",	        tmo, 0, 0, 0, 0, 0);    errnoSet(S_rarpLib_NORESPONSE);    return ERROR;    }   /********************************************************************************* revarprequest - form RARP ether packet and transmit** Send a RARP request for the ip address of the specified interface.** RETURNS: NA** NOMANUAL*/voidrevarprequest    (    struct ifnet *pIfp    )    {	struct sockaddr sa;	struct mbuf *pMbuf;	struct ether_header *eh;	struct ether_arp *ea;	struct arpcom *ac = (struct arpcom *)pIfp;	if ((pMbuf = mHdrClGet(M_DONTWAIT, MT_DATA, sizeof(*ea), TRUE)) == NULL)	    return; 	pMbuf->m_len = sizeof(*ea);	pMbuf->m_pkthdr.len = sizeof(*ea);	MH_ALIGN(pMbuf, sizeof(*ea));	ea = mtod(pMbuf, struct ether_arp *);	eh = (struct ether_header *)sa.sa_data;	bzero((caddr_t)ea, sizeof(*ea));	bcopy((caddr_t)etherbroadcastaddr, (caddr_t)eh->ether_dhost,	      sizeof(eh->ether_dhost));	eh->ether_type = ETHERTYPE_REVARP; /* htons is done in ipOutput */	ea->arp_hrd = htons(ARPHRD_ETHER);	ea->arp_pro = htons(ETHERTYPE_IP);	ea->arp_hln = sizeof(ea->arp_sha);	/* hardware address length */	ea->arp_pln = sizeof(ea->arp_spa);	/* protocol address length */	ea->arp_op = htons(ARPOP_REVREQUEST);	bcopy((caddr_t)ac->ac_enaddr, (caddr_t)ea->arp_sha,	   sizeof(ea->arp_sha));	bcopy((caddr_t)ac->ac_enaddr, (caddr_t)ea->arp_tha,	   sizeof(ea->arp_tha));	sa.sa_family = AF_UNSPEC;	sa.sa_len = sizeof(sa);	pIfp->if_output(pIfp, pMbuf, &sa, (struct rtentry *)0);    }/********************************************************************************* rarpIn -  callback routine bound to MUX ** This routine is called by the mux when a packet is ready to be processed** RETURNS: N/A**/void rarpIn            (    END_OBJ *           pCookie,        /* Returned by muxBind() call. */    long                type,           /* Protocol type.  */    M_BLK_ID            m,          	/* The whole packet. */    LL_HDR_INFO *       pLinkHdrInfo,   /* pointer to linklevel header*/    IP_DRV_CTRL *       pDrvCtrl        /* ip Drv ctrl */    )    {    struct arphdr *pArphdr;    struct ether_arp *ea;    char   *pChar;    /* verify correct interface */    if (rarpState.pEndId != pCookie)        goto out;            /* if a previous reply has already answered, we're done */    if (rarpState.ipAddrInitialized)        goto out;    if (m->m_len < sizeof(struct arphdr))	goto out;    pChar = mtod(m, char *);    pArphdr = (struct arphdr *)(pChar + pLinkHdrInfo->dataOffset);    /* verify supported RARP values per RFC 903 */    ea = (struct ether_arp *)pArphdr;    if (ntohs(pArphdr->ar_hrd) != ARPHRD_ETHER)	goto out;    if (ntohs(pArphdr->ar_pro) != ETHERTYPE_IP)	goto out;    if (ntohs(ea->arp_op) != ARPOP_REVREPLY)	goto out;    if (m->m_len < sizeof(struct arphdr) +         2 * (pArphdr->ar_hln + pArphdr->ar_pln))	goto out;	/** copy address into global variable **/    bcopy((caddr_t)ea->arp_tpa, (caddr_t)&rarpState.ipAddr, 	   sizeof(rarpState.ipAddr));    rarpState.ipAddrInitialized = TRUE;    out:	m_freem(m);    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产精品久久人人爱| 欧美人与性动xxxx| 麻豆91在线看| 日韩二区三区四区| 日本不卡123| 日本特黄久久久高潮| 日本午夜一区二区| 美国av一区二区| 狠狠色狠狠色综合| 国产一区二区不卡| 丁香天五香天堂综合| 国产福利精品一区| 成人美女在线观看| 一道本成人在线| 欧美剧情片在线观看| 5566中文字幕一区二区电影| 欧美一区二区免费视频| 久久亚洲一区二区三区明星换脸 | 在线一区二区三区四区| 91免费版在线| 日韩欧美中文字幕一区| 久久久一区二区三区捆绑**| 国产精品午夜电影| 一区二区欧美精品| 激情小说欧美图片| aa级大片欧美| 欧美日本国产视频| 欧美国产精品v| 亚洲人成伊人成综合网小说| 亚洲福利一二三区| 激情综合网av| 99re视频精品| 欧美精品少妇一区二区三区| 26uuu国产日韩综合| 成人欧美一区二区三区黑人麻豆| 亚洲国产精品一区二区久久 | 91.麻豆视频| 国产丝袜在线精品| 亚洲妇女屁股眼交7| 国产成人8x视频一区二区| 欧美系列在线观看| 久久久久久一级片| 日韩精品国产欧美| 99久久伊人网影院| 日韩视频免费直播| 亚洲在线中文字幕| 粉嫩13p一区二区三区| 欧美一区二区啪啪| 亚洲国产精品久久人人爱| 福利电影一区二区| 精品免费国产二区三区| 天天色天天操综合| 91免费看片在线观看| 国产亚洲综合在线| 久久精品国产一区二区| 在线观看亚洲一区| 1024成人网| 成人免费高清视频| 欧美激情综合在线| 国产自产v一区二区三区c| 91精品国产手机| 亚洲成人综合网站| 欧美视频中文一区二区三区在线观看 | 毛片一区二区三区| 欧美日韩高清在线播放| 亚洲欧美日本在线| 一本久道久久综合中文字幕| 国产精品久久久久9999吃药| 国产a视频精品免费观看| 欧美刺激午夜性久久久久久久| 性久久久久久久久久久久 | 天天综合网天天综合色| 色哟哟一区二区三区| 亚洲欧美日韩国产一区二区三区| av在线综合网| 亚洲日本在线天堂| av资源站一区| 一区二区三区四区五区视频在线观看| 91在线码无精品| 一区二区视频免费在线观看| 一本大道久久a久久精二百| 亚洲欧美日韩在线播放| 色综合咪咪久久| 亚洲一区二区三区四区在线| 色综合久久久久| 亚洲一二三级电影| 日韩免费高清电影| 国产做a爰片久久毛片| 欧美韩日一区二区三区四区| 波多野结衣视频一区| 亚洲男人天堂av| 欧美午夜片在线观看| 天天做天天摸天天爽国产一区| 欧美α欧美αv大片| 国产精品综合二区| 亚洲欧美日韩国产成人精品影院| 国内偷窥港台综合视频在线播放| 国产喷白浆一区二区三区| 不卡一区二区三区四区| 中文字幕在线不卡国产视频| 欧美日韩免费电影| 精品一区二区三区免费播放| 中文字幕中文字幕一区二区| 欧美喷潮久久久xxxxx| 久久国产日韩欧美精品| 中文一区二区在线观看| 欧美日韩在线播放| 国产成人精品免费在线| 亚洲国产欧美日韩另类综合 | 国产精品久久三| 在线欧美一区二区| 国产精品一区二区黑丝| 国产精品国产三级国产普通话99| 在线观看免费一区| 国产米奇在线777精品观看| 亚洲精品视频在线观看免费 | 国产日韩v精品一区二区| 91在线小视频| 国产麻豆一精品一av一免费 | 18欧美乱大交hd1984| 欧美日本一区二区三区四区| 国产精品88av| 午夜欧美在线一二页| 国产精品国产馆在线真实露脸| 91精品国产综合久久久久久久| 成人国产精品视频| 久久国产免费看| 五月天婷婷综合| 亚洲欧美日韩精品久久久久| 久久亚洲一区二区三区四区| 欧美日韩国产一级| 91久久一区二区| 成人精品国产免费网站| 激情小说亚洲一区| 麻豆视频一区二区| 亚洲成av人片在线| 一区二区不卡在线视频 午夜欧美不卡在| 久久精品一区二区三区不卡牛牛| 欧美日韩精品欧美日韩精品| 色狠狠色狠狠综合| 91网页版在线| 欧美精品少妇一区二区三区| 欧美亚洲精品一区| gogo大胆日本视频一区| 国产白丝精品91爽爽久久| 狠狠色狠狠色综合系列| 久久国产麻豆精品| 免费不卡在线观看| 亚洲欧美经典视频| 1000部国产精品成人观看| 国产精品久久久久天堂| 国产视频不卡一区| 日本一区二区免费在线| 欧美国产精品专区| 亚洲国产成人私人影院tom| 欧美精品一区二区三区很污很色的| 欧美一三区三区四区免费在线看 | 久久久三级国产网站| 日韩欧美久久久| 精品美女一区二区三区| 精品欧美乱码久久久久久| 2024国产精品| 国产精品乱子久久久久| 亚洲视频每日更新| 一区二区三区视频在线看| 亚洲线精品一区二区三区八戒| 午夜精品久久久久久久99水蜜桃| 日韩avvvv在线播放| 国产一区高清在线| 波多野结衣精品在线| 99r国产精品| 在线播放中文字幕一区| 欧美xfplay| 国产精品成人免费在线| 亚洲午夜激情网站| 久久国产精品第一页| 国产成人精品三级| 欧美日韩国产一二三| 久久精品人人做人人爽人人| 国产精品久久久久9999吃药| 婷婷开心久久网| 国产成人一区在线| 欧美性猛交xxxxxxxx| 久久久综合网站| 亚洲成年人影院| 国产91清纯白嫩初高中在线观看 | 欧美一区二区国产| 国产女主播在线一区二区| 亚洲天堂成人网| 韩国女主播一区| 欧美在线观看一二区| 欧美大片一区二区三区| 亚洲蜜臀av乱码久久精品 | 国产欧美日韩在线看| 亚洲你懂的在线视频| 精品亚洲成a人| 欧美日韩在线播放一区| 国产精品视频在线看| 麻豆精品新av中文字幕| 91久久免费观看|