/*********************************************************************************************************************************** SFTP Storage Internal ***********************************************************************************************************************************/ #ifndef STORAGE_SFTP_STORAGE_INTERN_H #define STORAGE_SFTP_STORAGE_INTERN_H #include #include #include "storage/sftp/storage.h" /*********************************************************************************************************************************** Object type ***********************************************************************************************************************************/ typedef struct StorageSftp StorageSftp; /*********************************************************************************************************************************** Getters ***********************************************************************************************************************************/ // Current libssh2 session/sftp session, used by the read/write objects FN_EXTERN LIBSSH2_SESSION *storageSftpSession(StorageSftp *this); FN_EXTERN LIBSSH2_SFTP *storageSftpSessionSftp(StorageSftp *this); // Id of the current connection FN_EXTERN unsigned int storageSftpConnId(StorageSftp *this); /*********************************************************************************************************************************** Functions ***********************************************************************************************************************************/ FN_EXTERN void storageSftpEvalLibSsh2Error( int ssh2Errno, uint64_t sftpErrno, const ErrorType *errorType, const String *msg, const String *hint); // Check which direction we are currently blocking on (reading, writing, or both) and wait for the fd to be ready accordingly FN_EXTERN bool storageSftpWaitFd(StorageSftp *this, int64_t rc); // If the error indicates the connection was lost then reopen the session so the operation can be retried. Returns true when the // session was reopened (the caller should retry the operation). FN_EXTERN bool storageSftpReconnect(StorageSftp *this, int rc); /*********************************************************************************************************************************** Macros for function logging ***********************************************************************************************************************************/ #define FUNCTION_LOG_STORAGE_SFTP_TYPE \ StorageSftp * #define FUNCTION_LOG_STORAGE_SFTP_FORMAT(value, buffer, bufferSize) \ objNameToLog(value, "StorageSftp *", buffer, bufferSize) #endif