ftpfs.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef __CURLFTPFS_FTPFS_H__
  2. #define __CURLFTPFS_FTPFS_H__
  3. /*
  4. FTP file system
  5. Copyright (C) 2006 Robson Braga Araujo <robsonbraga@gmail.com>
  6. This program can be distributed under the terms of the GNU GPL.
  7. See the file COPYING.
  8. */
  9. #include <curl/curl.h>
  10. #include <curl/easy.h>
  11. #include <pthread.h>
  12. #include <pthread.h>
  13. struct ftpfs {
  14. char* host;
  15. char* mountpoint;
  16. pthread_mutex_t lock;
  17. CURL* connection;
  18. CURLM* multi;
  19. int attached_to_multi;
  20. struct ftpfs_file* current_fh;
  21. unsigned blksize;
  22. int verbose;
  23. int debug;
  24. int transform_symlinks;
  25. int disable_epsv;
  26. int skip_pasv_ip;
  27. char* ftp_method;
  28. char* custom_list;
  29. int tcp_nodelay;
  30. char* ftp_port;
  31. int disable_eprt;
  32. int connect_timeout;
  33. int use_ssl;
  34. int no_verify_hostname;
  35. int no_verify_peer;
  36. char* cert;
  37. char* cert_type;
  38. char* key;
  39. char* key_type;
  40. char* key_password;
  41. char* engine;
  42. char* cacert;
  43. char* capath;
  44. char* ciphers;
  45. char* interface;
  46. char* krb4;
  47. char* proxy;
  48. int proxytunnel;
  49. int proxyanyauth;
  50. int proxybasic;
  51. int proxydigest;
  52. int proxyntlm;
  53. int proxytype;
  54. char* user;
  55. char* proxy_user;
  56. int ssl_version;
  57. int ip_version;
  58. char symlink_prefix[PATH_MAX+1];
  59. size_t symlink_prefix_len;
  60. curl_version_info_data* curl_version;
  61. int safe_nobody;
  62. int tryutf8;
  63. char *codepage;
  64. char *iocharset;
  65. int multiconn;
  66. };
  67. extern struct ftpfs ftpfs;
  68. #define curl_easy_setopt_or_die(handle, option, ...) \
  69. do {\
  70. CURLcode res = curl_easy_setopt(handle, option, __VA_ARGS__);\
  71. if (res != CURLE_OK) {\
  72. fprintf(stderr, "Error setting curl: %s\n", error_buf);\
  73. exit(1);\
  74. }\
  75. }while(0)
  76. #define DEBUG(level, args...) \
  77. do { if (level <= ftpfs.debug) {\
  78. int i = 0; \
  79. while (++i < level) fprintf(stderr, " "); \
  80. fprintf(stderr, "%ld ", time(NULL));\
  81. fprintf(stderr, __FILE__ ":%d ", __LINE__);\
  82. fprintf(stderr, args);\
  83. }\
  84. } while(0)
  85. #endif /* __CURLFTPFS_FTPFS_H__ */