6b6025b6cec67eb593ec576e5563c16159ca95ec
[openssl.git] / include / openssl / cmp_util.h
1 /*
2  * Copyright 2007-2019 The OpenSSL Project Authors. All Rights Reserved.
3  * Copyright Nokia 2007-2019
4  * Copyright Siemens AG 2015-2019
5  *
6  * Licensed under the Apache License 2.0 (the "License").  You may not use
7  * this file except in compliance with the License.  You can obtain a copy
8  * in the file LICENSE in the source distribution or at
9  * https://www.openssl.org/source/license.html
10  */
11
12 #ifndef OPENSSL_CMP_UTIL_H
13 # define OPENSSL_CMP_UTIL_H
14
15 # include <openssl/opensslconf.h>
16 # ifndef OPENSSL_NO_CMP
17
18 #  include <openssl/macros.h>
19 #  include <openssl/trace.h>
20 #  include <openssl/x509.h>
21
22 #  ifdef __cplusplus
23 extern "C" {
24 #  endif
25
26 int  OSSL_CMP_log_open(void);
27 void OSSL_CMP_log_close(void);
28 #  define OSSL_CMP_LOG_PREFIX "CMP "
29
30 /*
31  * generalized logging/error callback mirroring the severity levels of syslog.h
32  */
33 typedef int OSSL_CMP_severity;
34 #  define OSSL_CMP_LOG_EMERG   0
35 #  define OSSL_CMP_LOG_ALERT   1
36 #  define OSSL_CMP_LOG_CRIT    2
37 #  define OSSL_CMP_LOG_ERR     3
38 #  define OSSL_CMP_LOG_WARNING 4
39 #  define OSSL_CMP_LOG_NOTICE  5
40 #  define OSSL_CMP_LOG_INFO    6
41 #  define OSSL_CMP_LOG_DEBUG   7
42 typedef int (*OSSL_cmp_log_cb_t)(const char *func, const char *file, int line,
43                                  OSSL_CMP_severity level, const char *msg);
44
45 int OSSL_CMP_print_to_bio(BIO *bio, const char *component, const char *file,
46                           int line, OSSL_CMP_severity level, const char *msg);
47 /* use of the logging callback for outputting error queue */
48 void OSSL_CMP_print_errors_cb(OSSL_cmp_log_cb_t log_fn);
49
50 #  ifdef  __cplusplus
51 }
52 #  endif
53 # endif /* !defined(OPENSSL_NO_CMP) */
54 #endif /* !defined(OPENSSL_CMP_UTIL_H) */