root/psad/tags/psad-2.1.2/psad.h

Revision 1959, 2.5 kB (checked in by mbr, 2 years ago)

added safe_malloc() to always perform NULL check on pointer returned by malloc()

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*
2 ********************************************************************************
3 *
4 *  File: psad.h
5 *
6 *  Author: Michael Rash (mbr@cipherdyne.org)
7 *
8 *  Purpose: psad.h include appropriate system header files, and defines file
9 *           paths, function prototypes, and constants that are needed by
10 *           the C versions of psad.
11 *
12 *  Credits:  (see the CREDITS file)
13 *
14 *  Copyright (C) 1999-2006 Michael Rash (mbr@cipherdyne.org)
15 *
16 *  License (GNU Public License):
17 *
18 *     This program is distributed in the hope that it will be useful,
19 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
20 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 *     GNU General Public License for more details.
22 *
23 *     You should have received a copy of the GNU General Public License
24 *     along with this program; if not, write to the Free Software
25 *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
26 *     USA
27 *
28 ********************************************************************************
29 *
30 *  $Id$
31 */
32
33 #ifndef __PSAD_H__
34 #define __PSAD_H__
35
36 /* INCLUDES *******************************************************************/
37 #include <stdio.h>
38 #include <stdlib.h>
39 #include <string.h>
40 #include <unistd.h>    /* read(), write(), and close() */
41 #include <fcntl.h>     /* open() */
42 #include <sys/stat.h>  /* umask */
43 #include <sys/wait.h>
44 #include <sys/types.h>
45 #include <signal.h>
46 #include <syslog.h>
47 #include <ctype.h>
48
49 /* DEFINES ********************************************************************/
50 #define MAX_LINE_BUF 1024
51 #define MAX_PID_SIZE 6
52 #define MAX_PATH_LEN 100
53 #define MAX_MSG_LEN 120
54 #define MAX_GEN_LEN 80
55 #define MAX_EMAIL_LEN 300
56 #define MAX_ARG_LEN 30
57 #define MAX_NUM_LEN 6
58
59 /* PROTOTYPES *****************************************************************/
60 void slogr(const char *, const char *);
61 void check_unique_pid(const char *, const char *);
62 void write_pid(const char *, pid_t);
63 void daemonize_process(const char *);
64 void send_alert_email(const char *, const char *, const char *);
65 int has_sub_var(char *var_name, char *value, char *sub_var,
66     char *pre_str, char *post_str);
67 void expand_sub_var_value(char *value, const char *sub_var,
68     const char *pre_str, const char *post_str);
69 int find_char_var(const char *, char *, char *);
70 int check_import_config(time_t *config_mtime, char *config_file);
71 void *safe_malloc(const unsigned int len);
72
73 /* From OpenBSD */
74 size_t strlcpy(char *, const char *, size_t);
75 size_t strlcat(char *, const char *, size_t);
76
77 #endif  /* __PSAD_H__ */
Note: See TracBrowser for help on using the browser.