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

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

?? tftpdlib.c

?? vxworks 下TFTP源代碼,在嵌入式系統中應用極為廣泛
?? 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一区二区三区免费野_久草精品视频
国产精品久久久久久久久免费丝袜 | 国产精品丝袜久久久久久app| 欧美激情一区不卡| 亚洲超碰精品一区二区| 成人国产免费视频| 欧美tk—视频vk| 亚洲第一主播视频| 色噜噜狠狠一区二区三区果冻| 日韩欧美的一区二区| 亚洲一卡二卡三卡四卡| 成人一二三区视频| 2021国产精品久久精品| 三级影片在线观看欧美日韩一区二区| 国产精品一区二区在线观看网站| 欧美男女性生活在线直播观看| 国产精品白丝在线| 成人免费不卡视频| 久久精品亚洲乱码伦伦中文| 奇米影视一区二区三区| 欧美私模裸体表演在线观看| 日韩理论在线观看| 国产91精品久久久久久久网曝门| 日韩一级黄色大片| 青娱乐精品在线视频| 欧美日韩亚洲国产综合| 亚洲一区二区在线视频| 在线视频国产一区| 亚洲乱码一区二区三区在线观看| 国产成人av一区| 国产偷国产偷精品高清尤物 | 一区二区免费在线播放| 99九九99九九九视频精品| 国产精品美女一区二区三区| 国产91精品一区二区麻豆网站 | 欧美日韩三级一区二区| 一区二区三区精品在线| 欧美在线观看你懂的| 亚洲国产精品久久人人爱| 欧美三片在线视频观看| 三级欧美韩日大片在线看| 51精品久久久久久久蜜臀| 美女尤物国产一区| 久久精品夜色噜噜亚洲aⅴ| 国产电影精品久久禁18| 国产精品热久久久久夜色精品三区| 国产+成+人+亚洲欧洲自线| 国产精品乱码一区二区三区软件 | 欧美偷拍一区二区| 视频一区视频二区中文字幕| 日韩欧美一区电影| 成人午夜精品在线| 一个色妞综合视频在线观看| 欧美精品777| 国内一区二区在线| 国产精品成人网| 欧美影院精品一区| 久久99精品久久久久久国产越南| 久久免费的精品国产v∧| 99久久伊人网影院| 午夜婷婷国产麻豆精品| 欧美videossexotv100| www.在线成人| 午夜精品久久久久久久99樱桃 | 国产一区二区三区国产| 亚洲欧洲av一区二区三区久久| 在线视频综合导航| 加勒比av一区二区| 亚洲精品乱码久久久久久| 日韩欧美一卡二卡| 91在线国产观看| 久久精品久久精品| 亚洲色图视频免费播放| 亚洲专区一二三| 日韩欧美高清dvd碟片| 91麻豆精品视频| 精品中文字幕一区二区| 中文字幕日韩av资源站| 日韩三级伦理片妻子的秘密按摩| 成人黄色小视频在线观看| 奇米一区二区三区| 亚洲欧美日韩国产一区二区三区| 欧美一级二级三级乱码| 91日韩在线专区| 国产精品影视在线| 日韩精品亚洲专区| 亚洲日本成人在线观看| 久久久久久99精品| 6080午夜不卡| 欧洲精品中文字幕| 成人爱爱电影网址| 国产一区二区免费看| 日本视频在线一区| 午夜欧美2019年伦理| 亚洲天堂精品在线观看| 国产区在线观看成人精品 | 午夜精品久久久久久久久| 国产精品久久久久久久久久久免费看 | 国产真实乱偷精品视频免| 亚洲午夜电影网| 亚洲欧美日韩小说| 国产精品麻豆欧美日韩ww| 亚洲精品一区二区三区在线观看 | 成人黄色一级视频| 国产成人精品aa毛片| 另类人妖一区二区av| 亚洲成人一区在线| 亚洲国产视频网站| 亚洲一区二区视频在线观看| 亚洲毛片av在线| 日韩理论片网站| 亚洲图片欧美激情| 亚洲免费av观看| 亚洲色图丝袜美腿| 亚洲日本成人在线观看| 中文字幕中文字幕在线一区| 中文一区二区在线观看| 中文在线一区二区| 亚洲视频一区在线| 依依成人精品视频| 一区二区在线看| 一区二区三区欧美视频| 亚洲国产精品精华液网站| 亚洲一区二区欧美| 人人超碰91尤物精品国产| 麻豆成人免费电影| 国产一区二区三区四| 国产不卡在线播放| 99国产精品久久久| 欧美视频一二三区| 日韩亚洲欧美在线| 久久久精品欧美丰满| 国产精品久久久久久亚洲伦| 亚洲欧美另类综合偷拍| 午夜不卡av免费| 久久成人免费网| 不卡视频一二三四| 在线观看一区日韩| 日韩午夜精品视频| 国产精品沙发午睡系列990531| 亚洲九九爱视频| 日韩1区2区3区| 国产成人免费视频网站| 色偷偷成人一区二区三区91 | www成人在线观看| 国产精品成人在线观看| 亚洲高清视频中文字幕| 久久电影网站中文字幕 | 国产一区视频网站| 91一区二区三区在线观看| 欧美日韩免费一区二区三区视频| 日韩三级电影网址| 日韩一区有码在线| 奇米精品一区二区三区在线观看| 国产成人av在线影院| 欧美日韩中文国产| 欧美极品xxx| 日本三级韩国三级欧美三级| 懂色av一区二区夜夜嗨| 欧美日韩国产123区| 久久综合色天天久久综合图片| 亚洲欧美日韩国产中文在线| 国产麻豆精品95视频| 欧美性受xxxx黑人xyx| 久久久精品tv| 三级亚洲高清视频| 色欧美片视频在线观看| 久久亚洲私人国产精品va媚药| 亚洲综合自拍偷拍| 成人免费高清视频| 日韩欧美一级二级三级久久久| 樱花草国产18久久久久| 高清不卡一区二区| 欧美v日韩v国产v| 午夜av电影一区| 91福利国产精品| 一区精品在线播放| 国产高清亚洲一区| 91精品视频网| 亚洲成人激情自拍| 日本精品免费观看高清观看| 国产欧美1区2区3区| 韩国女主播一区二区三区| 在线播放一区二区三区| 亚洲一区在线播放| 色婷婷国产精品| 亚洲男人的天堂av| 成人a区在线观看| 国产欧美日韩在线视频| 狠狠色综合播放一区二区| 日韩欧美在线影院| 日本免费新一区视频| 在线91免费看| 日韩中文字幕一区二区三区| 欧美日韩国产首页| 亚洲18影院在线观看| 欧美日韩五月天| 无码av中文一区二区三区桃花岛| 欧美色老头old∨ideo| 亚洲v精品v日韩v欧美v专区| 欧美老年两性高潮|