Skip to main content

openthread/ot/types/
server_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 server configuration.
8/// Functional equivalent of [`otsys::otServerConfig`](crate::otsys::otServerConfig).
9#[derive(Debug, Default, Clone)]
10#[repr(transparent)]
11pub struct ServerConfig(pub otServerConfig);
12
13impl_ot_castable!(ServerConfig, otServerConfig);
14
15impl ServerConfig {
16    /// Length of server data.
17    pub fn server_data_len(&self) -> u8 {
18        self.0.mServerDataLength
19    }
20
21    /// Server data bytes.
22    pub fn server_data(&self) -> [u8; 248usize] {
23        self.0.mServerData
24    }
25
26    /// The Server RLOC16.
27    pub fn rloc16(&self) -> u16 {
28        self.0.mRloc16
29    }
30
31    /// Whether this config is considered Stable Network Data.
32    pub fn is_stable(&self) -> bool {
33        self.0.mStable()
34    }
35}