|
1 /* |
|
2 * Summary: minimal FTP implementation |
|
3 * Description: minimal FTP implementation allowing to fetch resources |
|
4 * like external subset. |
|
5 * |
|
6 * Copy: See Copyright for the status of this software. |
|
7 * |
|
8 * Author: Daniel Veillard |
|
9 */ |
|
10 |
|
11 #ifndef __NANO_FTP_H__ |
|
12 #define __NANO_FTP_H__ |
|
13 |
|
14 #include <libxml/xmlversion.h> |
|
15 |
|
16 #ifdef LIBXML_FTP_ENABLED |
|
17 |
|
18 #ifdef __cplusplus |
|
19 extern "C" { |
|
20 #endif |
|
21 |
|
22 /** |
|
23 * ftpListCallback: |
|
24 * @userData: user provided data for the callback |
|
25 * @filename: the file name (including "->" when links are shown) |
|
26 * @attrib: the attribute string |
|
27 * @owner: the owner string |
|
28 * @group: the group string |
|
29 * @size: the file size |
|
30 * @links: the link count |
|
31 * @year: the year |
|
32 * @month: the month |
|
33 * @day: the day |
|
34 * @hour: the hour |
|
35 * @minute: the minute |
|
36 * |
|
37 * A callback for the xmlNanoFTPList command. |
|
38 * Note that only one of year and day:minute are specified. |
|
39 */ |
|
40 typedef void (*ftpListCallback) (void *userData, |
|
41 const char *filename, const char *attrib, |
|
42 const char *owner, const char *group, |
|
43 unsigned long size, int links, int year, |
|
44 const char *month, int day, int hour, |
|
45 int minute); |
|
46 /** |
|
47 * ftpDataCallback: |
|
48 * @userData: the user provided context |
|
49 * @data: the data received |
|
50 * @len: its size in bytes |
|
51 * |
|
52 * A callback for the xmlNanoFTPGet command. |
|
53 */ |
|
54 typedef void (*ftpDataCallback) (void *userData, |
|
55 const char *data, |
|
56 int len); |
|
57 |
|
58 /* |
|
59 * Init |
|
60 */ |
|
61 XMLPUBFUN void XMLCALL |
|
62 xmlNanoFTPInit (void); |
|
63 XMLPUBFUN void XMLCALL |
|
64 xmlNanoFTPCleanup (void); |
|
65 |
|
66 /* |
|
67 * Creating/freeing contexts. |
|
68 */ |
|
69 XMLPUBFUN void * XMLCALL |
|
70 xmlNanoFTPNewCtxt (const char *URL); |
|
71 XMLPUBFUN void XMLCALL |
|
72 xmlNanoFTPFreeCtxt (void * ctx); |
|
73 XMLPUBFUN void * XMLCALL |
|
74 xmlNanoFTPConnectTo (const char *server, |
|
75 int port); |
|
76 /* |
|
77 * Opening/closing session connections. |
|
78 */ |
|
79 XMLPUBFUN void * XMLCALL |
|
80 xmlNanoFTPOpen (const char *URL); |
|
81 XMLPUBFUN int XMLCALL |
|
82 xmlNanoFTPConnect (void *ctx); |
|
83 XMLPUBFUN int XMLCALL |
|
84 xmlNanoFTPClose (void *ctx); |
|
85 XMLPUBFUN int XMLCALL |
|
86 xmlNanoFTPQuit (void *ctx); |
|
87 XMLPUBFUN void XMLCALL |
|
88 xmlNanoFTPScanProxy (const char *URL); |
|
89 XMLPUBFUN void XMLCALL |
|
90 xmlNanoFTPProxy (const char *host, |
|
91 int port, |
|
92 const char *user, |
|
93 const char *passwd, |
|
94 int type); |
|
95 XMLPUBFUN int XMLCALL |
|
96 xmlNanoFTPUpdateURL (void *ctx, |
|
97 const char *URL); |
|
98 |
|
99 /* |
|
100 * Rather internal commands. |
|
101 */ |
|
102 XMLPUBFUN int XMLCALL |
|
103 xmlNanoFTPGetResponse (void *ctx); |
|
104 XMLPUBFUN int XMLCALL |
|
105 xmlNanoFTPCheckResponse (void *ctx); |
|
106 |
|
107 /* |
|
108 * CD/DIR/GET handlers. |
|
109 */ |
|
110 XMLPUBFUN int XMLCALL |
|
111 xmlNanoFTPCwd (void *ctx, |
|
112 const char *directory); |
|
113 XMLPUBFUN int XMLCALL |
|
114 xmlNanoFTPDele (void *ctx, |
|
115 const char *file); |
|
116 |
|
117 XMLPUBFUN int XMLCALL |
|
118 xmlNanoFTPGetConnection (void *ctx); |
|
119 XMLPUBFUN int XMLCALL |
|
120 xmlNanoFTPCloseConnection(void *ctx); |
|
121 XMLPUBFUN int XMLCALL |
|
122 xmlNanoFTPList (void *ctx, |
|
123 ftpListCallback callback, |
|
124 void *userData, |
|
125 const char *filename); |
|
126 XMLPUBFUN int XMLCALL |
|
127 xmlNanoFTPGetSocket (void *ctx, |
|
128 const char *filename); |
|
129 XMLPUBFUN int XMLCALL |
|
130 xmlNanoFTPGet (void *ctx, |
|
131 ftpDataCallback callback, |
|
132 void *userData, |
|
133 const char *filename); |
|
134 XMLPUBFUN int XMLCALL |
|
135 xmlNanoFTPRead (void *ctx, |
|
136 void *dest, |
|
137 int len); |
|
138 |
|
139 #ifdef __cplusplus |
|
140 } |
|
141 #endif |
|
142 #endif /* LIBXML_FTP_ENABLED */ |
|
143 #endif /* __NANO_FTP_H__ */ |