forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCHIPError.h
1800 lines (1569 loc) · 47.3 KB
/
CHIPError.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
*
* Copyright (c) 2020-2022 Project CHIP Authors
* Copyright (c) 2013-2017 Nest Labs, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* This file defines error constants for the CHIP core
* subsystem.
*
* Error types, ranges, and mappings overrides may be made by
* defining the appropriate CHIP_CONFIG_* or _CHIP_CONFIG_*
* macros.
*/
#pragma once
#include <lib/core/CHIPConfig.h>
#include <lib/support/TypeTraits.h>
#include <inttypes.h>
#include <limits>
#include <type_traits>
#if __cplusplus >= 202002L
#include <source_location>
#endif // __cplusplus >= 202002L
namespace chip {
/**
* This class represents CHIP errors.
*
* At the top level, an error belongs to a Range and has an integral Value whose meaning depends on the Range.
* One, Range::kSDK, is used for the CHIP SDK's own errors; others encapsulate error codes from external sources
* (e.g. libraries, OS) into a CHIP_ERROR.
*
* CHIP SDK errors inside Range::kSDK consist of a component identifier given by SdkPart and an arbitrary small
* integer Code.
*/
class ChipError
{
public:
/// Internal representation of an error.
using StorageType = uint32_t;
/// Type for encapsulated error values.
using ValueType = StorageType;
/// Integer `printf` format for errors. This is a C macro in order to allow for string literal concatenation.
#define CHIP_ERROR_INTEGER_FORMAT PRIx32
#if CHIP_CONFIG_ERROR_FORMAT_AS_STRING
/// Type returned by Format().
using FormatType = const char *;
/// `printf` format for Format(). This is a C macro in order to allow for string literal concatenation.
#define CHIP_ERROR_FORMAT "s"
#else // CHIP_CONFIG_ERROR_FORMAT_AS_STRING
/// Type returned by Format().
using FormatType = StorageType;
/// `printf` format for Format(). This is a C macro in order to allow for string literal concatenation.
#define CHIP_ERROR_FORMAT CHIP_ERROR_INTEGER_FORMAT
#endif // CHIP_CONFIG_ERROR_FORMAT_AS_STRING
/**
* Top-level error classification.
*
* Every error belongs to a Range and has an integral Value whose meaning depends on the Range.
* All native CHIP SDK errors belong to the kSDK range. Other ranges are used to encapsulate error
* codes from other subsystems (e.g. platform or library) used by the CHIP SDK.
*/
enum class Range : uint8_t
{
kSDK = 0x0, ///< CHIP SDK errors.
kOS = 0x1, ///< Encapsulated OS errors, other than POSIX errno.
kPOSIX = 0x2, ///< Encapsulated POSIX errno values.
kLwIP = 0x3, ///< Encapsulated LwIP errors.
kOpenThread = 0x4, ///< Encapsulated OpenThread errors.
kPlatform = 0x5, ///< Platform-defined encapsulation.
kLastRange = kPlatform,
};
/**
* Secondary classification of CHIP SDK errors (Range::kSDK).
*/
enum class SdkPart : uint8_t
{
kCore = 0, ///< SDK core errors.
kInet = 1, ///< Inet layer errors; see <inet/InetError.h>.
kDevice = 2, ///< Device layer errors; see <platform/CHIPDeviceError.h>.
kASN1 = 3, ///< ASN1 errors; see <asn1/ASN1Error.h>.
kBLE = 4, ///< BLE layer errors; see <ble/BleError.h>.
kIMGlobalStatus = 5, ///< Interaction Model global status code.
kIMClusterStatus = 6, ///< Interaction Model cluster-specific status code.
kApplication = 7, ///< Application-defined errors; see CHIP_APPLICATION_ERROR
};
ChipError() = default;
// Helper for declaring constructors without too much repetition.
#if CHIP_CONFIG_ERROR_SOURCE
#if __cplusplus >= 202002L
#define CHIP_INITIALIZE_ERROR_SOURCE(f, l, loc) , mFile((f)), mLine((l)), mSourceLocation((loc))
#else
#define CHIP_INITIALIZE_ERROR_SOURCE(f, l, loc) , mFile((f)), mLine((l))
#endif // __cplusplus >= 202002L
#else // CHIP_CONFIG_ERROR_SOURCE
#define CHIP_INITIALIZE_ERROR_SOURCE(f, l, loc)
#endif // CHIP_CONFIG_ERROR_SOURCE
/**
* Construct a CHIP_ERROR encapsulating @a value inside the Range @a range.
*
* @note
* The result is valid only if CanEncapsulate() is true.
*/
constexpr ChipError(Range range, ValueType value) : ChipError(range, value, /*file=*/nullptr, /*line=*/0) {}
#if __cplusplus >= 202002L
constexpr ChipError(Range range, ValueType value, const char * file, unsigned int line,
std::source_location location = std::source_location::current()) :
mError(MakeInteger(range, (value & MakeMask(0, kValueLength)))) CHIP_INITIALIZE_ERROR_SOURCE(file, line, location)
{}
#else
constexpr ChipError(Range range, ValueType value, const char * file, unsigned int line) :
mError(MakeInteger(range, (value & MakeMask(0, kValueLength)))) CHIP_INITIALIZE_ERROR_SOURCE(file, line, /*loc=*/nullptr)
{}
#endif // __cplusplus >= 202002L
/**
* Construct a CHIP_ERROR for SdkPart @a part with @a code.
*
* @note
* The macro version CHIP_SDK_ERROR checks that the numeric value is constant and well-formed.
*/
constexpr ChipError(SdkPart part, uint8_t code) : ChipError(part, code, /*file=*/nullptr, /*line=*/0) {}
#if __cplusplus >= 202002L
constexpr ChipError(SdkPart part, uint8_t code, const char * file, unsigned int line,
std::source_location location = std::source_location::current()) :
mError(MakeInteger(part, code)) CHIP_INITIALIZE_ERROR_SOURCE(file, line, location)
{}
#else
constexpr ChipError(SdkPart part, uint8_t code, const char * file, unsigned int line) :
mError(MakeInteger(part, code)) CHIP_INITIALIZE_ERROR_SOURCE(file, line, /*loc=*/nullptr)
{}
#endif // __cplusplus >= 202002L
/**
* Construct a CHIP_ERROR constant for SdkPart @a part with @a code at the current source line.
* This checks that the numeric value is constant and well-formed.
* (In C++20 this could be replaced by a consteval constructor.)
*/
#if CHIP_CONFIG_ERROR_SOURCE
#define CHIP_SDK_ERROR(part, code) \
(::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
#else // CHIP_CONFIG_ERROR_SOURCE
#define CHIP_SDK_ERROR(part, code) (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value))
#endif // CHIP_CONFIG_ERROR_SOURCE
/**
* Construct a CHIP_ERROR from the underlying storage type.
*
* @note
* This is intended to be used only in foreign function interfaces.
*/
explicit constexpr ChipError(StorageType error) : ChipError(error, /*file=*/nullptr, /*line=*/0) {}
#if __cplusplus >= 202002L
explicit constexpr ChipError(StorageType error, const char * file, unsigned int line,
std::source_location location = std::source_location::current()) :
mError(error) CHIP_INITIALIZE_ERROR_SOURCE(file, line, location)
{}
#else
explicit constexpr ChipError(StorageType error, const char * file, unsigned int line) :
mError(error) CHIP_INITIALIZE_ERROR_SOURCE(file, line, /*loc=*/nullptr)
{}
#endif // __cplusplus >= 202002L
#undef CHIP_INITIALIZE_ERROR_SOURCE
/**
* Compare errors for equality.
*
* @note
* This only compares the error code. Under the CHIP_CONFIG_ERROR_SOURCE configuration, errors compare equal
* if they have the same error code, even if they have different source locations.
*/
bool operator==(const ChipError & other) const { return mError == other.mError; }
bool operator!=(const ChipError & other) const { return mError != other.mError; }
/**
* Return an integer code for the error.
*/
constexpr StorageType AsInteger() const { return mError; }
/*
* IsSuccess() is intended to support macros that can take either a ChipError or an integer error code.
* The latter follows the C convention that a non-zero integer indicates an error.
*
* @note
* Normal code should use `status == CHIP_NO_ERROR` rather than `IsSuccess(status)`.
*/
static constexpr bool IsSuccess(ChipError error) { return error.mError == 0; }
static constexpr bool IsSuccess(StorageType error) { return error == 0; }
/**
* Format an @a error for printing.
*
* Normally, this is used with the `printf()`-style macro CHIP_ERROR_FORMAT.
* For example,
* @code
* ChipLogError(subsystem, "A bad thing happened! %" CHIP_ERROR_FORMAT, status.Format());
* @endcode
*/
#if CHIP_CONFIG_ERROR_FORMAT_AS_STRING
FormatType Format() const { return AsString(); }
#else // CHIP_CONFIG_ERROR_FORMAT_AS_STRING
FormatType Format() const { return mError; }
#endif // CHIP_CONFIG_ERROR_FORMAT_AS_STRING
/**
* Format an @a error as a string for printing.
*
* @note
* Normally, prefer to use Format()
*/
const char * AsString() const
{
extern const char * ErrorStr(ChipError);
return ErrorStr(*this);
}
/**
* Test whether @a error belongs to the Range @a range.
*/
constexpr bool IsRange(Range range) const
{
return (mError & MakeMask(kRangeStart, kRangeLength)) == MakeField(kRangeStart, static_cast<StorageType>(range));
}
/**
* Get the Range to which the @a error belongs.
*/
constexpr Range GetRange() const { return static_cast<Range>(GetField(kRangeStart, kRangeLength, mError)); }
/**
* Get the encapsulated value of an @a error.
*/
constexpr ValueType GetValue() const { return GetField(kValueStart, kValueLength, mError); }
/**
* Test whether type @a T can always be losslessly encapsulated in a CHIP_ERROR.
*/
template <typename T>
static constexpr bool CanEncapsulate()
{
return std::numeric_limits<typename std::make_unsigned_t<T>>::digits <= kValueLength;
}
/**
* Test whether if @a value can be losslessly encapsulated in a CHIP_ERROR.
*/
template <typename T>
static constexpr bool CanEncapsulate(T value)
{
return CanEncapsulate<T>() || FitsInField(kValueLength, static_cast<ValueType>(value));
}
/**
* Test whether @a error is an SDK error belonging to the SdkPart @a part.
*/
constexpr bool IsPart(SdkPart part) const
{
return (mError & (MakeMask(kRangeStart, kRangeLength) | MakeMask(kSdkPartStart, kSdkPartLength))) ==
(MakeField(kRangeStart, static_cast<StorageType>(Range::kSDK)) |
MakeField(kSdkPartStart, static_cast<StorageType>(part)));
}
/**
* Get the SDK code for an SDK error.
*/
constexpr uint8_t GetSdkCode() const { return static_cast<uint8_t>(GetField(kSdkCodeStart, kSdkCodeLength, mError)); }
/**
* Test whether @a error is an SDK error representing an Interaction Model
* status. If it is, it can be converted to/from an interaction model
* StatusIB struct.
*/
constexpr bool IsIMStatus() const
{
// Open question: should CHIP_NO_ERROR be treated as an IM status for
// purposes of this test?
return IsPart(SdkPart::kIMGlobalStatus) || IsPart(SdkPart::kIMClusterStatus);
}
#if CHIP_CONFIG_ERROR_SOURCE
/**
* Get the source file name of the point where the error occurred.
*
* @note
* This will be `nullptr` if the error was not created with a file name.
*/
const char * GetFile() const { return mFile; }
/**
* Get the source line number of the point where the error occurred.
*
* @note
* This will be 0 if the error was not created with a file name.
*/
unsigned int GetLine() const { return mLine; }
#if __cplusplus >= 202002L
/**
* Get the source_location of the point where the error occurred.
*/
const std::source_location & GetSourceLocation() { return mSourceLocation; }
#endif // __cplusplus >= 202002L
#endif // CHIP_CONFIG_ERROR_SOURCE
private:
/*
* The representation of a CHIP_ERROR is structured so that SDK error code constants are small, in order to improve code
* density on embedded builds. Arm 32, Xtensa, and RISC-V can all handle 11-bit values in a move-immediate instruction.
* Further, SdkPart::kCore is 0 so that the most common errors fit in 8 bits for additional density on some processors.
*
* 31 28 24 20 16 12 8 4 0 Bit
* | | | | | | | | |
* | range | value |
* | kSdk==0 | 0 |0| part| code | SDK error
* | 01 - FF | encapsulated error code | Encapsulated error
*/
static constexpr int kRangeStart = 24;
static constexpr int kRangeLength = 8;
static constexpr int kValueStart = 0;
static constexpr int kValueLength = 24;
static constexpr int kSdkPartStart = 8;
static constexpr int kSdkPartLength = 3;
static constexpr int kSdkCodeStart = 0;
static constexpr int kSdkCodeLength = 8;
static constexpr StorageType GetField(unsigned int start, unsigned int length, StorageType value)
{
return (value >> start) & ((1u << length) - 1);
}
static constexpr StorageType MakeMask(unsigned int start, unsigned int length) { return ((1u << length) - 1) << start; }
static constexpr StorageType MakeField(unsigned int start, StorageType value) { return value << start; }
static constexpr bool FitsInField(unsigned int length, StorageType value) { return value < (1u << length); }
static constexpr StorageType MakeInteger(Range range, StorageType value)
{
return MakeField(kRangeStart, to_underlying(range)) | MakeField(kValueStart, value);
}
static constexpr StorageType MakeInteger(SdkPart part, uint8_t code)
{
return MakeInteger(Range::kSDK, MakeField(kSdkPartStart, to_underlying(part)) | MakeField(kSdkCodeStart, code));
}
template <unsigned int START, unsigned int LENGTH>
struct MaskConstant
{
static constexpr StorageType value = ((1u << LENGTH) - 1) << START;
};
// Assert that Range and Value fields fit in StorageType and don't overlap.
static_assert(kRangeStart + kRangeLength <= std::numeric_limits<StorageType>::digits, "Range does not fit in StorageType");
static_assert(kValueStart + kValueLength <= std::numeric_limits<StorageType>::digits, "Value does not fit in StorageType");
static_assert((MaskConstant<kRangeStart, kRangeLength>::value & MaskConstant<kValueStart, kValueLength>::value) == 0,
"Range and Value overlap");
// Assert that SDK Part and Code fields fit in SdkCode field and don't overlap.
static_assert(kSdkPartStart + kSdkPartLength <= kValueLength, "SdkPart does not fit in Value");
static_assert(kSdkCodeStart + kSdkCodeLength <= kValueLength, "SdkCode does not fit in Value");
static_assert((MaskConstant<kSdkPartStart, kSdkPartLength>::value & MaskConstant<kSdkCodeStart, kSdkCodeLength>::value) == 0,
"SdkPart and SdkCode overlap");
// Assert that Value fits in ValueType.
static_assert(kValueStart + kValueLength <= std::numeric_limits<ValueType>::digits, "Value does not fit in ValueType");
StorageType mError;
#if CHIP_CONFIG_ERROR_SOURCE
const char * mFile;
unsigned int mLine;
#if __cplusplus >= 202002L
std::source_location mSourceLocation;
#endif // __cplusplus >= 202002L
#endif // CHIP_CONFIG_ERROR_SOURCE
public:
/**
* Helper for constructing error constants.
*
* This template ensures that the numeric value is constant and well-formed.
*/
template <SdkPart PART, StorageType CODE>
struct SdkErrorConstant
{
static_assert(FitsInField(kSdkPartLength, to_underlying(PART)), "part is too large");
static_assert(FitsInField(kSdkCodeLength, CODE), "code is too large");
static_assert(MakeInteger(PART, CODE) != 0, "value is zero");
static constexpr StorageType value = MakeInteger(PART, CODE);
};
};
} // namespace chip
/**
* The basic type for all CHIP errors.
*/
using CHIP_ERROR = ::chip::ChipError;
/**
* Applications using the CHIP SDK can use this to define error codes in the CHIP_ERROR space for their own purposes.
* This is suitable for a small fixed set of errors, similar to `CHIP_ERROR_…` constants. For embedding arbitrary or
* larger values, use a custom Range offset from Range::kLastRange.
*/
#define CHIP_APPLICATION_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kApplication, (e))
#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
#define CHIP_IM_GLOBAL_STATUS(type) \
CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kIMGlobalStatus, \
::chip::to_underlying(::chip::Protocols::InteractionModel::Status::type))
//
// type must be a compile-time constant as mandated by CHIP_SDK_ERROR.
//
#define CHIP_IM_CLUSTER_STATUS(type) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kIMClusterStatus, type)
// clang-format off
/**
* @name Error Definitions
*
* @{
*/
/**
* @def CHIP_NO_ERROR
*
* @brief
* This defines the CHIP error code for success or no error.
*
*/
#if CHIP_CONFIG_ERROR_SOURCE && CHIP_CONFIG_ERROR_SOURCE_NO_ERROR
#define CHIP_NO_ERROR CHIP_ERROR(0, __FILE__, __LINE__)
#else // CHIP_CONFIG_ERROR_SOURCE && CHIP_CONFIG_ERROR_SOURCE_NO_ERROR
#define CHIP_NO_ERROR CHIP_ERROR(0)
#endif // CHIP_CONFIG_ERROR_SOURCE && CHIP_CONFIG_ERROR_SOURCE_NO_ERROR
/**
* @def CHIP_ERROR_SENDING_BLOCKED
*
* @brief
* A message exceeds the sent limit.
*
*/
#define CHIP_ERROR_SENDING_BLOCKED CHIP_CORE_ERROR(0x01)
/**
* @def CHIP_ERROR_CONNECTION_ABORTED
*
* @brief
* A connection has been aborted.
*
*/
#define CHIP_ERROR_CONNECTION_ABORTED CHIP_CORE_ERROR(0x02)
/**
* @def CHIP_ERROR_INCORRECT_STATE
*
* @brief
* An unexpected state was encountered.
*
*/
#define CHIP_ERROR_INCORRECT_STATE CHIP_CORE_ERROR(0x03)
/**
* @def CHIP_ERROR_MESSAGE_TOO_LONG
*
* @brief
* A message is too long.
*
*/
#define CHIP_ERROR_MESSAGE_TOO_LONG CHIP_CORE_ERROR(0x04)
/**
* Recursion depth overflow
*/
#define CHIP_ERROR_RECURSION_DEPTH_LIMIT CHIP_CORE_ERROR(0x05)
/**
* @def CHIP_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS
*
* @brief
* The attempt to register an unsolicited message handler failed because the
* unsolicited message handler pool is full.
*
*/
#define CHIP_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS CHIP_CORE_ERROR(0x06)
/**
* @def CHIP_ERROR_NO_UNSOLICITED_MESSAGE_HANDLER
*
* @brief
* The attempt to unregister an unsolicited message handler failed because
* the target handler was not found in the unsolicited message handler pool.
*
*/
#define CHIP_ERROR_NO_UNSOLICITED_MESSAGE_HANDLER CHIP_CORE_ERROR(0x07)
/**
* @def CHIP_ERROR_NO_CONNECTION_HANDLER
*
* @brief
* No callback has been registered for handling a connection.
*
*/
#define CHIP_ERROR_NO_CONNECTION_HANDLER CHIP_CORE_ERROR(0x08)
/**
* @def CHIP_ERROR_TOO_MANY_PEER_NODES
*
* @brief
* The number of peer nodes exceeds the maximum limit of a local node.
*
*/
#define CHIP_ERROR_TOO_MANY_PEER_NODES CHIP_CORE_ERROR(0x09)
/**
* @def CHIP_ERROR_SENTINEL
*
* @brief
* For use locally to mark conditions such as value found or end of iteration.
*
*/
#define CHIP_ERROR_SENTINEL CHIP_CORE_ERROR(0x0a)
/**
* @def CHIP_ERROR_NO_MEMORY
*
* @brief
* The attempt to allocate a buffer or object failed due to a lack of memory.
*
*/
#define CHIP_ERROR_NO_MEMORY CHIP_CORE_ERROR(0x0b)
/**
* @def CHIP_ERROR_NO_MESSAGE_HANDLER
*
* @brief
* No callback has been registered for handling a message.
*
*/
#define CHIP_ERROR_NO_MESSAGE_HANDLER CHIP_CORE_ERROR(0x0c)
/**
* @def CHIP_ERROR_MESSAGE_INCOMPLETE
*
* @brief
* A message is incomplete.
*
*/
#define CHIP_ERROR_MESSAGE_INCOMPLETE CHIP_CORE_ERROR(0x0d)
/**
* @def CHIP_ERROR_DATA_NOT_ALIGNED
*
* @brief
* The data is not aligned.
*
*/
#define CHIP_ERROR_DATA_NOT_ALIGNED CHIP_CORE_ERROR(0x0e)
/**
* @def CHIP_ERROR_UNKNOWN_KEY_TYPE
*
* @brief
* The encryption key type is unknown.
*
*/
#define CHIP_ERROR_UNKNOWN_KEY_TYPE CHIP_CORE_ERROR(0x0f)
/**
* @def CHIP_ERROR_KEY_NOT_FOUND
*
* @brief
* The encryption key is not found.
*
*/
#define CHIP_ERROR_KEY_NOT_FOUND CHIP_CORE_ERROR(0x10)
/**
* @def CHIP_ERROR_WRONG_ENCRYPTION_TYPE
*
* @brief
* The encryption type is incorrect for the specified key.
*
*/
#define CHIP_ERROR_WRONG_ENCRYPTION_TYPE CHIP_CORE_ERROR(0x11)
/**
* @def CHIP_ERROR_INVALID_UTF8
*
* @brief
* Invalid UTF8 string (contains some characters that are invalid)
*
*/
#define CHIP_ERROR_INVALID_UTF8 CHIP_CORE_ERROR(0x12)
/**
* @def CHIP_ERROR_INTEGRITY_CHECK_FAILED
*
* @brief
* The integrity check in the message does not match the expected integrity
* check.
*
*/
#define CHIP_ERROR_INTEGRITY_CHECK_FAILED CHIP_CORE_ERROR(0x13)
/**
* @def CHIP_ERROR_INVALID_SIGNATURE
*
* @brief
* Invalid signature.
*
*/
#define CHIP_ERROR_INVALID_SIGNATURE CHIP_CORE_ERROR(0x14)
/**
* @def CHIP_ERROR_INVALID_TLV_CHAR_STRING
*
* @brief
* Invalid TLV character string (e.g. null terminator)
*
*/
#define CHIP_ERROR_INVALID_TLV_CHAR_STRING CHIP_CORE_ERROR(0x15)
/**
* @def CHIP_ERROR_LIT_SUBSCRIBE_INACTIVE_TIMEOUT
*
* @brief
* Subscription timeout caused by LIT ICD device inactive mode
*
*/
#define CHIP_ERROR_LIT_SUBSCRIBE_INACTIVE_TIMEOUT CHIP_CORE_ERROR(0x16)
/**
* @def CHIP_ERROR_UNSUPPORTED_SIGNATURE_TYPE
*
* @brief
* A signature type is unsupported.
*
*/
#define CHIP_ERROR_UNSUPPORTED_SIGNATURE_TYPE CHIP_CORE_ERROR(0x17)
/**
* @def CHIP_ERROR_INVALID_MESSAGE_LENGTH
*
* @brief
* A message length is invalid.
*
*/
#define CHIP_ERROR_INVALID_MESSAGE_LENGTH CHIP_CORE_ERROR(0x18)
/**
* @def CHIP_ERROR_BUFFER_TOO_SMALL
*
* @brief
* A buffer is too small.
*
*/
#define CHIP_ERROR_BUFFER_TOO_SMALL CHIP_CORE_ERROR(0x19)
/**
* @def CHIP_ERROR_DUPLICATE_KEY_ID
*
* @brief
* A key id is duplicate.
*
*/
#define CHIP_ERROR_DUPLICATE_KEY_ID CHIP_CORE_ERROR(0x1a)
/**
* @def CHIP_ERROR_WRONG_KEY_TYPE
*
* @brief
* A key type does not match the expected key type.
*
*/
#define CHIP_ERROR_WRONG_KEY_TYPE CHIP_CORE_ERROR(0x1b)
/**
* @def CHIP_ERROR_UNINITIALIZED
*
* @brief
* A requested object is uninitialized.
*
*/
#define CHIP_ERROR_UNINITIALIZED CHIP_CORE_ERROR(0x1c)
/**
* @def CHIP_ERROR_INVALID_IPK
*
* @brief
* The IPK is invalid
*
*/
#define CHIP_ERROR_INVALID_IPK CHIP_CORE_ERROR(0x1d)
/**
* @def CHIP_ERROR_INVALID_STRING_LENGTH
*
* @brief
* A string length is invalid.
*
*/
#define CHIP_ERROR_INVALID_STRING_LENGTH CHIP_CORE_ERROR(0x1e)
/**
* @def CHIP_ERROR_INVALID_LIST_LENGTH
*
* @brief
* A list length is invalid.
*
*/
#define CHIP_ERROR_INVALID_LIST_LENGTH CHIP_CORE_ERROR(0x1f)
/**
* @def CHIP_ERROR_FAILED_DEVICE_ATTESTATION
*
* @brief
* Device Attestation failed.
*
*/
#define CHIP_ERROR_FAILED_DEVICE_ATTESTATION CHIP_CORE_ERROR(0x20)
/**
* @def CHIP_END_OF_TLV
*
* @brief
* The end of a TLV encoding,
* or the end of a TLV container element has been reached.
*
*/
#define CHIP_ERROR_END_OF_TLV CHIP_CORE_ERROR(0x21)
#define CHIP_END_OF_TLV CHIP_ERROR_END_OF_TLV
/**
* @def CHIP_ERROR_TLV_UNDERRUN
*
* @brief
* The TLV encoding ended prematurely.
*
*/
#define CHIP_ERROR_TLV_UNDERRUN CHIP_CORE_ERROR(0x22)
/**
* @def CHIP_ERROR_INVALID_TLV_ELEMENT
*
* @brief
* A TLV element is invalid.
*
*/
#define CHIP_ERROR_INVALID_TLV_ELEMENT CHIP_CORE_ERROR(0x23)
/**
* @def CHIP_ERROR_INVALID_TLV_TAG
*
* @brief
* A TLV tag is invalid.
*
*/
#define CHIP_ERROR_INVALID_TLV_TAG CHIP_CORE_ERROR(0x24)
/**
* @def CHIP_ERROR_UNKNOWN_IMPLICIT_TLV_TAG
*
* @brief
* An implicitly encoded TLV tag was encountered,
* but an implicit profile id has not been defined.
*
*/
#define CHIP_ERROR_UNKNOWN_IMPLICIT_TLV_TAG CHIP_CORE_ERROR(0x25)
/**
* @def CHIP_ERROR_WRONG_TLV_TYPE
*
* @brief
* A TLV type is wrong.
*
*/
#define CHIP_ERROR_WRONG_TLV_TYPE CHIP_CORE_ERROR(0x26)
/**
* @def CHIP_ERROR_TLV_CONTAINER_OPEN
*
* @brief
* A TLV container is unexpectedly open.
*
*/
#define CHIP_ERROR_TLV_CONTAINER_OPEN CHIP_CORE_ERROR(0x27)
// AVAILABLE: 0x28
// AVAILABLE: 0x29
/**
* @def CHIP_ERROR_INVALID_MESSAGE_TYPE
*
* @brief
* A message type is invalid.
*
*/
#define CHIP_ERROR_INVALID_MESSAGE_TYPE CHIP_CORE_ERROR(0x2a)
/**
* @def CHIP_ERROR_UNEXPECTED_TLV_ELEMENT
*
* @brief
* An unexpected TLV element was encountered.
*
*/
#define CHIP_ERROR_UNEXPECTED_TLV_ELEMENT CHIP_CORE_ERROR(0x2b)
// AVAILABLE: 0x2c
/**
* @def CHIP_ERROR_NOT_IMPLEMENTED
*
* @brief
* A requested function or feature is not implemented.
*
*/
#define CHIP_ERROR_NOT_IMPLEMENTED CHIP_CORE_ERROR(0x2d)
/**
* @def CHIP_ERROR_INVALID_ADDRESS
*
* @brief
* An address is invalid.
*
*/
#define CHIP_ERROR_INVALID_ADDRESS CHIP_CORE_ERROR(0x2e)
/**
* @def CHIP_ERROR_INVALID_ARGUMENT
*
* @brief
* An argument is invalid.
*
*/
#define CHIP_ERROR_INVALID_ARGUMENT CHIP_CORE_ERROR(0x2f)
/**
* @def CHIP_ERROR_INVALID_PATH_LIST
*
* @brief
* A TLV path list is invalid.
*
*/
#define CHIP_ERROR_INVALID_PATH_LIST CHIP_CORE_ERROR(0x30)
/**
* @def CHIP_ERROR_INVALID_DATA_LIST
*
* @brief
* A TLV data list is invalid.
*
*/
#define CHIP_ERROR_INVALID_DATA_LIST CHIP_CORE_ERROR(0x31)
/**
* @def CHIP_ERROR_TIMEOUT
*
* @brief
* A request timed out.
*
*/
#define CHIP_ERROR_TIMEOUT CHIP_CORE_ERROR(0x32)
/**
* @def CHIP_ERROR_INVALID_DEVICE_DESCRIPTOR
*
* @brief
* A device descriptor is invalid.
*
*/
#define CHIP_ERROR_INVALID_DEVICE_DESCRIPTOR CHIP_CORE_ERROR(0x33)
// AVAILABLE: 0x34
// AVAILABLE: 0x35
// AVAILABLE: 0x36
// AVAILABLE: 0x37
/**
* @def CHIP_ERROR_INVALID_PASE_PARAMETER
*
* @brief
* A PASE parameter is invalid.
*
*/
#define CHIP_ERROR_INVALID_PASE_PARAMETER CHIP_CORE_ERROR(0x38)
// AVAILABLE: 0x39
// AVAILABLE: 0x3a
/**
* @def CHIP_ERROR_INVALID_USE_OF_SESSION_KEY
*
* @brief
* A use of session key is invalid.
*
*/
#define CHIP_ERROR_INVALID_USE_OF_SESSION_KEY CHIP_CORE_ERROR(0x3b)
/**
* @def CHIP_ERROR_CONNECTION_CLOSED_UNEXPECTEDLY
*
* @brief
* A connection is closed unexpectedly.
*
*/
#define CHIP_ERROR_CONNECTION_CLOSED_UNEXPECTEDLY CHIP_CORE_ERROR(0x3c)
/**
* @def CHIP_ERROR_MISSING_TLV_ELEMENT
*
* @brief
* A TLV element is missing.
*
*/
#define CHIP_ERROR_MISSING_TLV_ELEMENT CHIP_CORE_ERROR(0x3d)
/**
* @def CHIP_ERROR_RANDOM_DATA_UNAVAILABLE
*
* @brief
* Secure random data is not available.
*
*/
#define CHIP_ERROR_RANDOM_DATA_UNAVAILABLE CHIP_CORE_ERROR(0x3e)
// AVAILABLE: 0x3f
// AVAILABLE: 0x40
/**
* @def CHIP_ERROR_HOST_PORT_LIST_EMPTY
*
* @brief
* A host/port list is empty.
*
*/
#define CHIP_ERROR_HOST_PORT_LIST_EMPTY CHIP_CORE_ERROR(0x41)
// AVAILABLE: 0x42
// AVAILABLE: 0x43
// AVAILABLE: 0x44
/**
* @def CHIP_ERROR_FORCED_RESET
*
* @brief
* A service manager is forced to reset.
*
*/
#define CHIP_ERROR_FORCED_RESET CHIP_CORE_ERROR(0x45)
/**
* @def CHIP_ERROR_NO_ENDPOINT
*
* @brief
* No endpoint is available.
*
*/
#define CHIP_ERROR_NO_ENDPOINT CHIP_CORE_ERROR(0x46)
/**
* @def CHIP_ERROR_INVALID_DESTINATION_NODE_ID
*
* @brief
* A destination node id is invalid.
*
*/