new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / src / os_maild / maild.h
1 /* Copyright (C) 2009 Trend Micro Inc.
2  * All rights reserved.
3  *
4  * This program is a free software; you can redistribute it
5  * and/or modify it under the terms of the GNU General Public
6  * License (version 2) as published by the FSF - Free Software
7  * Foundation.
8  */
9
10 #ifndef _MAILD_H
11 #define _MAILD_H
12
13 #define MAIL_LIST_SIZE      96   /* Max number of emails to be saved */
14 #define MAXCHILDPROCESS     6    /* Maximum simultaneous children */
15
16 /* Each timeout is x * 5 */
17 #define NEXTMAIL_TIMEOUT    2    /* Time to check for next msg - 5 */
18 #define DEFAULT_TIMEOUT     18   /* socket read timeout - 18 (*5)*/
19 #define SUBJECT_SIZE        128  /* Maximum subject size */
20
21 /* Maximum body size */
22 #define BODY_SIZE           OS_MAXSTR + OS_SIZE_1024
23
24 #define SMS_SUBJECT         "OSSEC %d - %d - %s"
25 #define MAIL_SUBJECT        "OSSEC Notification - %s - Alert level %d"
26 #define MAIL_SUBJECT_FULL   "OSSEC Alert - %s - Level %d - %s"
27
28 /* Full subject without ossec in the name */
29 #ifdef CLEANFULL
30 #define MAIL_SUBJECT_FULL2   "%d - %s - %s"
31 #endif
32
33 #ifdef LIBGEOIP_ENABLED
34 #define MAIL_BODY           "\r\nOSSEC HIDS Notification.\r\n" \
35                             "%s\r\n\r\n" \
36                             "Received From: %s\r\n" \
37                             "Rule: %d fired (level %d) -> \"%s\"\r\n" \
38                             "%s" \
39                             "%s" \
40                             "%s" \
41                             "Portion of the log(s):\r\n\r\n%s\r\n" \
42                             "\r\n\r\n --END OF NOTIFICATION\r\n\r\n\r\n"
43 #else
44 #define MAIL_BODY           "\r\nOSSEC HIDS Notification.\r\n" \
45                             "%s\r\n\r\n" \
46                             "Received From: %s\r\n" \
47                             "Rule: %d fired (level %d) -> \"%s\"\r\n" \
48                             "%s" \
49                             "Portion of the log(s):\r\n\r\n%s\r\n" \
50                             "\r\n\r\n --END OF NOTIFICATION\r\n\r\n\r\n"
51 #endif
52
53 /* Mail msg structure */
54 typedef struct _MailMsg {
55     char *subject;
56     char *body;
57 } MailMsg;
58
59 #include "shared.h"
60 #include "config/mail-config.h"
61
62 /* Config function */
63 int MailConf(int test_config, const char *cfgfile, MailConfig *Mail) __attribute__((nonnull));
64
65 /* Receive the e-mail message */
66 MailMsg *OS_RecvMailQ(file_queue *fileq, struct tm *p, MailConfig *mail,
67                       MailMsg **msg_sms) __attribute__((nonnull));
68
69 /* Send an email */
70 int OS_Sendmail(MailConfig *mail, struct tm *p) __attribute__((nonnull));
71 int OS_SendCustomEmail(char **to, char *subject, char *smtpserver, char *from, char *idsname, char *fname, const struct tm *p);
72
73 /* Mail timeout used by the file-queue */
74 extern unsigned int mail_timeout;
75
76 /* Global var for highest level on mail subjects */
77 extern unsigned int   _g_subject_level;
78 extern char _g_subject[SUBJECT_SIZE + 2];
79
80 #endif
81