亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
日韩成人伦理电影在线观看| 色94色欧美sute亚洲线路一久 | 一区二区高清免费观看影视大全| 亚洲国产精品久久久久秋霞影院| 久久成人18免费观看| 日本精品一级二级| 国产日韩欧美综合在线| 日韩成人一级大片| 色天天综合色天天久久| 国产日韩欧美麻豆| 国产专区欧美精品| 日韩欧美成人激情| 日韩精品每日更新| 欧美三区在线观看| 国产精品二三区| 国产精品一区二区在线看| 日韩欧美123| 免费精品视频最新在线| 在线综合+亚洲+欧美中文字幕| 一区二区三区中文在线| 91尤物视频在线观看| 国产精品美女久久久久久久网站| 国产乱国产乱300精品| 精品国产99国产精品| 天堂一区二区在线| 欧美另类一区二区三区| 亚洲国产日韩精品| 欧美精选午夜久久久乱码6080| 一区二区三区免费看视频| 91麻豆蜜桃一区二区三区| 亚洲靠逼com| 日本高清不卡aⅴ免费网站| 亚洲黄网站在线观看| 欧美专区日韩专区| 天天影视色香欲综合网老头| 欧美日韩久久久久久| 日本特黄久久久高潮| 91精品国产综合久久精品| 日本成人中文字幕| 精品国产一区二区三区久久久蜜月| 久久成人麻豆午夜电影| 国产喷白浆一区二区三区| 成人黄色国产精品网站大全在线免费观看| 国产精品亲子伦对白| 色综合一区二区| 亚洲成人av一区二区三区| 欧美一级片免费看| 国产精品一二三区| 亚洲品质自拍视频网站| 欧美日韩国产综合一区二区三区| 日韩中文字幕不卡| 欧美激情一区二区三区蜜桃视频| 99re在线精品| 午夜精品成人在线视频| 欧美成人精品福利| 91美女蜜桃在线| 午夜精品一区二区三区三上悠亚| 日韩一区二区三区在线视频| 国产成人精品一区二区三区网站观看| 国产欧美精品一区二区色综合 | 亚洲成人av电影| 欧美精品一区二区三| 99久久精品国产网站| 亚洲国产视频一区| 亚洲精品一区在线观看| 91在线国产福利| 肉色丝袜一区二区| 中文字幕永久在线不卡| 欧美一级艳片视频免费观看| 成人午夜视频福利| 男女视频一区二区| 中文字幕在线不卡一区二区三区| 4438亚洲最大| 色悠悠久久综合| 国产很黄免费观看久久| 亚洲h在线观看| 亚洲欧洲精品天堂一级| 日韩视频永久免费| 色丁香久综合在线久综合在线观看| 精品亚洲免费视频| 午夜欧美在线一二页| 亚洲人成亚洲人成在线观看图片| 日韩色在线观看| 欧美日韩国产高清一区二区三区| 成人综合在线观看| 久久成人免费网| 首页综合国产亚洲丝袜| 亚洲欧美日韩国产另类专区| 26uuu精品一区二区三区四区在线| 色乱码一区二区三区88| 国产美女在线观看一区| 轻轻草成人在线| 亚洲亚洲人成综合网络| 中文字幕在线不卡| 亚洲国产精品精华液ab| 久久婷婷国产综合精品青草| 91精品在线观看入口| 91精品福利视频| 91美女在线观看| 99久久精品国产一区| 不卡电影免费在线播放一区| 国产大陆亚洲精品国产| 精品一区二区三区在线视频| 日韩国产精品久久久久久亚洲| 国产精品久久久久一区| 国产欧美日韩不卡免费| 久久久久久久久蜜桃| 精品国产伦一区二区三区免费| 欧美高清视频不卡网| 欧美久久免费观看| 欧美日韩午夜影院| 91精品国产欧美一区二区18| 欧美精品亚洲一区二区在线播放| 欧美视频在线一区二区三区| 91麻豆swag| 欧美亚男人的天堂| 日本韩国视频一区二区| 在线观看国产日韩| 欧美日本在线播放| 日韩三级中文字幕| 亚洲精品一区二区三区四区高清 | 色婷婷久久久亚洲一区二区三区| 91天堂素人约啪| 色屁屁一区二区| 在线视频欧美精品| 欧美精品久久一区二区三区| 91精品国产高清一区二区三区| 日韩欧美一二区| 国产婷婷色一区二区三区四区| 中文久久乱码一区二区| 亚洲女与黑人做爰| 亚洲1区2区3区视频| 六月婷婷色综合| 国产不卡免费视频| 在线看国产一区二区| 91精品国产丝袜白色高跟鞋| 久久综合九色综合欧美亚洲| 欧美激情综合在线| 一级日本不卡的影视| 天堂一区二区在线免费观看| 国产一区在线观看麻豆| av影院午夜一区| 欧美日韩在线播放| 337p粉嫩大胆色噜噜噜噜亚洲 | 色综合视频一区二区三区高清| 欧美日韩欧美一区二区| 日韩精品一区二区三区四区视频 | 精品国产乱码久久久久久图片| 日本一区二区三区视频视频| 一个色综合网站| 久久精品国产秦先生| av成人免费在线观看| 欧洲人成人精品| 久久久国产精品午夜一区ai换脸| 曰韩精品一区二区| 国产又粗又猛又爽又黄91精品| 91网上在线视频| 337p日本欧洲亚洲大胆精品| 亚洲自拍偷拍网站| 国产精品综合视频| 欧美欧美欧美欧美| 国产精品久久久久久久蜜臀| 捆绑调教一区二区三区| 91视频.com| 久久久噜噜噜久久人人看| 午夜电影网一区| 成人一区二区三区视频在线观看| 7777精品久久久大香线蕉| 国产精品第一页第二页第三页| 九九九久久久精品| 欧美丰满美乳xxx高潮www| 综合色中文字幕| 国产自产高清不卡| 日韩欧美一区二区免费| 亚洲一区二三区| 99综合影院在线| 久久久99精品免费观看| 美女在线一区二区| 欧美久久免费观看| 亚洲电影你懂得| 91美女在线视频| 中文字幕综合网| 成人在线视频一区二区| 国产午夜精品一区二区三区嫩草| 丝袜美腿亚洲综合| 欧美日韩成人综合在线一区二区| **网站欧美大片在线观看| 国产精品一区二区久久精品爱涩| 欧美一区二区三区在线观看 | 日韩一区二区在线观看视频| 亚洲在线中文字幕| 色综合激情五月| 亚洲免费在线观看| 色琪琪一区二区三区亚洲区| 亚洲三级理论片| eeuss鲁片一区二区三区在线观看| 国产三级欧美三级日产三级99 | 国产欧美一区视频| 国产精品一区二区在线观看网站| 26uuu精品一区二区|