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.

images.h 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef IMAGES_H_
  2. #define IMAGES_H_
  3. #include "config.h"
  4. #include "fstring.h"
  5. struct html_image;
  6. struct rspamd_task;
  7. struct rspamd_mime_part;
  8. #define RSPAMD_DCT_LEN (64 * 64)
  9. enum rspamd_image_type {
  10. IMAGE_TYPE_PNG = 0,
  11. IMAGE_TYPE_JPG,
  12. IMAGE_TYPE_GIF,
  13. IMAGE_TYPE_BMP,
  14. IMAGE_TYPE_UNKNOWN
  15. };
  16. struct rspamd_image {
  17. struct rspamd_mime_part *parent;
  18. rspamd_ftok_t *data;
  19. rspamd_ftok_t *filename;
  20. struct html_image *html_image;
  21. enum rspamd_image_type type;
  22. guint32 width;
  23. guint32 height;
  24. gboolean is_normalized;
  25. guchar *dct;
  26. };
  27. /*
  28. * Process images from a worker task
  29. */
  30. void rspamd_images_process (struct rspamd_task *task);
  31. /**
  32. * Processes image in raw data
  33. * @param task
  34. * @param data
  35. * @return
  36. */
  37. struct rspamd_image* rspamd_maybe_process_image (rspamd_mempool_t *pool,
  38. rspamd_ftok_t *data);
  39. /*
  40. * Get textual representation of an image's type
  41. */
  42. const gchar * rspamd_image_type_str (enum rspamd_image_type type);
  43. void rspamd_image_normalize (struct rspamd_task *task, struct rspamd_image *img);
  44. #endif /* IMAGES_H_ */