pub struct ControlClient { /* private fields */ }Expand description
Mode 6 control protocol client with connected UDP, DNS resolution, fragment reassembly, and response validation.
Implementations§
Source§impl ControlClient
impl ControlClient
pub fn new(timeout_secs: u32, retries: u8) -> ControlClient
Sourcepub fn query(
&mut self,
host: &str,
port: u16,
msg: ControlMessage,
) -> Result<(Vec<u8>, u16, u16), QueryError>
pub fn query( &mut self, host: &str, port: u16, msg: ControlMessage, ) -> Result<(Vec<u8>, u16, u16), QueryError>
Send a Mode 6 request using connected UDP and collect fragments.
Sourcepub fn read_system_vars(
&mut self,
host: &str,
port: u16,
) -> Result<SystemVariables, QueryError>
pub fn read_system_vars( &mut self, host: &str, port: u16, ) -> Result<SystemVariables, QueryError>
Read system variables (ntpq -c rv).
Real C ntpq issues a separate status-summary request (READVAR associd=0, count=0) whose response status word is used for the textual description, followed by a second READVAR request to retrieve the actual variables. This two-request sequence is necessary because the status word can change between requests.
Sourcepub fn read_peer_vars(
&mut self,
host: &str,
port: u16,
associd: u16,
) -> Result<PeerVariables, QueryError>
pub fn read_peer_vars( &mut self, host: &str, port: u16, associd: u16, ) -> Result<PeerVariables, QueryError>
Read peer variables for a specific association.
Sourcepub fn read_associations(
&mut self,
host: &str,
port: u16,
) -> Result<Vec<AssociationStatus>, QueryError>
pub fn read_associations( &mut self, host: &str, port: u16, ) -> Result<Vec<AssociationStatus>, QueryError>
Read associations (ntpq -c as).
Sourcepub fn read_mru_list(
&mut self,
host: &str,
port: u16,
) -> Result<Vec<MruEntry>, QueryError>
pub fn read_mru_list( &mut self, host: &str, port: u16, ) -> Result<Vec<MruEntry>, QueryError>
Read the MRU (Most Recently Used) list from the daemon.
Uses the NTPsec-compatible nonce protocol:
- REQ_NONCE (opcode 12) to acquire a nonce
- READ_MRU (opcode 10) with the nonce to retrieve entries
The response uses textual Mode 6 variable lists with indexed entries (addr.N, last.N, first.N, ct.N).