nanoftp.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /*
  2. * Summary: minimal FTP implementation
  3. * Description: minimal FTP implementation allowing to fetch resources
  4. * like external subset. This module is DEPRECATED, do not
  5. * use any of its functions.
  6. *
  7. * Copy: See Copyright for the status of this software.
  8. *
  9. * Author: Daniel Veillard
  10. */
  11. #ifndef __NANO_FTP_H__
  12. #define __NANO_FTP_H__
  13. #include <libxml/xmlversion.h>
  14. #ifdef LIBXML_FTP_ENABLED
  15. /* Needed for portability to Windows 64 bits */
  16. #if defined(_WIN32)
  17. #include <winsock2.h>
  18. #else
  19. /**
  20. * SOCKET:
  21. *
  22. * macro used to provide portability of code to windows sockets
  23. */
  24. #define SOCKET int
  25. /**
  26. * INVALID_SOCKET:
  27. *
  28. * macro used to provide portability of code to windows sockets
  29. * the value to be used when the socket is not valid
  30. */
  31. #undef INVALID_SOCKET
  32. #define INVALID_SOCKET (-1)
  33. #endif
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. /**
  38. * ftpListCallback:
  39. * @userData: user provided data for the callback
  40. * @filename: the file name (including "->" when links are shown)
  41. * @attrib: the attribute string
  42. * @owner: the owner string
  43. * @group: the group string
  44. * @size: the file size
  45. * @links: the link count
  46. * @year: the year
  47. * @month: the month
  48. * @day: the day
  49. * @hour: the hour
  50. * @minute: the minute
  51. *
  52. * A callback for the xmlNanoFTPList command.
  53. * Note that only one of year and day:minute are specified.
  54. */
  55. typedef void (*ftpListCallback) (void *userData,
  56. const char *filename, const char *attrib,
  57. const char *owner, const char *group,
  58. unsigned long size, int links, int year,
  59. const char *month, int day, int hour,
  60. int minute);
  61. /**
  62. * ftpDataCallback:
  63. * @userData: the user provided context
  64. * @data: the data received
  65. * @len: its size in bytes
  66. *
  67. * A callback for the xmlNanoFTPGet command.
  68. */
  69. typedef void (*ftpDataCallback) (void *userData,
  70. const char *data,
  71. int len);
  72. /*
  73. * Init
  74. */
  75. XML_DEPRECATED
  76. XMLPUBFUN void XMLCALL
  77. xmlNanoFTPInit (void);
  78. XML_DEPRECATED
  79. XMLPUBFUN void XMLCALL
  80. xmlNanoFTPCleanup (void);
  81. /*
  82. * Creating/freeing contexts.
  83. */
  84. XML_DEPRECATED
  85. XMLPUBFUN void * XMLCALL
  86. xmlNanoFTPNewCtxt (const char *URL);
  87. XML_DEPRECATED
  88. XMLPUBFUN void XMLCALL
  89. xmlNanoFTPFreeCtxt (void * ctx);
  90. XML_DEPRECATED
  91. XMLPUBFUN void * XMLCALL
  92. xmlNanoFTPConnectTo (const char *server,
  93. int port);
  94. /*
  95. * Opening/closing session connections.
  96. */
  97. XML_DEPRECATED
  98. XMLPUBFUN void * XMLCALL
  99. xmlNanoFTPOpen (const char *URL);
  100. XML_DEPRECATED
  101. XMLPUBFUN int XMLCALL
  102. xmlNanoFTPConnect (void *ctx);
  103. XML_DEPRECATED
  104. XMLPUBFUN int XMLCALL
  105. xmlNanoFTPClose (void *ctx);
  106. XML_DEPRECATED
  107. XMLPUBFUN int XMLCALL
  108. xmlNanoFTPQuit (void *ctx);
  109. XML_DEPRECATED
  110. XMLPUBFUN void XMLCALL
  111. xmlNanoFTPScanProxy (const char *URL);
  112. XML_DEPRECATED
  113. XMLPUBFUN void XMLCALL
  114. xmlNanoFTPProxy (const char *host,
  115. int port,
  116. const char *user,
  117. const char *passwd,
  118. int type);
  119. XML_DEPRECATED
  120. XMLPUBFUN int XMLCALL
  121. xmlNanoFTPUpdateURL (void *ctx,
  122. const char *URL);
  123. /*
  124. * Rather internal commands.
  125. */
  126. XML_DEPRECATED
  127. XMLPUBFUN int XMLCALL
  128. xmlNanoFTPGetResponse (void *ctx);
  129. XML_DEPRECATED
  130. XMLPUBFUN int XMLCALL
  131. xmlNanoFTPCheckResponse (void *ctx);
  132. /*
  133. * CD/DIR/GET handlers.
  134. */
  135. XML_DEPRECATED
  136. XMLPUBFUN int XMLCALL
  137. xmlNanoFTPCwd (void *ctx,
  138. const char *directory);
  139. XML_DEPRECATED
  140. XMLPUBFUN int XMLCALL
  141. xmlNanoFTPDele (void *ctx,
  142. const char *file);
  143. XML_DEPRECATED
  144. XMLPUBFUN SOCKET XMLCALL
  145. xmlNanoFTPGetConnection (void *ctx);
  146. XML_DEPRECATED
  147. XMLPUBFUN int XMLCALL
  148. xmlNanoFTPCloseConnection(void *ctx);
  149. XML_DEPRECATED
  150. XMLPUBFUN int XMLCALL
  151. xmlNanoFTPList (void *ctx,
  152. ftpListCallback callback,
  153. void *userData,
  154. const char *filename);
  155. XML_DEPRECATED
  156. XMLPUBFUN SOCKET XMLCALL
  157. xmlNanoFTPGetSocket (void *ctx,
  158. const char *filename);
  159. XML_DEPRECATED
  160. XMLPUBFUN int XMLCALL
  161. xmlNanoFTPGet (void *ctx,
  162. ftpDataCallback callback,
  163. void *userData,
  164. const char *filename);
  165. XML_DEPRECATED
  166. XMLPUBFUN int XMLCALL
  167. xmlNanoFTPRead (void *ctx,
  168. void *dest,
  169. int len);
  170. #ifdef __cplusplus
  171. }
  172. #endif
  173. #endif /* LIBXML_FTP_ENABLED */
  174. #endif /* __NANO_FTP_H__ */