]> git.proxmox.com Git - mirror_frr.git/blob - lib/zlog_live.h
doc: Add `show ipv6 rpf X:X::X:X` command to docs
[mirror_frr.git] / lib / zlog_live.h
1 /*
2 * Copyright (c) 2019-22 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_LIVE_H
18 #define _FRR_ZLOG_LIVE_H
19
20 #include "printfrr.h"
21
22 struct zlog_live_hdr {
23 /* timestamp (CLOCK_REALTIME) */
24 uint64_t ts_sec;
25 uint32_t ts_nsec;
26
27 /* length of zlog_live_hdr, including variable length bits and
28 * possible future extensions - aka start of text
29 */
30 uint32_t hdrlen;
31
32 /* process & thread ID, meaning depends on OS */
33 int64_t pid;
34 int64_t tid;
35
36 /* number of lost messages due to best-effort non-blocking mode */
37 uint32_t lost_msgs;
38 /* syslog priority value */
39 uint32_t prio;
40 /* flags: currently unused */
41 uint32_t flags;
42 /* length of message text - extra data (e.g. future key/value metadata)
43 * may follow after it
44 */
45 uint32_t textlen;
46 /* length of "[XXXXX-XXXXX][EC 0] " header; consumer may want to skip
47 * over it if using the raw values below. Note that this text may be
48 * absent depending on "log error-category" and "log unique-id"
49 * settings
50 */
51 uint32_t texthdrlen;
52
53 /* xref unique identifier, "XXXXX-XXXXX\0" = 12 bytes */
54 char uid[12];
55 /* EC value */
56 uint32_t ec;
57
58 /* recorded printf formatting argument positions (variable length) */
59 uint32_t n_argpos;
60 struct fmt_outpos argpos[0];
61 };
62
63 struct zlt_live;
64
65 struct zlog_live_cfg {
66 struct zlt_live *target;
67
68 /* nothing else here */
69 };
70
71 extern void zlog_live_open(struct zlog_live_cfg *cfg, int prio_min,
72 int *other_fd);
73 extern void zlog_live_open_fd(struct zlog_live_cfg *cfg, int prio_min, int fd);
74
75 static inline bool zlog_live_is_null(struct zlog_live_cfg *cfg)
76 {
77 return cfg->target == NULL;
78 }
79
80 extern void zlog_live_close(struct zlog_live_cfg *cfg);
81 extern void zlog_live_disown(struct zlog_live_cfg *cfg);
82
83 #endif /* _FRR_ZLOG_5424_H */