RmFtp

RmFtp — Small ftp library

Stability Level

Stable, unless otherwise indicated

Functions

gboolean rm_ftp_send_command ()
gboolean rm_ftp_login ()
gboolean rm_ftp_passive ()
gchar * rm_ftp_list_dir ()
gchar * rm_ftp_get_file ()
gboolean rm_ftp_put_file ()
RmFtp * rm_ftp_init ()
gboolean rm_ftp_delete_file ()
gboolean rm_ftp_shutdown ()

Types and Values

  RmFtp

Description

Provides basic FTP functionality for interacting with the router.

Functions

rm_ftp_send_command ()

gboolean
rm_ftp_send_command (RmFtp *client,
                     gchar *command);

Send FTP command through io channel

Parameters

client

a RmFtp

 

command

FTP command

 

Returns

TRUE if data is available, FALSE on error


rm_ftp_login ()

gboolean
rm_ftp_login (RmFtp *client,
              const gchar *user,
              const gchar *password);

Login to FTP server

Parameters

client

a RmFtp

 

user

username

 

password

user password

 

Returns

TRUE if login was successfull, otherwise FALSE


rm_ftp_passive ()

gboolean
rm_ftp_passive (RmFtp *client);

Switch FTP transfer to passive mode

Parameters

client

a RmFtp

 

Returns

result, TRUE for success, FALSE on error


rm_ftp_list_dir ()

gchar *
rm_ftp_list_dir (RmFtp *client,
                 const gchar *dir);

List FTP directory

Parameters

client

a RmFtp

 

dir

directory name

 

Returns

directory listing


rm_ftp_get_file ()

gchar *
rm_ftp_get_file (RmFtp *client,
                 const gchar *file,
                 gsize *len);

Get file of FTP

Parameters

client

a RmFtp

 

file

file to download

 

len

pointer to store the file size to

 

Returns

file data or NULL on error


rm_ftp_put_file ()

gboolean
rm_ftp_put_file (RmFtp *client,
                 const gchar *file,
                 const gchar *path,
                 gchar *data,
                 gsize size);

Put file on FTP

Parameters

client

a RmFtp

 

file

file to upload

 

path

remote path

 

data

file data

 

size

file size

 

Returns

TRUE on success, otherwise FALSE


rm_ftp_init ()

RmFtp *
rm_ftp_init (const gchar *server);

Initialize ftp structure

Parameters

server

server host name

 

Returns

ftp structure or NULL on error


rm_ftp_delete_file ()

gboolean
rm_ftp_delete_file (RmFtp *client,
                    const gchar *file);

Delete file on FTP.

Parameters

client

a RmFtp

 

file

file to delete

 

Returns

TRUE on success, otherwise FALSE


rm_ftp_shutdown ()

gboolean
rm_ftp_shutdown (RmFtp *client);

Shutdown ftp structure (close sockets and free memory)

Parameters

client

a RmFtp

 

Returns

TRUE on success, otherwise FALSE

Types and Values

RmFtp

typedef struct {
} RmFtp;

The RmFtp contains only private fileds and should not be directly accessed.