Path: blob/master/venv/Lib/site-packages/lxml/includes/libxml/nanoftp.h
811 views
/*1* Summary: minimal FTP implementation2* Description: minimal FTP implementation allowing to fetch resources3* like external subset.4*5* Copy: See Copyright for the status of this software.6*7* Author: Daniel Veillard8*/910#ifndef __NANO_FTP_H__11#define __NANO_FTP_H__1213#include <libxml/xmlversion.h>1415#ifdef LIBXML_FTP_ENABLED1617/* Needed for portability to Windows 64 bits */18#if defined(__MINGW32__) || defined(_WIN32_WCE)19#include <winsock2.h>20#else21/**22* SOCKET:23*24* macro used to provide portability of code to windows sockets25*/26#define SOCKET int27/**28* INVALID_SOCKET:29*30* macro used to provide portability of code to windows sockets31* the value to be used when the socket is not valid32*/33#undef INVALID_SOCKET34#define INVALID_SOCKET (-1)35#endif3637#ifdef __cplusplus38extern "C" {39#endif4041/**42* ftpListCallback:43* @userData: user provided data for the callback44* @filename: the file name (including "->" when links are shown)45* @attrib: the attribute string46* @owner: the owner string47* @group: the group string48* @size: the file size49* @links: the link count50* @year: the year51* @month: the month52* @day: the day53* @hour: the hour54* @minute: the minute55*56* A callback for the xmlNanoFTPList command.57* Note that only one of year and day:minute are specified.58*/59typedef void (*ftpListCallback) (void *userData,60const char *filename, const char *attrib,61const char *owner, const char *group,62unsigned long size, int links, int year,63const char *month, int day, int hour,64int minute);65/**66* ftpDataCallback:67* @userData: the user provided context68* @data: the data received69* @len: its size in bytes70*71* A callback for the xmlNanoFTPGet command.72*/73typedef void (*ftpDataCallback) (void *userData,74const char *data,75int len);7677/*78* Init79*/80XMLPUBFUN void XMLCALL81xmlNanoFTPInit (void);82XMLPUBFUN void XMLCALL83xmlNanoFTPCleanup (void);8485/*86* Creating/freeing contexts.87*/88XMLPUBFUN void * XMLCALL89xmlNanoFTPNewCtxt (const char *URL);90XMLPUBFUN void XMLCALL91xmlNanoFTPFreeCtxt (void * ctx);92XMLPUBFUN void * XMLCALL93xmlNanoFTPConnectTo (const char *server,94int port);95/*96* Opening/closing session connections.97*/98XMLPUBFUN void * XMLCALL99xmlNanoFTPOpen (const char *URL);100XMLPUBFUN int XMLCALL101xmlNanoFTPConnect (void *ctx);102XMLPUBFUN int XMLCALL103xmlNanoFTPClose (void *ctx);104XMLPUBFUN int XMLCALL105xmlNanoFTPQuit (void *ctx);106XMLPUBFUN void XMLCALL107xmlNanoFTPScanProxy (const char *URL);108XMLPUBFUN void XMLCALL109xmlNanoFTPProxy (const char *host,110int port,111const char *user,112const char *passwd,113int type);114XMLPUBFUN int XMLCALL115xmlNanoFTPUpdateURL (void *ctx,116const char *URL);117118/*119* Rather internal commands.120*/121XMLPUBFUN int XMLCALL122xmlNanoFTPGetResponse (void *ctx);123XMLPUBFUN int XMLCALL124xmlNanoFTPCheckResponse (void *ctx);125126/*127* CD/DIR/GET handlers.128*/129XMLPUBFUN int XMLCALL130xmlNanoFTPCwd (void *ctx,131const char *directory);132XMLPUBFUN int XMLCALL133xmlNanoFTPDele (void *ctx,134const char *file);135136XMLPUBFUN SOCKET XMLCALL137xmlNanoFTPGetConnection (void *ctx);138XMLPUBFUN int XMLCALL139xmlNanoFTPCloseConnection(void *ctx);140XMLPUBFUN int XMLCALL141xmlNanoFTPList (void *ctx,142ftpListCallback callback,143void *userData,144const char *filename);145XMLPUBFUN SOCKET XMLCALL146xmlNanoFTPGetSocket (void *ctx,147const char *filename);148XMLPUBFUN int XMLCALL149xmlNanoFTPGet (void *ctx,150ftpDataCallback callback,151void *userData,152const char *filename);153XMLPUBFUN int XMLCALL154xmlNanoFTPRead (void *ctx,155void *dest,156int len);157158#ifdef __cplusplus159}160#endif161#endif /* LIBXML_FTP_ENABLED */162#endif /* __NANO_FTP_H__ */163164165