/src/connectedhomeip/zzz_generated/app-common/clusters/TlsCertificateManagement/Structs.ipp
Line | Count | Source |
1 | | /* |
2 | | * |
3 | | * Copyright (c) 2022 Project CHIP Authors |
4 | | * |
5 | | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | | * you may not use this file except in compliance with the License. |
7 | | * You may obtain a copy of the License at |
8 | | * |
9 | | * http://www.apache.org/licenses/LICENSE-2.0 |
10 | | * |
11 | | * Unless required by applicable law or agreed to in writing, software |
12 | | * distributed under the License is distributed on an "AS IS" BASIS, |
13 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
14 | | * See the License for the specific language governing permissions and |
15 | | * limitations under the License. |
16 | | */ |
17 | | |
18 | | // THIS FILE IS GENERATED BY ZAP |
19 | | // This file is generated from clusters-Structs.ipp.zapt |
20 | | |
21 | | #include <clusters/TlsCertificateManagement/Structs.h> |
22 | | |
23 | | #include <app/data-model/StructDecodeIterator.h> |
24 | | #include <app/data-model/WrappedStructEncoder.h> |
25 | | |
26 | | namespace chip { |
27 | | namespace app { |
28 | | namespace Clusters { |
29 | | namespace TlsCertificateManagement { |
30 | | namespace Structs { |
31 | | |
32 | | namespace TLSCertStruct { |
33 | | CHIP_ERROR Type::EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
34 | 0 | { |
35 | 0 | return DoEncode(aWriter, aTag, NullOptional); |
36 | 0 | } |
37 | | |
38 | | CHIP_ERROR Type::EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const |
39 | 0 | { |
40 | 0 | return DoEncode(aWriter, aTag, MakeOptional(aAccessingFabricIndex)); |
41 | 0 | } |
42 | | |
43 | | CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional<FabricIndex> & aAccessingFabricIndex) const |
44 | 0 | { |
45 | |
|
46 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
47 | |
|
48 | 0 | encoder.Encode(to_underlying(Fields::kCaid), caid); |
49 | 0 | encoder.Encode(to_underlying(Fields::kCertificate), certificate); |
50 | 0 | if (aAccessingFabricIndex.HasValue()) |
51 | 0 | { |
52 | 0 | encoder.Encode(to_underlying(Fields::kFabricIndex), fabricIndex); |
53 | 0 | } |
54 | |
|
55 | 0 | return encoder.Finalize(); |
56 | 0 | } |
57 | | |
58 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
59 | 0 | { |
60 | 0 | detail::StructDecodeIterator __iterator(reader); |
61 | 0 | while (true) |
62 | 0 | { |
63 | 0 | uint8_t __context_tag = 0; |
64 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
65 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
66 | 0 | ReturnErrorOnFailure(err); |
67 | | |
68 | 0 | if (__context_tag == to_underlying(Fields::kCaid)) |
69 | 0 | { |
70 | 0 | err = DataModel::Decode(reader, caid); |
71 | 0 | } |
72 | 0 | else if (__context_tag == to_underlying(Fields::kCertificate)) |
73 | 0 | { |
74 | 0 | err = DataModel::Decode(reader, certificate); |
75 | 0 | } |
76 | 0 | else if (__context_tag == to_underlying(Fields::kFabricIndex)) |
77 | 0 | { |
78 | 0 | err = DataModel::Decode(reader, fabricIndex); |
79 | 0 | } |
80 | |
|
81 | 0 | ReturnErrorOnFailure(err); |
82 | 0 | } |
83 | 0 | } |
84 | | |
85 | | } // namespace TLSCertStruct |
86 | | |
87 | | namespace TLSClientCertificateDetailStruct { |
88 | | CHIP_ERROR Type::EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const |
89 | 0 | { |
90 | 0 | return DoEncode(aWriter, aTag, NullOptional); |
91 | 0 | } |
92 | | |
93 | | CHIP_ERROR Type::EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const |
94 | 0 | { |
95 | 0 | return DoEncode(aWriter, aTag, MakeOptional(aAccessingFabricIndex)); |
96 | 0 | } |
97 | | |
98 | | CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional<FabricIndex> & aAccessingFabricIndex) const |
99 | 0 | { |
100 | |
|
101 | 0 | DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; |
102 | |
|
103 | 0 | encoder.Encode(to_underlying(Fields::kCcdid), ccdid); |
104 | 0 | encoder.Encode(to_underlying(Fields::kClientCertificate), clientCertificate); |
105 | 0 | encoder.Encode(to_underlying(Fields::kIntermediateCertificates), intermediateCertificates); |
106 | 0 | if (aAccessingFabricIndex.HasValue()) |
107 | 0 | { |
108 | 0 | encoder.Encode(to_underlying(Fields::kFabricIndex), fabricIndex); |
109 | 0 | } |
110 | |
|
111 | 0 | return encoder.Finalize(); |
112 | 0 | } |
113 | | |
114 | | CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) |
115 | 0 | { |
116 | 0 | detail::StructDecodeIterator __iterator(reader); |
117 | 0 | while (true) |
118 | 0 | { |
119 | 0 | uint8_t __context_tag = 0; |
120 | 0 | CHIP_ERROR err = __iterator.Next(__context_tag); |
121 | 0 | VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR); |
122 | 0 | ReturnErrorOnFailure(err); |
123 | | |
124 | 0 | if (__context_tag == to_underlying(Fields::kCcdid)) |
125 | 0 | { |
126 | 0 | err = DataModel::Decode(reader, ccdid); |
127 | 0 | } |
128 | 0 | else if (__context_tag == to_underlying(Fields::kClientCertificate)) |
129 | 0 | { |
130 | 0 | err = DataModel::Decode(reader, clientCertificate); |
131 | 0 | } |
132 | 0 | else if (__context_tag == to_underlying(Fields::kIntermediateCertificates)) |
133 | 0 | { |
134 | 0 | err = DataModel::Decode(reader, intermediateCertificates); |
135 | 0 | } |
136 | 0 | else if (__context_tag == to_underlying(Fields::kFabricIndex)) |
137 | 0 | { |
138 | 0 | err = DataModel::Decode(reader, fabricIndex); |
139 | 0 | } |
140 | |
|
141 | 0 | ReturnErrorOnFailure(err); |
142 | 0 | } |
143 | 0 | } |
144 | | |
145 | | } // namespace TLSClientCertificateDetailStruct |
146 | | } // namespace Structs |
147 | | } // namespace TlsCertificateManagement |
148 | | } // namespace Clusters |
149 | | } // namespace app |
150 | | } // namespace chip |