Commit Graph

3 Commits

Author SHA1 Message Date
Abtin Keshavarzian 64cf63ecb2 [test] fix address list comparison in spinel_prop_codec (#10954)
This commit updates how address lists are compared in the unit test
`spinel_prop_codec`, ensuring that the correct size based on the
array length is passed to `memcmp()`.
2024-11-27 07:33:11 -08:00
Li Cao b617ba3b71 [spinel] fix spinel_prop_codec unit test (#10950)
This commit fixes an issue in spinel_prop_codec unit test.

We cannot use Spinel::Decoder::ReadUintPacked with a spinel_prop_key_t
type. This will cause build errors on arm platforms.
2024-11-21 11:00:13 -08:00
Li Cao f26e1bb852 [spinel] add spinel property codec (#10934)
This commit adds spinel_prop_codec module to lib/spinel to provide
encoding & decoding functions for complex spinel properties.

This commit moves the encoding of `SPINEL_PROP_DNSSD_HOST`,
`SPINEL_PROP_DNSSD_SERVICE` and `SPINEL_PROP_DNSSD_KEY_RECORD` from
NcpBase to the lib and adds the decoding functions. The background is
that I found the encoding & decoding of complex spinel properties are
error-prone. However the encoding and decoding of one property are
usually put in different places. For example, encoding is in
openthread ncp while decoding is in ot-br-posix ncp spinel. It's
difficult to debug the decoding in ot-br-posix and there is no unit
tests for the encoding & decoding.

This commit puts the encoding & decoding together and adds unit tests
to ensure they are correct.
2024-11-20 12:24:34 -08:00