blob: cf334201c4af48894f4b060465d749ab715bd319 [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:
Daniel Veillardf69bb4b2001-05-19 13:24:56 +000045 * @userData: the user provided context
46 * @data: the data received
47 * @len: its size in bytes
48 *
Owen Taylor3473f882001-02-23 17:55:21 +000049 * A callback for the xmlNanoFTPGet command
50 */
51typedef void (*ftpDataCallback) (void *userData, const char *data, int len);
52
53/*
54 * Init
55 */
56void xmlNanoFTPInit (void);
57void xmlNanoFTPCleanup (void);
58
59/*
60 * Creating/freeing contexts
61 */
62void * xmlNanoFTPNewCtxt (const char *URL);
63void xmlNanoFTPFreeCtxt (void * ctx);
64void * xmlNanoFTPConnectTo (const char *server,
65 int port);
66/*
67 * Opening/closing session connections
68 */
69void * xmlNanoFTPOpen (const char *URL);
70int xmlNanoFTPConnect (void *ctx);
71int xmlNanoFTPClose (void *ctx);
72int xmlNanoFTPQuit (void *ctx);
73void xmlNanoFTPScanProxy (const char *URL);
74void xmlNanoFTPProxy (const char *host,
75 int port,
76 const char *user,
77 const char *passwd,
78 int type);
79int xmlNanoFTPUpdateURL (void *ctx,
80 const char *URL);
81
82/*
83 * Rathern internal commands
84 */
85int xmlNanoFTPGetResponse (void *ctx);
86int xmlNanoFTPCheckResponse (void *ctx);
87
88/*
89 * CD/DIR/GET handlers
90 */
91int xmlNanoFTPCwd (void *ctx,
92 char *directory);
93
94int xmlNanoFTPGetConnection (void *ctx);
95int xmlNanoFTPCloseConnection(void *ctx);
96int xmlNanoFTPList (void *ctx,
97 ftpListCallback callback,
98 void *userData,
99 char *filename);
100int xmlNanoFTPGetSocket (void *ctx,
101 const char *filename);
102int xmlNanoFTPGet (void *ctx,
103 ftpDataCallback callback,
104 void *userData,
105 const char *filename);
106int xmlNanoFTPRead (void *ctx,
107 void *dest,
108 int len);
109
110#ifdef __cplusplus
111}
112#endif /* LIBXML_FTP_ENABLED */
113#endif
114#endif /* __NANO_FTP_H__ */