00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __libOftp_H_proto_
00011 #define __libOftp_H_proto_
00012
00013
00014
00015 #include <sys/types.h>
00016 #include <netinet/in.h>
00017
00018
00019
00020
00021
00022 #define LIBOFTP_NOERROR 0
00023 #define LIBOFTP_ERROR_OS -1
00024 #define LIBOFTP_ERROR_PROTOCOL -2
00025 #define LIBOFTP_ERROR -3
00026 #define LIBOFTP_ERROR_BUFFER -4
00027 #define LIBOFTP_ERROR_TIMEOUT -5
00028
00029
00030
00031
00032 typedef struct
00033 {
00034 int socket;
00035 struct sockaddr_in saddr;
00036 enum { UNIX = 1, Windows_NT = 2 } system_type;
00037 enum { ASCII = 1, IMAGE = 3 } data_type;
00038 int flag_passive;
00039 int timeout_sec;
00040
00041 int reply_code;
00042 char error_message[256];
00043
00044 } LIBOFTP;
00045
00046
00047
00048
00049 #ifdef __cplusplus
00050 extern "C" {
00051 #endif
00052
00053 int ftp_initialize( LIBOFTP *ftp );
00054 int ftp_open( LIBOFTP *ftp, const char *host, int port );
00055 int ftp_user( LIBOFTP *ftp, const char *user, const char *pass );
00056 int ftp_passive( LIBOFTP *ftp, int flag );
00057 int ftp_timeout( LIBOFTP *ftp, int sec );
00058 int ftp_type( LIBOFTP *ftp, const char *type );
00059 int ftp_quit( LIBOFTP *ftp );
00060 int ftp_reset( LIBOFTP *ftp );
00061 int ftp_site( LIBOFTP *ftp, const char *cmdline );
00062 int ftp_delete( LIBOFTP *ftp, const char *fname );
00063 int ftp_rename( LIBOFTP *ftp, const char *from, const char *to );
00064
00065 int ftp_get_buffer( LIBOFTP *ftp, const char *fname, char *buf, int bufsiz );
00066 int ftp_put_buffer( LIBOFTP *ftp, const char *buf, int bufsiz, const char *fname );
00067 int ftp_append_buffer( LIBOFTP *ftp, const char *buf, int bufsiz, const char *fname );
00068 int ftp_get_file( LIBOFTP *ftp, const char *fname, const char *local_fname );
00069 int ftp_put_file( LIBOFTP *ftp, const char *local_fname, const char *fname );
00070 int ftp_append_file( LIBOFTP *ftp, const char *local_fname, const char *fname );
00071 int ftp_get_descriptor( LIBOFTP *ftp, const char *fname );
00072 int ftp_get_descriptor_close( LIBOFTP *ftp, int desc );
00073 int ftp_put_descriptor( LIBOFTP *ftp, const char *fname );
00074 int ftp_put_descriptor_close( LIBOFTP *ftp, int desc );
00075 int ftp_append_descriptor( LIBOFTP *ftp, const char *fname );
00076 int ftp_append_descriptor_close( LIBOFTP *ftp, int desc );
00077
00078 int ftp_list( LIBOFTP *ftp, const char *fglob, char *buf, int bufsiz );
00079 int ftp_nlist( LIBOFTP *ftp, const char *fglob, char *buf, int bufsiz );
00080 int ftp_mkdir( LIBOFTP *ftp, const char *dirname );
00081 int ftp_rmdir( LIBOFTP *ftp, const char *dirname );
00082 int ftp_pwd( LIBOFTP *ftp, char *buf, int bufsiz );
00083 int ftp_cd( LIBOFTP *ftp, const char *dirname );
00084
00085
00086
00087
00088
00089
00090 #ifdef __cplusplus
00091 }
00092 #endif
00093
00094 #endif