Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /trunk/liboftp.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (hide annotations) (download) (as text)
Sat Feb 28 15:03:18 2009 UTC (15 years ago) by hirohitohigashi
File MIME type: text/x-chdr
File size: 3200 byte(s)
added get/put functions by descriptor.

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 hirohitohigashi 29 /* LIBOFTP ERROR CODE */
22     #define LIBOFTP_NOERROR 0
23     #define LIBOFTP_ERROR_OS -1
24     #define LIBOFTP_ERROR_PROTOCOL -2
25     #define LIBOFTP_ERROR -3
26     #define LIBOFTP_ERROR_BUFFER -4
27     #define LIBOFTP_ERROR_TIMEOUT -5
28    
29    
30 hirohitohigashi 17 /***** Macros ***************************************************************/
31     /***** Typedefs *************************************************************/
32     typedef struct
33     {
34     int socket;
35 hirohitohigashi 20 struct sockaddr_in saddr;
36 hirohitohigashi 17 enum { UNIX = 1, Windows_NT = 2 } system_type;
37     enum { ASCII = 1, IMAGE = 3 } data_type;
38     int flag_passive;
39     int timeout_sec;
40 hirohitohigashi 29
41     int reply_code;
42 hirohitohigashi 17 char error_message[256];
43    
44     } LIBOFTP;
45    
46    
47     /***** Global variables *****************************************************/
48     /***** Function prototypes **************************************************/
49 hirohitohigashi 29 int ftp_initialize( LIBOFTP *ftp );
50 hirohitohigashi 25 int ftp_open( LIBOFTP *ftp, const char *host, int port );
51     int ftp_user( LIBOFTP *ftp, const char *user, const char *pass );
52 hirohitohigashi 17 int ftp_passive( LIBOFTP *ftp, int flag );
53 hirohitohigashi 29 int ftp_timeout( LIBOFTP *ftp, int sec );
54 hirohitohigashi 18 int ftp_type( LIBOFTP *ftp, const char *type );
55     int ftp_quit( LIBOFTP *ftp );
56 hirohitohigashi 24 int ftp_site( LIBOFTP *ftp, const char *cmdline );
57     int ftp_delete( LIBOFTP *ftp, const char *fname );
58     int ftp_rename( LIBOFTP *ftp, const char *from, const char *to );
59 hirohitohigashi 27
60 hirohitohigashi 17 int ftp_get_buffer( LIBOFTP *ftp, const char *fname, char *buf, int bufsiz );
61 hirohitohigashi 27 int ftp_put_buffer( LIBOFTP *ftp, char *buf, int bufsiz, const char *fname );
62     int ftp_append_buffer( LIBOFTP *ftp, char *buf, int bufsiz, const char *fname );
63 hirohitohigashi 28 int ftp_get_file( LIBOFTP *ftp, const char *fname, const char *local_fname );
64     int ftp_put_file( LIBOFTP *ftp, const char *local_fname, const char *fname );
65     int ftp_append_file( LIBOFTP *ftp, const char *local_fname, const char *fname );
66 hirohitohigashi 32 int ftp_get_descriptor( LIBOFTP *ftp, const char *fname );
67     int ftp_get_descriptor_close( LIBOFTP *ftp, int desc );
68     int ftp_put_descriptor( LIBOFTP *ftp, const char *fname );
69     int ftp_put_descriptor_close( LIBOFTP *ftp, int desc );
70     int ftp_append_descriptor( LIBOFTP *ftp, const char *fname );
71     int ftp_append_descriptor_close( LIBOFTP *ftp, int desc );
72 hirohitohigashi 27
73 hirohitohigashi 26 int ftp_list( LIBOFTP *ftp, const char *fglob, char *buf, int bufsiz );
74     int ftp_nlist( LIBOFTP *ftp, const char *fglob, char *buf, int bufsiz );
75 hirohitohigashi 22 int ftp_mkdir( LIBOFTP *ftp, const char *dirname );
76     int ftp_rmdir( LIBOFTP *ftp, const char *dirname );
77     int ftp_pwd( LIBOFTP *ftp, char *buf, int bufsiz );
78     int ftp_cd( LIBOFTP *ftp, const char *dirname );
79 hirohitohigashi 17
80    
81 hirohitohigashi 22
82 hirohitohigashi 17 /***** Inline functions *****************************************************/
83    
84    
85     #endif

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26