nanoftp.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. * Summary: minimal FTP implementation
  3. * Description: minimal FTP implementation allowing to fetch resources
  4. * like external subset.
  5. *
  6. * Copy: See Copyright for the status of this software.
  7. *
  8. * Author: Daniel Veillard
  9. */
  10. #ifndef __NANO_FTP_H__
  11. #define __NANO_FTP_H__
  12. #include <libxml/xmlversion.h>
  13. #ifdef LIBXML_FTP_ENABLED
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. /**
  18. * ftpListCallback:
  19. * @userData: user provided data for the callback
  20. * @filename: the file name (including "->" when links are shown)
  21. * @attrib: the attribute string
  22. * @owner: the owner string
  23. * @group: the group string
  24. * @size: the file size
  25. * @links: the link count
  26. * @year: the year
  27. * @month: the month
  28. * @day: the day
  29. * @hour: the hour
  30. * @minute: the minute
  31. *
  32. * A callback for the xmlNanoFTPList command.
  33. * Note that only one of year and day:minute are specified.
  34. */
  35. typedef void (*ftpListCallback) (void *userData,
  36. const char *filename, const char *attrib,
  37. const char *owner, const char *group,
  38. unsigned long size, int links, int year,
  39. const char *month, int day, int hour,
  40. int minute);
  41. /**
  42. * ftpDataCallback:
  43. * @userData: the user provided context
  44. * @data: the data received
  45. * @len: its size in bytes
  46. *
  47. * A callback for the xmlNanoFTPGet command.
  48. */
  49. typedef void (*ftpDataCallback) (void *userData,
  50. const char *data,
  51. int len);
  52. /*
  53. * Init
  54. */
  55. XMLPUBFUN void XMLCALL
  56. xmlNanoFTPInit (void);
  57. XMLPUBFUN void XMLCALL
  58. xmlNanoFTPCleanup (void);
  59. /*
  60. * Creating/freeing contexts.
  61. */
  62. XMLPUBFUN void * XMLCALL
  63. xmlNanoFTPNewCtxt (const char *URL);
  64. XMLPUBFUN void XMLCALL
  65. xmlNanoFTPFreeCtxt (void * ctx);
  66. XMLPUBFUN void * XMLCALL
  67. xmlNanoFTPConnectTo (const char *server,
  68. int port);
  69. /*
  70. * Opening/closing session connections.
  71. */
  72. XMLPUBFUN void * XMLCALL
  73. xmlNanoFTPOpen (const char *URL);
  74. XMLPUBFUN int XMLCALL
  75. xmlNanoFTPConnect (void *ctx);
  76. XMLPUBFUN int XMLCALL
  77. xmlNanoFTPClose (void *ctx);
  78. XMLPUBFUN int XMLCALL
  79. xmlNanoFTPQuit (void *ctx);
  80. XMLPUBFUN void XMLCALL
  81. xmlNanoFTPScanProxy (const char *URL);
  82. XMLPUBFUN void XMLCALL
  83. xmlNanoFTPProxy (const char *host,
  84. int port,
  85. const char *user,
  86. const char *passwd,
  87. int type);
  88. XMLPUBFUN int XMLCALL
  89. xmlNanoFTPUpdateURL (void *ctx,
  90. const char *URL);
  91. /*
  92. * Rather internal commands.
  93. */
  94. XMLPUBFUN int XMLCALL
  95. xmlNanoFTPGetResponse (void *ctx);
  96. XMLPUBFUN int XMLCALL
  97. xmlNanoFTPCheckResponse (void *ctx);
  98. /*
  99. * CD/DIR/GET handlers.
  100. */
  101. XMLPUBFUN int XMLCALL
  102. xmlNanoFTPCwd (void *ctx,
  103. const char *directory);
  104. XMLPUBFUN int XMLCALL
  105. xmlNanoFTPDele (void *ctx,
  106. const char *file);
  107. XMLPUBFUN int XMLCALL
  108. xmlNanoFTPGetConnection (void *ctx);
  109. XMLPUBFUN int XMLCALL
  110. xmlNanoFTPCloseConnection(void *ctx);
  111. XMLPUBFUN int XMLCALL
  112. xmlNanoFTPList (void *ctx,
  113. ftpListCallback callback,
  114. void *userData,
  115. const char *filename);
  116. XMLPUBFUN int XMLCALL
  117. xmlNanoFTPGetSocket (void *ctx,
  118. const char *filename);
  119. XMLPUBFUN int XMLCALL
  120. xmlNanoFTPGet (void *ctx,
  121. ftpDataCallback callback,
  122. void *userData,
  123. const char *filename);
  124. XMLPUBFUN int XMLCALL
  125. xmlNanoFTPRead (void *ctx,
  126. void *dest,
  127. int len);
  128. #ifdef __cplusplus
  129. }
  130. #endif
  131. #endif /* LIBXML_FTP_ENABLED */
  132. #endif /* __NANO_FTP_H__ */