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

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

?? tftpdlib.c

?? vxworks的完整的源代碼
?? 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一区二区三区免费野_久草精品视频
亚洲精品乱码久久久久久| 欧美性受极品xxxx喷水| 国产三级一区二区三区| 国产亚洲欧美一级| 午夜天堂影视香蕉久久| 成人美女视频在线观看18| 欧美麻豆精品久久久久久| 中文字幕+乱码+中文字幕一区| 中文字幕一区二| 麻豆视频观看网址久久| 91丝袜高跟美女视频| 国产日韩三级在线| 国产一区二区剧情av在线| 欧美久久久一区| 亚洲第一在线综合网站| 一本久久综合亚洲鲁鲁五月天 | 日日骚欧美日韩| 91麻豆国产福利在线观看| 久久亚洲精品小早川怜子| 久久国产麻豆精品| 欧美日韩一级二级三级| 亚洲一区免费视频| av在线不卡网| 国产丝袜美腿一区二区三区| 国产一区二区三区四| 精品精品国产高清一毛片一天堂| 亚洲chinese男男1069| 欧美午夜片在线看| 亚洲精品视频免费看| 91色九色蝌蚪| 一区二区三区中文字幕电影| aaa欧美日韩| 中文字幕一区二区不卡| 91在线精品一区二区| 亚洲婷婷在线视频| 一本到不卡免费一区二区| 一区二区三区四区视频精品免费 | 成人国产精品免费网站| 亚洲国产精品黑人久久久| 国产成人精品www牛牛影视| 久久精品亚洲麻豆av一区二区 | 亚洲国产精品av| www.成人在线| 亚洲免费在线看| 欧美三区免费完整视频在线观看| 亚洲成a人在线观看| 91精品一区二区三区久久久久久| 免费高清不卡av| 久久久久99精品国产片| 99国产欧美另类久久久精品 | 欧美色精品在线视频| 视频一区在线视频| 精品处破学生在线二十三| 成人黄色小视频| 亚洲.国产.中文慕字在线| 制服丝袜日韩国产| 国产精品99精品久久免费| ㊣最新国产の精品bt伙计久久| 99re成人在线| 日本欧美久久久久免费播放网| 欧美xxxx在线观看| 波多野结衣亚洲| 亚洲日本护士毛茸茸| 欧美男男青年gay1069videost| 精品一区二区av| 亚洲三级小视频| 欧美成人a∨高清免费观看| 成人黄色大片在线观看| 午夜不卡av在线| 中文字幕欧美区| 欧美日韩一级二级| 北条麻妃一区二区三区| 青青草伊人久久| 中文字幕人成不卡一区| 日韩午夜激情av| 97国产一区二区| 精彩视频一区二区| 亚洲成人三级小说| 日本一区二区三区dvd视频在线| 欧美影院精品一区| 成人精品免费视频| 久久99久久99精品免视看婷婷| 樱桃视频在线观看一区| 精品国产区一区| 精品婷婷伊人一区三区三| 激情综合亚洲精品| 丝袜美腿一区二区三区| 久久精品亚洲精品国产欧美| 欧美一区二区福利在线| 成人av在线播放网站| 日本不卡视频在线| 亚洲精品一二三区| 日本久久精品电影| 99久免费精品视频在线观看| 久久精品国产**网站演员| 国产精品国产三级国产普通话三级| 欧美视频中文一区二区三区在线观看| 国产一区二区三区免费播放| 亚洲成人免费视| 精品久久久久久久一区二区蜜臀| 99国产精品久久久久| 激情另类小说区图片区视频区| 亚洲精品乱码久久久久久久久| 久久蜜臀精品av| 欧美一区二区三区在线视频| 成人av网站在线| 国产sm精品调教视频网站| 琪琪一区二区三区| 亚洲一区二区三区精品在线| 中文在线资源观看网站视频免费不卡| 欧美一区二区在线看| 国产成人8x视频一区二区 | 亚洲国产精品欧美一二99| 国产欧美一区在线| 久久久久久久久久久久久夜| 51精品秘密在线观看| 欧美日韩精品专区| 一本到不卡精品视频在线观看| 国产盗摄一区二区| 国产91对白在线观看九色| 麻豆国产精品777777在线| 亚洲大片在线观看| 亚洲一二三四久久| 亚洲精品欧美综合四区| 中文字幕不卡的av| 中文字幕在线不卡| 国产精品久久久久影院老司| 欧美mv和日韩mv国产网站| 国产亚洲一本大道中文在线| 精品欧美久久久| 欧美mv和日韩mv国产网站| 精品黑人一区二区三区久久| 精品久久人人做人人爽| 91麻豆精品国产91久久久资源速度 | 国产精品一区在线观看乱码| 激情综合色综合久久综合| 久草精品在线观看| 国产精品亚洲人在线观看| 三级在线观看一区二区| 美女一区二区三区在线观看| 蜜桃精品视频在线观看| 精品一区二区三区免费观看| 国产一区在线精品| 国产成人aaaa| 色婷婷综合在线| 日韩亚洲欧美综合| 国产亚洲精品7777| 亚洲视频中文字幕| 亚洲一区二区三区四区在线| 日本午夜一区二区| 日本不卡视频在线观看| 国产成人在线色| 91九色02白丝porn| 日韩精品一区二区三区蜜臀| 久久精品亚洲麻豆av一区二区| 国产精品久久久久久久蜜臀 | 国产91在线观看丝袜| 91成人国产精品| 7777精品久久久大香线蕉| 久久久天堂av| 亚洲黄一区二区三区| 美女精品一区二区| 播五月开心婷婷综合| 欧美性受xxxx黑人xyx性爽| 精品国产乱子伦一区| 国产精品毛片久久久久久| 一区二区三区四区乱视频| 五月天丁香久久| 色综合久久久久久久久久久| 日韩欧美高清dvd碟片| 亚洲日本一区二区| 老司机午夜精品99久久| 高清不卡在线观看av| 日韩视频免费观看高清完整版 | 蜜桃视频在线观看一区二区| 色视频欧美一区二区三区| 欧美成人一区二区| 亚洲欧美在线视频观看| 久久99国产乱子伦精品免费| 色综合中文字幕| 久久久国产一区二区三区四区小说| 亚洲精品视频在线观看网站| 国产精品1024| 日韩三级精品电影久久久| 亚洲国产精品一区二区久久| 成人黄页在线观看| 欧美精品自拍偷拍| 中文字幕乱码一区二区免费| 日本中文字幕一区| 国产jizzjizz一区二区| 久久精品人人做人人爽人人| 日韩精品一卡二卡三卡四卡无卡| 99热99精品| 国产精品乱人伦中文| 美女一区二区三区在线观看| 欧美日韩国产综合久久| 亚洲另类在线一区| 国产东北露脸精品视频| 欧美在线制服丝袜| 亚洲福利国产精品|