1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
5 #include <sys/socket.h>
11 #include "time-util.h"
13 typedef struct ClientContext ClientContext
;
15 #include "journald-server.h"
17 struct ClientContext
{
45 sd_id128_t invocation_id
;
52 struct iovec
*extra_fields_iovec
;
53 size_t extra_fields_n_iovec
;
54 void *extra_fields_data
;
55 nsec_t extra_fields_mtime
;
57 usec_t log_ratelimit_interval
;
58 unsigned log_ratelimit_burst
;
60 Set
*log_filter_allowed_patterns
;
61 Set
*log_filter_denied_patterns
;
64 int client_context_get(
67 const struct ucred
*ucred
,
68 const char *label
, size_t label_len
,
72 int client_context_acquire(
75 const struct ucred
*ucred
,
76 const char *label
, size_t label_len
,
80 ClientContext
* client_context_release(Server
*s
, ClientContext
*c
);
82 void client_context_maybe_refresh(
85 const struct ucred
*ucred
,
86 const char *label
, size_t label_size
,
90 void client_context_acquire_default(Server
*s
);
91 void client_context_flush_all(Server
*s
);
92 void client_context_flush_regular(Server
*s
);
94 static inline size_t client_context_extra_fields_n_iovec(const ClientContext
*c
) {
95 return c
? c
->extra_fields_n_iovec
: 0;
98 static inline bool client_context_test_priority(const ClientContext
*c
, int priority
) {
102 if (c
->log_level_max
< 0)
105 return LOG_PRI(priority
) <= c
->log_level_max
;