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 #ifdef __cplusplus
00033 extern "C" {
00034 #endif
00035
00036
00037 typedef struct
00038 {
00039 int socket;
00040 struct sockaddr_in saddr;
00041 enum { UNIX = 1, Windows_NT = 2 } system_type;
00042 enum { ASCII = 1, IMAGE = 3 } data_type;
00043 int flag_passive;
00044 int timeout_sec;
00045
00046 int reply_code;
00047 char error_message[256];
00048
00049 } LIBOFTP;
00050
00051
00052
00053
00054 int ftp_initialize( LIBOFTP *ftp );
00055 int ftp_open( LIBOFTP *ftp, const char *host, int port );
00056 int ftp_user( LIBOFTP *ftp, const char *user, const char *pass );
00057 int ftp_passive( LIBOFTP *ftp, int flag );
00058 int ftp_timeout( LIBOFTP *ftp, int sec );
00059 int ftp_type( LIBOFTP *ftp, const char *type );
00060 int ftp_quit( LIBOFTP *ftp );
00061 int ftp_reset( LIBOFTP *ftp );
00062 int ftp_site( LIBOFTP *ftp, const char *cmdline );
00063 int ftp_delete( LIBOFTP *ftp, const char *fname );
00064 int ftp_rename( LIBOFTP *ftp, const char *from, const char *to );
00065
00066 int ftp_get_buffer( LIBOFTP *ftp, const char *fname, char *buf, int bufsiz );
00067 int ftp_put_buffer( LIBOFTP *ftp, const char *buf, int bufsiz, const char *fname );
00068 int ftp_append_buffer( LIBOFTP *ftp, const char *buf, int bufsiz, const char *fname );
00069 int ftp_get_file( LIBOFTP *ftp, const char *fname, const char *local_fname );
00070 int ftp_put_file( LIBOFTP *ftp, const char *local_fname, const char *fname );
00071 int ftp_append_file( LIBOFTP *ftp, const char *local_fname, const char *fname );
00072 int ftp_get_descriptor( LIBOFTP *ftp, const char *fname );
00073 int ftp_get_descriptor_close( LIBOFTP *ftp, int desc );
00074 int ftp_put_descriptor( LIBOFTP *ftp, const char *fname );
00075 int ftp_put_descriptor_close( LIBOFTP *ftp, int desc );
00076 int ftp_append_descriptor( LIBOFTP *ftp, const char *fname );
00077 int ftp_append_descriptor_close( LIBOFTP *ftp, int desc );
00078
00079 int ftp_list( LIBOFTP *ftp, const char *fglob, char *buf, int bufsiz );
00080 int ftp_nlist( LIBOFTP *ftp, const char *fglob, char *buf, int bufsiz );
00081 int ftp_mkdir( LIBOFTP *ftp, const char *dirname );
00082 int ftp_rmdir( LIBOFTP *ftp, const char *dirname );
00083 int ftp_pwd( LIBOFTP *ftp, char *buf, int bufsiz );
00084 int ftp_cd( LIBOFTP *ftp, const char *dirname );
00085
00086
00087
00088
00089
00090
00091 #ifdef __cplusplus
00092 }
00093 #endif
00094
00095 #endif