1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 #include <sys/socket.h>
10 #include "time-util.h"
12 typedef struct ClientContext ClientContext
;
14 #include "journald-server.h"
16 struct ClientContext
{
44 sd_id128_t invocation_id
;
51 struct iovec
*extra_fields_iovec
;
52 size_t extra_fields_n_iovec
;
53 void *extra_fields_data
;
54 nsec_t extra_fields_mtime
;
56 usec_t log_ratelimit_interval
;
57 unsigned log_ratelimit_burst
;
60 int client_context_get(
63 const struct ucred
*ucred
,
64 const char *label
, size_t label_len
,
68 int client_context_acquire(
71 const struct ucred
*ucred
,
72 const char *label
, size_t label_len
,
76 ClientContext
* client_context_release(Server
*s
, ClientContext
*c
);
78 void client_context_maybe_refresh(
81 const struct ucred
*ucred
,
82 const char *label
, size_t label_size
,
86 void client_context_acquire_default(Server
*s
);
87 void client_context_flush_all(Server
*s
);
89 static inline size_t client_context_extra_fields_n_iovec(const ClientContext
*c
) {
90 return c
? c
->extra_fields_n_iovec
: 0;
93 static inline bool client_context_test_priority(const ClientContext
*c
, int priority
) {
97 if (c
->log_level_max
< 0)
100 return LOG_PRI(priority
) <= c
->log_level_max
;