blob: 887f30a37bfe2664eeba7feea6397412af954a7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#ifndef IMAGES_H_
#define IMAGES_H_
#include "config.h"
#include "fstring.h"
#ifdef __cplusplus
extern "C" {
#endif
struct html_image;
struct rspamd_task;
struct rspamd_mime_part;
#define RSPAMD_DCT_LEN (64 * 64)
enum rspamd_image_type {
IMAGE_TYPE_PNG = 0,
IMAGE_TYPE_JPG,
IMAGE_TYPE_GIF,
IMAGE_TYPE_BMP,
IMAGE_TYPE_UNKNOWN
};
struct rspamd_image {
struct rspamd_mime_part *parent;
rspamd_ftok_t *data;
rspamd_ftok_t *filename;
struct html_image *html_image;
enum rspamd_image_type type;
guint32 width;
guint32 height;
gboolean is_normalized;
guchar *dct;
};
/*
* Process images from a worker task
*/
void rspamd_images_process (struct rspamd_task *task);
/**
* Process image if possible in a single mime part
* @param task
* @param part
* @return
*/
bool rspamd_images_process_mime_part_maybe (struct rspamd_task *task,
struct rspamd_mime_part *part);
/*
* Link embedded images to the HTML parts
*/
void rspamd_images_link (struct rspamd_task *task);
/**
* Processes image in raw data
* @param task
* @param data
* @return
*/
struct rspamd_image *rspamd_maybe_process_image (rspamd_mempool_t *pool,
rspamd_ftok_t *data);
/*
* Get textual representation of an image's type
*/
const gchar *rspamd_image_type_str (enum rspamd_image_type type);
void rspamd_image_normalize (struct rspamd_task *task, struct rspamd_image *img);
#ifdef __cplusplus
}
#endif
#endif /* IMAGES_H_ */
|