blob: 53465280d21f9fe631c73bbd4a8abcde8ff19a18 [file] [log] [blame]
Daniel Veillardda07c342000-01-25 18:31:22 +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__
Daniel Veillard361d8452000-04-03 19:48:13 +000011
12#include <libxml/xmlversion.h>
13#ifdef LIBXML_FTP_ENABLED
14
Daniel Veillardda07c342000-01-25 18:31:22 +000015#ifdef __cplusplus
16extern "C" {
17#endif
18
Daniel Veillardaeea04f2000-01-25 19:27:27 +000019/**
20 * ftpListCallback:
Daniel Veillarde41f2b72000-01-30 20:00:07 +000021 * @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 *
Daniel Veillardaeea04f2000-01-25 19:27:27 +000034 * A callback for the xmlNanoFTPList command
Daniel Veillarde41f2b72000-01-30 20:00:07 +000035 * Note that only one of year and day:minute are specified
Daniel Veillardaeea04f2000-01-25 19:27:27 +000036 */
Daniel Veillardda07c342000-01-25 18:31:22 +000037typedef 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,
Daniel Veillarde41f2b72000-01-30 20:00:07 +000041 const char *month, int day, int hour,
42 int minute);
Daniel Veillardaeea04f2000-01-25 19:27:27 +000043/**
44 * ftpDataCallback:
45 * A callback for the xmlNanoFTPGet command
46 */
Daniel Veillardda07c342000-01-25 18:31:22 +000047typedef void (*ftpDataCallback) (void *userData, const char *data, int len);
48
Daniel Veillardaeea04f2000-01-25 19:27:27 +000049/*
50 * Init
51 */
52void xmlNanoFTPInit (void);
Daniel Veillarde41f2b72000-01-30 20:00:07 +000053void xmlNanoFTPCleanup (void);
Daniel Veillardda07c342000-01-25 18:31:22 +000054
Daniel Veillardaeea04f2000-01-25 19:27:27 +000055/*
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);
Daniel Veillardda07c342000-01-25 18:31:22 +000067int xmlNanoFTPClose (void *ctx);
Daniel Veillardaeea04f2000-01-25 19:27:27 +000068int xmlNanoFTPQuit (void *ctx);
Daniel Veillarde41f2b72000-01-30 20:00:07 +000069void 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);
Daniel Veillardaeea04f2000-01-25 19:27:27 +000077
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,
Daniel Veillardda07c342000-01-25 18:31:22 +0000101 const char *filename);
102int xmlNanoFTPRead (void *ctx,
103 void *dest,
104 int len);
Daniel Veillardaeea04f2000-01-25 19:27:27 +0000105
Daniel Veillardda07c342000-01-25 18:31:22 +0000106#ifdef __cplusplus
107}
Daniel Veillard361d8452000-04-03 19:48:13 +0000108#endif /* LIBXML_FTP_ENABLED */
Daniel Veillardda07c342000-01-25 18:31:22 +0000109#endif
110#endif /* __NANO_FTP_H__ */