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

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

?? tftpdlib.c

?? vxworks操作系統(tǒng)源代碼_對于在vxworks環(huán)境下開發(fā)軟件的人員非常有用
?? C
?? 第 1 頁 / 共 2 頁
字號:
	    ;	strncpy(mode, ++strIndex, 32);	mode [31] = EOS;	}    return (OK);    }/******************************************************************************** tftpdFileRead - handle a read request** This routine constructs and executes the tftpPut() command to put the file* to the remote system.  Normally this routine is the entry point for a task* created by tftpdTask() in response to a read request.** RETURNS: OK, or ERROR if the file requested could not be opened.*/LOCAL STATUS tftpdFileRead    (    char	*fileName,		/* file to be sent */    TFTP_DESC	*pReplyDesc 	/* where to send the file */    )    {    int		requestFd;    int		returnValue = OK;    /*     * XXX - X windows needs files that don't work with DOS - they have     * more than three chars after a dot (as in fonts.alias).  If the     * funcpointer is non-null, call the routine with a pointer to     * filename, and the called routine should change the name to something     * DOS understands.     */    if (tftpdNameMunge != NULL)        (*tftpdNameMunge) (fileName);    requestFd = open (fileName, O_RDONLY, 0);    if (requestFd == ERROR)	{	if (tftpdDebug)	    {	    printErr ("%s: Could not open file %s\n", tftpdErrStr, fileName);	    }	tftpdErrorSend (pReplyDesc, errnoGet());	}    else	{	/*	 * We call tftpPut from the server on a read request because the	 * server is putting the file to the client	 */	returnValue = tftpPut (pReplyDesc, fileName, requestFd,			       TFTP_SERVER);	close (requestFd);	}    /*     * Close the socket, and delete the     * tftpd descriptor.     */    if (returnValue == ERROR)	{	printErr ("%s:  could not send client file \"%s\"\n", tftpdErrStr,		  fileName);	}    tftpdDescriptorDelete (pReplyDesc);    return (returnValue);    }/******************************************************************************** tftpdFileWrite - handle a write request** This routine constructs and executes the tftpGet() command to get the file* from the remote system.  Normally this routine is the entry point for a* task created by tftpdTask() in response to a write request.** RETURNS: OK, or ERROR if the file requested could not be opened.*/LOCAL STATUS tftpdFileWrite    (    char	*fileName,		/* file to be sent */    TFTP_DESC	*pReplyDesc 	/* where to send the file */    )    {    int		requestFd;    int		returnValue = OK;    requestFd = open (fileName, O_WRONLY | O_CREAT | O_TRUNC, 0);    if (requestFd == ERROR)	{	if (tftpdDebug)	    {	    printErr ("%s: Could not open file %s\n", tftpdErrStr, fileName);	    }	tftpdErrorSend (pReplyDesc, errnoGet());	}    else	{	/*	 * We call tftpGet from the server on a read request because the	 * server is putting the file to the client	 */	returnValue = tftpGet (pReplyDesc, fileName, requestFd,			       TFTP_SERVER);	close (requestFd);	}    /*     * Close the socket, and delete the     * tftpd descriptor.     */    if (returnValue == ERROR)	{	printErr ("%s:  could not send \"%s\" to client\n", tftpdErrStr);	}    tftpdDescriptorDelete (pReplyDesc);    return (returnValue);    }/******************************************************************************** tftpdDescriptorQueueInit - set up pool of available descriptors** This routine sets up the system for managing a pool of available reply* descriptors.  A piece of contiguous memory, large enough to hold an* array of <nEntries> descriptors, is allocated (with malloc()).* Pointers to each element in the array are written into a message* queue.  The routine tftpdDescriptorCreate() reads pointers out of this* queue, and tftpdDescriptorDelete() writes them back in when the* descriptor space is no longer needed.** RETURNS: OK, or ERROR if either out of memory or the queue could not* be allocated.*/LOCAL STATUS tftpdDescriptorQueueInit    (    int	nEntries	/* maximum number of descriptors in			 * use at any time */    )    {    TFTP_DESC *theAddress;    /*     * If nEntries is 0, set it to the default number of connections     */    if (nEntries == 0)        nEntries = tftpdMaxConnections;    /*     * Create the message queue     */    if ((tftpdDescriptorQueue = (MSG_Q_ID) msgQCreate (nEntries,						       sizeof (TFTP_DESC *),						       MSG_Q_FIFO)) == NULL)        {	return (ERROR);	}    /*     * Allocate space for the descriptors.     */    tftpdDescriptorPool = (TFTP_DESC *) KHEAP_ALLOC(sizeof (TFTP_DESC) * nEntries);    if (tftpdDescriptorPool == NULL)	{	msgQDelete (tftpdDescriptorQueue);        return (ERROR);	}    while (nEntries--)	{	theAddress = &(tftpdDescriptorPool [nEntries]);	msgQSend (tftpdDescriptorQueue, (char *) &theAddress,		  sizeof (TFTP_DESC *), WAIT_FOREVER, MSG_PRI_NORMAL);	}    return (OK);    }/******************************************************************************** tftpdDescriptorQueueDelete - delete pool of available descriptors** This routine deletes the memory and message queues allocated by* tftpdDescriptorQueueInit.** RETURNS: OK, or ERROR if either memory could not be freed or if the* message queue could not be deleted.*/LOCAL STATUS tftpdDescriptorQueueDelete    (    void    )    {    STATUS returnValue = OK;    if (msgQDelete (tftpdDescriptorQueue) == ERROR)	{	printErr ("%s:  could not delete message queue\n", tftpdErrStr);	returnValue = ERROR;	}    /*     * free() is now void according to ANSI, so can't check the return value     */    KHEAP_FREE((char *)tftpdDescriptorPool);    return (returnValue);    }/******************************************************************************** tftpdDescriptorCreate - build a tftp descriptor to use with tftpLib** The routines in tftpLib, tftpPut() and tftpGet() in particular, expect to* be passed a pointer to a struct of type TFTP_DESC that contains the* information about the connection to the host.  This is a convenience* routine to allocate space for a TFTP_DESC struct, fill in the elements,* and return a pointer to it.** This routine pends until a descriptor is available.** RETURNS:* A pointer to a newly allocated TFTP_DESC struct, or NULL on failure.*/LOCAL TFTP_DESC *tftpdDescriptorCreate    (    char	*mode,			/* mode 		*/    BOOL	connected,		/* state		*/    int		sock,			/* socket number	*/    u_short	clientPort,		/* client port number	*/    struct sockaddr_in *pClientAddr 	/* client address	*/    )    {    TFTP_DESC	*pTftpDesc;		/* pointer to the struct to return */    char	clientName [INET_ADDR_LEN];    if (msgQReceive (tftpdDescriptorQueue, (char *) &pTftpDesc,		     sizeof (pTftpDesc), WAIT_FOREVER) == ERROR)	{	/*	 * Couldn't get a descriptor from the queue, return an error	 */	return (NULL);	}    /*     * Copy the arguments into the appropriate elements of the struct     */    strncpy (pTftpDesc->mode, mode, 31);    pTftpDesc->mode [31] = EOS;    pTftpDesc->connected = connected;    /*     * clientName and serverName are reversed, because the routines     * that use this descriptor are expecting to look at the universe     * from the client side.     */    inet_ntoa_b (pClientAddr->sin_addr, clientName);    strncpy (pTftpDesc->serverName, clientName, 128);    pTftpDesc->serverName [127] = EOS;    bcopy ((char *) pClientAddr, (char *) &pTftpDesc->serverAddr,	   sizeof (struct sockaddr_in));    pTftpDesc->sock = sock;    pTftpDesc->serverPort = clientPort;    /*     * We've filled the struct, now return a pointer to it     */    return (pTftpDesc);    }/******************************************************************************** tftpdDescriptorDelete - delete a reply descriptor** This routine returns the space for a reply descriptor back to the* descriptor pool.** RETURNS: OK or ERROR.*/LOCAL STATUS tftpdDescriptorDelete    (    TFTP_DESC *descriptor    )    {    close (descriptor->sock);    return (msgQSend (tftpdDescriptorQueue, (char *) &descriptor,		      sizeof (TFTP_DESC *), WAIT_FOREVER, MSG_PRI_NORMAL));    }/******************************************************************************** tftpdDirectoryAdd - add a directory to the access list** This routine adds the specified directory name to the access list * for the TFTP server.** RETURNS: N/A*/STATUS tftpdDirectoryAdd    (    char	*fileName	/* name of directory to add to access list */    )    {    TFTPD_DIR	*newNode;    /*     * Allocate memory for the node     */    newNode = (TFTPD_DIR *) KHEAP_ALLOC(sizeof (TFTPD_DIR));    if (newNode == NULL)	{	return (ERROR);	}    /*     * Copy the filename into the node     */    strncpy (newNode->dirName, fileName, MAX_FILENAME_LENGTH);    newNode->dirName [MAX_FILENAME_LENGTH - 1] = EOS;    /*     * Add the node to the list     */    semTake (tftpdDirectorySem, WAIT_FOREVER);    lstAdd (&tftpdDirectoryList, (NODE *) newNode);    semGive (tftpdDirectorySem);    return (OK);    }/******************************************************************************** tftpdDirectoryRemove - delete a directory from the access list** This routine deletes the specified directory name from the access list * for the TFTP server.** RETURNS: N/A*/STATUS tftpdDirectoryRemove    (    char	*fileName	/* name of directory to add to access list */    )    {    TFTPD_DIR	*dirNode;    for (dirNode = (TFTPD_DIR *) lstFirst (&tftpdDirectoryList);	 dirNode != NULL;	 dirNode = (TFTPD_DIR *) lstNext ((NODE *) dirNode))	{	/*	 * if the name of the file matches the name in the current	 * element, delete the element	 */	if (strcmp (dirNode->dirName, fileName) == 0)	    {	    semTake (tftpdDirectorySem, WAIT_FOREVER);	    lstDelete (&tftpdDirectoryList, (NODE *) dirNode);	    semGive (tftpdDirectorySem);	    /*	     * Also need to free the memory	     */	    KHEAP_FREE((char *)dirNode);	    return (OK);	    }	}    /*     * If we got to this point, then there was no match.  Return error.     */    return (ERROR);    }/******************************************************************************** tftpdDirectoryValidate - confirm that file requested is in valid directory** This routine checks that the file requested is in a directory that* matches an entry in the directory access list.  The validation* procedure is:**     1.  If the requested file matches the directory exactly,*         deny access.  This prevents opening devices rather* 	  than files.**     2.  If the directory and the first part of the file*         are equal, permission is granted.**     Examples:** 		File		Directory	Result* 		/mem		/mem		rejected by #1* 		/mem/foo	/mem		granted* 		/stuff/foo	/mem		rejected by #2* 						(first four chars of file* 						don't match "/mem")** RETURNS: OK, or ERROR if access is not allowed.*/LOCAL STATUS tftpdDirectoryValidate    (    char *fileName    )    {    DEV_HDR	*deviceHdr;    char 	fullPathName [MAX_FILENAME_LENGTH];    char 	tmpString [MAX_FILENAME_LENGTH];    TFTPD_DIR	*dirNode;    STATUS 	returnValue = ERROR;    /*     * Use ioFullFileNameGet to get the complete name, including     * the device, of the requested file.     */    ioFullFileNameGet (fileName, &deviceHdr, fullPathName);    strcpy (tmpString, deviceHdr->name);    strcat (tmpString, fullPathName);    strcpy (fullPathName, tmpString);    /*     * If the access list is empty, there are no restrictions.  Return OK.     */    if (lstCount (&tftpdDirectoryList) == 0)	return (OK);    semTake (tftpdDirectorySem, WAIT_FOREVER);    for (dirNode = (TFTPD_DIR *) lstFirst (&tftpdDirectoryList);	 dirNode != NULL;	 dirNode = (TFTPD_DIR *) lstNext ((NODE *) dirNode))	{	/*	 * If the filename is exactly the same as the directory, break the loop	 * and return an error (rejected by #1)	 */	if (strcmp (fullPathName, dirNode->dirName) == 0)	    {	    returnValue = ERROR;	    break;	    }	/*	 * If the first part of the filename is exactly equal	 * to the directory name, return OK (#2).	 */	if (strncmp (dirNode->dirName, fullPathName,		     strlen (dirNode->dirName)) == 0)	    {	    returnValue = OK;	    break;	    }	}    semGive (tftpdDirectorySem);    if (returnValue == ERROR)	errnoSet (EACCESS);    return (returnValue);    }/******************************************************************************** tftpdErrorSend - send an error to a client** Given a client connection and an error number, this routine builds an error* packet and sends it to the client.** RETURNS:* OK, or ERROR if tftpSend() fails.  Note that no further action is required if* tftpSend() fails.*/LOCAL STATUS tftpdErrorSend    (    TFTP_DESC	*pReplyDesc,	/* client to send to */    int		errorNum		/* error to send */    )    {    TFTP_MSG	errMsg;    int		errSize;    int		repeatCount = tftpdErrorSendTries;    STATUS	returnValue = OK;    errSize = tftpErrorCreate (&errMsg, errorNum);    /*     * Try to send the error message a few times.     */    while (repeatCount--)	{	returnValue = tftpSend (pReplyDesc, &errMsg, errSize,				(TFTP_MSG *) 0, 0, 0, (int *) 0);	/*	 * If we didn't get an error, break out of the loop.  Otherwise,	 * wait one second and retry	 */	if (returnValue != ERROR)	    {	    break;	    }	else	    {	    taskDelay (sysClkRateGet ());	    }	}    return (returnValue);    }    /* XXX     * everything below here doesn't go into final product     */char *dirs[] = { "/mem", "/tftpboot", "/folk/james/zap", "/xt" };void tftpTst (void)    {    tftpdTask (sizeof (dirs) / sizeof (char *), dirs, 3);    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩女优视频免费观看| 成人av综合一区| 欧美一级一区二区| 老司机精品视频在线| 国产亚洲制服色| a亚洲天堂av| 亚洲女人****多毛耸耸8| 欧美日韩一二三区| 美女一区二区视频| 欧美国产综合一区二区| 色婷婷激情综合| 视频在线观看一区| 国产亚洲一区字幕| 色又黄又爽网站www久久| 午夜影院久久久| 久久品道一品道久久精品| 99riav久久精品riav| 日本午夜精品一区二区三区电影 | 久久精品国产在热久久| 国产亚洲va综合人人澡精品| jiyouzz国产精品久久| 一区二区三区四区蜜桃| 欧美一区二区性放荡片| 成人avav在线| 免费人成精品欧美精品| 国产精品传媒入口麻豆| 91精品国产综合久久久久久| 国产91丝袜在线18| 亚洲成a人v欧美综合天堂下载| 日韩欧美高清dvd碟片| 91一区二区三区在线播放| 日韩国产欧美一区二区三区| 欧美国产一区视频在线观看| 欧美日本一区二区三区四区| 成人涩涩免费视频| 日韩有码一区二区三区| 国产精品家庭影院| 欧美一区二区三区在线电影| 99这里都是精品| 久久丁香综合五月国产三级网站| 国产精品国产三级国产a| 日韩一级二级三级| 在线视频一区二区三| 国产精品夜夜嗨| 美腿丝袜亚洲一区| 亚洲观看高清完整版在线观看| 国产亚洲精久久久久久| 日韩欧美三级在线| 欧美日韩精品一区二区天天拍小说 | 粉嫩在线一区二区三区视频| 午夜精品福利视频网站| 亚洲欧美在线aaa| 国产午夜精品一区二区三区嫩草| 欧美精品99久久久**| 色婷婷综合五月| 高清国产一区二区三区| 久久精品国产精品亚洲红杏| 亚洲国产综合色| 亚洲已满18点击进入久久| ...中文天堂在线一区| 久久久久综合网| 精品国产乱码久久久久久1区2区 | 69av一区二区三区| 在线国产电影不卡| 91九色最新地址| 91一区二区在线观看| 97精品久久久久中文字幕 | 欧美性生活久久| 色婷婷久久久综合中文字幕| av电影天堂一区二区在线观看| 国产99久久久国产精品| 国产xxx精品视频大全| 国产精品一区二区视频| 国产精品一区在线观看乱码 | 日韩一级完整毛片| 欧美高清精品3d| 69堂国产成人免费视频| 91精品国产欧美一区二区18| 91精品国产日韩91久久久久久| 欧美一区二区三区思思人| 欧美一级二级三级乱码| 日韩欧美成人一区| 久久久www成人免费无遮挡大片 | 欧美丰满美乳xxx高潮www| 欧美美女视频在线观看| 91精品国产综合久久精品app| 欧美电影影音先锋| 日韩欧美激情在线| 精品国产一区二区三区av性色| 精品理论电影在线观看| 国产欧美久久久精品影院| 国产精品第13页| 亚洲午夜久久久| 青青草97国产精品免费观看无弹窗版| 日韩成人av影视| 国产原创一区二区三区| 成人激情免费视频| 欧美在线免费视屏| 日韩欧美一区二区久久婷婷| 国产午夜亚洲精品午夜鲁丝片| 久久久久国产精品麻豆| 1000精品久久久久久久久| 亚洲国产美女搞黄色| 捆绑调教美女网站视频一区| 国产自产v一区二区三区c| av在线不卡免费看| 91精品在线观看入口| 久久精品人人爽人人爽| 亚洲一区二区三区激情| 久久国产精品99久久久久久老狼| 成人免费看黄yyy456| 欧美午夜精品久久久| 精品三级在线观看| 亚洲精品菠萝久久久久久久| 日本不卡视频在线观看| 成人精品国产免费网站| 精品视频999| 欧美国产日韩亚洲一区| 亚洲va韩国va欧美va| 国产激情一区二区三区四区| 欧美中文字幕亚洲一区二区va在线 | 久久综合色鬼综合色| 亚洲自拍与偷拍| 福利电影一区二区| 欧美精品一级二级三级| 国产精品麻豆网站| 日本不卡免费在线视频| 一本到不卡免费一区二区| 精品蜜桃在线看| 一区2区3区在线看| 风流少妇一区二区| 日韩免费在线观看| 亚洲韩国精品一区| 94色蜜桃网一区二区三区| 久久夜色精品一区| 日本强好片久久久久久aaa| 一本色道久久加勒比精品| 欧美精品一区二区三| 婷婷中文字幕一区三区| 91丨porny丨在线| 中文字幕高清一区| 国产乱码一区二区三区| 日韩欧美在线综合网| 亚洲chinese男男1069| 91麻豆国产福利在线观看| 中文字幕精品—区二区四季| 久久精品国产99久久6| 67194成人在线观看| 亚洲国产欧美在线| 在线观看免费成人| 亚洲激情在线激情| 99re成人精品视频| 国产精品视频在线看| 国产成人夜色高潮福利影视| 欧美成人综合网站| 蜜桃视频免费观看一区| 51精品秘密在线观看| 性欧美疯狂xxxxbbbb| 欧美影院午夜播放| 亚洲午夜久久久久| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 中文字幕亚洲精品在线观看| 成人av资源站| ㊣最新国产の精品bt伙计久久| 国产成都精品91一区二区三| 久久九九全国免费| 国产原创一区二区| 欧美国产一区在线| 成人app在线| 一区二区三区四区在线| 欧美又粗又大又爽| 亚洲成av人片在线观看无码| 欧美日韩成人一区二区| 日本不卡高清视频| 精品久久久久久久久久久久久久久| 毛片一区二区三区| 久久久高清一区二区三区| 成人晚上爱看视频| 又紧又大又爽精品一区二区| 欧美亚州韩日在线看免费版国语版| 亚洲午夜视频在线| 欧美一区二区日韩一区二区| 激情六月婷婷久久| 国产精品入口麻豆九色| 色一情一乱一乱一91av| 亚洲成人自拍网| 精品成人免费观看| 99久久99久久精品免费观看| 一区二区成人在线| 日韩午夜激情电影| 成人理论电影网| 亚洲午夜激情av| 欧美成人猛片aaaaaaa| 成人黄页毛片网站| 午夜久久久影院| 久久久午夜精品| 欧美三级在线看| 国产成人丝袜美腿| 伊人夜夜躁av伊人久久| 日韩欧美一二三四区|