Develop and Download Open Source Software

Browse Subversion Repository

Contents of /tags/REL-2.2/liboftp.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 55 - (show annotations) (download) (as text)
Wed Mar 24 08:04:56 2010 UTC (13 years, 11 months ago) by hirohitohigashi
File MIME type: text/x-chdr
File size: 3313 byte(s)
Tag release 2.2
1 /*
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 /* 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 /***** Macros ***************************************************************/
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 /***** Typedefs *************************************************************/
37 typedef struct
38 {
39 int socket;
40 struct sockaddr_in saddr;
41 enum { UNIX = 1, Windows_NT = 2 } system_type;
42 enum { ASCII = 1, IMAGE = 3 } data_type;
43 int flag_passive;
44 int timeout_sec;
45
46 int reply_code;
47 char error_message[256];
48
49 } LIBOFTP;
50
51
52 /***** Global variables *****************************************************/
53 /***** Function prototypes **************************************************/
54 int ftp_initialize( LIBOFTP *ftp );
55 int ftp_open( LIBOFTP *ftp, const char *host, int port );
56 int ftp_user( LIBOFTP *ftp, const char *user, const char *pass );
57 int ftp_passive( LIBOFTP *ftp, int flag );
58 int ftp_timeout( LIBOFTP *ftp, int sec );
59 int ftp_type( LIBOFTP *ftp, const char *type );
60 int ftp_quit( LIBOFTP *ftp );
61 int ftp_reset( LIBOFTP *ftp );
62 int ftp_site( LIBOFTP *ftp, const char *cmdline );
63 int ftp_delete( LIBOFTP *ftp, const char *fname );
64 int ftp_rename( LIBOFTP *ftp, const char *from, const char *to );
65
66 int ftp_get_buffer( LIBOFTP *ftp, const char *fname, char *buf, int bufsiz );
67 int ftp_put_buffer( LIBOFTP *ftp, const char *buf, int bufsiz, const char *fname );
68 int ftp_append_buffer( LIBOFTP *ftp, const char *buf, int bufsiz, const char *fname );
69 int ftp_get_file( LIBOFTP *ftp, const char *fname, const char *local_fname );
70 int ftp_put_file( LIBOFTP *ftp, const char *local_fname, const char *fname );
71 int ftp_append_file( LIBOFTP *ftp, const char *local_fname, const char *fname );
72 int ftp_get_descriptor( LIBOFTP *ftp, const char *fname );
73 int ftp_get_descriptor_close( LIBOFTP *ftp, int desc );
74 int ftp_put_descriptor( LIBOFTP *ftp, const char *fname );
75 int ftp_put_descriptor_close( LIBOFTP *ftp, int desc );
76 int ftp_append_descriptor( LIBOFTP *ftp, const char *fname );
77 int ftp_append_descriptor_close( LIBOFTP *ftp, int desc );
78
79 int ftp_list( LIBOFTP *ftp, const char *fglob, char *buf, int bufsiz );
80 int ftp_nlist( LIBOFTP *ftp, const char *fglob, char *buf, int bufsiz );
81 int ftp_mkdir( LIBOFTP *ftp, const char *dirname );
82 int ftp_rmdir( LIBOFTP *ftp, const char *dirname );
83 int ftp_pwd( LIBOFTP *ftp, char *buf, int bufsiz );
84 int ftp_cd( LIBOFTP *ftp, const char *dirname );
85
86
87
88 /***** Inline functions *****************************************************/
89
90
91 #ifdef __cplusplus
92 }
93 #endif
94
95 #endif

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