You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

archives.h 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*-
  2. * Copyright 2016 Vsevolod Stakhov
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef SRC_LIBMIME_ARCHIVES_H_
  17. #define SRC_LIBMIME_ARCHIVES_H_
  18. #include "config.h"
  19. enum rspamd_archive_type {
  20. RSPAMD_ARCHIVE_ZIP,
  21. RSPAMD_ARCHIVE_RAR,
  22. RSPAMD_ARCHIVE_7ZIP,
  23. RSPAMD_ARCHIVE_GZIP,
  24. };
  25. enum rspamd_archive_flags {
  26. RSPAMD_ARCHIVE_ENCRYPTED = (1 << 0),
  27. };
  28. enum rspamd_archive_file_flags {
  29. RSPAMD_ARCHIVE_FILE_ENCRYPTED = (1 << 0),
  30. };
  31. struct rspamd_archive_file {
  32. GString *fname;
  33. gsize compressed_size;
  34. gsize uncompressed_size;
  35. enum rspamd_archive_file_flags flags;
  36. };
  37. struct rspamd_archive {
  38. enum rspamd_archive_type type;
  39. const rspamd_ftok_t *archive_name;
  40. gsize size;
  41. enum rspamd_archive_flags flags;
  42. GPtrArray *files; /* Array of struct rspamd_archive_file */
  43. };
  44. /**
  45. * Process archives from a worker task
  46. */
  47. void rspamd_archives_process (struct rspamd_task *task);
  48. /**
  49. * Get textual representation of an archive's type
  50. */
  51. const gchar * rspamd_archive_type_str (enum rspamd_archive_type type);
  52. #endif /* SRC_LIBMIME_ARCHIVES_H_ */