| 1 |
hirohitohigashi |
17 |
/* |
| 2 |
|
|
liboftp: this is an FTP library to simplify the work to a Developer |
| 3 |
|
|
who want to work with FTP servers (RFC 959). |
| 4 |
|
|
|
| 5 |
|
|
Copyright (c) 2009 hirohito higashi. All rights reserved. |
| 6 |
|
|
This file is distributed under BSD license. |
| 7 |
|
|
*/ |
| 8 |
|
|
|
| 9 |
|
|
|
| 10 |
|
|
#ifndef __libOftp_H_proto_ |
| 11 |
|
|
#define __libOftp_H_proto_ |
| 12 |
|
|
|
| 13 |
|
|
/***** Feature test switches ************************************************/ |
| 14 |
|
|
/***** System headers *******************************************************/ |
| 15 |
|
|
#include <sys/types.h> |
| 16 |
|
|
#include <netinet/in.h> |
| 17 |
|
|
|
| 18 |
|
|
|
| 19 |
|
|
/***** Local headers ********************************************************/ |
| 20 |
|
|
/***** Constat values *******************************************************/ |
| 21 |
|
|
/***** Macros ***************************************************************/ |
| 22 |
|
|
/***** Typedefs *************************************************************/ |
| 23 |
|
|
typedef struct |
| 24 |
|
|
{ |
| 25 |
|
|
int socket; |
| 26 |
hirohitohigashi |
20 |
struct sockaddr_in saddr; |
| 27 |
hirohitohigashi |
17 |
enum { UNIX = 1, Windows_NT = 2 } system_type; |
| 28 |
|
|
enum { ASCII = 1, IMAGE = 3 } data_type; |
| 29 |
|
|
int flag_passive; |
| 30 |
|
|
int timeout_sec; |
| 31 |
|
|
|
| 32 |
|
|
int error_no; |
| 33 |
|
|
char error_message[256]; |
| 34 |
|
|
|
| 35 |
|
|
} LIBOFTP; |
| 36 |
|
|
|
| 37 |
|
|
|
| 38 |
|
|
/***** Global variables *****************************************************/ |
| 39 |
|
|
/***** Function prototypes **************************************************/ |
| 40 |
hirohitohigashi |
25 |
int ftp_open( LIBOFTP *ftp, const char *host, int port ); |
| 41 |
|
|
int ftp_user( LIBOFTP *ftp, const char *user, const char *pass ); |
| 42 |
hirohitohigashi |
17 |
int ftp_passive( LIBOFTP *ftp, int flag ); |
| 43 |
hirohitohigashi |
18 |
int ftp_type( LIBOFTP *ftp, const char *type ); |
| 44 |
|
|
int ftp_quit( LIBOFTP *ftp ); |
| 45 |
hirohitohigashi |
24 |
int ftp_site( LIBOFTP *ftp, const char *cmdline ); |
| 46 |
|
|
int ftp_delete( LIBOFTP *ftp, const char *fname ); |
| 47 |
|
|
int ftp_rename( LIBOFTP *ftp, const char *from, const char *to ); |
| 48 |
hirohitohigashi |
17 |
int ftp_get_buffer( LIBOFTP *ftp, const char *fname, char *buf, int bufsiz ); |
| 49 |
|
|
int ftp_put_buffer( LIBOFTP *ftp, const char *fname, char *buf, int bufsiz ); |
| 50 |
|
|
int ftp_append_buffer( LIBOFTP *ftp, const char *fname, char *buf, int bufsiz ); |
| 51 |
hirohitohigashi |
22 |
int ftp_mkdir( LIBOFTP *ftp, const char *dirname ); |
| 52 |
|
|
int ftp_rmdir( LIBOFTP *ftp, const char *dirname ); |
| 53 |
|
|
int ftp_pwd( LIBOFTP *ftp, char *buf, int bufsiz ); |
| 54 |
|
|
int ftp_cd( LIBOFTP *ftp, const char *dirname ); |
| 55 |
hirohitohigashi |
17 |
|
| 56 |
|
|
|
| 57 |
hirohitohigashi |
22 |
|
| 58 |
hirohitohigashi |
17 |
/***** Inline functions *****************************************************/ |
| 59 |
|
|
|
| 60 |
|
|
|
| 61 |
|
|
#endif |