Helper functions for FTP client. More...
#include <stdlib.h>
#include <ctype.h>
#include "ftp/ftp_client.h"
#include "ftp/ftp_client_transport.h"
#include "ftp/ftp_client_misc.h"
#include "str.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL FTP_TRACE_LEVEL |
Detailed Description
Helper functions for FTP client.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.4.4
Definition in file ftp_client_misc.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL FTP_TRACE_LEVEL |
Definition at line 32 of file ftp_client_misc.c.
Function Documentation
◆ ftpClientChangeState()
void ftpClientChangeState | ( | FtpClientContext * | context, |
FtpClientState | newState | ||
) |
Update FTP client state.
- Parameters
-
[in] context Pointer to the FTP client context [in] newState New state to switch to
Definition at line 53 of file ftp_client_misc.c.
◆ ftpClientCheckTimeout()
error_t ftpClientCheckTimeout | ( | FtpClientContext * | context | ) |
Determine whether a timeout error has occurred.
- Parameters
-
[in] context Pointer to the FTP client context
- Returns
- Error code
Definition at line 1176 of file ftp_client_misc.c.
◆ ftpClientFormatCommand()
error_t ftpClientFormatCommand | ( | FtpClientContext * | context, |
const char_t * | command, | ||
const char_t * | argument | ||
) |
Format FTP command.
- Parameters
-
[in] context Pointer to the FTP client context [in] command NULL-terminated string containing the FTP command [in] argument NULL-terminated string containing the argument
- Returns
- Error code
Definition at line 185 of file ftp_client_misc.c.
◆ ftpClientFormatPasvCommand()
error_t ftpClientFormatPasvCommand | ( | FtpClientContext * | context | ) |
Format PASV or EPSV command.
- Parameters
-
[in] context Pointer to the FTP client context
- Returns
- Error code
Definition at line 300 of file ftp_client_misc.c.
◆ ftpClientFormatPortCommand()
error_t ftpClientFormatPortCommand | ( | FtpClientContext * | context, |
const IpAddr * | ipAddr, | ||
uint16_t | port | ||
) |
Format PORT or EPRT command.
- Parameters
-
[in] context Pointer to the FTP client context [in] ipAddr Host IP address [in] port TCP port number
- Returns
- Error code
Definition at line 223 of file ftp_client_misc.c.
◆ ftpClientInitDataTransfer()
error_t ftpClientInitDataTransfer | ( | FtpClientContext * | context, |
bool_t | direction | ||
) |
Initiate data transfer.
- Parameters
-
[in] context Pointer to the FTP client context [in] direction Data transfer direction
- Returns
- Error code
Definition at line 723 of file ftp_client_misc.c.
◆ ftpClientParseDirEntry()
error_t ftpClientParseDirEntry | ( | char_t * | line, |
FtpDirEntry * | dirEntry | ||
) |
Parse directory entry.
- Parameters
-
[in] line NULL-terminated string [out] dirEntry Pointer to a directory entry
- Returns
- Error code
Definition at line 486 of file ftp_client_misc.c.
◆ ftpClientParsePasvReply()
error_t ftpClientParsePasvReply | ( | FtpClientContext * | context, |
uint16_t * | port | ||
) |
Parse PASV or EPSV response.
- Parameters
-
[in] context Pointer to the FTP client context [out] port The TCP port number the server is listening on
- Returns
- Error code
Definition at line 357 of file ftp_client_misc.c.
◆ ftpClientParsePwdReply()
error_t ftpClientParsePwdReply | ( | FtpClientContext * | context, |
char_t * | path, | ||
size_t | maxLen | ||
) |
Parse PWD response.
- Parameters
-
[in] context Pointer to the FTP client context [out] path Output buffer where to store the current directory [in] maxLen Maximum number of characters the buffer can hold
- Returns
- Error code
Definition at line 443 of file ftp_client_misc.c.
◆ ftpClientSendCommand()
error_t ftpClientSendCommand | ( | FtpClientContext * | context | ) |
Send FTP command and wait for a reply.
- Parameters
-
[in] context Pointer to the FTP client context
- Returns
- Error code
Definition at line 69 of file ftp_client_misc.c.
◆ ftpClientTerminateDataTransfer()
error_t ftpClientTerminateDataTransfer | ( | FtpClientContext * | context | ) |
Terminate data transfer.
- Parameters
-
[in] context Pointer to the FTP client context
- Returns
- Error code
Definition at line 1079 of file ftp_client_misc.c.