blob: df45a6eea72790ed086f40b786739b3980a95262 [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 *
Daniel Veillardc5d64342001-06-24 12:13:24 +00006 * daniel@veillard.com
Owen Taylor3473f882001-02-23 17:55:21 +00007 */
8
9#ifndef __NANO_FTP_H__
10#define __NANO_FTP_H__
11
Daniel Veillardc5d64342001-06-24 12:13:24 +000012#if defined(WIN32) && defined(_MSC_VER)
13#include <libxml/xmlwin32version.h>
14#else
Owen Taylor3473f882001-02-23 17:55:21 +000015#include <libxml/xmlversion.h>
Daniel Veillardc5d64342001-06-24 12:13:24 +000016#endif
Owen Taylor3473f882001-02-23 17:55:21 +000017#ifdef LIBXML_FTP_ENABLED
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23/**
24 * ftpListCallback:
25 * @userData: user provided data for the callback
26 * @filename: the file name (including "->" when links are shown)
27 * @attrib: the attribute string
28 * @owner: the owner string
29 * @group: the group string
30 * @size: the file size
31 * @links: the link count
32 * @year: the year
33 * @month: the month
34 * @day: the day
35 * @hour: the hour
36 * @minute: the minute
37 *
38 * A callback for the xmlNanoFTPList command
39 * Note that only one of year and day:minute are specified
40 */
41typedef void (*ftpListCallback) (void *userData,
Daniel Veillard963d2ae2002-01-20 22:08:18 +000042 const char *filename, const char *attrib,
Owen Taylor3473f882001-02-23 17:55:21 +000043 const char *owner, const char *group,
44 unsigned long size, int links, int year,
45 const char *month, int day, int hour,
46 int minute);
47/**
48 * ftpDataCallback:
Daniel Veillardf69bb4b2001-05-19 13:24:56 +000049 * @userData: the user provided context
50 * @data: the data received
51 * @len: its size in bytes
52 *
Owen Taylor3473f882001-02-23 17:55:21 +000053 * A callback for the xmlNanoFTPGet command
54 */
Daniel Veillard963d2ae2002-01-20 22:08:18 +000055typedef void (*ftpDataCallback) (void *userData,
56 const char *data,
57 int len);
Owen Taylor3473f882001-02-23 17:55:21 +000058
59/*
60 * Init
61 */
62void xmlNanoFTPInit (void);
63void xmlNanoFTPCleanup (void);
64
65/*
66 * Creating/freeing contexts
67 */
68void * xmlNanoFTPNewCtxt (const char *URL);
69void xmlNanoFTPFreeCtxt (void * ctx);
70void * xmlNanoFTPConnectTo (const char *server,
71 int port);
72/*
73 * Opening/closing session connections
74 */
75void * xmlNanoFTPOpen (const char *URL);
76int xmlNanoFTPConnect (void *ctx);
77int xmlNanoFTPClose (void *ctx);
78int xmlNanoFTPQuit (void *ctx);
79void xmlNanoFTPScanProxy (const char *URL);
80void xmlNanoFTPProxy (const char *host,
81 int port,
82 const char *user,
83 const char *passwd,
84 int type);
85int xmlNanoFTPUpdateURL (void *ctx,
86 const char *URL);
87
88/*
89 * Rathern internal commands
90 */
91int xmlNanoFTPGetResponse (void *ctx);
92int xmlNanoFTPCheckResponse (void *ctx);
93
94/*
95 * CD/DIR/GET handlers
96 */
97int xmlNanoFTPCwd (void *ctx,
98 char *directory);
99
100int xmlNanoFTPGetConnection (void *ctx);
101int xmlNanoFTPCloseConnection(void *ctx);
102int xmlNanoFTPList (void *ctx,
103 ftpListCallback callback,
104 void *userData,
105 char *filename);
106int xmlNanoFTPGetSocket (void *ctx,
107 const char *filename);
108int xmlNanoFTPGet (void *ctx,
109 ftpDataCallback callback,
110 void *userData,
111 const char *filename);
112int xmlNanoFTPRead (void *ctx,
113 void *dest,
114 int len);
115
116#ifdef __cplusplus
117}
118#endif /* LIBXML_FTP_ENABLED */
119#endif
120#endif /* __NANO_FTP_H__ */