blob: 01fadb8295161212cd4076320bf28dc0f790973d [file] [log] [blame]
Owen Taylor3473f882001-02-23 17:55:21 +00001/*
Daniel Veillardbe586972003-11-18 20:56:51 +00002 * Summary: minimal FTP implementation
3 * Description: minimal FTP implementation allowing to fetch resources
4 * like external subset.
Owen Taylor3473f882001-02-23 17:55:21 +00005 *
Daniel Veillardbe586972003-11-18 20:56:51 +00006 * Copy: See Copyright for the status of this software.
Owen Taylor3473f882001-02-23 17:55:21 +00007 *
Daniel Veillardbe586972003-11-18 20:56:51 +00008 * Author: Daniel Veillard
Owen Taylor3473f882001-02-23 17:55:21 +00009 */
10
11#ifndef __NANO_FTP_H__
12#define __NANO_FTP_H__
13
14#include <libxml/xmlversion.h>
Igor Zlatkovic7ae91bc2002-11-08 17:18:52 +000015
Owen Taylor3473f882001-02-23 17:55:21 +000016#ifdef LIBXML_FTP_ENABLED
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22/**
23 * ftpListCallback:
24 * @userData: user provided data for the callback
25 * @filename: the file name (including "->" when links are shown)
26 * @attrib: the attribute string
27 * @owner: the owner string
28 * @group: the group string
29 * @size: the file size
30 * @links: the link count
31 * @year: the year
32 * @month: the month
33 * @day: the day
34 * @hour: the hour
35 * @minute: the minute
36 *
Daniel Veillard61f26172002-03-12 18:46:39 +000037 * A callback for the xmlNanoFTPList command.
38 * Note that only one of year and day:minute are specified.
Owen Taylor3473f882001-02-23 17:55:21 +000039 */
40typedef void (*ftpListCallback) (void *userData,
Daniel Veillard963d2ae2002-01-20 22:08:18 +000041 const char *filename, const char *attrib,
Owen Taylor3473f882001-02-23 17:55:21 +000042 const char *owner, const char *group,
43 unsigned long size, int links, int year,
44 const char *month, int day, int hour,
45 int minute);
46/**
47 * ftpDataCallback:
Daniel Veillardf69bb4b2001-05-19 13:24:56 +000048 * @userData: the user provided context
49 * @data: the data received
50 * @len: its size in bytes
51 *
Daniel Veillard61f26172002-03-12 18:46:39 +000052 * A callback for the xmlNanoFTPGet command.
Owen Taylor3473f882001-02-23 17:55:21 +000053 */
Daniel Veillard963d2ae2002-01-20 22:08:18 +000054typedef void (*ftpDataCallback) (void *userData,
55 const char *data,
56 int len);
Owen Taylor3473f882001-02-23 17:55:21 +000057
58/*
59 * Init
60 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +000061XMLPUBFUN void XMLCALL
62 xmlNanoFTPInit (void);
63XMLPUBFUN void XMLCALL
64 xmlNanoFTPCleanup (void);
Owen Taylor3473f882001-02-23 17:55:21 +000065
66/*
Daniel Veillard61f26172002-03-12 18:46:39 +000067 * Creating/freeing contexts.
Owen Taylor3473f882001-02-23 17:55:21 +000068 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +000069XMLPUBFUN void * XMLCALL
70 xmlNanoFTPNewCtxt (const char *URL);
71XMLPUBFUN void XMLCALL
72 xmlNanoFTPFreeCtxt (void * ctx);
73XMLPUBFUN void * XMLCALL
74 xmlNanoFTPConnectTo (const char *server,
Owen Taylor3473f882001-02-23 17:55:21 +000075 int port);
76/*
Daniel Veillard61f26172002-03-12 18:46:39 +000077 * Opening/closing session connections.
Owen Taylor3473f882001-02-23 17:55:21 +000078 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +000079XMLPUBFUN void * XMLCALL
80 xmlNanoFTPOpen (const char *URL);
81XMLPUBFUN int XMLCALL
82 xmlNanoFTPConnect (void *ctx);
83XMLPUBFUN int XMLCALL
84 xmlNanoFTPClose (void *ctx);
85XMLPUBFUN int XMLCALL
86 xmlNanoFTPQuit (void *ctx);
87XMLPUBFUN void XMLCALL
88 xmlNanoFTPScanProxy (const char *URL);
89XMLPUBFUN void XMLCALL
90 xmlNanoFTPProxy (const char *host,
Owen Taylor3473f882001-02-23 17:55:21 +000091 int port,
92 const char *user,
93 const char *passwd,
94 int type);
Igor Zlatkovic76874e42003-08-25 09:05:12 +000095XMLPUBFUN int XMLCALL
96 xmlNanoFTPUpdateURL (void *ctx,
Owen Taylor3473f882001-02-23 17:55:21 +000097 const char *URL);
98
99/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000100 * Rather internal commands.
Owen Taylor3473f882001-02-23 17:55:21 +0000101 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000102XMLPUBFUN int XMLCALL
103 xmlNanoFTPGetResponse (void *ctx);
104XMLPUBFUN int XMLCALL
105 xmlNanoFTPCheckResponse (void *ctx);
Owen Taylor3473f882001-02-23 17:55:21 +0000106
107/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000108 * CD/DIR/GET handlers.
Owen Taylor3473f882001-02-23 17:55:21 +0000109 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000110XMLPUBFUN int XMLCALL
111 xmlNanoFTPCwd (void *ctx,
Owen Taylor3473f882001-02-23 17:55:21 +0000112 char *directory);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000113XMLPUBFUN int XMLCALL
114 xmlNanoFTPDele (void *ctx,
Daniel Veillard6c73cb82003-03-05 16:45:40 +0000115 char *file);
Owen Taylor3473f882001-02-23 17:55:21 +0000116
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000117XMLPUBFUN int XMLCALL
118 xmlNanoFTPGetConnection (void *ctx);
119XMLPUBFUN int XMLCALL
120 xmlNanoFTPCloseConnection(void *ctx);
121XMLPUBFUN int XMLCALL
122 xmlNanoFTPList (void *ctx,
Owen Taylor3473f882001-02-23 17:55:21 +0000123 ftpListCallback callback,
124 void *userData,
125 char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000126XMLPUBFUN int XMLCALL
127 xmlNanoFTPGetSocket (void *ctx,
Owen Taylor3473f882001-02-23 17:55:21 +0000128 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000129XMLPUBFUN int XMLCALL
130 xmlNanoFTPGet (void *ctx,
Owen Taylor3473f882001-02-23 17:55:21 +0000131 ftpDataCallback callback,
132 void *userData,
133 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000134XMLPUBFUN int XMLCALL
135 xmlNanoFTPRead (void *ctx,
Owen Taylor3473f882001-02-23 17:55:21 +0000136 void *dest,
137 int len);
138
139#ifdef __cplusplus
140}
141#endif /* LIBXML_FTP_ENABLED */
142#endif
143#endif /* __NANO_FTP_H__ */