gskftpcommon

Name

gskftpcommon -- 

Synopsis



struct      GskFtpCommand;
enum        GskFtpCommandType;
enum        GskFtpCharType;
enum        GskFtpTerminalType;
enum        GskFtpFileStructure;
enum        GskFtpTransferMode;
const char* gsk_ftp_command_name            (GskFtpCommandType command_type);
GskFtpCommand* gsk_ftp_command_new_user     (const char *username);
GskFtpCommand* gsk_ftp_command_new_password (const char *username);
GskFtpCommand* gsk_ftp_command_new_account  (const char *account);
GskFtpCommand* gsk_ftp_command_new_mount    (const char *mount_point);
GskFtpCommand* gsk_ftp_command_new_rep_type (GskFtpCharType char_type,
                                             GskFtpTerminalType terminal_type,
                                             int byte_size);
GskFtpCommand* gsk_ftp_command_new_file_struct
                                            (GskFtpFileStructure file_struct);
GskFtpCommand* gsk_ftp_command_new_transfer_mode
                                            (GskFtpTransferMode transfer_mode);
GskFtpCommand* gsk_ftp_command_new_help     (const char *topic);
GskFtpCommand* gsk_ftp_command_new_file     (GskFtpCommandType cmd_type,
                                             const char *path);
GskFtpCommand* gsk_ftp_command_new_simple   (GskFtpCommandType cmd_type);
GskFtpCommand* gsk_ftp_command_parse        (const char *parse);
char*       gsk_ftp_command_to_string       (GskFtpCommand *command);
void        gsk_ftp_command_append          (GskFtpCommand *command,
                                             GskBuffer *buffer);
void        gsk_ftp_command_destroy         (GskFtpCommand *command);
struct      GskFtpReply;
GskFtpReply* gsk_ftp_reply_new_simple       (GskFtpReplyType type);
GskFtpReply* gsk_ftp_reply_new_status       (GskFtpReplyType type,
                                             const char *message);
GskFtpReply* gsk_ftp_reply_new_system       (const char *system,
                                             const char *additional);
GskFtpReply* gsk_ftp_reply_new_ready_in_n   (int num_minutes);
GskFtpReply* gsk_ftp_reply_parse            (const char *raw_string);
char*       gsk_ftp_reply_to_string         (GskFtpReply *reply);
void        gsk_ftp_reply_append            (GskFtpReply *reply,
                                             GskBuffer *buffer);

Description

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);

command_type :

Returns :


gsk_ftp_command_new_user ()

GskFtpCommand* gsk_ftp_command_new_user     (const char *username);

username :

Returns :


gsk_ftp_command_new_password ()

GskFtpCommand* gsk_ftp_command_new_password (const char *username);

username :

Returns :


gsk_ftp_command_new_account ()

GskFtpCommand* gsk_ftp_command_new_account  (const char *account);

account :

Returns :


gsk_ftp_command_new_mount ()

GskFtpCommand* gsk_ftp_command_new_mount    (const char *mount_point);

mount_point :

Returns :


gsk_ftp_command_new_rep_type ()

GskFtpCommand* gsk_ftp_command_new_rep_type (GskFtpCharType char_type,
                                             GskFtpTerminalType terminal_type,
                                             int byte_size);

char_type :

terminal_type :

byte_size :

Returns :


gsk_ftp_command_new_file_struct ()

GskFtpCommand* gsk_ftp_command_new_file_struct
                                            (GskFtpFileStructure file_struct);

file_struct :

Returns :


gsk_ftp_command_new_transfer_mode ()

GskFtpCommand* gsk_ftp_command_new_transfer_mode
                                            (GskFtpTransferMode transfer_mode);

transfer_mode :

Returns :


gsk_ftp_command_new_help ()

GskFtpCommand* gsk_ftp_command_new_help     (const char *topic);

topic :

Returns :


gsk_ftp_command_new_file ()

GskFtpCommand* gsk_ftp_command_new_file     (GskFtpCommandType cmd_type,
                                             const char *path);

cmd_type :

path :

Returns :


gsk_ftp_command_new_simple ()

GskFtpCommand* gsk_ftp_command_new_simple   (GskFtpCommandType cmd_type);

cmd_type :

Returns :


gsk_ftp_command_parse ()

GskFtpCommand* gsk_ftp_command_parse        (const char *parse);

parse :

Returns :


gsk_ftp_command_to_string ()

char*       gsk_ftp_command_to_string       (GskFtpCommand *command);

command :

Returns :


gsk_ftp_command_append ()

void        gsk_ftp_command_append          (GskFtpCommand *command,
                                             GskBuffer *buffer);

command :

buffer :


gsk_ftp_command_destroy ()

void        gsk_ftp_command_destroy         (GskFtpCommand *command);

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);

type :

Returns :


gsk_ftp_reply_new_status ()

GskFtpReply* gsk_ftp_reply_new_status       (GskFtpReplyType type,
                                             const char *message);

type :

message :

Returns :


gsk_ftp_reply_new_system ()

GskFtpReply* gsk_ftp_reply_new_system       (const char *system,
                                             const char *additional);

system :

additional :

Returns :


gsk_ftp_reply_new_ready_in_n ()

GskFtpReply* gsk_ftp_reply_new_ready_in_n   (int num_minutes);

num_minutes :

Returns :


gsk_ftp_reply_parse ()

GskFtpReply* gsk_ftp_reply_parse            (const char *raw_string);

raw_string :

Returns :


gsk_ftp_reply_to_string ()

char*       gsk_ftp_reply_to_string         (GskFtpReply *reply);

reply :

Returns :


gsk_ftp_reply_append ()

void        gsk_ftp_reply_append            (GskFtpReply *reply,
                                             GskBuffer *buffer);

reply :

buffer :