]> git.proxmox.com Git - mirror_frr.git/blame - lib/zlog_targets.h
Merge pull request #6242 from pguibert6WIND/flowspec_nlri_too_big
[mirror_frr.git] / lib / zlog_targets.h
CommitLineData
0bdeb5e5
DL
1/*
2 * Copyright (c) 2015-19 David Lamparter, for NetDEF, Inc.
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _FRR_ZLOG_TARGETS_H
18#define _FRR_ZLOG_TARGETS_H
19
20#include <pthread.h>
21
22#include "zlog.h"
23
24/* multiple file log targets can be active */
25
26struct zlt_fd;
27
28struct zlog_cfg_file {
29 struct zlt_fd *active;
30
31 pthread_mutex_t cfg_mtx;
32
33 /* call zlog_file_set_other() to apply these */
34 int prio_min;
35 char ts_subsec;
36 bool record_priority;
37
38 /* call zlog_file_set_filename/fd() to change this */
39 char *filename;
40 int fd;
1c408628
DL
41
42 void (*zlog_wrap)(struct zlog_target *zt, struct zlog_msg *msgs[],
43 size_t nmsgs);
0bdeb5e5
DL
44};
45
46extern void zlog_file_init(struct zlog_cfg_file *zcf);
47extern void zlog_file_fini(struct zlog_cfg_file *zcf);
48
49extern void zlog_file_set_other(struct zlog_cfg_file *zcf);
50extern bool zlog_file_set_filename(struct zlog_cfg_file *zcf, const char *name);
51extern bool zlog_file_set_fd(struct zlog_cfg_file *zcf, int fd);
52extern bool zlog_file_rotate(struct zlog_cfg_file *zcf);
53
1c408628
DL
54extern void zlog_fd(struct zlog_target *zt, struct zlog_msg *msgs[],
55 size_t nmsgs);
56
0bdeb5e5
DL
57/* syslog is always limited to one target */
58
59extern void zlog_syslog_set_facility(int facility);
60extern int zlog_syslog_get_facility(void);
61
62/* use ZLOG_DISABLED to disable */
63extern void zlog_syslog_set_prio_min(int prio_min);
64extern int zlog_syslog_get_prio_min(void);
65
66#endif /* _FRR_ZLOG_TARGETS_H */