sftp_client.c
error_t sftpClientWriteFile(SftpClientContext *context, const void *data, size_t length, size_t *written, uint_t flags)
Write to a remote file.
Definition: sftp_client.c:912
error_t sftpClientFormatFxpWrite(SftpClientContext *context, const uint8_t *handle, size_t handleLen, uint64_t offset, uint32_t dataLen)
Format SSH_FXP_WRITE packet.
Definition: sftp_client_packet.c:360
SftpStatusCode sftpClientGetStatusCode(SftpClientContext *context)
Retrieve SFTP status code.
Definition: sftp_client.c:1423
SFTP packet parsing and formatting.
error_t sftpClientFormatFxpRename(SftpClientContext *context, const char_t *oldPath, const char_t *newPath)
Format SSH_FXP_RENAME packet.
Definition: sftp_client_packet.c:940
error_t sftpClientFormatFxpRemove(SftpClientContext *context, const char_t *filename)
Format SSH_FXP_REMOVE packet.
Definition: sftp_client_packet.c:584
error_t sftpClientFormatFxpRmDir(SftpClientContext *context, const char_t *path)
Format SSH_FXP_RMDIR packet.
Definition: sftp_client_packet.c:734
error_t sftpClientFormatFxpReadDir(SftpClientContext *context, const uint8_t *handle, size_t handleLen)
Format SSH_FXP_READDIR packet.
Definition: sftp_client_packet.c:515
error_t sftpClientSetTimeout(SftpClientContext *context, systime_t timeout)
Set communication timeout.
Definition: sftp_client.c:100
SSH transport layer protocol.
error_t sftpClientOpenConnection(SftpClientContext *context)
Open SSH connection.
Definition: sftp_client_misc.c:72
error_t sftpClientRenameFile(SftpClientContext *context, const char_t *oldPath, const char_t *newPath)
Rename a file.
Definition: sftp_client.c:1299
error_t sftpClientBindToInterface(SftpClientContext *context, NetInterface *interface)
Bind the SFTP client to a particular network interface.
Definition: sftp_client.c:121
error_t sftpClientProcessEvents(SftpClientContext *context)
Process SFTP client events.
Definition: sftp_client_misc.c:409
error_t sshReadChannel(SshChannel *channel, void *data, size_t size, size_t *received, uint_t flags)
Receive data from the specified channel.
Definition: ssh.c:2180
error_t sftpClientCheckTimeout(SftpClientContext *context)
Determine whether a timeout error has occurred.
Definition: sftp_client_misc.c:630
error_t sftpClientOpenFile(SftpClientContext *context, const char_t *path, uint_t mode)
Open a file for reading, writing, or appending.
Definition: sftp_client.c:845
error_t sftpClientFormatFxpInit(SftpClientContext *context, uint32_t version)
Format SSH_FXP_INIT packet.
Definition: sftp_client_packet.c:53
error_t sftpClientFormatFxpRealPath(SftpClientContext *context, const char_t *path)
Format SSH_FXP_REALPATH packet.
Definition: sftp_client_packet.c:802
error_t sftpClientConnect(SftpClientContext *context, const IpAddr *serverIpAddr, uint16_t serverPort)
Establish a connection with the specified SFTP server.
Definition: sftp_client.c:144
error_t(* SftpClientSshInitCallback)(SftpClientContext *context, SshContext *sshContext)
SSH initialization callback function.
Definition: sftp_client.h:140
error_t sftpParseName(SftpVersion version, SftpName *name, const uint8_t *data, size_t length, size_t *consumed)
Parse name structure.
Definition: sftp_common.c:370
error_t sftpClientInit(SftpClientContext *context)
Initialize SFTP client context.
Definition: sftp_client.c:52
error_t sftpClientEstablishConnection(SftpClientContext *context)
Establish SSH connection.
Definition: sftp_client_misc.c:141
error_t sftpClientDisconnect(SftpClientContext *context)
Gracefully disconnect from the SFTP server.
Definition: sftp_client.c:1450
error_t sshWriteChannel(SshChannel *channel, const void *data, size_t length, size_t *written, uint_t flags)
Write data to the specified channel.
Definition: ssh.c:2051
error_t sshSendDisconnect(SshConnection *connection, uint32_t reasonCode, const char_t *description)
Send SSH_MSG_DISCONNECT message.
Definition: ssh_transport.c:209
error_t socketConnect(Socket *socket, const IpAddr *remoteIpAddr, uint16_t remotePort)
Establish a connection to a specified socket.
Definition: socket.c:1349
SFTP client.
error_t socketShutdown(Socket *socket, uint_t how)
Disable reception, transmission, or both.
Definition: socket.c:2020
error_t sftpClientFormatFxpOpen(SftpClientContext *context, const char_t *filename, uint32_t pflags)
Format SSH_FXP_OPEN packet.
Definition: sftp_client_packet.c:106
error_t sftpClientClose(SftpClientContext *context)
Close the connection with the SFTP server.
Definition: sftp_client.c:1571
error_t sftpClientCreateDir(SftpClientContext *context, const char_t *path)
Create a new directory.
Definition: sftp_client.c:724
error_t sftpClientFormatFxpRead(SftpClientContext *context, const uint8_t *handle, size_t handleLen, uint64_t offset, uint32_t dataLen)
Format SSH_FXP_READ packet.
Definition: sftp_client_packet.c:270
error_t sftpClientReadDir(SftpClientContext *context, SftpDirEntry *dirEntry)
Read an entry from the directory.
Definition: sftp_client.c:508
error_t sftpClientChangeWorkingDir(SftpClientContext *context, const char_t *path)
Change working directory.
Definition: sftp_client.c:340
Helper functions for SFTP client.
void sftpClientChangeState(SftpClientContext *context, SftpClientState newState)
Update SFTP client state.
Definition: sftp_client_misc.c:55
error_t sftpClientDeleteFile(SftpClientContext *context, const char_t *path)
Delete a file.
Definition: sftp_client.c:1364
error_t sftpClientDeleteDir(SftpClientContext *context, const char_t *path)
Remove a directory.
Definition: sftp_client.c:784
error_t sftpClientRegisterSshInitCallback(SftpClientContext *context, SftpClientSshInitCallback callback)
Register SSH initialization callback function.
Definition: sftp_client.c:78
@ SFTP_CLIENT_STATE_SENDING_COMMAND_1
Definition: sftp_client.h:125
const char_t * sftpClientGetWorkingDir(SftpClientContext *context)
Get current working directory.
Definition: sftp_client.c:313
void sftpGetAbsolutePath(SftpClientContext *context, const char_t *path, char_t *fullPath)
Retrieve the full pathname.
Definition: sftp_client_misc.c:699
@ SFTP_CLIENT_STATE_SENDING_COMMAND_2
Definition: sftp_client.h:126
error_t sftpClientFormatFxpMkDir(SftpClientContext *context, const char_t *path)
Format SSH_FXP_MKDIR packet.
Definition: sftp_client_packet.c:652
error_t sftpClientOpenDir(SftpClientContext *context, const char_t *path)
Open a directory.
Definition: sftp_client.c:448
error_t sftpClientChangeToParentDir(SftpClientContext *context)
Change to parent directory.
Definition: sftp_client.c:434
void sftpClientCloseConnection(SftpClientContext *context)
Close SSH connection.
Definition: sftp_client_misc.c:295
void sftpClientDeinit(SftpClientContext *context)
Release SFTP client context.
Definition: sftp_client.c:1592
error_t sftpClientSendCommand(SftpClientContext *context)
Send SFTP request and wait for a response.
Definition: sftp_client_misc.c:315
@ SFTP_CLIENT_STATE_CHANNEL_OPEN_REPLY
Definition: sftp_client.h:121
Secure Shell (SSH)
error_t sftpClientFormatFxpOpenDir(SftpClientContext *context, const char_t *path)
Format SSH_FXP_OPENDIR packet.
Definition: sftp_client_packet.c:446
error_t socketSetTimeout(Socket *socket, systime_t timeout)
Set timeout value for blocking operations.
Definition: socket.c:148
error_t sftpClientReadFile(SftpClientContext *context, void *data, size_t size, size_t *received, uint_t flags)
Read from a remote file.
Definition: sftp_client.c:1086
Debugging facilities.
error_t sftpClientFormatFxpClose(SftpClientContext *context, const uint8_t *handle, size_t handleLen)
Format SSH_FXP_CLOSE packet.
Definition: sftp_client_packet.c:197