Details
struct GskFtpCommand
struct GskFtpCommand {
GskFtpCommandType type;
union
{
/* The following commands take no argument:
* CDUP Change to parent directory.
* REIN Reinitialize
* QUIT Logout
* PASV Set passive mode
* STOU Store unique
* SYST Find server system type.
* NOOP No operation to perform.
*/
char *username; /* for USER */
char *password; /* for PASS */
char *account; /* for ACCT */
char *mount_point; /* for SMNT */
struct /* for PORT */
{
int port;
guint8 address[4];
} data_port;
struct
{ /* for TYPE */
GskFtpCharType char_type;
GskFtpTerminalType term_type;
int local_byte_size;
} representation_type;
GskFtpFileStructure struct_type; /* for STRU */
GskFtpTransferMode transfer_mode; /* for MODE */
/* The following commands use pathname:
* CWD RETR STOR APPE ALLO REST RNFR RNTO
* ABOR DELE RMD MKD LIST NLST STAT
*/
char *pathname;
char *help_topic; /* for HELP (may be NULL) */
} d;
};
enum GskFtpCommandType
typedef enum
{
/* --- Authorization commands. See RFC 959, Section 4.1.1. --- */
/* Login information */
GSK_FTP_COMMAND_USER,
GSK_FTP_COMMAND_PASS,
GSK_FTP_COMMAND_ACCT,
/* Directory-changing commands. */
GSK_FTP_COMMAND_CWD,
GSK_FTP_COMMAND_CDUP,
/* Mounting "structures" (eg filesystems) */
GSK_FTP_COMMAND_SMNT,
/* Clear current authorization. */
GSK_FTP_COMMAND_REIN, /* stay logged in */
GSK_FTP_COMMAND_QUIT, /* disconnect */
/* --- Set data transport parameters. See RFC 959, 4.1.2. --- */
GSK_FTP_COMMAND_PORT,
/* passive mode (client connects to remote side) */
GSK_FTP_COMMAND_PASV,
/* data format type */
GSK_FTP_COMMAND_TYPE,
GSK_FTP_COMMAND_STRU,
GSK_FTP_COMMAND_MODE,
/* --- Service commands --- */
GSK_FTP_COMMAND_RETR, /* read a file from the server */
GSK_FTP_COMMAND_STOR, /* write a file to the server */
GSK_FTP_COMMAND_STOU, /* create (don't overwrite) a file */
GSK_FTP_COMMAND_APPE, /* append data to the file */
GSK_FTP_COMMAND_ALLO, /* allocate space */
GSK_FTP_COMMAND_REST, /* restart transfer ???? */
GSK_FTP_COMMAND_RNFR, /* rename file from */
GSK_FTP_COMMAND_RNTO, /* rename from to */
GSK_FTP_COMMAND_ABOR, /* abort file transfer */
GSK_FTP_COMMAND_DELE, /* delet e file from the server */
GSK_FTP_COMMAND_RMD, /* remove a directory */
GSK_FTP_COMMAND_MKD, /* make a directory */
GSK_FTP_COMMAND_PWD, /* `print working directory' */
GSK_FTP_COMMAND_LIST, /* list files in dir (human-readable) */
GSK_FTP_COMMAND_NLST, /* list files in dir (machine-readable) */
GSK_FTP_COMMAND_SITE, /* site specific parameter */
GSK_FTP_COMMAND_SYST, /* report server system type */
GSK_FTP_COMMAND_STAT, /* stat a remote file */
GSK_FTP_COMMAND_HELP, /* request help */
GSK_FTP_COMMAND_NOOP /* no operation */
} GskFtpCommandType;
enum GskFtpCharType
typedef enum /* for ftp TYPE command */
{
GSK_FTP_CHAR_TYPE_ASCII,
GSK_FTP_CHAR_TYPE_EBCDIC,
GSK_FTP_CHAR_TYPE_IMAGE
} GskFtpCharType;
enum GskFtpTerminalType
typedef enum /* for ftp TYPE command */
{
GSK_FTP_TERMINAL_NONPRINT,
GSK_FTP_TERMINAL_TELNET,
GSK_FTP_TERMINAL_CARRIAGE_CONTROL
} GskFtpTerminalType;
enum GskFtpFileStructure
typedef enum /* for ftp STRU command */
{
GSK_FTP_FILE_STRUCTURE_FILE,
GSK_FTP_FILE_STRUCTURE_RECORD,
GSK_FTP_FILE_STRUCTURE_PAGE
} GskFtpFileStructure;
enum GskFtpTransferMode
typedef enum /* for ftp MODE command */
{
GSK_FTP_TRANSFER_MODE_STREAM,
GSK_FTP_TRANSFER_MODE_BLOCK,
GSK_FTP_TRANSFER_MODE_COMPRESSED
} GskFtpTransferMode;
gsk_ftp_command_name ()
const char* gsk_ftp_command_name (GskFtpCommandType command_type);
gsk_ftp_command_new_user ()
GskFtpCommand* gsk_ftp_command_new_user (const char *username);
gsk_ftp_command_new_password ()
GskFtpCommand* gsk_ftp_command_new_password (const char *username);
gsk_ftp_command_new_account ()
GskFtpCommand* gsk_ftp_command_new_account (const char *account);
gsk_ftp_command_new_mount ()
GskFtpCommand* gsk_ftp_command_new_mount (const char *mount_point);
gsk_ftp_command_new_help ()
GskFtpCommand* gsk_ftp_command_new_help (const char *topic);
gsk_ftp_command_parse ()
GskFtpCommand* gsk_ftp_command_parse (const char *parse);
gsk_ftp_command_to_string ()
char* gsk_ftp_command_to_string (GskFtpCommand *command);
gsk_ftp_command_destroy ()
void gsk_ftp_command_destroy (GskFtpCommand *command);
struct GskFtpReply
struct GskFtpReply {
GskFtpReplyType type;
union
{
struct
{
char m[4];
char d[4];
} restart_marker;
/* SYSTEM_STATUS, DIR_STATUS, FILE_STATUS, HELP_MESSAGE */
char *literal;
/* NAME_SYSTEM */
struct
{
char *name;
char *additional;
} name_system;
/* READY_IN_N_MINUTES */
struct
{
int n_minutes;
} n_minutes;
} d;
};
gsk_ftp_reply_new_simple ()
GskFtpReply* gsk_ftp_reply_new_simple (GskFtpReplyType type);
gsk_ftp_reply_new_status ()
GskFtpReply* gsk_ftp_reply_new_status (GskFtpReplyType type,
const char *message);
gsk_ftp_reply_new_system ()
GskFtpReply* gsk_ftp_reply_new_system (const char *system,
const char *additional);
gsk_ftp_reply_new_ready_in_n ()
GskFtpReply* gsk_ftp_reply_new_ready_in_n (int num_minutes);
gsk_ftp_reply_parse ()
GskFtpReply* gsk_ftp_reply_parse (const char *raw_string);
gsk_ftp_reply_to_string ()
char* gsk_ftp_reply_to_string (GskFtpReply *reply);