/*
- silcsftp.h
+ silcsftp.h
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2001 Pekka Riikonen
+ Copyright (C) 2001 - 2005 Pekka Riikonen
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
*
* DESCRIPTION
*
- * SILC SFTP Interface is the implementation of the SSH File Transfer
+ * SILC SFTP Interface is the implementation of the Secure File Transfer
* Protocol. The interface defines the SFTP client and the SFTP server.
* The SFTP is the mandatory file transfer protocol in the SILC protocol.
* The SFTP server implementation is filesystem independent and generic
/****s* silcsftp/SilcSFTPAPI/SilcSFTP
*
* NAME
- *
+ *
* typedef struct SilcSFTPStruct *SilcSFTP;
*
* DESCRIPTION
* This context is the actual SFTP client and SFTP server, and is
* allocated by silc_sftp_client_start or silc_sftp_server_start and
* given as argument usually to all silc_sftp_* functions. It is freed
- * by the silc_sftp_client_shutdown or silc_sftp_server_shutdown
+ * by the silc_sftp_client_shutdown or silc_sftp_server_shutdown
* functions.
*
***/
/****d* silcsftp/SilcSFTPAPI/SilcSFTPVersion
*
* NAME
- *
+ *
* typedef SilcUInt32 SilcSFTPVersion;
*
* DESCRIPTION
/****d* silcsftp/SilcSFTPAPI/SilcSFTPStatus
*
* NAME
- *
+ *
* typedef enum { ... } SilcSFTPStatus
*
* DESCRIPTION
SILC_SFTP_STATUS_NO_CONNECTION = 6, /* No connection to server */
SILC_SFTP_STATUS_CONNECTION_LOST = 7, /* Connection lost to server */
SILC_SFTP_STATUS_OP_UNSUPPORTED = 8, /* Operation unsupported */
+ SILC_SFTP_STATUS_INVALID_HANDLE = 9, /* Invalid file handle */
+ SILC_SFTP_STATUS_NO_SUCH_PATH = 10, /* Path does not exist */
+ SILC_SFTP_STATUS_FILE_ALREADY_EXIST = 11, /* File already exists */
+ SILC_SFTP_STATUS_WRITE_PROTECT = 12, /* Read-only or protected */
+ SILC_SFTP_STATUS_NO_MEDIA = 13, /* No media available */
+ SILC_SFTP_STATUS_NO_SPACE_ON_DEVICE = 14, /* No space on device */
+ SILC_SFTP_STATUS_QUOTA_EXCEEDED = 15, /* Quota limit reached */
+ SILC_SFTP_STATUS_UNKNOWN_PRINCIBLE = 16, /* Unknown princible */
+ SILC_SFTP_STATUS_LOCK_CONFLICT = 17, /* File already locked */
+ SILC_SFTP_STATUS_NOT_EMPTY = 18, /* Directory not empty */
+ SILC_SFTP_STATUS_NOT_A_DIRECTORY = 19, /* Not a directory */
+ SILC_SFTP_STATUS_INVALID_FILENAME = 20, /* Invalid filename */
+ SILC_SFTP_STATUS_LINK_LOOP = 21, /* Too many symlinks */
+ SILC_SFTP_STATUS_CANNOT_DELETE = 22, /* Could not delete file */
+ SILC_SFTP_STATUS_INVALID_PARAMETER = 23, /* Invalid parameter */
+ SILC_SFTP_STATUS_FILE_IS_A_DIRECTORY = 24, /* File is a directory file */
+ SILC_SFTP_STATUS_BR_LOCK_CONFLICT = 25, /* Byte range lock conflict */
+ SILC_SFTP_STATUS_BR_LOCK_REFUSED = 26, /* Byte range lock refused */
+ SILC_SFTP_STATUS_DELETE_PENDING = 27, /* File is being deleted */
+ SILC_SFTP_STATUS_FILE_CORRUPT = 28, /* File is corrupted */
} SilcSFTPStatus;
/***/
/****d* silcsftp/SilcSFTPAPI/SilcSFTPFileOperation
*
* NAME
- *
+ *
* typedef enum { ... } SilcSFTPFileOperation
*
* DESCRIPTION
/****s* silcsftp/SilcSFTPAPI/SilcSFTPAttributes
*
* NAME
- *
+ *
* typedef struct { ... } *SilcSFTPAttributes, SilcSFTPAttributesStruct;
*
* DESCRIPTION
*
* SFTP File attributes structure represents the attributes for a file.
- * This structure can be used by the client to send attributes to the
+ * This structure can be used by the client to send attributes to the
* server, and by server to return file attributes to the client.
*
***/
typedef struct {
- SilcUInt32 flags; /* Flags to indicate present attributes */
- SilcUInt64 size; /* Sife of the file in bytes */
- SilcUInt32 uid; /* Unix user ID */
- SilcUInt32 gid; /* Unix group ID */
- SilcUInt32 permissions; /* POSIX file permission bitmask */
- SilcUInt32 atime; /* Access time of file */
- SilcUInt32 mtime; /* Modification time of file */
+ SilcUInt32 flags; /* Flags to indicate present attributes */
+ SilcUInt64 size; /* Sife of the file in bytes */
+ SilcUInt32 uid; /* Unix user ID */
+ SilcUInt32 gid; /* Unix group ID */
+ SilcUInt32 permissions; /* POSIX file permission bitmask */
+ SilcUInt32 atime; /* Access time of file */
+ SilcUInt32 mtime; /* Modification time of file */
SilcUInt32 extended_count; /* Extended type and data count */
SilcBuffer *extended_type;
/****s* silcsftp/SilcSFTPAPI/SilcSFTPName
*
* NAME
- *
+ *
* typedef struct { ... } *SilcSFTPName, SilcSFTPNameStruct
*
* DESCRIPTION
* example when reading the contents of a directory.
*
***/
-typedef struct {
+typedef struct {
char **filename;
char **long_filename;
SilcSFTPAttributes *attrs;
/****s* silcsftp/SilcSFTPAPI/SilcSFTPHandle
*
* NAME
- *
+ *
* typedef struct SilcSFTPHandleStruct *SilcSFTPHandle;
*
* DESCRIPTION
*
* SYNOPSIS
*
- * typedef void (*SilcSFTPSendPacketCallback)(SilcBuffer packet,
+ * typedef void (*SilcSFTPSendPacketCallback)(SilcBuffer packet,
* void *context);
*
* DESCRIPTION
*
* SYNOPSIS
*
- * void silc_sftp_open(SilcSFTP sftp,
+ * void silc_sftp_open(SilcSFTP sftp,
* const char *filename,
* SilcSFTPFileOperation pflags,
* SilcSFTPAttributes attrs,
* `callback' to return the opened file handle.
*
***/
-void silc_sftp_open(SilcSFTP sftp,
+void silc_sftp_open(SilcSFTP sftp,
const char *filename,
SilcSFTPFileOperation pflags,
SilcSFTPAttributes attrs,
*
* void silc_sftp_read(SilcSFTP sftp,
* SilcSFTPHandle handle,
- * SilcUInt64 offset,
+ * SilcUInt64 offset,
* SilcUInt32 len,
* SilcSFTPDataCallback callback,
* void *context);
***/
void silc_sftp_read(SilcSFTP sftp,
SilcSFTPHandle handle,
- SilcUInt64 offset,
+ SilcUInt64 offset,
SilcUInt32 len,
SilcSFTPDataCallback callback,
void *context);
* DESCRIPTION
*
* Writes to a file indicated by the file handle `handle' starting from
- * offset of `offset' at most `data_len' bytes of `data'. The `callback'
+ * offset of `offset' at most `data_len' bytes of `data'. The `callback'
* is called to indicate the status of the writing.
*
***/
*
* DESCRIPTION
*
- * Performs an extended operation indicated by the `request' with
+ * Performs an extended operation indicated by the `request' with
* optional extended operation data indicated by the `data'. The callback
* is called to return any data associated with the extended request.
*
* SYNOPSIS
*
* SilcSFTP silc_sftp_server_start(SilcSFTPSendPacketCallback send_packet,
- * void *send_context,
+ * void *send_context,
* SilcSFTPFilesystem fs);
*
* DESCRIPTION
*
* Starts SFTP server and returns a context to it. This function returns
- * the allocated SFTP client context or NULL on error. The `send_packet'
+ * the allocated SFTP server context or NULL on error. The `send_packet'
* is called by the library when it needs to send a packet. The `fs' is the
* filesystem context allocated by the application. Each socket connection
* should start its own server by calling this function.
*
***/
SilcSFTP silc_sftp_server_start(SilcSFTPSendPacketCallback send_packet,
- void *send_context,
+ void *send_context,
SilcSFTPFilesystem fs);
/****f* silcsftp/SilcSFTPAPI/silc_sftp_server_shutdown
/****d* silcsftp/SilcSFTPAPI/SilcSFTPMonitors
*
* NAME
- *
+ *
* typedef enum { ... } SilcSFTPMonitors;
*
* DESCRIPTION
/****s* silcsftp/SilcSFTPAPI/SilcSFTPMonitorData
*
* NAME
- *
+ *
* typedef struct { ... } *SilcSFTPMonitorData, SilcSFTPMonitorDataStruct;
*
* DESCRIPTION
*
* void silc_sftp_server_set_monitor(SilcSFTP sftp,
* SilcSFTPMonitors monitors,
- * SilcSFTPMonitor monitor,
+ * SilcSFTPMonitor monitor,
* void *context);
*
* DESCRIPTION
*
- * Sets monitor callback to monitor various request sent by an client.
+ * Sets monitor callback to monitor various request sent by a client.
* When request that has been set in the `monitors' is received the
* monitor callback will be called to notify the caller.
*
***/
void silc_sftp_server_set_monitor(SilcSFTP sftp,
SilcSFTPMonitors monitors,
- SilcSFTPMonitor monitor,
+ SilcSFTPMonitor monitor,
void *context);
/* Function that is called to process the incmoing SFTP packet. */