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

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

?? ftpdlib.c

?? vxworks的完整的源代碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
    int		newSock;    FAST FTPD_SESSION_DATA *pSlot;    int		on = 1;    int		addrLen;    struct sockaddr_in	addr;    char	a_ip_addr [INET_ADDR_LEN];  /* ascii ip address of client */    ftpdNumTasks = 0;    /* The following loop halts if this task is deleted. */    FOREVER        {        /* Wait for a new incoming connection. */        addrLen = sizeof (struct sockaddr);        ftpdDebugMsg ("waiting for a new client connection...\n",0,0,0,0);        newSock = accept (ftpdServerSock, (struct sockaddr *) &addr, &addrLen);	if (newSock < 0)            {            ftpdDebugMsg ("cannot accept a new connection\n",0,0,0,0);            break;            }        /*         * Register a new FTP client session. This process is a critical         * section with the server shutdown routine. If an error occurs,         * the reply must be sent over the control connection to the peer         * before the semaphore is released. Otherwise, this task could         * be deleted and no response would be sent, possibly causing         * the new client to hang indefinitely.         */        semTake (ftpsMutexSem, WAIT_FOREVER);        setsockopt (newSock, SOL_SOCKET, SO_KEEPALIVE, (char *) &on,                    sizeof (on));        inet_ntoa_b (addr.sin_addr, a_ip_addr);        ftpdDebugMsg ("accepted a new client connection from %s\n",                      (int) a_ip_addr, 0, 0, 0);        /* Create a new session entry for this connection, if possible. */        pSlot = ftpdSessionAdd ();        if (pSlot == NULL) 	/* Maximum number of connections reached. */            {            /* Send transient failure report to client. */            ftpdCmdSend (pSlot, newSock, 421,                          "Session limit reached, closing control connection",                          0, 0, 0, 0, 0, 0);            ftpdDebugMsg ("cannot get a new connection slot\n",0,0,0,0);	    close (newSock);            semGive (ftpsMutexSem);            continue;            }	pSlot->cmdSock	= newSock;        /* Save the control address and assign the default data address. */        bcopy ( (char *)&addr, (char *)&pSlot->peerAddr,                sizeof (struct sockaddr_in));        bcopy ( (char *)&addr, (char *)&pSlot->dataAddr,                sizeof (struct sockaddr_in));        pSlot->dataAddr.sin_port = htons (FTP_DATA_PORT);	/* Create a task name. */        sprintf (ftpdWorkTaskName, "tFtpdServ%d", ftpdNumTasks);        /* Spawn a secondary task to process FTP requests for this session. */	ftpdDebugMsg ("creating a new server task %s...\n", 		      (int) ftpdWorkTaskName, 0, 0, 0);	if (taskSpawn (ftpdWorkTaskName, ftpdWorkTaskPriority,		       ftpdWorkTaskOptions, ftpdWorkTaskStackSize,		       ftpdWorkTask, (int) pSlot,		       0, 0, 0, 0, 0, 0, 0, 0, 0) == ERROR)	    {            /* Send transient failure report to client. */            ftpdCmdSend (pSlot, newSock, 421,                          "Service not available, closing control connection",                         0, 0, 0, 0, 0, 0);	    ftpdSessionDelete (pSlot);	    ftpdDebugMsg ("cannot create a new work task\n",0,0,0,0);            semGive (ftpsMutexSem);            continue;	    }	ftpdDebugMsg ("done.\n",0,0,0,0);        /* Session added - end of critical section with shutdown routine. */        semGive (ftpsMutexSem);	}    /* Fatal error - update state of server. */    ftpsActive = FALSE;    return;    }/********************************************************************************* ftpdInit - initialize the FTP server task** This routine installs the password verification routine indicated by* <pLoginRtn> and establishes a control connection for the primary FTP* server task, which it then creates. It is called automatically during* system startup if INCLUDE_FTP_SERVER is defined. The primary server task * supports simultaneous client sessions, up to the limit specified by the * global variable 'ftpsMaxClients'. The default value allows a maximum of * four simultaneous connections. The <stackSize> argument specifies the stack * size for the primary server task. It is set to the value specified in the * 'ftpdWorkTaskStackSize' global variable by default.** RETURNS:* OK if server started, or ERROR otherwise.** ERRNO: N/A*/STATUS ftpdInit    (    FUNCPTR 	pLoginRtn, 	/* user verification routine, or NULL */    int 	stackSize 	/* task stack size, or 0 for default */    )    {    int 		on = 1;    struct sockaddr_in 	ctrlAddr;    if (ftpsActive)	return (OK);    loginVerifyRtn = pLoginRtn;    ftpsShutdownFlag = FALSE;    ftpsCurrentClients = 0;    /* Create the FTP server control socket. */    ftpdServerSock = socket (AF_INET, SOCK_STREAM, 0);    if (ftpdServerSock < 0)        return (ERROR);    /* Create data structures for managing client connections. */    lstInit (&ftpsSessionList);    ftpsMutexSem = semMCreate (SEM_Q_FIFO | SEM_DELETE_SAFE);    if (ftpsMutexSem == NULL)        {        close (ftpdServerSock);        return (ERROR);        }    ftpsSignalSem = semBCreate (SEM_Q_FIFO, SEM_EMPTY);    if (ftpsSignalSem == NULL)        {        close (ftpdServerSock);        semDelete (ftpsMutexSem);        return (ERROR);        }    /* Setup control connection for client requests. */    ctrlAddr.sin_family = AF_INET;    ctrlAddr.sin_addr.s_addr = INADDR_ANY;    ctrlAddr.sin_port = htons (FTP_DAEMON_PORT);    if (setsockopt (ftpdServerSock, SOL_SOCKET, SO_REUSEADDR,                    (char *) &on, sizeof (on)) < 0)        {        close (ftpdServerSock);        semDelete (ftpsMutexSem);        semDelete (ftpsSignalSem);        return (ERROR);        }    if (bind (ftpdServerSock, (struct sockaddr *) &ctrlAddr,              sizeof (ctrlAddr)) < 0)        {        close (ftpdServerSock);        semDelete (ftpsMutexSem);        semDelete (ftpsSignalSem);        return (ERROR);        }    if (listen (ftpdServerSock, 5) < 0)        {        close (ftpdServerSock);        semDelete (ftpsMutexSem);        semDelete (ftpsSignalSem);        return (ERROR);        }    /* Create a FTP server task to receive client requests. */    ftpdTaskId = taskSpawn ("tFtpdTask", ftpdTaskPriority - 1, ftpdTaskOptions,                            stackSize == 0 ? ftpdWorkTaskStackSize : stackSize,                            (FUNCPTR) ftpdTask, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);    if (ftpdTaskId == ERROR)        {        ftpdDebugMsg ("ERROR: ftpdTask cannot be created\n",0,0,0,0);        close (ftpdServerSock);        semDelete (ftpsMutexSem);        semDelete (ftpsSignalSem);        return (ERROR);        }    ftpsActive = TRUE;    ftpdDebugMsg ("ftpdTask created\n",0,0,0,0);    return (OK);    }/********************************************************************************* ftpdDelete - terminate the FTP server task** This routine halts the FTP server and closes the control connection. All* client sessions are removed after completing any commands in progress.* When this routine executes, no further client connections will be accepted* until the server is restarted. This routine is not reentrant and must not* be called from interrupt level.** NOTE: If any file transfer operations are in progress when this routine is* executed, the transfers will be aborted, possibly leaving incomplete files* on the destination host.** RETURNS: OK if shutdown completed, or ERROR otherwise.** ERRNO: N/A** INTERNAL* This routine is synchronized with the deletion routine for a client session* so that the exit of the client tasks can be detected. It also shares a* critical section with the creation of client sessions to prevent orphaned* tasks, which would occur if a session were added after this routine had* shut down all known clients.*/STATUS ftpdDelete (void)    {    BOOL serverActive = FALSE;    FTPD_SESSION_DATA * 	pData;    if (! ftpsActive)    /* Automatic success if server is not running. */        return (OK);    /*     * Remove the FTP server task to prevent additional sessions from starting.     * The exclusion semaphore guarantees a stable list of active clients.     */    semTake (ftpsMutexSem, WAIT_FOREVER);    taskDelete (ftpdTaskId);    ftpdTaskId = -1;    if (ftpsCurrentClients != 0)        serverActive = TRUE;    /*     * Set the shutdown flag so that any secondary server tasks will exit     * as soon as possible. Once the FTP server has started, this routine is     * the only writer of the flag and the secondary tasks are the only     * readers. To avoid unnecessary blocking, the secondary tasks do not     * guard access to this flag when checking for a pending shutdown during     * normal processing. Those tasks do protect access to this flag during     * their cleanup routine to prevent a race condition which would result     * in incorrect use of the signalling semaphore.     */    ftpsShutdownFlag = TRUE;    /*      * Close the command sockets of any active sessions to prevent further      * activity. If the session is waiting for a command from a socket,     * the close will trigger the session exit.     */    pData = (FTPD_SESSION_DATA *)lstFirst (&ftpsSessionList);    while (pData != NULL)        {        ftpdSockFree (&pData->cmdSock);        pData = (FTPD_SESSION_DATA *)lstNext (&pData->node);        }    semGive (ftpsMutexSem);       /* Wait for all secondary tasks to exit. */    if (serverActive)        {        /*         * When a shutdown is in progress, the cleanup routine of the last         * client task to exit gives the signalling semaphore.         */        semTake (ftpsSignalSem, WAIT_FOREVER);        }    /*     * Remove the original socket - this occurs after all secondary tasks     * have exited to avoid prematurely closing their control sockets.     */    ftpdSockFree (&ftpdServerSock);    /* Remove the protection and signalling semaphores and list of clients. */    lstFree (&ftpsSessionList);    /* Sanity check - should already be empty. */    semDelete (ftpsMutexSem);    semDelete (ftpsSignalSem);    ftpsActive = FALSE;    return (OK);    }/********************************************************************************* ftpdSessionAdd - add a new entry to the ftpd session slot list** Each of the incoming FTP sessions is associated with an entry in the* FTP server's session list which records session-specific context for each* control connection established by the FTP clients. This routine creates and* initializes a new entry in the session list, unless the needed memory is not* available or the upper limit for simultaneous connections is reached.** RETURNS: A pointer to the session list entry, or NULL of none available.** ERRNO: N/A** NOMANUAL** INTERNAL* This routine executes within a critical section of the primary FTP server* task, so mutual exclusion is already present when adding entries to the* client list and updating the shared variables indicating the current number* of connected clients.*/LOCAL FTPD_SESSION_DATA *ftpdSessionAdd (void)    {    FAST FTPD_SESSION_DATA 	*pSlot;    if (ftpsCurrentClients == ftpsMaxClients)        return (NULL);    /* get memory for the new session entry */    pSlot = (FTPD_SESSION_DATA *) KHEAP_ALLOC(sizeof (FTPD_SESSION_DATA));    if (pSlot == NULL)	{	return (NULL);	}    bzero ((char *)pSlot, sizeof(FTPD_SESSION_DATA));    /* initialize key fields in the newly acquired slot */    pSlot->dataSock = FTPD_SOCK_FREE;    pSlot->cmdSock = FTPD_SOCK_FREE;    pSlot->cmdSockError = OK;    pSlot->status = FTPD_STREAM_MODE | FTPD_ASCII_TYPE | FTPD_NO_RECORD_STRU;    pSlot->byteCount = 0;    /* assign the default directory for this guy */    ioDefPathGet (pSlot->curDirName);    /* Add new entry to the list of active sessions. */    lstAdd (&ftpsSessionList, &pSlot->node);    ftpdNumTasks++;    ftpsCurrentClients++;    return (pSlot);    }/********************************************************************************* ftpdSessionDelete - remove an entry from the FTP session list** This routine removes the session-specific context from the session list* after the client exits or a fatal error occurs.** RETURNS: N/A** ERRNO: N/A** NOMANUAL** INTERNAL* Unless an error occurs, this routine is only called in response to a* pending server shutdown, indicated by the shutdown flag. Even if the* shutdown flag is not detected and this routine is called because of an* error, the appropriate signal will still be sent to any pending shutdown* routine. The shutdown routine will only return after any active client* sessions have exited.*/LOCAL void ftpdSessionDelete    (    FAST FTPD_SESSION_DATA *pSlot       /* pointer to the slot to be deleted */    )    {    if (pSlot == NULL)			/* null slot? don't do anything */        return;    /*     * The deletion of a session entry must be an atomic operation to support     * an upper limit on the number of simultaneous connections allowed.     * This mutual exclusion also prevents a race condition with the server     * shutdown routine. The last client session will always send an exit     * signal to the shutdown routine, whether or not the shutdown flag was     * detected during normal processing.     */    semTake (ftpsMutexSem, WAIT_FOREVER);    --ftpdNumTasks;    --ftpsCurrentClients;    lstDelete (&ftpsSessionList, &pSlot->node);    ftpdSockFree (&pSlot->cmdSock);	/* release data and command sockets */    ftpdSockFree (&pSlot->dataSock);    KHEAP_FREE((char *)pSlot);    /* Send required signal if all sessions are closed. */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品久久嫩草网站秘色| 色噜噜偷拍精品综合在线| 国内一区二区视频| 国产成人免费在线| 色菇凉天天综合网| 欧美一区二区三区日韩| 欧美大肚乱孕交hd孕妇| 亚洲国产岛国毛片在线| 亚洲精品视频免费观看| 人禽交欧美网站| 成人不卡免费av| 欧美日韩另类国产亚洲欧美一级| 日韩欧美不卡在线观看视频| 国产精品三级视频| 水野朝阳av一区二区三区| 国内久久精品视频| 欧美日韩国产片| 久久久久久久久久久久久久久99 | 秋霞电影网一区二区| 久久97超碰国产精品超碰| 成人动漫中文字幕| 欧美一区二区三区在线| 国产精品麻豆久久久| 日韩精品免费专区| 91首页免费视频| 精品国产精品网麻豆系列 | 一本大道久久a久久精品综合| 91精品久久久久久蜜臀| 国产精品护士白丝一区av| 日韩激情视频网站| 91老师片黄在线观看| 日韩欧美一级二级三级久久久| 中文字幕日本不卡| 国产又黄又大久久| 欧美日韩五月天| 自拍偷拍欧美激情| 激情久久久久久久久久久久久久久久| 一本色道久久加勒比精品 | 成人精品免费网站| 欧美一级一级性生活免费录像| 亚洲欧美日韩在线| 国产福利精品一区二区| 7777精品伊人久久久大香线蕉超级流畅| 国产精品美女一区二区| 国内偷窥港台综合视频在线播放| 欧美精三区欧美精三区| 亚洲精品免费视频| 成人av综合一区| 国产日韩欧美电影| 国产制服丝袜一区| 日韩精品专区在线| 青娱乐精品视频| 欧美日韩综合一区| 一级做a爱片久久| 94色蜜桃网一区二区三区| 久久午夜羞羞影院免费观看| 日韩精品一二三区| 91精品国产综合久久福利软件| 亚洲综合一区二区| 色一情一伦一子一伦一区| 国产免费观看久久| 国产99久久久精品| 国产欧美日韩另类一区| 久草在线在线精品观看| 日韩一区二区三区四区| 亚洲第一二三四区| 欧美久久免费观看| 丝袜美腿亚洲综合| 91精品国产黑色紧身裤美女| 亚洲动漫第一页| 欧美性生活一区| 亚洲第四色夜色| 777久久久精品| 麻豆国产精品官网| 欧美成人官网二区| 狠狠色综合色综合网络| 日韩欧美国产不卡| 韩国女主播成人在线| 久久噜噜亚洲综合| 国产传媒日韩欧美成人| 久久久久久久久久美女| 成人午夜视频在线观看| 国产精品久久久久婷婷| 99re热这里只有精品免费视频| 亚洲丝袜另类动漫二区| 一本大道av一区二区在线播放| 亚洲免费观看高清在线观看| 色综合色综合色综合色综合色综合| 亚洲精品欧美激情| 国产精品对白交换视频| 青青草精品视频| 欧美不卡123| 高清不卡一区二区| 国产精品福利av | 亚洲一区二区三区四区中文字幕| 在线观看国产91| 日日摸夜夜添夜夜添精品视频| 欧美一级夜夜爽| 丁香婷婷综合激情五月色| 国产精品高清亚洲| 欧美日韩一区视频| 久久精品国产精品亚洲红杏 | 国产suv精品一区二区6| 国产精品护士白丝一区av| 欧美视频一区在线观看| 美女在线观看视频一区二区| 久久蜜桃av一区二区天堂| 波多野结衣在线一区| 一级精品视频在线观看宜春院| 91精品在线观看入口| 国精品**一区二区三区在线蜜桃| 国产精品日日摸夜夜摸av| 日本高清不卡在线观看| 美国十次了思思久久精品导航| 国产欧美精品一区二区色综合| 色婷婷av一区二区三区软件| 视频一区二区中文字幕| 欧美精品一区二区高清在线观看| 99精品久久99久久久久| 日韩电影在线看| 国产欧美精品在线观看| 欧美蜜桃一区二区三区| 国产成人精品aa毛片| 亚洲国产人成综合网站| 26uuu色噜噜精品一区| 日本精品一区二区三区高清| 久久国产精品免费| 亚洲乱码中文字幕综合| 日韩精品影音先锋| 在线中文字幕不卡| 国产精品夜夜嗨| 婷婷综合另类小说色区| 中文字幕av不卡| 欧美一级欧美一级在线播放| av一二三不卡影片| 久久超级碰视频| 亚洲午夜在线电影| 亚洲国产成人在线| 日韩一级在线观看| 欧美日韩一区二区三区不卡| 国产成人亚洲综合a∨婷婷| 三级欧美韩日大片在线看| 国产精品久久久久影院老司 | 亚洲激情综合网| 久久精品亚洲精品国产欧美| 欧美日本在线播放| 99re亚洲国产精品| 粉嫩av亚洲一区二区图片| 七七婷婷婷婷精品国产| 亚洲精品免费电影| 亚洲欧洲另类国产综合| 久久久综合九色合综国产精品| 91麻豆精品国产自产在线观看一区| 91视频在线观看| 国产成人综合自拍| 久久精品72免费观看| 亚洲成人第一页| 一区二区三区av电影| 中文字幕精品一区| 国产日产欧美精品一区二区三区| 日韩一级二级三级| 欧美久久高跟鞋激| 欧美高清视频在线高清观看mv色露露十八 | 日本久久电影网| 99国产欧美另类久久久精品| 国产一区二区在线视频| 日日夜夜精品视频天天综合网| 成人高清免费在线播放| 欧美一区二区不卡视频| 丝袜美腿亚洲一区| 欧美日韩精品综合在线| 亚洲人成网站在线| 99久久精品免费看国产免费软件| 中文无字幕一区二区三区| 91精品国产aⅴ一区二区| 91超碰这里只有精品国产| 欧美精品一区二| 中文字幕视频一区| 中文字幕在线不卡一区| 日韩女优视频免费观看| 国产**成人网毛片九色 | 亚洲精品亚洲人成人网| 日韩欧美一区二区在线视频| 国产精品伦一区二区三级视频| 国产做a爰片久久毛片| 亚洲欧美日韩久久| 日韩免费成人网| 色老汉一区二区三区| 亚洲欧美偷拍三级| 在线欧美日韩精品| 一区二区成人在线观看| 欧美日韩高清一区二区不卡| 亚洲一区二区三区自拍| 日韩一级在线观看| 99久久精品情趣| 国产综合久久久久久鬼色 | 精品少妇一区二区三区免费观看| 老司机一区二区| 18欧美亚洲精品| 中文乱码免费一区二区|