upload.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef RVC_MOD_UPLOAD_UPLOAD_H_
  2. #define RVC_MOD_UPLOAD_UPLOAD_H_
  3. #include <list.h>
  4. #ifdef RVC_OS_WIN
  5. #else
  6. #include <sys/stat.h>
  7. #include <sys/types.h>
  8. #include <fcntl.h>
  9. #include <time.h>
  10. #include <stdio.h>
  11. #include <cstdio>
  12. #include <iostream>
  13. #endif
  14. typedef struct file_t file_t;
  15. typedef struct upload_dir_t upload_dir_t;
  16. struct file_t
  17. {
  18. struct list_head entry;
  19. char *path;
  20. char *name;
  21. unsigned int create_time;//距离2000年1月1日的流逝的秒数
  22. unsigned int length;
  23. upload_dir_t *owner;
  24. };
  25. #define UPLOAD_FLAG_AUTODELETE 0x01
  26. #define UPLOAD_FLAG_MOVEPATH 0x02
  27. #define UPLOAD_FLAG_ZIP 0x04
  28. // from ini config
  29. struct upload_dir_t {
  30. struct list_head entry;
  31. char *name;
  32. char *path;
  33. int flags;//自动删除|移动|压缩
  34. char *movepath;
  35. struct list_head candidate_list;//需要上传文件的集合
  36. int silent_time; // sec
  37. int child_count_limitation;
  38. int fileCount;//增加lwt 当前文件的个数
  39. int fileLenSum;//文件总长度 单位是k
  40. };
  41. void upload_file_destroy(file_t *file);
  42. int upload_create(struct list_head *list, IEntityFunction *pEntityFunc, IConfigInfo *pConfig,CSimpleStringA &checkDir);
  43. int upload_fresh(struct list_head *list);
  44. #ifdef RVC_OS_WIN
  45. bool ZipData(LPCTSTR lpszZipArchive, LPCTSTR lpszSrcFile);
  46. #else
  47. unsigned long GetTickCount();
  48. int changeFileAtt(const char* path);
  49. long getLinuxFileCTime(const char* fileName);
  50. #endif // RVC_OS_WIN
  51. //增加lwt
  52. /** 交易受限功能代码废弃
  53. int check_dir_fresh(const char *path,int limitation,int silentTime,int &fileSumlen);
  54. */
  55. void updir_del_file(file_t *file);
  56. #endif // RVC_MOD_UPLOAD_UPLOAD_H_