Coverage Report

Created: 2025-06-20 06:55

/src/connectedhomeip/zzz_generated/app-common/clusters/TlsCertificateManagement/Commands.ipp
Line
Count
Source (jump to first uncovered line)
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-Commands.ipp.zapt
20
21
#include <clusters/TlsCertificateManagement/Commands.h>
22
23
#include <app/data-model/Decode.h>
24
#include <app/data-model/StructDecodeIterator.h>
25
#include <app/data-model/WrappedStructEncoder.h>
26
27
namespace chip {
28
namespace app {
29
namespace Clusters {
30
namespace TlsCertificateManagement {
31
namespace Commands {
32
namespace ProvisionRootCertificate {
33
34
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
35
0
{
36
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
37
0
    encoder.Encode(to_underlying(Fields::kCertificate), certificate);
38
0
    encoder.Encode(to_underlying(Fields::kCaid), caid);
39
0
    return encoder.Finalize();
40
0
}
41
42
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader, FabricIndex aAccessingFabricIndex)
43
0
{
44
0
    detail::StructDecodeIterator __iterator(reader);
45
0
    while (true)
46
0
    {
47
0
        uint8_t __context_tag = 0;
48
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
49
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
50
0
        ReturnErrorOnFailure(err);
51
52
0
        if (__context_tag == to_underlying(Fields::kCertificate))
53
0
        {
54
0
            err = DataModel::Decode(reader, certificate);
55
0
        }
56
0
        else if (__context_tag == to_underlying(Fields::kCaid))
57
0
        {
58
0
            err = DataModel::Decode(reader, caid);
59
0
        }
60
61
0
        ReturnErrorOnFailure(err);
62
0
    }
63
0
}
64
} // namespace ProvisionRootCertificate.
65
namespace ProvisionRootCertificateResponse {
66
67
CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
68
0
{
69
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
70
0
    encoder.Encode(to_underlying(Fields::kCaid), caid);
71
0
    return encoder.Finalize();
72
0
}
73
74
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
75
0
{
76
0
    detail::StructDecodeIterator __iterator(reader);
77
0
    while (true)
78
0
    {
79
0
        uint8_t __context_tag = 0;
80
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
81
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
82
0
        ReturnErrorOnFailure(err);
83
84
0
        if (__context_tag == to_underlying(Fields::kCaid))
85
0
        {
86
0
            err = DataModel::Decode(reader, caid);
87
0
        }
88
89
0
        ReturnErrorOnFailure(err);
90
0
    }
91
0
}
92
} // namespace ProvisionRootCertificateResponse.
93
namespace FindRootCertificate {
94
95
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
96
0
{
97
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
98
0
    encoder.Encode(to_underlying(Fields::kCaid), caid);
99
0
    return encoder.Finalize();
100
0
}
101
102
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader, FabricIndex aAccessingFabricIndex)
103
0
{
104
0
    detail::StructDecodeIterator __iterator(reader);
105
0
    while (true)
106
0
    {
107
0
        uint8_t __context_tag = 0;
108
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
109
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
110
0
        ReturnErrorOnFailure(err);
111
112
0
        if (__context_tag == to_underlying(Fields::kCaid))
113
0
        {
114
0
            err = DataModel::Decode(reader, caid);
115
0
        }
116
117
0
        ReturnErrorOnFailure(err);
118
0
    }
119
0
}
120
} // namespace FindRootCertificate.
121
namespace FindRootCertificateResponse {
122
123
CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
124
0
{
125
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
126
0
    encoder.EncodeResponseCommandFabricScopedStructField(to_underlying(Fields::kCertificateDetails), aWriter.mAccessingFabricIndex,
127
0
                                                         certificateDetails);
128
0
    return encoder.Finalize();
129
0
}
130
131
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
132
0
{
133
0
    detail::StructDecodeIterator __iterator(reader);
134
0
    while (true)
135
0
    {
136
0
        uint8_t __context_tag = 0;
137
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
138
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
139
0
        ReturnErrorOnFailure(err);
140
141
0
        if (__context_tag == to_underlying(Fields::kCertificateDetails))
142
0
        {
143
0
            err = DataModel::Decode(reader, certificateDetails);
144
0
        }
145
146
0
        ReturnErrorOnFailure(err);
147
0
    }
148
0
}
149
} // namespace FindRootCertificateResponse.
150
namespace LookupRootCertificate {
151
152
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
153
0
{
154
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
155
0
    encoder.Encode(to_underlying(Fields::kFingerprint), fingerprint);
156
0
    return encoder.Finalize();
157
0
}
158
159
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader, FabricIndex aAccessingFabricIndex)
160
0
{
161
0
    detail::StructDecodeIterator __iterator(reader);
162
0
    while (true)
163
0
    {
164
0
        uint8_t __context_tag = 0;
165
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
166
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
167
0
        ReturnErrorOnFailure(err);
168
169
0
        if (__context_tag == to_underlying(Fields::kFingerprint))
170
0
        {
171
0
            err = DataModel::Decode(reader, fingerprint);
172
0
        }
173
174
0
        ReturnErrorOnFailure(err);
175
0
    }
176
0
}
177
} // namespace LookupRootCertificate.
178
namespace LookupRootCertificateResponse {
179
180
CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
181
0
{
182
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
183
0
    encoder.Encode(to_underlying(Fields::kCaid), caid);
184
0
    return encoder.Finalize();
185
0
}
186
187
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
188
0
{
189
0
    detail::StructDecodeIterator __iterator(reader);
190
0
    while (true)
191
0
    {
192
0
        uint8_t __context_tag = 0;
193
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
194
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
195
0
        ReturnErrorOnFailure(err);
196
197
0
        if (__context_tag == to_underlying(Fields::kCaid))
198
0
        {
199
0
            err = DataModel::Decode(reader, caid);
200
0
        }
201
202
0
        ReturnErrorOnFailure(err);
203
0
    }
204
0
}
205
} // namespace LookupRootCertificateResponse.
206
namespace RemoveRootCertificate {
207
208
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
209
0
{
210
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
211
0
    encoder.Encode(to_underlying(Fields::kCaid), caid);
212
0
    return encoder.Finalize();
213
0
}
214
215
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader, FabricIndex aAccessingFabricIndex)
216
0
{
217
0
    detail::StructDecodeIterator __iterator(reader);
218
0
    while (true)
219
0
    {
220
0
        uint8_t __context_tag = 0;
221
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
222
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
223
0
        ReturnErrorOnFailure(err);
224
225
0
        if (__context_tag == to_underlying(Fields::kCaid))
226
0
        {
227
0
            err = DataModel::Decode(reader, caid);
228
0
        }
229
230
0
        ReturnErrorOnFailure(err);
231
0
    }
232
0
}
233
} // namespace RemoveRootCertificate.
234
namespace TLSClientCSR {
235
236
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
237
0
{
238
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
239
0
    encoder.Encode(to_underlying(Fields::kNonce), nonce);
240
0
    return encoder.Finalize();
241
0
}
242
243
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader, FabricIndex aAccessingFabricIndex)
244
0
{
245
0
    detail::StructDecodeIterator __iterator(reader);
246
0
    while (true)
247
0
    {
248
0
        uint8_t __context_tag = 0;
249
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
250
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
251
0
        ReturnErrorOnFailure(err);
252
253
0
        if (__context_tag == to_underlying(Fields::kNonce))
254
0
        {
255
0
            err = DataModel::Decode(reader, nonce);
256
0
        }
257
258
0
        ReturnErrorOnFailure(err);
259
0
    }
260
0
}
261
} // namespace TLSClientCSR.
262
namespace TLSClientCSRResponse {
263
264
CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
265
0
{
266
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
267
0
    encoder.Encode(to_underlying(Fields::kCcdid), ccdid);
268
0
    encoder.Encode(to_underlying(Fields::kCsr), csr);
269
0
    encoder.Encode(to_underlying(Fields::kNonce), nonce);
270
0
    return encoder.Finalize();
271
0
}
272
273
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
274
0
{
275
0
    detail::StructDecodeIterator __iterator(reader);
276
0
    while (true)
277
0
    {
278
0
        uint8_t __context_tag = 0;
279
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
280
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
281
0
        ReturnErrorOnFailure(err);
282
283
0
        if (__context_tag == to_underlying(Fields::kCcdid))
284
0
        {
285
0
            err = DataModel::Decode(reader, ccdid);
286
0
        }
287
0
        else if (__context_tag == to_underlying(Fields::kCsr))
288
0
        {
289
0
            err = DataModel::Decode(reader, csr);
290
0
        }
291
0
        else if (__context_tag == to_underlying(Fields::kNonce))
292
0
        {
293
0
            err = DataModel::Decode(reader, nonce);
294
0
        }
295
296
0
        ReturnErrorOnFailure(err);
297
0
    }
298
0
}
299
} // namespace TLSClientCSRResponse.
300
namespace ProvisionClientCertificate {
301
302
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
303
0
{
304
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
305
0
    encoder.Encode(to_underlying(Fields::kCcdid), ccdid);
306
0
    encoder.EncodeRequestCommandFabricScopedStructField(to_underlying(Fields::kClientCertificateDetails), clientCertificateDetails);
307
0
    return encoder.Finalize();
308
0
}
309
310
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader, FabricIndex aAccessingFabricIndex)
311
0
{
312
0
    detail::StructDecodeIterator __iterator(reader);
313
0
    while (true)
314
0
    {
315
0
        uint8_t __context_tag = 0;
316
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
317
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
318
0
        ReturnErrorOnFailure(err);
319
320
0
        if (__context_tag == to_underlying(Fields::kCcdid))
321
0
        {
322
0
            err = DataModel::Decode(reader, ccdid);
323
0
        }
324
0
        else if (__context_tag == to_underlying(Fields::kClientCertificateDetails))
325
0
        {
326
0
            err = DataModel::Decode(reader, clientCertificateDetails);
327
0
            if (err == CHIP_NO_ERROR)
328
0
            {
329
0
                clientCertificateDetails.SetFabricIndex(aAccessingFabricIndex);
330
0
            }
331
0
        }
332
333
0
        ReturnErrorOnFailure(err);
334
0
    }
335
0
}
336
} // namespace ProvisionClientCertificate.
337
namespace FindClientCertificate {
338
339
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
340
0
{
341
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
342
0
    encoder.Encode(to_underlying(Fields::kCcdid), ccdid);
343
0
    return encoder.Finalize();
344
0
}
345
346
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader, FabricIndex aAccessingFabricIndex)
347
0
{
348
0
    detail::StructDecodeIterator __iterator(reader);
349
0
    while (true)
350
0
    {
351
0
        uint8_t __context_tag = 0;
352
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
353
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
354
0
        ReturnErrorOnFailure(err);
355
356
0
        if (__context_tag == to_underlying(Fields::kCcdid))
357
0
        {
358
0
            err = DataModel::Decode(reader, ccdid);
359
0
        }
360
361
0
        ReturnErrorOnFailure(err);
362
0
    }
363
0
}
364
} // namespace FindClientCertificate.
365
namespace FindClientCertificateResponse {
366
367
CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
368
0
{
369
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
370
0
    encoder.EncodeResponseCommandFabricScopedStructField(to_underlying(Fields::kCertificateDetails), aWriter.mAccessingFabricIndex,
371
0
                                                         certificateDetails);
372
0
    return encoder.Finalize();
373
0
}
374
375
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
376
0
{
377
0
    detail::StructDecodeIterator __iterator(reader);
378
0
    while (true)
379
0
    {
380
0
        uint8_t __context_tag = 0;
381
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
382
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
383
0
        ReturnErrorOnFailure(err);
384
385
0
        if (__context_tag == to_underlying(Fields::kCertificateDetails))
386
0
        {
387
0
            err = DataModel::Decode(reader, certificateDetails);
388
0
        }
389
390
0
        ReturnErrorOnFailure(err);
391
0
    }
392
0
}
393
} // namespace FindClientCertificateResponse.
394
namespace LookupClientCertificate {
395
396
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
397
0
{
398
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
399
0
    encoder.Encode(to_underlying(Fields::kFingerprint), fingerprint);
400
0
    return encoder.Finalize();
401
0
}
402
403
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader, FabricIndex aAccessingFabricIndex)
404
0
{
405
0
    detail::StructDecodeIterator __iterator(reader);
406
0
    while (true)
407
0
    {
408
0
        uint8_t __context_tag = 0;
409
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
410
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
411
0
        ReturnErrorOnFailure(err);
412
413
0
        if (__context_tag == to_underlying(Fields::kFingerprint))
414
0
        {
415
0
            err = DataModel::Decode(reader, fingerprint);
416
0
        }
417
418
0
        ReturnErrorOnFailure(err);
419
0
    }
420
0
}
421
} // namespace LookupClientCertificate.
422
namespace LookupClientCertificateResponse {
423
424
CHIP_ERROR Type::Encode(DataModel::FabricAwareTLVWriter & aWriter, TLV::Tag aTag) const
425
0
{
426
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
427
0
    encoder.Encode(to_underlying(Fields::kCcdid), ccdid);
428
0
    return encoder.Finalize();
429
0
}
430
431
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
432
0
{
433
0
    detail::StructDecodeIterator __iterator(reader);
434
0
    while (true)
435
0
    {
436
0
        uint8_t __context_tag = 0;
437
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
438
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
439
0
        ReturnErrorOnFailure(err);
440
441
0
        if (__context_tag == to_underlying(Fields::kCcdid))
442
0
        {
443
0
            err = DataModel::Decode(reader, ccdid);
444
0
        }
445
446
0
        ReturnErrorOnFailure(err);
447
0
    }
448
0
}
449
} // namespace LookupClientCertificateResponse.
450
namespace RemoveClientCertificate {
451
452
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
453
0
{
454
0
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
455
0
    encoder.Encode(to_underlying(Fields::kCcdid), ccdid);
456
0
    return encoder.Finalize();
457
0
}
458
459
CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader, FabricIndex aAccessingFabricIndex)
460
0
{
461
0
    detail::StructDecodeIterator __iterator(reader);
462
0
    while (true)
463
0
    {
464
0
        uint8_t __context_tag = 0;
465
0
        CHIP_ERROR err        = __iterator.Next(__context_tag);
466
0
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
467
0
        ReturnErrorOnFailure(err);
468
469
0
        if (__context_tag == to_underlying(Fields::kCcdid))
470
0
        {
471
0
            err = DataModel::Decode(reader, ccdid);
472
0
        }
473
474
0
        ReturnErrorOnFailure(err);
475
0
    }
476
0
}
477
} // namespace RemoveClientCertificate.
478
} // namespace Commands
479
} // namespace TlsCertificateManagement
480
} // namespace Clusters
481
} // namespace app
482
} // namespace chip