blob: f19194dbfbf66b058eefe1310dabeffe6aa69822 [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
12#include <libxml/xmlversion.h>
Igor Zlatkovic7ae91bc2002-11-08 17:18:52 +000013
Owen Taylor3473f882001-02-23 17:55:21 +000014#ifdef LIBXML_FTP_ENABLED
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20/**
21 * ftpListCallback:
22 * @userData: user provided data for the callback
23 * @filename: the file name (including "->" when links are shown)
24 * @attrib: the attribute string
25 * @owner: the owner string
26 * @group: the group string
27 * @size: the file size
28 * @links: the link count
29 * @year: the year
30 * @month: the month
31 * @day: the day
32 * @hour: the hour
33 * @minute: the minute
34 *
Daniel Veillard61f26172002-03-12 18:46:39 +000035 * A callback for the xmlNanoFTPList command.
36 * Note that only one of year and day:minute are specified.
Owen Taylor3473f882001-02-23 17:55:21 +000037 */
38typedef void (*ftpListCallback) (void *userData,
Daniel Veillard963d2ae2002-01-20 22:08:18 +000039 const char *filename, const char *attrib,
Owen Taylor3473f882001-02-23 17:55:21 +000040 const char *owner, const char *group,
41 unsigned long size, int links, int year,
42 const char *month, int day, int hour,
43 int minute);
44/**
45 * ftpDataCallback:
Daniel Veillardf69bb4b2001-05-19 13:24:56 +000046 * @userData: the user provided context
47 * @data: the data received
48 * @len: its size in bytes
49 *
Daniel Veillard61f26172002-03-12 18:46:39 +000050 * A callback for the xmlNanoFTPGet command.
Owen Taylor3473f882001-02-23 17:55:21 +000051 */
Daniel Veillard963d2ae2002-01-20 22:08:18 +000052typedef void (*ftpDataCallback) (void *userData,
53 const char *data,
54 int len);
Owen Taylor3473f882001-02-23 17:55:21 +000055
56/*
57 * Init
58 */
59void xmlNanoFTPInit (void);
60void xmlNanoFTPCleanup (void);
61
62/*
Daniel Veillard61f26172002-03-12 18:46:39 +000063 * Creating/freeing contexts.
Owen Taylor3473f882001-02-23 17:55:21 +000064 */
65void * xmlNanoFTPNewCtxt (const char *URL);
66void xmlNanoFTPFreeCtxt (void * ctx);
67void * xmlNanoFTPConnectTo (const char *server,
68 int port);
69/*
Daniel Veillard61f26172002-03-12 18:46:39 +000070 * Opening/closing session connections.
Owen Taylor3473f882001-02-23 17:55:21 +000071 */
72void * xmlNanoFTPOpen (const char *URL);
73int xmlNanoFTPConnect (void *ctx);
74int xmlNanoFTPClose (void *ctx);
75int xmlNanoFTPQuit (void *ctx);
76void xmlNanoFTPScanProxy (const char *URL);
77void xmlNanoFTPProxy (const char *host,
78 int port,
79 const char *user,
80 const char *passwd,
81 int type);
82int xmlNanoFTPUpdateURL (void *ctx,
83 const char *URL);
84
85/*
Daniel Veillard61f26172002-03-12 18:46:39 +000086 * Rather internal commands.
Owen Taylor3473f882001-02-23 17:55:21 +000087 */
88int xmlNanoFTPGetResponse (void *ctx);
89int xmlNanoFTPCheckResponse (void *ctx);
90
91/*
Daniel Veillard61f26172002-03-12 18:46:39 +000092 * CD/DIR/GET handlers.
Owen Taylor3473f882001-02-23 17:55:21 +000093 */
94int xmlNanoFTPCwd (void *ctx,
95 char *directory);
Daniel Veillard6c73cb82003-03-05 16:45:40 +000096int xmlNanoFTPDele (void *ctx,
97 char *file);
Owen Taylor3473f882001-02-23 17:55:21 +000098
99int xmlNanoFTPGetConnection (void *ctx);
100int xmlNanoFTPCloseConnection(void *ctx);
101int xmlNanoFTPList (void *ctx,
102 ftpListCallback callback,
103 void *userData,
104 char *filename);
105int xmlNanoFTPGetSocket (void *ctx,
106 const char *filename);
107int xmlNanoFTPGet (void *ctx,
108 ftpDataCallback callback,
109 void *userData,
110 const char *filename);
111int xmlNanoFTPRead (void *ctx,
112 void *dest,
113 int len);
114
115#ifdef __cplusplus
116}
117#endif /* LIBXML_FTP_ENABLED */
118#endif
119#endif /* __NANO_FTP_H__ */