1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-16 02:50:07 +03:00
libxml2/include/libxml/nanoftp.h

164 lines
3.7 KiB
C
Raw Permalink Normal View History

2001-02-23 17:55:21 +00:00
/*
* Summary: minimal FTP implementation
* Description: minimal FTP implementation allowing to fetch resources
* like external subset.
2001-02-23 17:55:21 +00:00
*
* Copy: See Copyright for the status of this software.
2001-02-23 17:55:21 +00:00
*
* Author: Daniel Veillard
2001-02-23 17:55:21 +00:00
*/
2001-02-23 17:55:21 +00:00
#ifndef __NANO_FTP_H__
#define __NANO_FTP_H__
#include <libxml/xmlversion.h>
2002-11-08 17:18:52 +00:00
2001-02-23 17:55:21 +00:00
#ifdef LIBXML_FTP_ENABLED
/* Needed for portability to Windows 64 bits */
#if defined(_WIN32) && !defined(__CYGWIN__)
#include <winsock2.h>
#else
2010-11-04 18:35:57 +01:00
/**
* SOCKET:
*
* macro used to provide portability of code to windows sockets
*/
#define SOCKET int
2010-11-04 18:35:57 +01:00
/**
* INVALID_SOCKET:
*
* macro used to provide portability of code to windows sockets
* the value to be used when the socket is not valid
*/
Various "make distcheck" and portability fixups Makefile.am: * Don't use @VAR@, use $(VAR). Autoconf's AC_SUBST provides us the Make variable, it allows overriding the value at the command line, and (notably) it avoids a Make parse error in the libxml2_la_LDFLAGS assignment when @MODULE_PLATFORM_LIBS@ is empty * Changed how the THREADS_W32 mechanism switches the build between testThreads.c and testThreadsWin32.c as appropriate; using AM_CONDITIONAL allows this to work cleanly and plays well with dependencies * testapi.c should be specified as BUILT_SOURCES * Create symlinks to the test/ and result/ subdirs so that the runtests target is usable in out-of-source-tree builds * Don't do MAKEFLAGS+=--silent as this is not portable to non-GNU Makes * Fixed incorrect find(1) syntax in the "cleanup" rule, and doing "rm -f" instead of just "rm" is good form * (DIST)CLEANFILES needed a bit more coverage to allow "make distcheck" to pass configure.in: * Need AC_PROG_LN_S to create test/ and result/ symlinks in Makefile.am * AC_LIBTOOL_WIN32_DLL and AM_PROG_LIBTOOL are obsolete; these have been superceded by LT_INIT * Don't rebuild docs by default, as this requires GNU Make (as implemented) * Check for uint32_t as some platforms don't provide it * Check for some more functions, and undefine HAVE_MMAP if we don't also HAVE_MUNMAP (one system I tested on actually needed this) * Changed THREADS_W32 from a filename insert into an Automake conditional * The "Copyright" file will not be in the current directory if builddir != srcdir doc/Makefile.am: * EXTRA_DIST cannot use wildcards when they refer to generated files; this breaks dependencies. What I did was define EXTRA_DIST_wc, which uses GNU Make $(wildcard) directives to build up a list of files, and EXTRA_DIST, as a literal expansion of EXTRA_DIST_wc. I also added a new rule, "check-extra-dist", to simplify checking that the two variables are equivalent. (Note that this works only when builddir == srcdir) (I can implement this differently if desired; this is just one way of doing it) * Don't define an "all" target; this steps on Automake's toes * Fixed up the "libxml2-api.xml ..." rule by using $(wildcard) for dependencies (as Make doesn't process the wildcards otherwise) and qualifying appropriate files with $(srcdir) (Note that $(srcdir) is not needed in the dependencies, thanks to VPATH, which we can count on as this is GNU-Make-only code anyway) doc/devhelp/Makefile.am: * Qualified appropriate files with $(srcdir) * Added an "uninstall-local" rule so that "make distcheck" passes doc/examples/Makefile.am: * Rather than use a wildcard that doesn't work, use a substitution that most Make programs can handle doc/examples/index.py: * Do the same here include/libxml/nanoftp.h: * Some platforms (e.g. MSVC 6) already #define INVALID_SOCKET: user@host:/cygdrive/c/Program Files/Microsoft Visual Studio/VC98/\ Include$ grep -R INVALID_SOCKET . ./WINSOCK.H:#define INVALID_SOCKET (SOCKET)(~0) ./WINSOCK2.H:#define INVALID_SOCKET (SOCKET)(~0) include/libxml/xmlversion.h.in: * Support ancient GCCs (I was actually able to build the library with 2.5 but for this bit) python/Makefile.am: * Expanded CLEANFILES to allow "make distcheck" to pass python/tests/Makefile.am: * Define CLEANFILES instead of a "clean" rule, and added tmp.xml to allow "make distcheck" to pass testRelax.c: * Use HAVE_MMAP instead of the less explicit HAVE_SYS_MMAN_H (as some systems have the header but not the function) testSchemas.c: * Use HAVE_MMAP instead of the less explicit HAVE_SYS_MMAN_H testapi.c: * Don't use putenv() if it's not available threads.c: * This fixes the following build error on Solaris 8: libtool: compile: cc -DHAVE_CONFIG_H -I. -I./include -I./include \ -D_REENTRANT -D__EXTENSIONS__ -D_REENTRANT -Dsparc -Xa -mt -v \ -xarch=v9 -xcrossfile -xO5 -c threads.c -KPIC -DPIC -o threads.o "threads.c", line 442: controlling expressions must have scalar type "threads.c", line 512: controlling expressions must have scalar type cc: acomp failed for threads.c *** Error code 1 trio.c: * Define isascii() if the system doesn't provide it trio.h: * The trio library's HAVE_CONFIG_H header is not the same as LibXML2's HAVE_CONFIG_H header; this change is needed to avoid a double-inclusion win32/configure.js: * Added support for the LZMA compression option win32/Makefile.{bcb,mingw,msvc}: * Added appropriate bits to support WITH_LZMA=1 * Install the header files under $(INCPREFIX)\libxml2\libxml instead of $(INCPREFIX)\libxml, to mirror the install location on Unix+Autotools xml2-config.in: * @MODULE_PLATFORM_LIBS@ (usually "-ldl") needs to be in there in order for `xml2-config --libs` to provide a complete set of dependencies xmllint.c: * Use HAVE_MMAP instead of the less-explicit HAVE_SYS_MMAN_H
2012-08-06 11:32:54 +08:00
#undef INVALID_SOCKET
#define INVALID_SOCKET (-1)
#endif
2001-02-23 17:55:21 +00:00
#ifdef __cplusplus
extern "C" {
#endif
/**
* ftpListCallback:
2001-02-23 17:55:21 +00:00
* @userData: user provided data for the callback
* @filename: the file name (including "->" when links are shown)
* @attrib: the attribute string
* @owner: the owner string
* @group: the group string
* @size: the file size
* @links: the link count
* @year: the year
* @month: the month
* @day: the day
* @hour: the hour
* @minute: the minute
*
* A callback for the xmlNanoFTPList command.
* Note that only one of year and day:minute are specified.
2001-02-23 17:55:21 +00:00
*/
typedef void (*ftpListCallback) (void *userData,
const char *filename, const char *attrib,
2001-02-23 17:55:21 +00:00
const char *owner, const char *group,
unsigned long size, int links, int year,
const char *month, int day, int hour,
int minute);
/**
* ftpDataCallback:
* @userData: the user provided context
* @data: the data received
* @len: its size in bytes
*
* A callback for the xmlNanoFTPGet command.
2001-02-23 17:55:21 +00:00
*/
typedef void (*ftpDataCallback) (void *userData,
const char *data,
int len);
2001-02-23 17:55:21 +00:00
/*
* Init
*/
2003-08-25 09:05:12 +00:00
XMLPUBFUN void XMLCALL
xmlNanoFTPInit (void);
XMLPUBFUN void XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPCleanup (void);
2001-02-23 17:55:21 +00:00
/*
* Creating/freeing contexts.
2001-02-23 17:55:21 +00:00
*/
XMLPUBFUN void * XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPNewCtxt (const char *URL);
XMLPUBFUN void XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPFreeCtxt (void * ctx);
XMLPUBFUN void * XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPConnectTo (const char *server,
2001-02-23 17:55:21 +00:00
int port);
/*
* Opening/closing session connections.
2001-02-23 17:55:21 +00:00
*/
XMLPUBFUN void * XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPOpen (const char *URL);
XMLPUBFUN int XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPConnect (void *ctx);
XMLPUBFUN int XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPClose (void *ctx);
XMLPUBFUN int XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPQuit (void *ctx);
XMLPUBFUN void XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPScanProxy (const char *URL);
XMLPUBFUN void XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPProxy (const char *host,
2001-02-23 17:55:21 +00:00
int port,
const char *user,
const char *passwd,
int type);
XMLPUBFUN int XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPUpdateURL (void *ctx,
2001-02-23 17:55:21 +00:00
const char *URL);
/*
* Rather internal commands.
2001-02-23 17:55:21 +00:00
*/
XMLPUBFUN int XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPGetResponse (void *ctx);
XMLPUBFUN int XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPCheckResponse (void *ctx);
2001-02-23 17:55:21 +00:00
/*
* CD/DIR/GET handlers.
2001-02-23 17:55:21 +00:00
*/
XMLPUBFUN int XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPCwd (void *ctx,
const char *directory);
XMLPUBFUN int XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPDele (void *ctx,
const char *file);
2001-02-23 17:55:21 +00:00
XMLPUBFUN SOCKET XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPGetConnection (void *ctx);
XMLPUBFUN int XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPCloseConnection(void *ctx);
XMLPUBFUN int XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPList (void *ctx,
2001-02-23 17:55:21 +00:00
ftpListCallback callback,
void *userData,
const char *filename);
XMLPUBFUN SOCKET XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPGetSocket (void *ctx,
2001-02-23 17:55:21 +00:00
const char *filename);
XMLPUBFUN int XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPGet (void *ctx,
2001-02-23 17:55:21 +00:00
ftpDataCallback callback,
void *userData,
const char *filename);
XMLPUBFUN int XMLCALL
2003-08-25 09:05:12 +00:00
xmlNanoFTPRead (void *ctx,
2001-02-23 17:55:21 +00:00
void *dest,
int len);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_FTP_ENABLED */
2001-02-23 17:55:21 +00:00
#endif /* __NANO_FTP_H__ */