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