nfdmgmt

package
v0.0.0-...-6c4fd92 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2024 License: NIST-PD-fallback Imports: 15 Imported by: 5

Documentation

Overview

Package nfdmgmt provides access to NFD Management API.

Index

Constants

View Source
const (
	TtControlParameters = 0x68
	TtFaceID            = 0x69
	TtOrigin            = 0x6F
	TtCost              = 0x6A
	TtFlags             = 0x6C
	TtExpirationPeriod  = 0x6D

	TtControlResponse = 0x65
	TtStatusCode      = 0x66
	TtStatusText      = 0x67
)

TLV-TYPE assigned numbers.

View Source
const (
	RouteOriginApp     = 0
	RouteOriginStatic  = 255
	RouteOriginClient  = 65
	RouteOriginAutoReg = 64
)

RouteOrigin assigned numbers.

Variables

View Source
var (
	PrefixLocalhost = ndn.ParseName("/localhost/nfd")
	PrefixLocalhop  = ndn.ParseName("/localhop/nfd")
)

Command prefixes.

Functions

func MakeCommandInterest

func MakeCommandInterest(commandPrefix ndn.Name, cmd ControlCommand) ndn.Interest

MakeCommandInterest constructs a control command Interest without signing.

Types

type Client

type Client struct {
	ConsumerOpts endpoint.ConsumerOptions
	Prefix       ndn.Name
	Signer       ndn.Signer
}

Client provides access to NFD Management API.

func New

func New() (*Client, error)

New creates a Client.

func (*Client) Close

func (c *Client) Close() error

Close does nothing.

func (*Client) Invoke

func (c *Client) Invoke(ctx context.Context, cmd ControlCommand) (cr ControlResponse, e error)

Invoke invokes a control command.

func (*Client) OpenFace

func (c *Client) OpenFace() (mgmt.Face, error)

OpenFace creates a socket face toward NFD.

Transport type and socket path are read from NDN_CLIENT_TRANSPORT environment variable. However, this does not support client.conf file. https://docs.named-data.net/ndn-cxx/0.8.1/manpages/ndn-client.conf.html

NFD uses in-band management where the prefix registration commands are sent over the same face. To use prefix registration feature, calling code need to: 1. Add the l3.Face to an l3.Forwarder, and set the l3.Forwarder into c.ConsumerOpts if it's not the default. 2. Add a route toward the face for c.Prefix (default is /localhost/nfd). 3. Set c.Signer to a key accepted by NFD (default is digest signing).

type ControlCommand

type ControlCommand interface {
	Verb() []ndn.NameComponent
	Parameters() []tlv.Fielder
}

ControlCommand represents a NFD control command.

type ControlResponse

type ControlResponse struct {
	StatusCode int
	StatusText string
	Body       []byte
}

ControlResponse represents a NFD control response.

func (*ControlResponse) UnmarshalTLV

func (cr *ControlResponse) UnmarshalTLV(typ uint32, value []byte) error

type RibRegisterCommand

type RibRegisterCommand struct {
	Name      ndn.Name                `json:"name"`
	FaceID    int                     `json:"faceID,omitempty"`
	Origin    int                     `json:"origin"`
	Cost      int                     `json:"cost"`
	NoInherit bool                    `json:"noInherit"`
	Capture   bool                    `json:"capture"`
	Expires   nnduration.Milliseconds `json:"expires,omitempty"`
}

RibRegisterCommand is a NFD command to register a route.

func (RibRegisterCommand) Parameters

func (cmd RibRegisterCommand) Parameters() (a []tlv.Fielder)

Parameters encodes ControlParameters.

func (RibRegisterCommand) Verb

Verb returns "rib/register".

type RibUnregisterCommand

type RibUnregisterCommand struct {
	Name   ndn.Name `json:"name"`
	FaceID int      `json:"faceID,omitempty"`
	Origin int      `json:"origin"`
}

RibUnregisterCommand is a NFD command to unregister a route.

func (RibUnregisterCommand) Parameters

func (cmd RibUnregisterCommand) Parameters() (a []tlv.Fielder)

Parameters encodes ControlParameters.

func (RibUnregisterCommand) Verb

Verb returns "rib/unregister".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL