The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
log.h
Go to the documentation of this file.
1#pragma once
2/*
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16 */
17#ifdef WITH_TLS
18/**
19 * $Id: 6c70110dd186a9263cdd5af7acafa9f62704447b $
20 *
21 * @file lib/tls/log.h
22 * @brief Prototypes for TLS logging functions
23 *
24 * @copyright 2017 The FreeRADIUS project
25 * @copyright 2021 Arran Cudbard-Bell (a.cudbardb@freeradius.org)
26 */
27RCSIDH(tls_log_h, "$Id: 6c70110dd186a9263cdd5af7acafa9f62704447b $")
28
29#include "openssl_user_macros.h"
30
31
32#include <freeradius-devel/server/request.h>
33#include <openssl/bio.h>
34
35#include "base.h"
36
37/** Write out a certificate chain to the request or global log
38 *
39 * @param[in] _request The current request or NULL if you want to write to the global log.
40 * @param[in] _log_type Type of log message to create.
41 * @param[in] _chain A stack of X509 certificates representing the chain.
42 * @param[in] _leaf The leaf certificate. May be NULL.
43 */
44#define fr_tls_chain_log(_request, _log_type, _chain, _leaf) \
45 _fr_tls_chain_log( __FILE__, __LINE__, _request, _log_type, _chain, _leaf)
46void _fr_tls_chain_log(char const *file, int line,
47 request_t *request, fr_log_type_t log_type, STACK_OF(X509) *chain, X509 *leaf);
48
49/** Write out a certificate chain with a marker to the request or global log
50 *
51 * @param[in] _request The current request or NULL if you want to write to the global log.
52 * @param[in] _log_type Type of log message to create.
53 * @param[in] _chain A stack of X509 certificates representing the chain.
54 * @param[in] _leaf The leaf certificate. May be NULL.
55 * @param[in] _marker Emit a marker for this certificate.
56 */
57#define fr_tls_chain_marker_log(_request, _log_type, _chain, _leaf, _marker) \
58 _fr_tls_chain_marker_log( __FILE__, __LINE__, _request, _log_type, _chain, _leaf, _marker)
59void _fr_tls_chain_marker_log(char const *file, int line,
60 request_t *request, fr_log_type_t log_type, STACK_OF(X509) *chain, X509 *leaf,
61 X509 *marker);
62
63/** Write out a collection of X509 objects to the request or global log
64 *
65 * @param[in] _request The current request or NULL if you want to write to the global log.
66 * @param[in] _log_type Type of log message to create.
67 * @param[in] _objects to print to the log
68 */
69#define fr_tls_x509_objects_log(_request, _log_type, _objects) \
70 _fr_tls_x509_objects_log( __FILE__, __LINE__, _request, _log_type, _objects)
71void _fr_tls_x509_objects_log(char const *file, int line,
72 request_t *request, fr_log_type_t log_type,
73 STACK_OF(X509_OBJECT) *objects);
74
75int fr_tls_log_io_error(request_t *request, int err, char const *msg, ...)
76 CC_HINT(format (printf, 3, 4));
77
78int fr_tls_log(request_t *request, char const *msg, ...) CC_HINT(format (printf, 2, 3));
79
80void fr_tls_log_clear(void);
81
82/** Return a BIO that writes to the log of the specified request
83 *
84 * @note BIO should be considered invalid if the request yields
85 *
86 * @param[in] _request to associate with the logging BIO.
87 * @param[in] _type of log messages.
88 * @param[in] _lvl to print log messages at.
89 * @return A BIO.
90 */
91#define fr_tls_request_log_bio(_request, _type, _lvl) \
92 _fr_tls_request_log_bio(__FILE__, __LINE__, _request, _type, _lvl)
93BIO *_fr_tls_request_log_bio(char const *file, int line, request_t *request,
95
96/** Return a BIO that writes to the global log
97 *
98 * @note BIO should be considered invalid if the request yields
99 *
100 * @param[in] _type of log messages.
101 * @param[in] _lvl to print log messages at.
102 * @return A BIO.
103 */
104#define fr_tls_global_log_bio(_type, _lvl) \
105 _fr_tls_global_log_bio(__FILE__, __LINE__, _type, _lvl)
106BIO *_fr_tls_global_log_bio(char const *file, int line, fr_log_type_t type, fr_log_lvl_t lvl);
107
108int fr_tls_log_init(void); /* Called from fr_openssl_init() */
109
110void fr_tls_log_free(void); /* Called from fr_openssl_init() */
111#endif
int const char * file
Definition acutest.h:702
log_entry msg
Definition acutest.h:794
int const char int line
Definition acutest.h:702
#define RCSIDH(h, id)
Definition build.h:507
static fr_slen_t err
Definition dict.h:882
fr_log_lvl_t
Definition log.h:64
fr_log_type_t
Definition log.h:51
fr_aka_sim_id_type_t type
int nonnull(2, 5))