Skip to main content

openthread/ot/types/
service_config.rs

1// Copyright 2026 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use crate::prelude_internal::*;
6
7/// Data type representing a service configuration.
8/// Functional equivalent of [`otsys::otServiceConfig`](crate::otsys::otServiceConfig).
9#[derive(Debug, Default, Clone)]
10#[repr(transparent)]
11pub struct ServiceConfig(pub otServiceConfig);
12
13impl_ot_castable!(ServiceConfig, otServiceConfig);
14
15impl ServiceConfig {
16    /// IANA Enterprise Number.
17    pub fn enterprise_number(&self) -> u32 {
18        self.0.mEnterpriseNumber
19    }
20
21    /// The Server configuration.
22    pub fn server_config(&self) -> &ServerConfig {
23        (&self.0.mServerConfig).into()
24    }
25
26    /// Service data bytes.
27    pub fn service_data(&self) -> [u8; 252usize] {
28        self.0.mServiceData
29    }
30
31    /// Length of service data.
32    pub fn service_data_len(&self) -> u8 {
33        self.0.mServiceDataLength
34    }
35
36    /// Service ID (when iterating over the Network Data).
37    pub fn service_id(&self) -> u8 {
38        self.0.mServiceId
39    }
40}