nanoftp.h revision a2351322c89608d09ce1a99e5eccd62d00c79890
13473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor/* 2be5869729a416032a4abb5a65430d25831828f75Daniel Veillard * Summary: minimal FTP implementation 3be5869729a416032a4abb5a65430d25831828f75Daniel Veillard * Description: minimal FTP implementation allowing to fetch resources 4be5869729a416032a4abb5a65430d25831828f75Daniel Veillard * like external subset. 53473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * 6be5869729a416032a4abb5a65430d25831828f75Daniel Veillard * Copy: See Copyright for the status of this software. 73473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * 8be5869729a416032a4abb5a65430d25831828f75Daniel Veillard * Author: Daniel Veillard 93473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor */ 103473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor 113473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#ifndef __NANO_FTP_H__ 123473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#define __NANO_FTP_H__ 133473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor 143473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#include <libxml/xmlversion.h> 157ae91bcd9e94946a7be41290cb67ffc9c2cf0a9fIgor Zlatkovic 163473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#ifdef LIBXML_FTP_ENABLED 173473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor 183473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#ifdef __cplusplus 193473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylorextern "C" { 203473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#endif 213473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor 223473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor/** 233473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * ftpListCallback: 243473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * @userData: user provided data for the callback 253473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * @filename: the file name (including "->" when links are shown) 263473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * @attrib: the attribute string 273473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * @owner: the owner string 283473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * @group: the group string 293473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * @size: the file size 303473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * @links: the link count 313473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * @year: the year 323473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * @month: the month 333473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * @day: the day 343473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * @hour: the hour 353473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * @minute: the minute 363473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * 3761f261749f44d6e6f938441598bc724cd1375c51Daniel Veillard * A callback for the xmlNanoFTPList command. 3861f261749f44d6e6f938441598bc724cd1375c51Daniel Veillard * Note that only one of year and day:minute are specified. 393473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor */ 403473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylortypedef void (*ftpListCallback) (void *userData, 41963d2ae41574066f9b44bcae610dd280c1e57dd8Daniel Veillard const char *filename, const char *attrib, 423473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor const char *owner, const char *group, 433473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor unsigned long size, int links, int year, 443473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor const char *month, int day, int hour, 453473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor int minute); 463473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor/** 473473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * ftpDataCallback: 48f69bb4b5bf3df1982f63a331b02cd7187456492fDaniel Veillard * @userData: the user provided context 49f69bb4b5bf3df1982f63a331b02cd7187456492fDaniel Veillard * @data: the data received 50f69bb4b5bf3df1982f63a331b02cd7187456492fDaniel Veillard * @len: its size in bytes 51f69bb4b5bf3df1982f63a331b02cd7187456492fDaniel Veillard * 5261f261749f44d6e6f938441598bc724cd1375c51Daniel Veillard * A callback for the xmlNanoFTPGet command. 533473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor */ 54963d2ae41574066f9b44bcae610dd280c1e57dd8Daniel Veillardtypedef void (*ftpDataCallback) (void *userData, 55963d2ae41574066f9b44bcae610dd280c1e57dd8Daniel Veillard const char *data, 56963d2ae41574066f9b44bcae610dd280c1e57dd8Daniel Veillard int len); 573473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor 583473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor/* 593473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * Init 603473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor */ 6176874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN void XMLCALL 6276874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPInit (void); 6376874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN void XMLCALL 6476874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPCleanup (void); 653473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor 663473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor/* 6761f261749f44d6e6f938441598bc724cd1375c51Daniel Veillard * Creating/freeing contexts. 683473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor */ 6976874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN void * XMLCALL 7076874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPNewCtxt (const char *URL); 7176874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN void XMLCALL 7276874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPFreeCtxt (void * ctx); 7376874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN void * XMLCALL 7476874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPConnectTo (const char *server, 753473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor int port); 763473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor/* 7761f261749f44d6e6f938441598bc724cd1375c51Daniel Veillard * Opening/closing session connections. 783473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor */ 7976874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN void * XMLCALL 8076874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPOpen (const char *URL); 8176874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN int XMLCALL 8276874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPConnect (void *ctx); 8376874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN int XMLCALL 8476874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPClose (void *ctx); 8576874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN int XMLCALL 8676874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPQuit (void *ctx); 8776874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN void XMLCALL 8876874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPScanProxy (const char *URL); 8976874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN void XMLCALL 9076874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPProxy (const char *host, 913473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor int port, 923473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor const char *user, 933473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor const char *passwd, 943473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor int type); 9576874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN int XMLCALL 9676874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPUpdateURL (void *ctx, 973473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor const char *URL); 983473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor 993473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor/* 10061f261749f44d6e6f938441598bc724cd1375c51Daniel Veillard * Rather internal commands. 1013473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor */ 10276874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN int XMLCALL 10376874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPGetResponse (void *ctx); 10476874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN int XMLCALL 10576874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPCheckResponse (void *ctx); 1063473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor 1073473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor/* 10861f261749f44d6e6f938441598bc724cd1375c51Daniel Veillard * CD/DIR/GET handlers. 1093473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor */ 11076874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN int XMLCALL 11176874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPCwd (void *ctx, 1123473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor char *directory); 11376874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN int XMLCALL 11476874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPDele (void *ctx, 1156c73cb8b67f3332b6bd2b2ff0480482770713838Daniel Veillard char *file); 1163473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor 11776874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN int XMLCALL 11876874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPGetConnection (void *ctx); 11976874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN int XMLCALL 12076874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPCloseConnection(void *ctx); 12176874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN int XMLCALL 12276874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPList (void *ctx, 1233473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor ftpListCallback callback, 1243473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor void *userData, 1253473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor char *filename); 12676874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN int XMLCALL 12776874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPGetSocket (void *ctx, 1283473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor const char *filename); 12976874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN int XMLCALL 13076874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPGet (void *ctx, 1313473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor ftpDataCallback callback, 1323473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor void *userData, 1333473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor const char *filename); 13476874e4516a1d7b467d400604f8aef77be015727Igor ZlatkovicXMLPUBFUN int XMLCALL 13576874e4516a1d7b467d400604f8aef77be015727Igor Zlatkovic xmlNanoFTPRead (void *ctx, 1363473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor void *dest, 1373473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor int len); 1383473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor 1393473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#ifdef __cplusplus 1403473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor} 1413473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#endif 142a2351322c89608d09ce1a99e5eccd62d00c79890Daniel Veillard#endif /* LIBXML_FTP_ENABLED */ 1433473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#endif /* __NANO_FTP_H__ */ 144