Skip to content

Commit

Permalink
[dnssd] remove constants for _A subtype and AP TXT field (#28332)
Browse files Browse the repository at this point in the history
* [dnssd] remove constants for _A subtype and AP TXT field

The _A subtype and AP TXT field were removed from the spec
long time ago but the constants describing the maximum
lengths are still present in the SDK.

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Apr 4, 2024
1 parent 1f80871 commit 0f0a555
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
16 changes: 7 additions & 9 deletions src/lib/dnssd/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@ constexpr size_t kHostNameMaxLength = 16; // MAC or 802.15.4 Extended Address in
* Matter DNS service subtypes
*/

constexpr size_t kSubTypeShortDiscriminatorMaxLength = 4; // _S<dd>
constexpr size_t kSubTypeLongDiscriminatorMaxLength = 6; // _L<dddd>
constexpr size_t kSubTypeVendorIdMaxLength = 7; // _V<ddddd>
constexpr size_t kSubTypeDeviceTypeMaxLength = 12; // _T<dddddddddd>
constexpr size_t kSubTypeCommissioningModeMaxLength = 3; // _C<d>
constexpr size_t kSubTypeAdditionalCommissioningMaxLength = 3; // _A<d>
constexpr size_t kSubTypeCompressedFabricIdMaxLength = 18; // _I<16-hex-digits>
constexpr size_t kSubTypeShortDiscriminatorMaxLength = 4; // _S<dd>
constexpr size_t kSubTypeLongDiscriminatorMaxLength = 6; // _L<dddd>
constexpr size_t kSubTypeVendorIdMaxLength = 7; // _V<ddddd>
constexpr size_t kSubTypeDeviceTypeMaxLength = 12; // _T<dddddddddd>
constexpr size_t kSubTypeCommissioningModeMaxLength = 3; // _CM
constexpr size_t kSubTypeCompressedFabricIdMaxLength = 18; // _I<16-hex-digits>

/*
* Matter operational node service settings
Expand All @@ -68,8 +67,7 @@ namespace Commission {

#define SUBTYPES \
(std::initializer_list<size_t>{ kSubTypeShortDiscriminatorMaxLength, kSubTypeLongDiscriminatorMaxLength, \
kSubTypeVendorIdMaxLength, kSubTypeDeviceTypeMaxLength, kSubTypeCommissioningModeMaxLength, \
kSubTypeAdditionalCommissioningMaxLength })
kSubTypeVendorIdMaxLength, kSubTypeDeviceTypeMaxLength, kSubTypeCommissioningModeMaxLength })

constexpr size_t kInstanceNameMaxLength = 16; // 64-bit random number in hex
constexpr size_t kSubTypeMaxNumber = SUBTYPES.size();
Expand Down
19 changes: 8 additions & 11 deletions src/lib/dnssd/TxtFields.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@ static constexpr System::Clock::Milliseconds32 kMaxRetryInterval = 3600000_ms32;
static constexpr size_t kKeyTcpSupportedMaxLength = 1;

// Commissionable/commissioner node TXT entries
static constexpr size_t kKeyLongDiscriminatorMaxLength = 5;
static constexpr size_t kKeyVendorProductMaxLength = 11;
static constexpr size_t kKeyAdditionalCommissioningMaxLength = 1;
static constexpr size_t kKeyCommissioningModeMaxLength = 1;
static constexpr size_t kKeyDeviceTypeMaxLength = 10;
static constexpr size_t kKeyDeviceNameMaxLength = 32;
static constexpr size_t kKeyRotatingDeviceIdMaxLength = 100;
static constexpr size_t kKeyPairingInstructionMaxLength = 128;
static constexpr size_t kKeyPairingHintMaxLength = 10;
static constexpr size_t kKeyLongDiscriminatorMaxLength = 5;
static constexpr size_t kKeyVendorProductMaxLength = 11;
static constexpr size_t kKeyCommissioningModeMaxLength = 1;
static constexpr size_t kKeyDeviceTypeMaxLength = 10;
static constexpr size_t kKeyDeviceNameMaxLength = 32;
static constexpr size_t kKeyRotatingDeviceIdMaxLength = 100;
static constexpr size_t kKeyPairingInstructionMaxLength = 128;
static constexpr size_t kKeyPairingHintMaxLength = 10;

enum class TxtKeyUse : uint8_t
{
Expand All @@ -60,7 +59,6 @@ enum class TxtFieldKey : uint8_t
kUnknown,
kLongDiscriminator,
kVendorProduct,
kAdditionalPairing,
kCommissioningMode,
kDeviceType,
kDeviceName,
Expand All @@ -87,7 +85,6 @@ constexpr const TxtFieldInfo txtFieldInfo[static_cast<size_t>(TxtFieldKey::kCoun
{ TxtFieldKey::kUnknown, 0, "", TxtKeyUse::kNone },
{ TxtFieldKey::kLongDiscriminator, kKeyLongDiscriminatorMaxLength, "D", TxtKeyUse::kCommission },
{ TxtFieldKey::kVendorProduct, kKeyVendorProductMaxLength, "VP", TxtKeyUse::kCommission },
{ TxtFieldKey::kAdditionalPairing, kKeyAdditionalCommissioningMaxLength, "AP", TxtKeyUse::kCommission },
{ TxtFieldKey::kCommissioningMode, kKeyCommissioningModeMaxLength, "CM", TxtKeyUse::kCommission },
{ TxtFieldKey::kDeviceType, kKeyDeviceTypeMaxLength, "DT", TxtKeyUse::kCommission },
{ TxtFieldKey::kDeviceName, kKeyDeviceNameMaxLength, "DN", TxtKeyUse::kCommission },
Expand Down

0 comments on commit 0f0a555

Please sign in to comment.