-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generated using ./scripts/tools/zap_regen_all.py
- Loading branch information
Showing
5 changed files
with
1,692 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
...ava/chip/devicecontroller/cluster/structs/TlsCertificateManagementClusterTLSCertStruct.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* | ||
* 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. | ||
*/ | ||
package chip.devicecontroller.cluster.structs | ||
|
||
import chip.devicecontroller.cluster.* | ||
import matter.tlv.ContextSpecificTag | ||
import matter.tlv.Tag | ||
import matter.tlv.TlvReader | ||
import matter.tlv.TlvWriter | ||
|
||
class TlsCertificateManagementClusterTLSCertStruct(val caid: UInt, val certificate: ByteArray) { | ||
override fun toString(): String = buildString { | ||
append("TlsCertificateManagementClusterTLSCertStruct {\n") | ||
append("\tcaid : $caid\n") | ||
append("\tcertificate : $certificate\n") | ||
append("}\n") | ||
} | ||
|
||
fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { | ||
tlvWriter.apply { | ||
startStructure(tlvTag) | ||
put(ContextSpecificTag(TAG_CAID), caid) | ||
put(ContextSpecificTag(TAG_CERTIFICATE), certificate) | ||
endStructure() | ||
} | ||
} | ||
|
||
companion object { | ||
private const val TAG_CAID = 0 | ||
private const val TAG_CERTIFICATE = 1 | ||
|
||
fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): TlsCertificateManagementClusterTLSCertStruct { | ||
tlvReader.enterStructure(tlvTag) | ||
val caid = tlvReader.getUInt(ContextSpecificTag(TAG_CAID)) | ||
val certificate = tlvReader.getByteArray(ContextSpecificTag(TAG_CERTIFICATE)) | ||
|
||
tlvReader.exitContainer() | ||
|
||
return TlsCertificateManagementClusterTLSCertStruct(caid, certificate) | ||
} | ||
} | ||
} |
83 changes: 83 additions & 0 deletions
83
...roller/cluster/structs/TlsCertificateManagementClusterTLSClientCertificateDetailStruct.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* | ||
* 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. | ||
*/ | ||
package chip.devicecontroller.cluster.structs | ||
|
||
import chip.devicecontroller.cluster.* | ||
import matter.tlv.AnonymousTag | ||
import matter.tlv.ContextSpecificTag | ||
import matter.tlv.Tag | ||
import matter.tlv.TlvReader | ||
import matter.tlv.TlvWriter | ||
|
||
class TlsCertificateManagementClusterTLSClientCertificateDetailStruct( | ||
val ccdid: UInt, | ||
val clientCertificate: ByteArray, | ||
val intermediateCerts: List<ByteArray>, | ||
) { | ||
override fun toString(): String = buildString { | ||
append("TlsCertificateManagementClusterTLSClientCertificateDetailStruct {\n") | ||
append("\tccdid : $ccdid\n") | ||
append("\tclientCertificate : $clientCertificate\n") | ||
append("\tintermediateCerts : $intermediateCerts\n") | ||
append("}\n") | ||
} | ||
|
||
fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { | ||
tlvWriter.apply { | ||
startStructure(tlvTag) | ||
put(ContextSpecificTag(TAG_CCDID), ccdid) | ||
put(ContextSpecificTag(TAG_CLIENT_CERTIFICATE), clientCertificate) | ||
startArray(ContextSpecificTag(TAG_INTERMEDIATE_CERTS)) | ||
for (item in intermediateCerts.iterator()) { | ||
put(AnonymousTag, item) | ||
} | ||
endArray() | ||
endStructure() | ||
} | ||
} | ||
|
||
companion object { | ||
private const val TAG_CCDID = 0 | ||
private const val TAG_CLIENT_CERTIFICATE = 1 | ||
private const val TAG_INTERMEDIATE_CERTS = 2 | ||
|
||
fun fromTlv( | ||
tlvTag: Tag, | ||
tlvReader: TlvReader, | ||
): TlsCertificateManagementClusterTLSClientCertificateDetailStruct { | ||
tlvReader.enterStructure(tlvTag) | ||
val ccdid = tlvReader.getUInt(ContextSpecificTag(TAG_CCDID)) | ||
val clientCertificate = tlvReader.getByteArray(ContextSpecificTag(TAG_CLIENT_CERTIFICATE)) | ||
val intermediateCerts = | ||
buildList<ByteArray> { | ||
tlvReader.enterArray(ContextSpecificTag(TAG_INTERMEDIATE_CERTS)) | ||
while (!tlvReader.isEndOfContainer()) { | ||
add(tlvReader.getByteArray(AnonymousTag)) | ||
} | ||
tlvReader.exitContainer() | ||
} | ||
|
||
tlvReader.exitContainer() | ||
|
||
return TlsCertificateManagementClusterTLSClientCertificateDetailStruct( | ||
ccdid, | ||
clientCertificate, | ||
intermediateCerts, | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.