blob: 53465280d21f9fe631c73bbd4a8abcde8ff19a18 [file] [log] [blame]
Owen Taylor3473f882001-02-23 17:55:21 +00001/*
2 * nanohttp.c: minimalist FTP implementation to fetch external subsets.
3 *
4 * See Copyright for the status of this software.
5 *
6 * Daniel.Veillard@w3.org
7 */
8
9#ifndef __NANO_FTP_H__
10#define __NANO_FTP_H__
11
12#include <libxml/xmlversion.h>
13#ifdef LIBXML_FTP_ENABLED
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/**
20 * ftpListCallback:
21 * @userData: user provided data for the callback
22 * @filename: the file name (including "->" when links are shown)
23 * @attrib: the attribute string
24 * @owner: the owner string
25 * @group: the group string
26 * @size: the file size
27 * @links: the link count
28 * @year: the year
29 * @month: the month
30 * @day: the day
31 * @hour: the hour
32 * @minute: the minute
33 *
34 * A callback for the xmlNanoFTPList command
35 * Note that only one of year and day:minute are specified
36 */
37typedef void (*ftpListCallback) (void *userData,
38 const char *filename, const char* attrib,
39 const char *owner, const char *group,
40 unsigned long size, int links, int year,
41 const char *month, int day, int hour,
42 int minute);
43/**
44 * ftpDataCallback:
45 * A callback for the xmlNanoFTPGet command
46 */
47typedef void (*ftpDataCallback) (void *userData, const char *data, int len);
48
49/*
50 * Init
51 */
52void xmlNanoFTPInit (void);
53void xmlNanoFTPCleanup (void);
54
55/*
56 * Creating/freeing contexts
57 */
58void * xmlNanoFTPNewCtxt (const char *URL);
59void xmlNanoFTPFreeCtxt (void * ctx);
60void * xmlNanoFTPConnectTo (const char *server,
61 int port);
62/*
63 * Opening/closing session connections
64 */
65void * xmlNanoFTPOpen (const char *URL);
66int xmlNanoFTPConnect (void *ctx);
67int xmlNanoFTPClose (void *ctx);
68int xmlNanoFTPQuit (void *ctx);
69void xmlNanoFTPScanProxy (const char *URL);
70void xmlNanoFTPProxy (const char *host,
71 int port,
72 const char *user,
73 const char *passwd,
74 int type);
75int xmlNanoFTPUpdateURL (void *ctx,
76 const char *URL);
77
78/*
79 * Rathern internal commands
80 */
81int xmlNanoFTPGetResponse (void *ctx);
82int xmlNanoFTPCheckResponse (void *ctx);
83
84/*
85 * CD/DIR/GET handlers
86 */
87int xmlNanoFTPCwd (void *ctx,
88 char *directory);
89
90int xmlNanoFTPGetConnection (void *ctx);
91int xmlNanoFTPCloseConnection(void *ctx);
92int xmlNanoFTPList (void *ctx,
93 ftpListCallback callback,
94 void *userData,
95 char *filename);
96int xmlNanoFTPGetSocket (void *ctx,
97 const char *filename);
98int xmlNanoFTPGet (void *ctx,
99 ftpDataCallback callback,
100 void *userData,
101 const char *filename);
102int xmlNanoFTPRead (void *ctx,
103 void *dest,
104 int len);
105
106#ifdef __cplusplus
107}
108#endif /* LIBXML_FTP_ENABLED */
109#endif
110#endif /* __NANO_FTP_H__ */