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

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

?? ftpdlib.c

?? vxwork源代碼
?? 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一区二区三区免费野_久草精品视频
亚洲制服欧美中文字幕中文字幕| 日韩欧美国产一区在线观看| 国产精品人成在线观看免费| 国产精品一区二区男女羞羞无遮挡 | 成人性生交大片免费看视频在线| 久久精品一区蜜桃臀影院| 国产不卡视频一区二区三区| 国产精品欧美久久久久一区二区| 不卡av在线网| 亚洲电影视频在线| 精品日韩99亚洲| 波多野结衣的一区二区三区| 亚洲精品美国一| 日韩欧美高清在线| 成人av网在线| 午夜精彩视频在线观看不卡| 欧美不卡在线视频| 成人国产一区二区三区精品| 亚洲一区中文日韩| 日韩一二三区视频| 成人综合日日夜夜| 午夜av一区二区三区| 2022国产精品视频| 日本高清成人免费播放| 免费观看在线综合色| 日本一二三四高清不卡| 欧美性色黄大片手机版| 国产美女精品一区二区三区| 自拍视频在线观看一区二区| 欧美日韩午夜在线视频| 成人性生交大片免费看视频在线| 亚洲一区二区偷拍精品| 久久综合久久综合久久| 欧洲一区二区av| 国产电影一区在线| 五月天中文字幕一区二区| 国产色综合久久| 在线看国产一区二区| 韩国女主播成人在线| 一区二区欧美国产| 国产精品视频第一区| 欧美欧美欧美欧美| 不卡av在线网| 国产尤物一区二区在线 | 一区二区三区免费看视频| 日韩一区二区免费视频| 91免费观看视频在线| 精品午夜一区二区三区在线观看| 亚洲国产精品久久久男人的天堂 | 中文字幕在线免费不卡| 欧美电影免费观看高清完整版在线 | 欧美国产激情二区三区| 日韩一级片在线播放| 一本一道久久a久久精品 | 欧美一区二区三区播放老司机| 成人午夜激情视频| 黄色成人免费在线| 日本欧美肥老太交大片| 一区二区三区四区亚洲| 国产精品五月天| 国产欧美视频一区二区三区| 欧美一区二区精品在线| 欧美三级在线播放| 91女神在线视频| 99久久久国产精品免费蜜臀| 国产精品一区2区| 精品一区二区av| 精品影视av免费| 免费的国产精品| 亚洲高清免费视频| 午夜伊人狠狠久久| 亚洲国产精品一区二区久久恐怖片| 亚洲视频一区在线观看| 亚洲欧美日韩中文字幕一区二区三区| 久久久精品国产免费观看同学| 91精品一区二区三区久久久久久| 欧美日韩综合不卡| 欧美伦理影视网| 欧美精品777| 宅男在线国产精品| 日韩一区二区电影| 精品三级av在线| 久久婷婷一区二区三区| 久久久久久影视| 国产精品不卡在线观看| 中文字幕一区在线观看视频| 国产精品久久久久久久久快鸭| 国产精品网站在线观看| 国产香蕉久久精品综合网| 久久久国产精品午夜一区ai换脸| 国产欧美日韩中文久久| 中文字幕在线一区免费| 亚洲视频每日更新| 久久精品在线观看| 中文字幕成人网| 色综合天天综合色综合av| 国产精品伊人色| 成人黄色电影在线| 91久久线看在观草草青青| 欧美精品视频www在线观看| 91精品黄色片免费大全| 久久综合九色综合97_久久久| 26uuu国产电影一区二区| 国产精品污www在线观看| 亚洲另类在线制服丝袜| 日韩精品福利网| 国产美女主播视频一区| 99re亚洲国产精品| 7799精品视频| 国产三级一区二区| 亚洲小说欧美激情另类| 麻豆国产欧美一区二区三区| 国产精品亚洲第一区在线暖暖韩国| 不卡免费追剧大全电视剧网站| 色婷婷综合视频在线观看| 欧美一区二区三区小说| 中文av字幕一区| 亚瑟在线精品视频| 丰满少妇久久久久久久| 欧美日韩一区二区三区四区五区| 26uuu久久天堂性欧美| 亚洲人成亚洲人成在线观看图片| 日韩福利电影在线| 99视频在线精品| 日韩美女视频在线| 亚洲图片另类小说| 美女任你摸久久 | 亚洲一区二区偷拍精品| 激情久久五月天| 在线观看成人小视频| 欧美精品一区在线观看| 亚洲一二三区在线观看| 成人综合婷婷国产精品久久 | 亚洲一区视频在线观看视频| 久久99精品国产.久久久久| 欧美亚洲日本国产| 日本一区二区免费在线观看视频 | 亚洲伦理在线免费看| 国产麻豆日韩欧美久久| 欧美一级欧美三级在线观看| 亚洲婷婷综合色高清在线| 久久99在线观看| 6080亚洲精品一区二区| 亚洲美女在线一区| 成人手机在线视频| 精品va天堂亚洲国产| 蜜桃91丨九色丨蝌蚪91桃色| 欧美自拍偷拍午夜视频| 亚洲欧洲av一区二区三区久久| 精品在线你懂的| 日韩精品一区二区三区swag| 亚洲bdsm女犯bdsm网站| 在线观看视频91| 亚洲精品欧美激情| 色哟哟欧美精品| 亚洲桃色在线一区| 91色视频在线| 国产精品入口麻豆原神| 国产自产v一区二区三区c| 欧美一级一区二区| 日欧美一区二区| 欧美日韩在线亚洲一区蜜芽| 洋洋av久久久久久久一区| 94-欧美-setu| 亚洲免费三区一区二区| 一本一本久久a久久精品综合麻豆| 欧美国产1区2区| 国产成人亚洲精品青草天美| 久久综合色播五月| 国产一区二区三区在线观看免费视频 | 亚洲色图一区二区| 99久久精品免费看| 亚洲精品福利视频网站| 在线亚洲人成电影网站色www| 亚洲精品一二三四区| 在线欧美日韩精品| 午夜婷婷国产麻豆精品| 欧美一区二区日韩| 韩国女主播一区| 欧美国产激情一区二区三区蜜月| 成人h动漫精品一区二区| 亚洲私人影院在线观看| 欧美午夜在线一二页| 奇米影视在线99精品| 精品国产伦一区二区三区观看体验| 国产精品系列在线播放| 亚洲视频一区二区免费在线观看| 欧美在线|欧美| 美女任你摸久久| 国产精品久久久久久久久免费樱桃 | 欧美极品美女视频| 色94色欧美sute亚洲线路一久| 亚洲无线码一区二区三区| 日韩午夜激情视频| 高清国产午夜精品久久久久久| 亚洲视频综合在线| 日韩你懂的电影在线观看| 成人国产精品免费网站| 香蕉av福利精品导航| 国产日本欧美一区二区|