3c40f8ca44190164f8547d71423e063f0e442324
[platform/upstream/connectedhomeip.git] / src / lib / asn1 / ASN1Config.h
1 /*
2  *
3  *    Copyright (c) 2020 Project CHIP Authors
4  *    Copyright (c) 2014-2017 Nest Labs, Inc.
5  *    All rights reserved.
6  *
7  *    Licensed under the Apache License, Version 2.0 (the "License");
8  *    you may not use this file except in compliance with the License.
9  *    You may obtain a copy of the License at
10  *
11  *        http://www.apache.org/licenses/LICENSE-2.0
12  *
13  *    Unless required by applicable law or agreed to in writing, software
14  *    distributed under the License is distributed on an "AS IS" BASIS,
15  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  *    See the License for the specific language governing permissions and
17  *    limitations under the License.
18  */
19
20 /**
21  *    @file
22  *      This file defines default compile-time configuration constants
23  *      for the CHIP ASN1 subsystem.
24  *
25  */
26
27 #pragma once
28
29 #include <core/CHIPConfig.h>
30
31 // clang-format off
32
33 /**
34  *  @def ASN1_CONFIG_ERROR_TYPE
35  *
36  *  @brief
37  *    This defines the data type used to represent errors for the ASN1
38  *    subsystem.
39  *
40  */
41 #ifndef ASN1_CONFIG_ERROR_TYPE
42 #include <stdint.h>
43
44 #define ASN1_CONFIG_ERROR_TYPE                              int32_t
45 #endif // ASN1_CONFIG_ERROR_TYPE
46
47 /**
48  *  @def ASN1_CONFIG_NO_ERROR
49  *
50  *  @brief
51  *    This defines the ASN1 error code for no error or success.
52  *
53  */
54 #ifndef ASN1_CONFIG_NO_ERROR
55 #define ASN1_CONFIG_NO_ERROR                                0
56 #endif // ASN1_CONFIG_NO_ERROR
57
58 /**
59  *  @def ASN1_CONFIG_ERROR_MIN
60  *
61  *  @brief
62  *    This defines the base or minimum ASN1 error number range.
63  *
64  */
65 #ifndef ASN1_CONFIG_ERROR_MIN
66 #define ASN1_CONFIG_ERROR_MIN                               5000
67 #endif // ASN1_CONFIG_ERROR_MIN
68
69 /**
70  *  @def ASN1_CONFIG_ERROR_MAX
71  *
72  *  @brief
73  *    This defines the top or maximum ASN1 error number range.
74  *
75  */
76 #ifndef ASN1_CONFIG_ERROR_MAX
77 #define ASN1_CONFIG_ERROR_MAX                               5999
78 #endif // ASN1_CONFIG_ERROR_MAX
79
80 /**
81  *  @def _ASN1_CONFIG_ERROR
82  *
83  *  @brief
84  *    This defines a mapping function for ASN1 errors that allows
85  *    mapping such errors into a platform- or system-specific range.
86  *
87  */
88 #ifndef _ASN1_CONFIG_ERROR
89 #define _ASN1_CONFIG_ERROR(e)                               (ASN1_ERROR_MIN + (e))
90 #endif // _ASN1_CONFIG_ERROR
91
92 // clang-format on