MgmtClient

Struct MgmtClient 

Source
pub struct MgmtClient { /* private fields */ }
Expand description

Management client for a running ndn-fwd forwarder.

Sends NFD management Interests over an IpcFace and decodes the ControlResponse from the returned Data packet.

On Unix the transport is a Unix domain socket; on Windows it is a Named Pipe. Both are accessed through the same MgmtClient API.

Implementations§

Source§

impl MgmtClient

Source

pub async fn connect( face_socket: impl AsRef<str>, ) -> Result<Self, ForwarderError>

Connect to the forwarder’s IPC socket.

face_socket is a Unix domain socket path on Unix (e.g. /run/nfd/nfd.sock) or a Named Pipe path on Windows (e.g. \\.\pipe\ndn).

Source

pub fn from_face(face: Arc<IpcFace>) -> Self

Wrap an existing IpcFace (e.g. from a ForwarderClient).

Source

pub async fn route_add( &self, prefix: &Name, face_id: Option<u64>, cost: u64, ) -> Result<ControlParameters, ForwarderError>

Add (or update) a route: rib/register.

Pass face_id: None to let the router use the requesting face (the default NFD behaviour when no FaceId is supplied). This is the correct value to use when connecting over a Unix socket without SHM, because there is no separate SHM face ID to reference.

Source

pub async fn route_remove( &self, prefix: &Name, face_id: Option<u64>, ) -> Result<ControlParameters, ForwarderError>

Remove a route: rib/unregister.

Pass face_id: None to remove the route on the requesting face.

Source

pub async fn route_list(&self) -> Result<Vec<FibEntry>, ForwarderError>

List all FIB routes: fib/list.

Returns NFD TLV FibEntry dataset entries (per-spec wire format).

Source

pub async fn rib_list(&self) -> Result<Vec<RibEntry>, ForwarderError>

List all RIB routes: rib/list.

Returns NFD TLV RibEntry dataset entries (per-spec wire format).

Source

pub async fn face_create( &self, uri: &str, ) -> Result<ControlParameters, ForwarderError>

Create a face: faces/create.

Source

pub async fn face_create_with_mtu( &self, uri: &str, mtu: Option<u64>, ) -> Result<ControlParameters, ForwarderError>

Create a face with an optional mtu hint: faces/create.

For SHM faces the router uses mtu to size the ring slot so it can carry Data packets whose content body is up to mtu bytes. For Unix and network faces mtu is currently ignored.

Source

pub async fn face_destroy( &self, face_id: u64, ) -> Result<ControlParameters, ForwarderError>

Destroy a face: faces/destroy.

Source

pub async fn face_list(&self) -> Result<Vec<FaceStatus>, ForwarderError>

List all faces: faces/list.

Returns NFD TLV FaceStatus dataset entries (per-spec wire format).

Source

pub async fn strategy_set( &self, prefix: &Name, strategy: &Name, ) -> Result<ControlParameters, ForwarderError>

Set forwarding strategy for a prefix: strategy-choice/set.

Source

pub async fn strategy_unset( &self, prefix: &Name, ) -> Result<ControlParameters, ForwarderError>

Unset forwarding strategy for a prefix: strategy-choice/unset.

Source

pub async fn strategy_list(&self) -> Result<Vec<StrategyChoice>, ForwarderError>

List all strategy choices: strategy-choice/list.

Returns NFD TLV StrategyChoice dataset entries (per-spec wire format).

Source

pub async fn cs_info(&self) -> Result<ControlResponse, ForwarderError>

Content store info: cs/info.

Source

pub async fn cs_config( &self, capacity: Option<u64>, ) -> Result<ControlParameters, ForwarderError>

Configure CS capacity: cs/config.

If capacity is Some, sets the new max capacity in bytes. Always returns the current capacity.

Source

pub async fn cs_erase( &self, prefix: &Name, count: Option<u64>, ) -> Result<ControlParameters, ForwarderError>

Erase CS entries by prefix: cs/erase.

Returns the number of entries erased (in the count field of the response ControlParameters).

Source

pub async fn neighbors_list(&self) -> Result<ControlResponse, ForwarderError>

List discovered neighbors: neighbors/list.

Source

pub async fn service_list(&self) -> Result<ControlResponse, ForwarderError>

List locally announced services: service/list.

Source

pub async fn service_announce( &self, prefix: &Name, ) -> Result<ControlParameters, ForwarderError>

Announce a service prefix at runtime: service/announce.

Source

pub async fn service_withdraw( &self, prefix: &Name, ) -> Result<ControlParameters, ForwarderError>

Withdraw a previously announced service prefix: service/withdraw.

Source

pub async fn service_browse( &self, prefix: Option<&Name>, ) -> Result<ControlResponse, ForwarderError>

Browse all known service records (local + received from peers): service/browse.

When prefix is Some, the router returns only records whose announced_prefix has prefix as a prefix (server-side filter).

Source

pub async fn status(&self) -> Result<ControlResponse, ForwarderError>

General forwarder status: status/general.

Source

pub async fn shutdown(&self) -> Result<ControlResponse, ForwarderError>

Request graceful shutdown: status/shutdown.

Source

pub async fn config_get(&self) -> Result<ControlResponse, ForwarderError>

Retrieve the running router configuration as TOML: config/get.

Source

pub async fn face_counters(&self) -> Result<ControlResponse, ForwarderError>

Per-face packet/byte counters: faces/counters.

Source

pub async fn measurements_list(&self) -> Result<ControlResponse, ForwarderError>

Per-prefix measurements (satisfaction rate, RTTs): measurements/list.

Source

pub async fn security_identity_list( &self, ) -> Result<ControlResponse, ForwarderError>

List all identity keys in the PIB: security/identity-list.

Source

pub async fn security_identity_status( &self, ) -> Result<ControlResponse, ForwarderError>

Query the active identity status: security/identity-status.

Returns a ControlResponse whose status_text is a space-separated key=value line: identity=<name> is_ephemeral=<bool> pib_path=<path>. Works whether or not a PIB is configured (unlike identity-list).

Source

pub async fn security_identity_generate( &self, name: &Name, ) -> Result<ControlParameters, ForwarderError>

Generate a new Ed25519 identity key: security/identity-generate.

Source

pub async fn security_anchor_list( &self, ) -> Result<ControlResponse, ForwarderError>

List all trust anchors in the PIB: security/anchor-list.

Source

pub async fn security_key_delete( &self, name: &Name, ) -> Result<ControlParameters, ForwarderError>

Delete a key from the PIB: security/key-delete.

Source

pub async fn security_identity_did( &self, name: &Name, ) -> Result<ControlResponse, ForwarderError>

Get the did:ndn: DID for a named identity: security/identity-did.

The response status_text contains the DID string.

Source

pub async fn security_ca_info(&self) -> Result<ControlResponse, ForwarderError>

Retrieve the router’s NDNCERT CA profile: security/ca-info.

Returns NOT_FOUND if no ca_prefix is configured.

Source

pub async fn security_ca_enroll( &self, ca_prefix: &Name, challenge_type: &str, challenge_param: &str, ) -> Result<ControlParameters, ForwarderError>

Initiate NDNCERT enrollment with a CA: security/ca-enroll.

Parameters:

  • ca_prefix — NDN name of the CA (e.g. /ndn/edu/example/CA)
  • challenge_type"token", "pin", "possession", or "yubikey-hotp"
  • challenge_param — the challenge secret/code

The router starts a background enrollment session and returns immediately with status_text = "started". Poll security/identity-list to detect when the certificate has been installed.

Source

pub async fn security_ca_token_add( &self, description: &str, ) -> Result<ControlParameters, ForwarderError>

Add a Zero-Touch-Provisioning token to the CA: security/ca-token-add.

Returns the generated token in ControlParameters::uri.

Source

pub async fn security_ca_requests( &self, ) -> Result<ControlResponse, ForwarderError>

List pending NDNCERT CA enrollment requests: security/ca-requests.

Source

pub async fn security_yubikey_detect( &self, ) -> Result<ControlResponse, ForwarderError>

Detect whether a YubiKey is connected: security/yubikey-detect.

Returns Ok with status_text = "present" if a YubiKey is found, or an error if not present or the yubikey-piv feature is not compiled in.

Source

pub async fn security_yubikey_generate( &self, name: &Name, ) -> Result<ControlParameters, ForwarderError>

Generate a P-256 key in YubiKey PIV slot 9a: security/yubikey-generate.

On success the response body.uri contains the base64url-encoded 65-byte uncompressed public key.

Source

pub async fn security_schema_list( &self, ) -> Result<ControlResponse, ForwarderError>

List all active trust schema rules: security/schema-list.

Returns a human-readable list of rules; one per line in the status_text: [0] /data_pattern => /key_pattern

Source

pub async fn security_schema_rule_add( &self, rule: &str, ) -> Result<ControlResponse, ForwarderError>

Add a trust schema rule: security/schema-rule-add.

rule must be in the form "<data_pattern> => <key_pattern>", e.g.: "/sensor/<node>/<type> => /sensor/<node>/KEY/<id>".

Source

pub async fn security_schema_rule_remove( &self, index: u64, ) -> Result<ControlResponse, ForwarderError>

Remove a trust schema rule by index: security/schema-rule-remove.

index is the 0-based position from security_schema_list().

Source

pub async fn security_schema_set( &self, rules: &str, ) -> Result<ControlResponse, ForwarderError>

Replace the entire trust schema: security/schema-set.

rules is a newline-separated list of rule strings. Each line must be in the form "<data_pattern> => <key_pattern>". Pass an empty string to clear all rules (schema rejects everything).

Source

pub async fn discovery_status(&self) -> Result<ControlResponse, ForwarderError>

Get discovery protocol status and current config: discovery/status.

Source

pub async fn discovery_config_set( &self, params: &str, ) -> Result<ControlResponse, ForwarderError>

Update runtime-mutable discovery parameters: discovery/config.

Pass parameters as a URL query string: "hello_interval_base_ms=5000&liveness_miss_count=3".

Supported keys: hello_interval_base_ms, hello_interval_max_ms, hello_jitter, liveness_timeout_ms, liveness_miss_count, probe_timeout_ms, swim_indirect_fanout, gossip_fanout, auto_create_faces.

Source

pub async fn routing_dvr_status( &self, ) -> Result<ControlResponse, ForwarderError>

Get DVR routing protocol status: routing/dvr-status.

Source

pub async fn routing_dvr_config_set( &self, params: &str, ) -> Result<ControlResponse, ForwarderError>

Update runtime-mutable DVR parameters: routing/dvr-config.

Pass parameters as a URL query string: "update_interval_ms=30000&route_ttl_ms=90000".

Source

pub async fn log_get_filter(&self) -> Result<ControlResponse, ForwarderError>

Get the current runtime log filter string: log/get-filter.

Source

pub async fn log_get_recent( &self, after_seq: u64, ) -> Result<ControlResponse, ForwarderError>

Get new log lines from the router’s in-memory ring buffer: log/get-recent.

Pass the last sequence number received (0 on first call) in after_seq. The router returns only entries with a higher sequence number, so repeated polls never replay old lines.

Response format: first line is the new max sequence number, followed by zero or more log lines.

Source

pub async fn log_set_filter( &self, filter: &str, ) -> Result<ControlResponse, ForwarderError>

Set the runtime log filter: log/set-filter.

The filter string is an EnvFilter-compatible directive (e.g. "info", "debug,ndn_engine=trace").

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more