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

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

?? tftpdlib.c

?? Tornado平臺下
?? 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一区二区三区| 在线观看日韩高清av| 国产精品系列在线| 久久精品国产秦先生| 欧美挠脚心视频网站| 夜夜精品视频一区二区| 成人av在线网站| 久久综合九色综合欧美98| 天堂av在线一区| 91精品1区2区| 亚洲视频一区在线观看| 大胆亚洲人体视频| 久久久久久久久久久99999| 美女www一区二区| 欧美一二三在线| 污片在线观看一区二区| 在线一区二区视频| 亚洲视频一区在线| av电影在线不卡| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 蜜臀av一区二区| 欧洲国内综合视频| 亚洲专区一二三| 91碰在线视频| 一区二区三区欧美| 色琪琪一区二区三区亚洲区| 国产精品美日韩| 波多野结衣中文字幕一区 | 欧美一区二区三区人| 天堂蜜桃91精品| 7777精品伊人久久久大香线蕉经典版下载 | 亚洲综合激情另类小说区| 91农村精品一区二区在线| 亚洲男人的天堂av| 在线免费观看视频一区| 亚洲视频一区二区在线观看| 91官网在线免费观看| 亚洲自拍偷拍欧美| 欧美福利视频一区| 捆绑调教一区二区三区| 精品国产乱码久久久久久蜜臀| 美国十次综合导航| 久久久99久久| av电影在线不卡| 亚洲综合偷拍欧美一区色| 欧美日韩一级片在线观看| 视频一区免费在线观看| 欧美不卡在线视频| 成人黄色免费短视频| 亚洲激情在线播放| 91精品国产色综合久久| 国产原创一区二区| 亚洲欧洲av色图| 欧美精品v国产精品v日韩精品| 精品一区二区三区在线观看| 久久久久高清精品| 一本色道久久加勒比精品 | 欧美精品18+| 国产福利电影一区二区三区| 亚洲精品国产精品乱码不99| 日韩欧美你懂的| 成人高清伦理免费影院在线观看| 亚洲一区二区三区爽爽爽爽爽| 欧美不卡一区二区| 91香蕉视频在线| 美国一区二区三区在线播放| 亚洲色欲色欲www在线观看| 91超碰这里只有精品国产| 成人精品一区二区三区四区| 亚洲国产成人porn| 中文字幕国产精品一区二区| 欧美夫妻性生活| 91影院在线免费观看| 狠狠色狠狠色综合日日91app| 夜夜嗨av一区二区三区四季av | 精品午夜久久福利影院| 亚洲女爱视频在线| 精品乱人伦一区二区三区| 欧美视频你懂的| 成人av网站大全| 另类成人小视频在线| 亚洲午夜在线电影| 国产精品初高中害羞小美女文| 日韩一区二区在线播放| 在线观看精品一区| 成人一道本在线| 国产最新精品精品你懂的| 亚洲综合免费观看高清完整版在线 | 日韩成人免费电影| 亚洲免费在线观看视频| 国产日产欧美精品一区二区三区| 日韩一区二区三| 欧美人伦禁忌dvd放荡欲情| 色综合久久天天综合网| 丰满少妇久久久久久久| 精品一区中文字幕| 美腿丝袜亚洲色图| 日韩电影在线免费看| 亚洲激情av在线| 国产精品伦理在线| 久久这里只有精品视频网| 欧美一区在线视频| 欧美日韩高清一区二区| 欧美亚洲动漫制服丝袜| 色老综合老女人久久久| 91视频一区二区三区| 色综合久久久网| 99国产精品久久久久久久久久久| 懂色中文一区二区在线播放| 国产伦精品一区二区三区免费迷 | 久久天天做天天爱综合色| 91精品国产免费| 欧美一区二区性放荡片| 日韩欧美高清一区| 欧美成人午夜电影| 久久免费视频一区| 国产精品久久久久影院老司| 国产精品免费观看视频| 亚洲精品亚洲人成人网| 亚洲高清不卡在线观看| 视频一区二区欧美| 国产一区二区三区在线观看免费视频 | 亚洲国产精品一区二区www在线| 亚洲一二三级电影| 日韩av不卡一区二区| 久久精工是国产品牌吗| 韩国毛片一区二区三区| av在线一区二区三区| 欧美性受xxxx黑人xyx性爽| 91麻豆精品国产| 精品久久久久久久久久久久包黑料| 久久综合久久综合久久综合| 中文文精品字幕一区二区| 亚洲精品国产精品乱码不99| 免费人成精品欧美精品 | 天天爽夜夜爽夜夜爽精品视频| 婷婷久久综合九色国产成人| 紧缚奴在线一区二区三区| 成人app网站| 欧美日韩国产精品自在自线| 久久综合九色综合欧美就去吻| 国产精品成人网| 蜜桃精品视频在线| 91在线国内视频| 日韩午夜激情视频| 中文字幕一区二区三区在线播放 | 成人avav在线| 国产精品久久久久久久蜜臀| 欧美一区二区三区影视| 欧美日韩一区二区电影| 日韩欧美一级片| 亚洲男人的天堂av| 91精品国产丝袜白色高跟鞋| 91麻豆产精品久久久久久| 激情图片小说一区| 亚洲aⅴ怡春院| 一区二区日韩av| 欧美—级在线免费片| 色婷婷狠狠综合| 精品视频在线看| 石原莉奈在线亚洲三区| 日韩av电影免费观看高清完整版在线观看| 亚洲成人av资源| 精品一区二区三区在线播放 | 久久99久久精品欧美| 国产一区二区三区综合| 丁香六月综合激情| 91搞黄在线观看| 欧美精品九九99久久| 欧美精品一区二区精品网| 国产片一区二区| 亚洲欧美日韩中文字幕一区二区三区| 亚洲女厕所小便bbb| 日韩精品午夜视频| 国产美女在线精品| 色av成人天堂桃色av| 欧美大片国产精品| 国产精品成人一区二区艾草| 午夜欧美大尺度福利影院在线看| 喷白浆一区二区| av影院午夜一区| 日韩欧美亚洲国产另类| 综合久久给合久久狠狠狠97色| 亚洲午夜精品17c| 国产乱子伦一区二区三区国色天香| av电影在线观看一区| 日韩一区二区影院| 亚洲天堂福利av| 久久国产生活片100| 一本色道久久综合狠狠躁的推荐| 欧美一区二区精品在线| 最好看的中文字幕久久| 麻豆精品精品国产自在97香蕉| 99国产精品视频免费观看| 精品久久国产97色综合| 亚洲成人精品影院|