File: log.h

package info (click to toggle)
pmacct 1.7.6-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 11,548 kB
  • sloc: ansic: 106,538; sh: 4,876; cpp: 4,340; python: 3,631; makefile: 502
file content (91 lines) | stat: -rw-r--r-- 2,645 bytes parent folder | download | duplicates (3)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
    pmacct (Promiscuous mode IP Accounting package)
    pmacct is Copyright (C) 2003-2020 by Paolo Lucente
*/

/*
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#ifndef LOG_H
#define LOG_H

/* includes */
#include <stdarg.h>
#include <sys/stat.h>

/* defines */
#define LOGSTRLEN LONGSRVBUFLEN 

struct _facility_map {
  char string[10];
  int num;
};

static const struct _facility_map facility_map[] = {
	{"auth", LOG_AUTH},
	{"mail", LOG_MAIL},
	{"daemon", LOG_DAEMON},
	{"kern", LOG_KERN},
	{"user", LOG_USER},
	{"local0", LOG_LOCAL0},
	{"local1", LOG_LOCAL1},
	{"local2", LOG_LOCAL2},
	{"local3", LOG_LOCAL3},
	{"local4", LOG_LOCAL4},
	{"local5", LOG_LOCAL5},
	{"local6", LOG_LOCAL6},
	{"local7", LOG_LOCAL7},
	{"-1", -1},
};

struct log_notification {
  time_t stamp;
  u_int8_t knob;
  int timeout;
};

struct _log_notifications {
  struct log_notification snaplen_issue;
  struct log_notification max_classifiers;
  struct log_notification bgp_peers_throttling;
  struct log_notification bgp_peers_limit;
  struct log_notification bmp_peers_throttling;
  struct log_notification bmp_peers_limit;
  struct log_notification geoip_ipv4_file_null;
  struct log_notification geoip_ipv6_file_null;
#if defined (WITH_NDPI)
  struct log_notification ndpi_cache_full;
  struct log_notification ndpi_tmp_frag_warn;
#endif
  struct log_notification tee_plugin_cant_bridge_af;
};

/* prototypes */
extern void Log(short int, char *, ...)
#ifdef __GNUC__
  __attribute__((format(printf, 2, 3)))
#endif
  ;
extern int parse_log_facility(const char *);
extern void log_notification_init(struct log_notification *);
extern void log_notifications_init(struct _log_notifications *);
extern int log_notification_set(struct log_notification *, time_t, int);
extern int log_notification_unset(struct log_notification *);
extern int log_notification_isset(struct log_notification *, time_t);

/* global vars */
extern struct _log_notifications log_notifications;
#endif //LOG_H