|
Packit Bot |
06c835 |
/*
|
|
Packit Bot |
06c835 |
* Summary: minimal FTP implementation
|
|
Packit Bot |
06c835 |
* Description: minimal FTP implementation allowing to fetch resources
|
|
Packit Bot |
06c835 |
* like external subset.
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
* Copy: See Copyright for the status of this software.
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
* Author: Daniel Veillard
|
|
Packit Bot |
06c835 |
*/
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
#ifndef __NANO_FTP_H__
|
|
Packit Bot |
06c835 |
#define __NANO_FTP_H__
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
#include <libxml/xmlversion.h>
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
#ifdef LIBXML_FTP_ENABLED
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
/* Needed for portability to Windows 64 bits */
|
|
Packit Bot |
06c835 |
#if defined(__MINGW32__) || defined(_WIN32_WCE)
|
|
Packit Bot |
06c835 |
#include <winsock2.h>
|
|
Packit Bot |
06c835 |
#else
|
|
Packit Bot |
06c835 |
/**
|
|
Packit Bot |
06c835 |
* SOCKET:
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
* macro used to provide portability of code to windows sockets
|
|
Packit Bot |
06c835 |
*/
|
|
Packit Bot |
06c835 |
#define SOCKET int
|
|
Packit Bot |
06c835 |
/**
|
|
Packit Bot |
06c835 |
* INVALID_SOCKET:
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
* macro used to provide portability of code to windows sockets
|
|
Packit Bot |
06c835 |
* the value to be used when the socket is not valid
|
|
Packit Bot |
06c835 |
*/
|
|
Packit Bot |
06c835 |
#undef INVALID_SOCKET
|
|
Packit Bot |
06c835 |
#define INVALID_SOCKET (-1)
|
|
Packit Bot |
06c835 |
#endif
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
#ifdef __cplusplus
|
|
Packit Bot |
06c835 |
extern "C" {
|
|
Packit Bot |
06c835 |
#endif
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
/**
|
|
Packit Bot |
06c835 |
* ftpListCallback:
|
|
Packit Bot |
06c835 |
* @userData: user provided data for the callback
|
|
Packit Bot |
06c835 |
* @filename: the file name (including "->" when links are shown)
|
|
Packit Bot |
06c835 |
* @attrib: the attribute string
|
|
Packit Bot |
06c835 |
* @owner: the owner string
|
|
Packit Bot |
06c835 |
* @group: the group string
|
|
Packit Bot |
06c835 |
* @size: the file size
|
|
Packit Bot |
06c835 |
* @links: the link count
|
|
Packit Bot |
06c835 |
* @year: the year
|
|
Packit Bot |
06c835 |
* @month: the month
|
|
Packit Bot |
06c835 |
* @day: the day
|
|
Packit Bot |
06c835 |
* @hour: the hour
|
|
Packit Bot |
06c835 |
* @minute: the minute
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
* A callback for the xmlNanoFTPList command.
|
|
Packit Bot |
06c835 |
* Note that only one of year and day:minute are specified.
|
|
Packit Bot |
06c835 |
*/
|
|
Packit Bot |
06c835 |
typedef void (*ftpListCallback) (void *userData,
|
|
Packit Bot |
06c835 |
const char *filename, const char *attrib,
|
|
Packit Bot |
06c835 |
const char *owner, const char *group,
|
|
Packit Bot |
06c835 |
unsigned long size, int links, int year,
|
|
Packit Bot |
06c835 |
const char *month, int day, int hour,
|
|
Packit Bot |
06c835 |
int minute);
|
|
Packit Bot |
06c835 |
/**
|
|
Packit Bot |
06c835 |
* ftpDataCallback:
|
|
Packit Bot |
06c835 |
* @userData: the user provided context
|
|
Packit Bot |
06c835 |
* @data: the data received
|
|
Packit Bot |
06c835 |
* @len: its size in bytes
|
|
Packit Bot |
06c835 |
*
|
|
Packit Bot |
06c835 |
* A callback for the xmlNanoFTPGet command.
|
|
Packit Bot |
06c835 |
*/
|
|
Packit Bot |
06c835 |
typedef void (*ftpDataCallback) (void *userData,
|
|
Packit Bot |
06c835 |
const char *data,
|
|
Packit Bot |
06c835 |
int len);
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
/*
|
|
Packit Bot |
06c835 |
* Init
|
|
Packit Bot |
06c835 |
*/
|
|
Packit Bot |
06c835 |
XMLPUBFUN void XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPInit (void);
|
|
Packit Bot |
06c835 |
XMLPUBFUN void XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPCleanup (void);
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
/*
|
|
Packit Bot |
06c835 |
* Creating/freeing contexts.
|
|
Packit Bot |
06c835 |
*/
|
|
Packit Bot |
06c835 |
XMLPUBFUN void * XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPNewCtxt (const char *URL);
|
|
Packit Bot |
06c835 |
XMLPUBFUN void XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPFreeCtxt (void * ctx);
|
|
Packit Bot |
06c835 |
XMLPUBFUN void * XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPConnectTo (const char *server,
|
|
Packit Bot |
06c835 |
int port);
|
|
Packit Bot |
06c835 |
/*
|
|
Packit Bot |
06c835 |
* Opening/closing session connections.
|
|
Packit Bot |
06c835 |
*/
|
|
Packit Bot |
06c835 |
XMLPUBFUN void * XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPOpen (const char *URL);
|
|
Packit Bot |
06c835 |
XMLPUBFUN int XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPConnect (void *ctx);
|
|
Packit Bot |
06c835 |
XMLPUBFUN int XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPClose (void *ctx);
|
|
Packit Bot |
06c835 |
XMLPUBFUN int XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPQuit (void *ctx);
|
|
Packit Bot |
06c835 |
XMLPUBFUN void XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPScanProxy (const char *URL);
|
|
Packit Bot |
06c835 |
XMLPUBFUN void XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPProxy (const char *host,
|
|
Packit Bot |
06c835 |
int port,
|
|
Packit Bot |
06c835 |
const char *user,
|
|
Packit Bot |
06c835 |
const char *passwd,
|
|
Packit Bot |
06c835 |
int type);
|
|
Packit Bot |
06c835 |
XMLPUBFUN int XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPUpdateURL (void *ctx,
|
|
Packit Bot |
06c835 |
const char *URL);
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
/*
|
|
Packit Bot |
06c835 |
* Rather internal commands.
|
|
Packit Bot |
06c835 |
*/
|
|
Packit Bot |
06c835 |
XMLPUBFUN int XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPGetResponse (void *ctx);
|
|
Packit Bot |
06c835 |
XMLPUBFUN int XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPCheckResponse (void *ctx);
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
/*
|
|
Packit Bot |
06c835 |
* CD/DIR/GET handlers.
|
|
Packit Bot |
06c835 |
*/
|
|
Packit Bot |
06c835 |
XMLPUBFUN int XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPCwd (void *ctx,
|
|
Packit Bot |
06c835 |
const char *directory);
|
|
Packit Bot |
06c835 |
XMLPUBFUN int XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPDele (void *ctx,
|
|
Packit Bot |
06c835 |
const char *file);
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
XMLPUBFUN SOCKET XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPGetConnection (void *ctx);
|
|
Packit Bot |
06c835 |
XMLPUBFUN int XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPCloseConnection(void *ctx);
|
|
Packit Bot |
06c835 |
XMLPUBFUN int XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPList (void *ctx,
|
|
Packit Bot |
06c835 |
ftpListCallback callback,
|
|
Packit Bot |
06c835 |
void *userData,
|
|
Packit Bot |
06c835 |
const char *filename);
|
|
Packit Bot |
06c835 |
XMLPUBFUN SOCKET XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPGetSocket (void *ctx,
|
|
Packit Bot |
06c835 |
const char *filename);
|
|
Packit Bot |
06c835 |
XMLPUBFUN int XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPGet (void *ctx,
|
|
Packit Bot |
06c835 |
ftpDataCallback callback,
|
|
Packit Bot |
06c835 |
void *userData,
|
|
Packit Bot |
06c835 |
const char *filename);
|
|
Packit Bot |
06c835 |
XMLPUBFUN int XMLCALL
|
|
Packit Bot |
06c835 |
xmlNanoFTPRead (void *ctx,
|
|
Packit Bot |
06c835 |
void *dest,
|
|
Packit Bot |
06c835 |
int len);
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
#ifdef __cplusplus
|
|
Packit Bot |
06c835 |
}
|
|
Packit Bot |
06c835 |
#endif
|
|
Packit Bot |
06c835 |
#endif /* LIBXML_FTP_ENABLED */
|
|
Packit Bot |
06c835 |
#endif /* __NANO_FTP_H__ */
|